コード例 #1
0
 /**
  * Prepare
  *
  * @param array $args data plugin related field arguments
  */
 private function prepareColumns($args)
 {
     /** @var helper_plugin_data $dthlp */
     $dthlp = plugin_load('helper', 'data');
     if (!$dthlp) {
         msg('Loading the data helper failed. Make sure the data plugin is installed.', -1);
     }
     foreach ($args as $arg) {
         $arg = $this->replaceTranslation($arg);
         $datatype = $dthlp->_column($arg);
         if (is_array($datatype['type'])) {
             $datatype['basetype'] = $datatype['type']['type'];
             $datatype['enum'] = $datatype['type']['enum'];
             $datatype['type'] = $datatype['origtype'];
         } else {
             $datatype['basetype'] = $datatype['type'];
         }
     }
     $datatype['title'] = '@@DISPLAY@@';
     if (isset($datatype['enum'])) {
         $values = preg_split('/\\s*,\\s*/', $datatype['enum']);
         if (!$datatype['multi'] && $this->opt['optional']) {
             array_unshift($values, '');
         }
         $this->opt['args'] = $values;
         $this->additional = $datatype['multi'] ? array('multiple' => 'multiple') : array();
     } else {
         $classes = 'data_type_' . $datatype['type'] . ($datatype['multi'] ? 's' : '') . ' ' . 'data_type_' . $datatype['basetype'] . ($datatype['multi'] ? 's' : '');
         $content = form_makeTextField('@@NAME@@', '@@VALUE@@', '@@DISPLAY@@', '@@ID@@', '@@CLASS@@ ' . $classes);
         $this->tpl = $content;
     }
     if (!isset($this->opt['display'])) {
         $this->opt['display'] = $this->opt['label'];
     }
 }
コード例 #2
0
ファイル: syntax.php プロジェクト: Jocai/Door43
 /**
  * form for slack invite
  *
  *
  */
 function slackinvite_signinform()
 {
     global $ID;
     $html = '';
     $params = array();
     $params['id'] = 'slackinvite_plugin_id';
     $params['action'] = wl($ID);
     $params['method'] = 'post';
     $params['enctype'] = 'multipart/form-data';
     $params['class'] = 'slackinvite_plugin';
     // Modification of the default dw HTML upload form
     $form = new Doku_Form($params);
     $form->startFieldset($this->getLang('signup'));
     $form->addHidden('source', hsc("slackinvite"));
     //add source of call, used in action to ignore anything not from this form
     $form->addElement(form_makeTextField('first_name', '', $this->getLang('first_name'), 'first__name'));
     $form->addElement(form_makeTextField('last_name', '', $this->getLang('last_name'), 'last__name'));
     $form->addElement(form_makeTextField('email', '', $this->getLang('email'), 'email'));
     $form->addElement(form_makeButton('submit', 'slacksignup', $this->getLang('btn_signup')));
     $form->endFieldset();
     $html .= '<div class="dokuwiki"><p>' . NL;
     //$html .= '<h3>TEAM43 Slack Sign Up</h3>';
     $html .= $form->getForm();
     $html .= '</p></div>' . NL;
     return $html;
 }
コード例 #3
0
 /**
  * This user will need to interact with the QR code in order to configure GA.
  */
 public function renderProfileForm()
 {
     global $conf, $USERINFO;
     $elements = array();
     $ga = new PHPGangsta_GoogleAuthenticator();
     if ($this->_settingExists("secret")) {
         // The user has a revokable GA secret.
         // Show the QR code so the user can add other devices.
         $mysecret = $this->_settingGet("secret");
         $data = $this->generateQRCodeData($USERINFO['name'] . '@' . $conf['title'], $mysecret);
         $elements[] = '<figure><figcaption>' . $this->getLang('directions') . '</figcaption>';
         $elements[] = '<img src="' . $data . '" alt="' . $this->getLang('directions') . '" />';
         $elements[] = '</figure>';
         // Check to see if the user needs to verify the code.
         if (!$this->_settingExists("verified")) {
             $elements[] = '<span>' . $this->getLang('verifynotice') . '</span>';
             $elements[] = form_makeTextField('googleauth_verify', '', $this->getLang('verifymodule'), '', 'block', array('size' => '50', 'autocomplete' => 'off'));
         }
         // Show the option to revoke the GA secret.
         $elements[] = form_makeCheckboxField('googleauth_disable', '1', $this->getLang('killmodule'), '', 'block');
     } else {
         // The user may opt in using GA.
         //Provide a checkbox to create a personal secret.
         $elements[] = form_makeCheckboxField('googleauth_enable', '1', $this->getLang('enablemodule'), '', 'block');
     }
     return $elements;
 }
コード例 #4
0
 protected function override_html_register()
 {
     global $lang;
     global $conf;
     global $INPUT;
     $base_attrs = array('size' => 50, 'required' => 'required');
     $email_attrs = $base_attrs + array('type' => 'email', 'class' => 'edit');
     print $this->override_locale_xhtml('register');
     print '<div class="centeralign">' . NL;
     $form = new Doku_Form(array('id' => 'dw__register'));
     $form->startFieldset($lang['btn_register']);
     $form->addHidden('do', 'register');
     $form->addHidden('save', '1');
     $form->addElement(form_makeTextField('login', $INPUT->post->str('login'), $lang['user'], '', 'block', $base_attrs));
     if (!$conf['autopasswd']) {
         $form->addElement(form_makePasswordField('pass', $lang['pass'], '', 'block', $base_attrs));
         $form->addElement(form_makePasswordField('passchk', $lang['passchk'], '', 'block', $base_attrs));
     }
     $form->addElement(form_makeTextField('fullname', $INPUT->post->str('fullname'), $lang['fullname'], '', 'block', $base_attrs));
     $form->addElement(form_makeField('email', 'email', $INPUT->post->str('email'), $lang['email'], '', 'block', $email_attrs));
     $form->addElement(form_makeButton('submit', '', $lang['btn_register']));
     $form->endFieldset();
     html_form('register', $form);
     print '</div>' . NL;
 }
コード例 #5
0
 /**
  * Arguments:
  *  - cmd
  *  - label
  *  - =default (optional)
  *
  * @param array $args The tokenized definition, only split at spaces
  */
 function __construct($args)
 {
     parent::__construct($args);
     $this->tpl = form_makeTextField('@@NAME@@', '@@VALUE@@', '@@DISPLAY@@', '', '@@CLASS@@');
     if (isset($this->opt['class'])) {
         $this->tpl['class'] .= ' ' . $this->opt['class'];
     }
 }
コード例 #6
0
ファイル: fieldtime.php プロジェクト: rusidea/analitika
 /**
  * Arguments:
  *  - cmd
  *  - label
  *  - ^ (optional)
  *
  * @param array $args The tokenized definition, only split at spaces
  */
 public function initialize($args)
 {
     parent::initialize($args);
     $attr = array('class' => 'timefield edit', 'maxlength' => '8');
     if (!isset($this->opt['optional'])) {
         $attr['required'] = 'required';
         $attr['class'] .= ' required';
     }
     $this->tpl = form_makeTextField('@@NAME@@', '@@VALUE@@', '@@DISPLAY@@', '@@ID@@', '@@CLASS@@', $attr);
 }
コード例 #7
0
ファイル: action.php プロジェクト: phpsource/web-wiki
 /**
  * custom event handler
  *
  * @param Doku_Event $event  event object by reference
  * @param mixed      $param  the parameters passed to register_hook when this
  *                           handler was registered
  *
  * @return   not required
  */
 public function handle_registerform_output(Doku_Event &$event, $param)
 {
     $pos = $event->data->findElementByAttribute('type', 'submit');
     if (!$pos) {
         return;
     }
     $spam = isset($_POST['spam']) ? $_POST['spam'] : '';
     $out = form_makeTextField('spam', $spam, 'To which email address do you have to send an email now?', '', 'block', array('size' => '50'));
     $event->data->insertElement($pos, $out);
 }
コード例 #8
0
 /**
  * output appropriate html
  */
 public function html()
 {
     global $lang;
     $helper = $this->loadHelper('loadskin', true);
     print '<div id="plugin__loadskin">';
     print $this->locale_xhtml('intro');
     $form = new Doku_Form(array());
     $form->startFieldSet('Add rule');
     $form->addHidden('id', $ID);
     $form->addHidden('do', 'admin');
     $form->addHidden('page', 'loadskin');
     $form->addHidden('act', 'add');
     $form->addElement(form_makeOpenTag('p'));
     $form->addElement(form_makeTextField('pattern', '', $this->getLang('pattern')));
     $form->addElement(form_makeCloseTag('p'));
     $form->addElement(form_makeOpenTag('p'));
     $form->addElement(form_makeListboxField('tpl', $helper->getTemplates(), '', $this->getLang('template')));
     $form->addElement(form_makeCloseTag('p'));
     $form->addElement(form_makeButton('submit', '', $lang['btn_save']));
     $form->endFieldSet();
     $form->printForm();
     if (@file_exists($this->config)) {
         $data = unserialize(io_readFile($this->config, false));
         if (!empty($data)) {
             echo '<table class="inline">' . DOKU_LF;
             echo '  <tr>' . DOKU_LF;
             echo '    <th>' . $this->getLang('pattern') . '</th>' . DOKU_LF;
             echo '    <th>' . $this->getLang('template') . '</th>' . DOKU_LF;
             echo '    <th>' . $this->getLang('action') . '</th>' . DOKU_LF;
             echo '  </tr>' . DOKU_LF;
             foreach ($data as $key => $value) {
                 echo '  <tr>' . DOKU_LF;
                 echo '    <td>' . $key . '</td>' . DOKU_LF;
                 echo '    <td>' . $value . '</td>' . DOKU_LF;
                 echo '    <td>' . DOKU_LF;
                 $form = new Doku_Form(array());
                 $form->addHidden('do', 'admin');
                 $form->addHidden('page', 'loadskin');
                 $form->addHidden('act', 'del');
                 $form->addHidden('id', $ID);
                 $form->addHidden('pattern', $key);
                 $form->addElement(form_makeButton('submit', '', $lang['btn_delete']));
                 $form->printForm();
                 echo '    </td>' . DOKU_LF;
                 echo '  </tr>' . DOKU_LF;
             }
             echo '</table>' . DOKU_LF;
         }
     }
     print '</div>';
 }
コード例 #9
0
ファイル: fieldtextbox.php プロジェクト: rusidea/analitika
 /**
  * Arguments:
  *  - cmd
  *  - label
  *  - =default (optional)
  *  - ^ (optional)
  *
  * @param array $args The tokenized definition, only split at spaces
  */
 function initialize($args)
 {
     parent::initialize($args);
     $attr = array();
     if (!isset($this->opt['optional'])) {
         $attr['required'] = 'required';
     }
     $this->tpl = form_makeTextField('@@NAME@@', '@@VALUE@@', '@@DISPLAY@@', '@@ID@@', '@@CLASS@@', $attr);
     if (isset($this->opt['class'])) {
         $this->tpl['class'] .= ' ' . $this->opt['class'];
     }
     if (!isset($this->opt['optional'])) {
         $this->tpl['class'] .= ' required';
     }
 }
コード例 #10
0
 function test_close_fieldset()
 {
     $form = new Doku_Form(array('id' => 'dw__testform', 'action' => '/test'));
     $form->startFieldset('Test');
     $form->addHidden('summary', 'changes &c');
     $form->addElement(form_makeTextField('t', 'v', 'Text', 'text__id', 'block'));
     $form->addElement(form_makeCheckboxField('r', '1', 'Check', 'check__id', 'simple'));
     $form->addElement(form_makeButton('submit', 'save', 'Save', array('accesskey' => 's')));
     $form->addElement(form_makeButton('submit', 'cancel', 'Cancel'));
     ob_start();
     $form->printForm();
     $output = ob_get_contents();
     ob_end_clean();
     $this->assertEquals($this->_ignoreTagWS($output), $this->_ignoreTagWS($this->_realoutput()));
 }
コード例 #11
0
 /**
  * This user will need to verify their email.
  */
 public function renderProfileForm()
 {
     $elements = array();
     // If email has not been verified, then do so here.
     if (!$this->attribute->exists("twofactoremail", "verified")) {
         // Render the HTML to prompt for the verification/activation OTP.
         $elements[] = '<span>' . $this->getLang('verifynotice') . '</span>';
         $elements[] = form_makeTextField('email_verify', '', $this->getLang('verifymodule'), '', 'block', array('size' => '50', 'autocomplete' => 'off'));
         $elements[] = form_makeCheckboxField('email_send', '1', $this->getLang('resendcode'), '', 'block');
     } else {
         // Render the element to remove email.
         $elements[] = form_makeCheckboxField('email_disable', '1', $this->getLang('killmodule'), '', 'block');
     }
     return $elements;
 }
コード例 #12
0
 /**
  * This user will need to supply a phone number and their cell provider.
  */
 public function renderProfileForm()
 {
     $elements = array();
     // Provide an input for the phone number.
     $phone = $this->_settingGet("phone", '');
     $elements[] = form_makeTextField('smsappliance_phone', $phone, $this->getLang('phone'), '', 'block', array('size' => '50'));
     // If the phone number has not been verified, then do so here.
     if ($phone) {
         if (!$this->_settingExists("verified")) {
             // Render the HTML to prompt for the verification/activation OTP.
             $elements[] = '<span>' . $this->getLang('verifynotice') . '</span>';
             $elements[] = form_makeTextField('smsappliance_verify', '', $this->getLang('verifymodule'), '', 'block', array('size' => '50', 'autocomplete' => 'off'));
             $elements[] = form_makeCheckboxField('smsappliance_send', '1', $this->getLang('resendcode'), '', 'block');
         }
         // Render the element to remove the phone since it exists.
         $elements[] = form_makeCheckboxField('smsappliance_disable', '1', $this->getLang('killmodule'), '', 'block');
     }
     return $elements;
 }
コード例 #13
0
 /**
  * This user will need to verify their email.
  */
 public function renderProfileForm()
 {
     $elements = array();
     // Prompt for an email address.
     $email = $this->_settingGet("email");
     $elements[] = form_makeTextField('altemail_email', $email, $this->getLang('email'), '', 'block', array('size' => '50', 'autocomplete' => 'off'));
     // If email has not been verified, then do so here.
     if (!$this->_settingExists("verified") && $email) {
         // Render the HTML to prompt for the verification/activation OTP.
         $elements[] = '<span>' . $this->getLang('verifynotice') . '</span>';
         $elements[] = form_makeTextField('altemail_verify', '', $this->getLang('verifymodule'), '', 'block', array('size' => '50', 'autocomplete' => 'off'));
         $elements[] = form_makeCheckboxField('altemail_send', '1', $this->getLang('resendcode'), '', 'block');
     }
     if ($this->_settingExists("email")) {
         // Render the element to remove email.
         $elements[] = form_makeCheckboxField('altemail_disable', '1', $this->getLang('killmodule'), '', 'block');
     }
     return $elements;
 }
コード例 #14
0
 /**
  * This user will need to supply a phone number and their cell provider.
  */
 public function renderProfileForm()
 {
     $elements = array();
     // Provide an input for the phone number.
     $phone = $this->attribute->exists("twofactor", "phone") ? $this->attribute->get("twofactor", "phone") : '';
     $elements['phone'] = form_makeTextField('phone', $phone, $this->_getSharedLang('phone'), '', 'block', array('size' => '50'));
     $providers = array_keys($this->_getProviders());
     $provider = $this->attribute->exists("twofactorsmsgateway", "provider") ? $this->attribute->get("twofactorsmsgateway", "provider") : $providers[0];
     $elements[] = form_makeListboxField('smsgateway_provider', $providers, $provider, $this->getLang('provider'), '', 'block');
     // If the phone number has not been verified, then do so here.
     if ($phone) {
         if (!$this->attribute->exists("twofactorsmsgateway", "verified")) {
             // Render the HTML to prompt for the verification/activation OTP.
             $elements[] = '<span>' . $this->getLang('verifynotice') . '</span>';
             $elements[] = form_makeTextField('smsgateway_verify', '', $this->getLang('verifymodule'), '', 'block', array('size' => '50', 'autocomplete' => 'off'));
             $elements[] = form_makeCheckboxField('smsgateway_send', '1', $this->getLang('resendcode'), '', 'block');
         }
         // Render the element to remove the phone since it exists.
         $elements[] = form_makeCheckboxField('smsgateway_disable', '1', $this->getLang('killmodule'), '', 'block');
     }
     return $elements;
 }
コード例 #15
0
 function __construct($syntax_plugin, $args)
 {
     $dthlp =& plugin_load('helper', 'data');
     if (!$dthlp) {
         msg('Loading the data helper failed. Make sure the data plugin is installed.', -1);
     }
     $this->init($syntax_plugin, $args);
     $n_args = array();
     foreach ($args as $arg) {
         if ($arg[0] !== '_') {
             $n_args[] = $arg;
             continue;
         }
         $datatype = $dthlp->_column($arg);
         if (is_array($datatype['type'])) {
             $datatype['basetype'] = $datatype['type']['type'];
             $datatype['enum'] = $datatype['type']['enum'];
             $datatype['type'] = $datatype['origtype'];
         } else {
             $datatype['basetype'] = $datatype['type'];
         }
     }
     $this->standardArgs($n_args);
     if (isset($datatype['enum'])) {
         $values = preg_split('/\\s*,\\s*/', $datatype['enum']);
         if (!$datatype['multi'] && $this->opt['optional']) {
             array_unshift($values, '');
         }
         $this->opt['args'] = $values;
         $this->additional = $datatype['multi'] ? array('multiple' => 'multiple') : array();
     } else {
         $classes = 'data_type_' . $datatype['type'] . ($datatype['multi'] ? 's' : '') . ' ' . 'data_type_' . $datatype['basetype'] . ($datatype['multi'] ? 's' : '');
         $content = form_makeTextField('@@NAME@@', '@@VALUE@@', '@@LABEL@@', '', '@@CLASS@@ ' . $classes);
         $this->tpl = $content;
     }
 }
コード例 #16
0
ファイル: html.php プロジェクト: evacomaroski/dokuwiki
/**
 * Form to request a new password for an existing account
 *
 * @author Benoit Chesneau <*****@*****.**>
 * @author Andreas Gohr <*****@*****.**>
 */
function html_resendpwd()
{
    global $lang;
    global $conf;
    global $INPUT;
    $token = preg_replace('/[^a-f0-9]+/', '', $INPUT->str('pwauth'));
    if (!$conf['autopasswd'] && $token) {
        print p_locale_xhtml('resetpwd');
        print '<div class="centeralign">' . NL;
        $form = new Doku_Form(array('id' => 'dw__resendpwd'));
        $form->startFieldset($lang['btn_resendpwd']);
        $form->addHidden('token', $token);
        $form->addHidden('do', 'resendpwd');
        $form->addElement(form_makePasswordField('pass', $lang['pass'], '', 'block', array('size' => '50')));
        $form->addElement(form_makePasswordField('passchk', $lang['passchk'], '', 'block', array('size' => '50')));
        $form->addElement(form_makeButton('submit', '', $lang['btn_resendpwd']));
        $form->endFieldset();
        html_form('resendpwd', $form);
        print '</div>' . NL;
    } else {
        print p_locale_xhtml('resendpwd');
        print '<div class="centeralign">' . NL;
        $form = new Doku_Form(array('id' => 'dw__resendpwd'));
        $form->startFieldset($lang['resendpwd']);
        $form->addHidden('do', 'resendpwd');
        $form->addHidden('save', '1');
        $form->addElement(form_makeTag('br'));
        $form->addElement(form_makeTextField('login', $INPUT->post->str('login'), $lang['user'], '', 'block'));
        $form->addElement(form_makeTag('br'));
        $form->addElement(form_makeTag('br'));
        $form->addElement(form_makeButton('submit', '', $lang['btn_resendpwd']));
        $form->endFieldset();
        html_form('resendpwd', $form);
        print '</div>' . NL;
    }
}
コード例 #17
0
 /**
  * Display the simple move form
  */
 protected function GUI_simpleForm()
 {
     global $ID;
     echo $this->locale_xhtml('move');
     $treelink = wl($ID, array('do' => 'admin', 'page' => 'move_tree'));
     echo '<p id="plugin_move__treelink">';
     printf($this->getLang('treelink'), $treelink);
     echo '</p>';
     $form = new Doku_Form(array('action' => wl($ID), 'method' => 'post', 'class' => 'plugin_move_form'));
     $form->addHidden('page', 'move_main');
     $form->addHidden('id', $ID);
     $form->startFieldset($this->getLang('legend'));
     $form->addElement(form_makeRadioField('class', 'page', $this->getLang('movepage') . ' <code>' . $ID . '</code>', '', 'block radio click-page', array('checked' => 'checked')));
     $form->addElement(form_makeRadioField('class', 'namespace', $this->getLang('movens') . ' <code>' . getNS($ID) . '</code>', '', 'block radio click-ns'));
     $form->addElement(form_makeTextField('dst', $ID, $this->getLang('dst'), '', 'block indent'));
     $form->addElement(form_makeMenuField('type', array('pages' => $this->getLang('move_pages'), 'media' => $this->getLang('move_media'), 'both' => $this->getLang('move_media_and_pages')), 'both', $this->getLang('content_to_move'), '', 'block indent select'));
     $form->addElement(form_makeCheckboxField('autoskip', '1', $this->getLang('autoskip'), '', 'block', $this->getConf('autoskip') ? array('checked' => 'checked') : array()));
     $form->addElement(form_makeCheckboxField('autorewrite', '1', $this->getLang('autorewrite'), '', 'block', $this->getConf('autorewrite') ? array('checked' => 'checked') : array()));
     $form->addElement(form_makeButton('submit', 'admin', $this->getLang('btn_start')));
     $form->endFieldset();
     $form->printForm();
 }
コード例 #18
0
 function __construct($args)
 {
     parent::__construct($args);
     $this->tpl = form_makeTextField('@@NAME@@', '@@VALUE@@', '@@LABEL@@', '', '@@CLASS@@', array('class' => 'datepicker edit', 'maxlength' => '10'));
 }
コード例 #19
0
ファイル: admin.php プロジェクト: neutrinog/Door43
    /**
     * show the move and/or rename a page form
     *
     * @author  Michael Hamann <*****@*****.**>
     * @author  Gary Owen <*****@*****.**>
     */
    function printForm() {
        global $ID;

        $ns = getNS($ID);

        $ns_select_data = $this->build_namespace_select_content($ns);

        $form = new Doku_Form(array('action' => wl($ID), 'method' => 'post', 'class' => 'move__form'));
        $form->addHidden('page', $this->getPluginName());
        $form->addHidden('id', $ID);
        $form->addHidden('move_type', 'page');
        $form->startFieldset($this->getLang('movepage'));
        $form->addElement(form_makeMenuField('ns_for_page', $ns_select_data, $this->opts['ns_for_page'], $this->getLang('targetns'), '', 'block'));
        $form->addElement(form_makeTextField('newns', $this->opts['newns'], $this->getLang('newtargetns'), '', 'block'));
        $form->addElement(form_makeTextField('newname', $this->opts['newname'], $this->getLang('newname'), '', 'block'));
        $form->addElement(form_makeButton('submit', 'admin', $this->getLang('submit')));
        $form->endFieldset();
        $form->printForm();

        if ($this->ns_opts !== false) {
            ptln('<fieldset>');
            ptln('<legend>');
            ptln($this->getLang('movens'));
            ptln('</legend>');
            ptln('<p>');
            ptln(sprintf($this->getLang('ns_move_in_progress'), $this->ns_opts['num_pages'], $this->ns_opts['num_media'], ':'.hsc($this->ns_opts['ns']), ':'.hsc($this->ns_opts['newns'])));
            ptln('</p>');
            ptln($this->helper->getNSMoveButton('continue'));
            ptln($this->helper->getNSMoveButton('abort'));
            ptln('</fieldset>');
        } else {
            $form = new Doku_Form(array('action' => wl($ID), 'method' => 'post', 'class' => 'move__form'));
            $form->addHidden('page', $this->getPluginName());
            $form->addHidden('id', $ID);
            $form->addHidden('move_type', 'namespace');
            $form->startFieldset($this->getLang('movens'));
            $form->addElement(form_makeMenuField('targetns', $ns_select_data, $this->opts['targetns'], $this->getLang('targetns'), '', 'block'));
            $form->addElement(form_makeTextField('newnsname', $this->opts['newnsname'], $this->getLang('newnsname'), '', 'block'));
            $form->addElement(form_makeMenuField('contenttomove', array('pages' => $this->getLang('move_pages'), 'media' => $this->getLang('move_media'), 'both' => $this->getLang('move_media_and_pages')), $this->opts['contenttomove'], $this->getLang('content_to_move'), '', 'block'));
            $form->addElement(form_makeButton('submit', 'admin', $this->getLang('submit')));
            $form->endFieldset();
            $form->printForm();
        }
    }
コード例 #20
0
 function html()
 {
     $sqlite = $this->dthlp->_getDB();
     if (!$sqlite) {
         return false;
     }
     echo $this->locale_xhtml('admin_intro');
     $sql = "SELECT * FROM aliases ORDER BY name";
     $res = $sqlite->query($sql);
     $rows = $sqlite->res2arr($res);
     $form = new Doku_Form(array('method' => 'post'));
     $form->addHidden('page', 'data_aliases');
     $form->addElement('<table class="inline">' . '<tr>' . '<th>' . $this->getLang('name') . '</th>' . '<th>' . $this->getLang('type') . '</th>' . '<th>' . $this->getLang('prefix') . '</th>' . '<th>' . $this->getLang('postfix') . '</th>' . '<th>' . $this->getLang('enum') . '</th>' . '</tr>');
     // add empty row for adding a new entry
     $rows[] = array('name' => '', 'type' => '', 'prefix' => '', 'postfix' => '', 'enum' => '');
     $cur = 0;
     foreach ($rows as $row) {
         $form->addElement('<tr>');
         $form->addElement('<td>');
         $form->addElement(form_makeTextField('d[' . $cur . '][name]', $row['name'], ''));
         $form->addElement('</td>');
         $form->addElement('<td>');
         $form->addElement(form_makeMenuField('d[' . $cur . '][type]', array('', 'page', 'title', 'mail', 'url', 'dt', 'wiki'), $row['type'], ''));
         $form->addElement('</td>');
         $form->addElement('<td>');
         $form->addElement(form_makeTextField('d[' . $cur . '][prefix]', $row['prefix'], ''));
         $form->addElement('</td>');
         $form->addElement('<td>');
         $form->addElement(form_makeTextField('d[' . $cur . '][postfix]', $row['postfix'], ''));
         $form->addElement('</td>');
         $form->addElement('<td>');
         $form->addElement(form_makeTextField('d[' . $cur . '][enum]', $row['enum'], ''));
         $form->addElement('</td>');
         $form->addElement('</tr>');
         $cur++;
     }
     $form->addElement('</table>');
     $form->addElement(form_makeButton('submit', 'admin', $this->getLang('submit')));
     $form->printForm();
 }
コード例 #21
0
 /**
  * Output html of the admin page
  */
 public function html()
 {
     global $ID;
     global $INPUT;
     if (is_null($this->_auth)) {
         print $this->lang['badauth'];
         return false;
     }
     $sqlite = $this->hlp->_getDB();
     if (!$sqlite) {
         return;
     }
     $fn = $INPUT->param('fn');
     if (is_array($fn)) {
         $cmd = key($fn);
         $param = is_array($fn[$cmd]) ? key($fn[$cmd]) : null;
     } else {
         $cmd = $fn;
         $param = null;
     }
     $user_list = $this->_auth->retrieveUsers($this->_start, $this->_pagesize, $this->_filter);
     echo $this->locale_xhtml('admin_intro');
     $form = new Doku_Form(array('method' => 'post'));
     $form->addHidden('page', 'userprofile_users');
     // List registered users
     $form->addElement('<table>' . '<tr>' . '<th>' . $this->getLang('username') . '</th>' . '<th>' . $this->getLang('realname') . '</th>' . '<th>' . $this->getLang('email') . '</th>' . '</tr>');
     foreach ($user_list as $user => $userinfo) {
         extract($userinfo);
         /**
          * @var string $name
          * @var string $pass
          * @var string $mail
          * @var array  $grps
          */
         if (!in_array('noprofile', $grps)) {
             $form->addElement('<tr>' . '<td><a href="' . wl($ID, array('fn[edit][' . $user . ']' => 1, 'do' => 'admin', 'page' => 'userprofile_users', 'sectok' => getSecurityToken())) . '" title="' . $this->lang['edit_prompt'] . '">' . hsc($user) . '</a></td>' . '<td>' . hsc($name) . '</td>' . '<td>' . hsc($mail) . '</td>' . '</tr>');
         }
     }
     $form->addElement('</table>');
     // Edit table
     if ($cmd == "edit") {
         $user = $param;
         $profile = $this->hlp->getProfile($user);
         // create hidden fields
         $form->addHidden('up[user][user]', $user);
         $form->addHidden('up[user][name]', $user_list[$user]['name']);
         $form->addHidden('up[user][email]', $user_list[$user]['mail']);
         $sql = "SELECT * FROM fields";
         $res = $sqlite->query($sql);
         $fields = $sqlite->res2arr($res);
         $form->addElement('<table>' . '<tr>' . '<th colspan="2">' . $this->getLang('th_edit') . '</th>' . '</tr>' . '<tr>' . '<td>' . $this->getLang('realname') . '</td>' . '<td>' . hsc($user_list[$user]['name']) . '</td>' . '</tr>' . '<tr>' . '<td>' . $this->getLang('email') . '</td>' . '<td>' . hsc($user_list[$user]['mail']) . '</td>' . '</tr>');
         foreach ($fields as $field) {
             $form->addElement('<tr>');
             $form->addElement('<td>' . hsc($field['title']) . '</td>');
             $form->addElement('<td>');
             $defaults_array = explode('|', $field['defaultval']);
             if (count($defaults_array) > 1) {
                 // create select field
                 $defaults_array = array_map('trim', $defaults_array);
                 $form->addElement(form_makeMenuField('up[data][' . $field['name'] . ']', $defaults_array, $profile[$field['name']], ''));
             } else {
                 // create regular text field
                 $form->addElement(form_makeTextField('up[data][' . $field['name'] . ']', $profile[$field['name']], ''));
             }
             $form->addElement('</td>');
             $form->addElement('</tr>');
         }
         $form->addElement('<tr>' . '<td colspan="2">');
         $form->addElement(form_makeButton('submit', 'admin', $this->getLang('submit')));
         $form->addElement('</td>');
         $form->addElement('</table>');
     }
     $form->printForm();
 }
コード例 #22
0
ファイル: xhtml.php プロジェクト: roverrobot/projects
function create_button($type)
{
    return xhtml_action('projects.create', 'add', array('type' => $type), array(form_makeTextField('New')));
}
コード例 #23
0
ファイル: comments.php プロジェクト: Narrator/plugin-blogtng
 /**
  * Prints the comment form
  *
  * FIXME
  *  allow comments only for registered users
  *  add toolbar
  */
 function tpl_form($page, $pid)
 {
     global $INFO;
     global $BLOGTNG;
     $form = new DOKU_Form('blogtng__comment_form', wl($page) . '#blogtng__comment_form');
     $form->addHidden('pid', $pid);
     $form->addHidden('id', $page);
     $form->addHidden('btng[comment][source]', 'comment');
     foreach (array('name', 'mail', 'web') as $field) {
         $attr = $BLOGTNG['comment_submit_errors'][$field] ? array('class' => 'edit error') : array();
         if ($field == 'web' && !$this->getConf('comments_allow_web')) {
             continue;
         } else {
             $form->addElement(form_makeTextField('btng[comment][' . $field . ']', $BLOGTNG['comment'][$field], $this->getLang('comment_' . $field), 'blogtng__comment_' . $field, 'edit block', $attr));
         }
     }
     $form->addElement(form_makeOpenTag('div', array('class' => 'blogtng__toolbar')));
     $form->addElement(form_makeCloseTag('div'));
     if ($BLOGTNG['comment_submit_errors']['text']) {
         $form->addElement(form_makeWikiText($BLOGTNG['comment']['text'], array('class' => 'edit error')));
     } else {
         $form->addElement(form_makeWikiText($BLOGTNG['comment']['text']));
     }
     //add captcha if available
     $helper = null;
     if (@is_dir(DOKU_PLUGIN . 'captcha')) {
         $helper = plugin_load('helper', 'captcha');
     }
     if (!is_null($helper) && $helper->isEnabled()) {
         $form->addElement($helper->getHTML());
     }
     $form->addElement(form_makeButton('submit', 'comment_preview', $this->getLang('comment_preview'), array('class' => 'button', 'id' => 'blogtng__preview_submit')));
     $form->addElement(form_makeButton('submit', 'comment_submit', $this->getLang('comment_submit'), array('class' => 'button', 'id' => 'blogtng__comment_submit')));
     if ($this->getConf('comments_subscription')) {
         $form->addElement(form_makeCheckboxField('blogtng[subscribe]', 1, $this->getLang('comment_subscribe')));
     }
     print '<div id="blogtng__comment_form_wrap">' . DOKU_LF;
     $form->printForm();
     if (isset($BLOGTNG['comment_action']) && $BLOGTNG['comment_action'] == 'preview' && empty($BLOGTNG['comment_submit_errors'])) {
         print '<div id="blogtng__comment_preview">' . DOKU_LF;
         $comment = new blogtng_comment();
         $comment->data = $BLOGTNG['comment'];
         $comment->data['cid'] = 'preview';
         $comment->output('default');
         print '</div>' . DOKU_LF;
     }
     print '</div>' . DOKU_LF;
 }
コード例 #24
0
ファイル: media.php プロジェクト: yjliugit/dokuwiki
/**
 * Print the search field form
 *
 * @author Tobias Sarnowski <*****@*****.**>
 * @author Kate Arzamastseva <*****@*****.**>
 */
function media_searchform($ns, $query = '', $fullscreen = false)
{
    global $lang;
    // The default HTML search form
    $params = array('id' => 'dw__mediasearch');
    if (!$fullscreen) {
        $params['action'] = DOKU_BASE . 'lib/exe/mediamanager.php';
    } else {
        $params['action'] = media_managerURL(array(), '&');
    }
    $form = new Doku_Form($params);
    $form->addHidden('ns', $ns);
    $form->addHidden($fullscreen ? 'mediado' : 'do', 'searchlist');
    if (!$fullscreen) {
        $form->addElement('<div class="upload">' . $lang['mediasearch'] . '</div>' . NL);
    }
    $form->addElement(form_makeOpenTag('p'));
    $form->addElement(form_makeTextField('q', $query, $lang['searchmedia'], '', '', array('title' => sprintf($lang['searchmedia_in'], hsc($ns) . ':*'))));
    $form->addElement(form_makeButton('submit', '', $lang['btn_search']));
    $form->addElement(form_makeCloseTag('p'));
    html_form('searchmedia', $form);
}
コード例 #25
0
ファイル: media.php プロジェクト: lorea/Hydra-dev
/**
 * Print the search field form
 *
 * @author Tobias Sarnowski <*****@*****.**>
 */
function media_searchform($ns, $query = '')
{
    global $lang;
    // The default HTML search form
    $form = new Doku_Form(array('id' => 'dw__mediasearch', 'action' => DOKU_BASE . 'lib/exe/mediamanager.php'));
    $form->addElement('<div class="upload">' . $lang['mediasearch'] . '</div>');
    $form->addElement(formSecurityToken());
    $form->addHidden('ns', $ns);
    $form->addHidden('do', 'searchlist');
    $form->addElement(form_makeOpenTag('p'));
    $form->addElement(form_makeTextField('q', $query, $lang['searchmedia'], '', '', array('title' => sprintf($lang['searchmedia_in'], hsc($ns) . ':*'))));
    $form->addElement(form_makeButton('submit', '', $lang['btn_search']));
    $form->addElement(form_makeCloseTag('p'));
    html_form('searchmedia', $form);
}
コード例 #26
0
ファイル: gui.php プロジェクト: yjliugit/dokuwiki
 /**
  * Display the template tab
  */
 public function tabInstall()
 {
     echo '<div class="panelHeader">';
     echo $this->locale_xhtml('intro_install');
     echo '</div>';
     $form = new Doku_Form(array('action' => $this->tabURL('', array(), '&'), 'enctype' => 'multipart/form-data', 'class' => 'install'));
     $form->addElement(form_makeTextField('installurl', '', $this->getLang('install_url'), '', 'block'));
     $form->addElement(form_makeFileField('installfile', $this->getLang('install_upload'), '', 'block'));
     $form->addElement(form_makeButton('submit', '', $this->getLang('btn_install')));
     $form->printForm();
 }
コード例 #27
0
ファイル: html.php プロジェクト: nefercheprure/dokuwiki
/**
 * Form to request a new password for an existing account
 *
 * @author Benoit Chesneau <*****@*****.**>
 */
function html_resendpwd()
{
    global $lang;
    global $conf;
    global $ID;
    print p_locale_xhtml('resendpwd');
    print '<div class="centeralign">' . NL;
    $form = new Doku_Form(array('id' => 'dw__resendpwd'));
    $form->startFieldset($lang['resendpwd']);
    $form->addHidden('do', 'resendpwd');
    $form->addHidden('save', '1');
    $form->addElement(form_makeTag('br'));
    $form->addElement(form_makeTextField('login', $_POST['login'], $lang['user'], '', 'block'));
    $form->addElement(form_makeTag('br'));
    $form->addElement(form_makeTag('br'));
    $form->addElement(form_makeButton('submit', '', $lang['btn_resendpwd']));
    $form->endFieldset();
    html_form('resendpwd', $form);
    print '</div>' . NL;
}
コード例 #28
0
ファイル: helper.php プロジェクト: x42/dokuoauth
 /**
  *
  */
 public function oauthAddConsumer($opt)
 {
     global $lang;
     global $conf;
     $this->oauthToolbar();
     print '<h1>OAuth - Add Consumer</h1>' . NL;
     print '<div class="leftalign">' . NL;
     print '</div>' . NL;
     print '<div class="centeralign">' . NL;
     $form = new Doku_Form('dw__oauth');
     $form->startFieldset('Create Consumer');
     #   $form->addHidden('id', $ID);
     #   $form->addElement('<p>Your Username: '******'REMOTE_USER'].'</p>');
     #   $form->addHidden('dwoauthnonce', $opt['secpass']);
     $form->addHidden('feedback', 1);
     $form->addElement(form_makeTextField('consumer_key', $opt['consumer_key'], 'Consumer Key', 'focus__this', 'block'));
     $form->addElement(form_makeTextField('consumer_secret', $opt['consumer_secret'], 'Consumer Secret', '', 'block'));
     $form->addElement(form_makeTextField('callback_url', $opt['callback_url'], 'callback Url', '', 'block'));
     $form->addElement(form_makeButton('submit', 'oauth', 'addconsumer'));
     $form->addElement(form_makeButton('submit', 'oauth', 'cancel'));
     $form->endFieldset();
     // TODO: change-user/re-login button.. (go to logout, keep special $ID='OAUTHPLUGIN:'.$opt['secpass']
     html_form('confirm', $form);
     print '</div>' . NL;
 }
コード例 #29
0
ファイル: syntax.php プロジェクト: nextghost/Dokutranslate
 function _renderReviews($id, $meta, $parid)
 {
     # Check for permission to write reviews
     $mod = canReview($id, $meta, $parid);
     # No reviews and no moderator privileges => no review block
     if (!$mod && empty($meta[$parid]['reviews'])) {
         return '';
     }
     $ret = "<div class=\"dokutranslate_review\">\n";
     $ret .= '<h5>' . $this->getLang('review_header') . "</h5>\n";
     $ret .= "<table>\n";
     $listbox = array(array('0', $this->getLang('trans_wrong')), array('1', $this->getLang('trans_rephrase')), array('2', $this->getLang('trans_accepted')));
     # Prepare review form for current user
     if ($mod) {
         if (isset($meta[$parid]['reviews'][$_SERVER['REMOTE_USER']])) {
             $myReview = $meta[$parid]['reviews'][$_SERVER['REMOTE_USER']];
         } else {
             $myReview = array('message' => '', 'quality' => 0, 'incomplete' => false);
         }
         $form = new Doku_Form(array());
         $form->addHidden('parid', strval($parid));
         $form->addHidden('do', 'dokutranslate_review');
         $form->addElement(form_makeTextField('review', $myReview['message'], $this->getLang('trans_message'), '', 'nowrap', array('size' => '50')));
         $form->addElement(form_makeMenuField('quality', $listbox, strval($myReview['quality']), $this->getLang('trans_quality'), '', 'nowrap'));
         $args = array();
         if ($myReview['incomplete']) {
             $args['checked'] = 'checked';
         }
         $form->addElement(form_makeCheckboxField('incomplete', '1', $this->getLang('trans_incomplete'), '', 'nowrap', $args));
         $form->addElement(form_makeButton('submit', '', $this->getLang('add_review')));
     }
     # Display all reviews for this paragraph
     while (list($key, $value) = each($meta[$parid]['reviews'])) {
         $ret .= '<tr><td>' . hsc($key) . '</td><td>';
         # Moderators can modify their own review
         if ($mod && $key == $_SERVER['REMOTE_USER']) {
             $ret .= $form->getForm();
         } else {
             $ret .= '(' . $listbox[$value['quality']][1];
             if ($value['incomplete']) {
                 $ret .= ', ' . $this->getLang('rend_incomplete');
             }
             $ret .= ') ';
             $ret .= hsc($value['message']);
         }
         $ret .= "</td></tr>\n";
     }
     # Current user is a moderator who didn't write a review yet,
     # display the review form at the end
     if ($mod && !isset($meta[$parid]['reviews'][$_SERVER['REMOTE_USER']])) {
         if (empty($meta[$parid]['reviews'])) {
             $ret .= '<tr><td>';
         } else {
             $ret .= '<tr><td colspan="2">';
         }
         $ret .= $form->getForm();
         $ret .= "</td></tr>\n";
     }
     $ret .= "</table></div>\n";
     return $ret;
 }
コード例 #30
0
 /**
  * Output html of the admin page
  */
 public function html()
 {
     $sqlite = $this->hlp->_getDB();
     if (!$sqlite) {
         return;
     }
     echo $this->locale_xhtml('admin_intro');
     $sql = "SELECT * FROM fields";
     $res = $sqlite->query($sql);
     $rows = $sqlite->res2arr($res);
     $form = new Doku_Form(array('method' => 'post'));
     $form->addHidden('page', 'userprofile_fields');
     $form->addElement('<table class="inline">' . '<tr>' . '<th>' . $this->getLang('name') . '</th>' . '<th>' . $this->getLang('title') . '</th>' . '<th>' . $this->getLang('defaultval') . '</th>' . '</tr>');
     // add empty row for adding a new entry
     $rows[] = array('name' => '', 'title' => '', 'defaultval' => '');
     $cur = 0;
     foreach ($rows as $row) {
         $form->addElement('<tr>');
         $form->addElement('<td>');
         $form->addHidden('up[' . $cur . '][fid]', $row['fid']);
         $form->addElement(form_makeTextField('up[' . $cur . '][name]', $row['name'], ''));
         $form->addElement('</td>');
         $form->addElement('<td>');
         $form->addElement(form_makeTextField('up[' . $cur . '][title]', $row['title'], ''));
         $form->addElement('</td>');
         $form->addElement('<td>');
         $form->addElement(form_makeTextField('up[' . $cur . '][defaultval]', $row['defaultval'], ''));
         $form->addElement('</td>');
         $form->addElement('</tr>');
         $cur++;
     }
     $form->addElement('</table>');
     $form->addElement(form_makeButton('submit', 'admin', $this->getLang('submit')));
     $form->printForm();
 }