function showList($conds = array('af_deleted' => 0), $optarray = array())
 {
     global $wgAbuseFilterCentralDB, $wgAbuseFilterIsCentral;
     $output = '';
     $output .= Xml::element('h2', null, $this->msg('abusefilter-list')->parse());
     $pager = new AbuseFilterPager($this, $conds);
     $deleted = $optarray['deleted'];
     $hidedisabled = $optarray['hidedisabled'];
     $scope = $optarray['scope'];
     # Options form
     $fields = array();
     $fields['abusefilter-list-options-deleted'] = Xml::radioLabel($this->msg('abusefilter-list-options-deleted-show')->text(), 'deletedfilters', 'show', 'mw-abusefilter-deletedfilters-show', $deleted == 'show') . Xml::radioLabel($this->msg('abusefilter-list-options-deleted-hide')->text(), 'deletedfilters', 'hide', 'mw-abusefilter-deletedfilters-hide', $deleted == 'hide') . Xml::radioLabel($this->msg('abusefilter-list-options-deleted-only')->text(), 'deletedfilters', 'only', 'mw-abusefilter-deletedfilters-only', $deleted == 'only');
     if (isset($wgAbuseFilterCentralDB) && !$wgAbuseFilterIsCentral) {
         $fields['abusefilter-list-options-scope'] = Xml::radioLabel($this->msg('abusefilter-list-options-scope-local')->text(), 'rulescope', 'local', 'mw-abusefilter-rulescope-local', $scope == 'local') . Xml::radioLabel($this->msg('abusefilter-list-options-scope-global')->text(), 'rulescope', 'global', 'mw-abusefilter-rulescope-global', $scope == 'global');
     }
     $fields['abusefilter-list-options-disabled'] = Xml::checkLabel($this->msg('abusefilter-list-options-hidedisabled')->text(), 'hidedisabled', 'mw-abusefilter-disabledfilters-hide', $hidedisabled);
     $fields['abusefilter-list-limit'] = $pager->getLimitSelect();
     $options = Xml::buildForm($fields, 'abusefilter-list-options-submit');
     $options .= Html::hidden('title', $this->getTitle()->getPrefixedText());
     $options = Xml::tags('form', array('method' => 'get', 'action' => $this->getTitle()->getFullURL()), $options);
     $options = Xml::fieldset($this->msg('abusefilter-list-options')->text(), $options);
     $output .= $options;
     if (isset($wgAbuseFilterCentralDB) && !$wgAbuseFilterIsCentral && $scope == 'global') {
         $globalPager = new GlobalAbuseFilterPager($this, $conds);
         $output .= $globalPager->getNavigationBar() . $globalPager->getBody() . $globalPager->getNavigationBar();
     } else {
         $output .= $pager->getNavigationBar() . $pager->getBody() . $pager->getNavigationBar();
     }
     $this->getOutput()->addHTML($output);
 }
Esempio n. 2
0
 function getInputHTML($value)
 {
     $attribs = [];
     if (!empty($this->mParams['disabled'])) {
         $attribs['disabled'] = 'disabled';
     }
     $html = Xml::radioLabel($this->msg('minimum-size')->text(), $this->mName . '-mode', 'min', $this->mID . '-mode-min', $value >= 0, $attribs);
     $html .= '&#160;' . Xml::radioLabel($this->msg('maximum-size')->text(), $this->mName . '-mode', 'max', $this->mID . '-mode-max', $value < 0, $attribs);
     $html .= '&#160;' . parent::getInputHTML($value ? abs($value) : '');
     $html .= '&#160;' . $this->msg('pagesize')->parse();
     return $html;
 }
Esempio n. 3
0
    function buildForm()
    {
        global $wgScript;
        $languages = Language::getLanguageNames(false);
        ksort($languages);
        $out = Xml::openElement('form', array('method' => 'get', 'action' => $wgScript, 'id' => 'mw-allmessages-form')) . Xml::fieldset(wfMsg('allmessages-filter-legend')) . Xml::hidden('title', $this->getTitle()) . Xml::openElement('table', array('class' => 'mw-allmessages-table')) . "\n" . '<tr>
				<td class="mw-label">' . Xml::label(wfMsg('allmessages-prefix'), 'mw-allmessages-form-prefix') . "</td>\n\n\t\t\t\t<td class=\"mw-input\">" . Xml::input('prefix', 20, str_replace('_', ' ', $this->prefix), array('id' => 'mw-allmessages-form-prefix')) . "</td>\n\n\t\t\t</tr>\n\t\t\t<tr>\n\n\t\t\t\t<td class='mw-label'>" . wfMsg('allmessages-filter') . "</td>\n\n\t\t\t\t<td class='mw-input'>" . Xml::radioLabel(wfMsg('allmessages-filter-unmodified'), 'filter', 'unmodified', 'mw-allmessages-form-filter-unmodified', $this->filter == 'unmodified' ? true : false) . Xml::radioLabel(wfMsg('allmessages-filter-all'), 'filter', 'all', 'mw-allmessages-form-filter-all', $this->filter == 'all' ? true : false) . Xml::radioLabel(wfMsg('allmessages-filter-modified'), 'filter', 'modified', 'mw-allmessages-form-filter-modified', $this->filter == 'modified' ? true : false) . "</td>\n\n\t\t\t</tr>\n\t\t\t<tr>\n\n\t\t\t\t<td class=\"mw-label\">" . Xml::label(wfMsg('allmessages-language'), 'mw-allmessages-form-lang') . "</td>\n\n\t\t\t\t<td class=\"mw-input\">" . Xml::openElement('select', array('id' => 'mw-allmessages-form-lang', 'name' => 'lang'));
        foreach ($languages as $lang => $name) {
            $selected = $lang == $this->langCode ? true : false;
            $out .= Xml::option($lang . ' - ' . $name, $lang, $selected) . "\n";
        }
        $out .= Xml::closeElement('select') . "</td>\n\n\t\t\t</tr>\n\t\t\t<tr>\n\n\t\t\t\t<td></td>\n\t\t\t\t<td>" . Xml::submitButton(wfMsg('allmessages-filter-submit')) . "</td>\n\n\t\t\t</tr>" . Xml::closeElement('table') . $this->table->getHiddenFields(array('title', 'prefix', 'filter', 'lang')) . Xml::closeElement('fieldset') . Xml::closeElement('form');
        return $out;
    }
    function buildForm()
    {
        $attrs = ['id' => 'mw-allmessages-form-lang', 'name' => 'lang'];
        $msg = wfMessage('allmessages-language');
        $langSelect = Xml::languageSelector($this->langcode, false, null, $attrs, $msg);
        $out = Xml::openElement('form', ['method' => 'get', 'action' => $this->getConfig()->get('Script'), 'id' => 'mw-allmessages-form']) . Xml::fieldset($this->msg('allmessages-filter-legend')->text()) . Html::hidden('title', $this->getTitle()->getPrefixedText()) . Xml::openElement('table', ['class' => 'mw-allmessages-table']) . "\n" . '<tr>
				<td class="mw-label">' . Xml::label($this->msg('allmessages-prefix')->text(), 'mw-allmessages-form-prefix') . "</td>\n\n\t\t\t<td class=\"mw-input\">" . Xml::input('prefix', 20, str_replace('_', ' ', $this->displayPrefix), ['id' => 'mw-allmessages-form-prefix']) . "</td>\n\n\t\t\t</tr>\n\t\t\t<tr>\n\n\t\t\t<td class='mw-label'>" . $this->msg('allmessages-filter')->escaped() . "</td>\n\n\t\t\t\t<td class='mw-input'>" . Xml::radioLabel($this->msg('allmessages-filter-unmodified')->text(), 'filter', 'unmodified', 'mw-allmessages-form-filter-unmodified', $this->filter === 'unmodified') . Xml::radioLabel($this->msg('allmessages-filter-all')->text(), 'filter', 'all', 'mw-allmessages-form-filter-all', $this->filter === 'all') . Xml::radioLabel($this->msg('allmessages-filter-modified')->text(), 'filter', 'modified', 'mw-allmessages-form-filter-modified', $this->filter === 'modified') . "</td>\n\n\t\t\t</tr>\n\t\t\t<tr>\n\n\t\t\t\t<td class=\"mw-label\">" . $langSelect[0] . "</td>\n\n\t\t\t\t<td class=\"mw-input\">" . $langSelect[1] . "</td>\n\n\t\t\t</tr>" . '<tr>
				<td class="mw-label">' . Xml::label($this->msg('table_pager_limit_label')->text(), 'mw-table_pager_limit_label') . '</td>
			<td class="mw-input">' . $this->getLimitSelect(['id' => 'mw-table_pager_limit_label']) . '</td>
			<tr>
				<td></td>
				<td>' . Xml::submitButton($this->msg('allmessages-filter-submit')->text()) . "</td>\n\n\t\t\t</tr>" . Xml::closeElement('table') . $this->getHiddenFields(['title', 'prefix', 'filter', 'lang', 'limit']) . Xml::closeElement('fieldset') . Xml::closeElement('form');
        return $out;
    }
 /**
  * @return string|null When string, "skip" or "continue"
  */
 public function execute()
 {
     if ($this->getVar('_ExistingDBSettings')) {
         return 'skip';
     }
     $r = $this->parent->request;
     if ($r->wasPosted()) {
         $status = $this->submit();
         if ($status->isGood()) {
             $this->setVar('_UpgradeDone', false);
             return 'continue';
         } else {
             $this->parent->showStatusBox($status);
         }
     }
     $this->startForm();
     $types = "<ul class=\"config-settings-block\">\n";
     $settings = '';
     $defaultType = $this->getVar('wgDBtype');
     // Messages: config-dbsupport-mysql, config-dbsupport-postgres, config-dbsupport-oracle,
     // config-dbsupport-sqlite, config-dbsupport-mssql
     $dbSupport = '';
     foreach (Installer::getDBTypes() as $type) {
         $dbSupport .= wfMessage("config-dbsupport-{$type}")->plain() . "\n";
     }
     $this->addHTML($this->parent->getInfoBox(wfMessage('config-support-info', trim($dbSupport))->text()));
     // It's possible that the library for the default DB type is not compiled in.
     // In that case, instead select the first supported DB type in the list.
     $compiledDBs = $this->parent->getCompiledDBs();
     if (!in_array($defaultType, $compiledDBs)) {
         $defaultType = $compiledDBs[0];
     }
     foreach ($compiledDBs as $type) {
         $installer = $this->parent->getDBInstaller($type);
         $types .= '<li>' . Xml::radioLabel($installer->getReadableName(), 'DBType', $type, "DBType_{$type}", $type == $defaultType, array('class' => 'dbRadio', 'rel' => "DB_wrapper_{$type}")) . "</li>\n";
         // Messages: config-header-mysql, config-header-postgres, config-header-oracle,
         // config-header-sqlite
         $settings .= Html::openElement('div', array('id' => 'DB_wrapper_' . $type, 'class' => 'dbWrapper')) . Html::element('h3', array(), wfMessage('config-header-' . $type)->text()) . $installer->getConnectForm() . "</div>\n";
     }
     $types .= "</ul><br style=\"clear: left\"/>\n";
     $this->addHTML($this->parent->label('config-db-type', false, $types) . $settings);
     $this->endForm();
     return null;
 }
 /**
  * Process the 'delvote' action.
  * @param Article $article The article to endorse/object to deletion of.
  */
 public function process($article)
 {
     global $wgRequest, $wgOut, $wgUser;
     $errs = $article->mTitle->getUserPermissionsErrors('deletequeue-vote', $wgUser);
     if (count($errs) > 0) {
         $wgOut->showPermissionsErrorPage($errs);
         return;
     }
     $dqi = DeleteQueueItem::newFromArticle($article);
     $wgOut->setPageTitle(wfMsg('deletequeue-vote-title', $article->mTitle->getPrefixedText()));
     // Load form data
     $token = $wgRequest->getVal('wpEditToken');
     $action = $wgRequest->getVal('wpVote');
     $comments = $wgRequest->getText('wpComments');
     if ($wgUser->matchEditToken($token) && in_array($action, array('endorse', 'object'))) {
         $dqi->addVote($action, $comments);
         if ($action == 'object' && $dqi->getQueue() == 'prod') {
             $dbw = wfGetDB(DB_MASTER);
             $dbw->begin();
             $dqi->setQueue('deletediscuss', $dqi->getReason());
             $lp = new LogPage('delete');
             $lp->addEntry('requeue', $article->mTitle, $comments, array(wfMsgForContent('deletequeue-queue-prod'), wfMsgForContent("deletequeue-queue-deletediscuss")));
             $dbw->commit();
             $wgOut->addWikiMsg('deletequeue-vote-requeued', wfMsgNoTrans('deletequeue-queue-deletediscuss'));
         } else {
             $wgOut->addWikiMsg("deletequeue-vote-success-{$action}");
         }
         return;
     }
     $wgOut->addWikiMsg('deletequeue-vote-text', $article->mTitle->getPrefixedText(), $dqi->getReason());
     // Add main form.
     $fields = array();
     $options = Xml::tags('p', null, Xml::radioLabel(wfMsg('deletequeue-vote-endorse'), 'wpVote', 'endorse', 'mw-deletequeue-vote-endorse'));
     $options .= Xml::tags('p', null, Xml::radioLabel(wfMsg('deletequeue-vote-object'), 'wpVote', 'object', 'mw-deletequeue-vote-object'));
     $fields['deletequeue-vote-action'] = $options;
     $fields['deletequeue-vote-reason'] = Xml::input('wpComments', 45, $comments);
     $article_id = $article->getId();
     $title = $this->getTitle("vote/{$article_id}");
     $form = Xml::buildForm($fields, 'deletequeue-vote-submit') . Html::Hidden('wpEditToken', $wgUser->editToken()) . Html::Hidden('title', $title->getPrefixedText());
     $form = Xml::tags('form', array('action' => $title->getLocalURL(), 'method' => 'POST'), $form);
     $form = Xml::fieldset(wfMsg('deletequeue-vote-legend'), $form);
     $wgOut->addHTML($form);
 }
Esempio n. 7
0
 function showList($conds = array('af_deleted' => 0), $optarray = array())
 {
     $output = '';
     $output .= Xml::element('h2', null, wfMsgExt('abusefilter-list', array('parseinline')));
     $pager = new AbuseFilterPager($this, $conds);
     $deleted = $optarray['deleted'];
     $hidedisabled = $optarray['hidedisabled'];
     # Options form
     $fields = array();
     $fields['abusefilter-list-options-deleted'] = Xml::radioLabel(wfMsg('abusefilter-list-options-deleted-show'), 'deletedfilters', 'show', 'mw-abusefilter-deletedfilters-show', $deleted == 'show') . Xml::radioLabel(wfMsg('abusefilter-list-options-deleted-hide'), 'deletedfilters', 'hide', 'mw-abusefilter-deletedfilters-hide', $deleted == 'hide') . Xml::radioLabel(wfMsg('abusefilter-list-options-deleted-only'), 'deletedfilters', 'only', 'mw-abusefilter-deletedfilters-only', $deleted == 'only');
     $fields['abusefilter-list-options-disabled'] = Xml::checkLabel(wfMsg('abusefilter-list-options-hidedisabled'), 'hidedisabled', 'mw-abusefilter-disabledfilters-hide', $hidedisabled);
     $fields['abusefilter-list-limit'] = $pager->getLimitSelect();
     $options = Xml::buildForm($fields, 'abusefilter-list-options-submit');
     $options .= Html::hidden('title', $this->getTitle()->getPrefixedText());
     $options = Xml::tags('form', array('method' => 'get', 'action' => $this->getTitle()->getFullURL()), $options);
     $options = Xml::fieldset(wfMsg('abusefilter-list-options'), $options);
     $output .= $options;
     $output .= $pager->getNavigationBar() . $pager->getBody() . $pager->getNavigationBar();
     $this->getOutput()->addHTML($output);
 }
 private function showSurvey($survey, $submitMsg, $opt, $loadFromDB = false)
 {
     global $wgUser, $wgOut, $wgOptInStyleVersion;
     UsabilityInitiativeHooks::initialize();
     UsabilityInitiativeHooks::addScript('OptIn/OptIn.js', $wgOptInStyleVersion);
     UsabilityInitiativeHooks::addStyle('OptIn/OptIn.css', $wgOptInStyleVersion);
     $loaded = array();
     if ($loadFromDB) {
         $dbr = wfGetDb(DB_SLAVE);
         $res = $dbr->select('optin_survey', array('ois_question', 'ois_answer', 'ois_answer_data'), array('ois_user' => $wgUser->getID(), 'ois_type' => $opt), __METHOD__);
         foreach ($res as $row) {
             $loaded[$row->ois_question] = array($row->ois_answer, $row->ois_answer_data);
         }
     }
     $query = array('from' => $this->mOrigin, 'fromquery' => $this->mOriginQuery);
     $retval = Xml::openElement('form', array('method' => 'post', 'action' => $this->getTitle()->getLinkURL($query), 'id' => 'optin-survey'));
     $retval .= Xml::hidden('opt', $opt);
     $retval .= Xml::hidden('token', $wgUser->editToken());
     $retval .= Xml::openElement('dl');
     foreach ($survey as $id => $question) {
         $answer = isset($loaded[$id]) ? $loaded[$id][0] : null;
         $answerdata = isset($loaded[$id]) ? $loaded[$id][1] : null;
         switch ($question['type']) {
             case 'dropdown':
                 $retval .= Xml::tags('dt', null, wfMsgWikiHtml($question['question']));
                 $retval .= Xml::openElement('dd');
                 $attrs = array('id' => "survey-{$id}", 'name' => "survey-{$id}");
                 if (isset($question['other'])) {
                     $attrs['class'] = 'optin-need-other';
                 }
                 $retval .= Xml::openElement('select', $attrs);
                 foreach ($question['answers'] as $aid => $answer) {
                     $retval .= Xml::option(wfMsg($answer), $aid, $answer === $aid);
                 }
                 if (isset($question['other'])) {
                     $retval .= Xml::option(wfMsg($question['other']), 'other', $answer === 'other');
                 }
                 $retval .= Xml::closeElement('select');
                 if (isset($question['other'])) {
                     $retval .= Xml::tags('div', array(), Xml::input("survey-{$id}-other", false, $answer === 'other' ? $answerdata : false, array('class' => 'optin-other-select', 'id' => "survey-{$id}-other")));
                 }
                 $retval .= Xml::closeElement('dd');
                 break;
             case 'radios':
                 $retval .= Xml::tags('dt', null, wfMsgWikiHtml($question['question']));
                 $retval .= Xml::openElement('dd');
                 $radios = array();
                 foreach ($question['answers'] as $aid => $answer) {
                     $radios[] = Xml::radioLabel(wfMsg($answer), "survey-{$id}", $aid, "survey-{$id}-{$aid}", $answer === $aid);
                 }
                 if (isset($question['other'])) {
                     $radios[] = Xml::radioLabel(wfMsg($question['other']), "survey-{$id}", 'other', "survey-{$id}-other-radio", $answer === 'other') . '&nbsp;' . Xml::input("survey-{$id}-other", false, $answer === 'other' ? $answerdata : false, array('class' => 'optin-other-radios'));
                 }
                 $retval .= implode(Xml::element('br'), $radios);
                 $retval .= Xml::closeElement('dd');
                 break;
             case 'checkboxes':
                 $answers = explode(',', $answer);
                 $retval .= Xml::tags('dt', null, wfMsgWikiHtml($question['question']));
                 $retval .= Xml::openElement('dd');
                 $checkboxes = array();
                 foreach ($question['answers'] as $aid => $answer) {
                     $checkboxes[] = Xml::checkLabel(wfMsg($answer), "survey-{$id}[]", "survey-{$id}-{$aid}", in_array($aid, $answers, true), array('value' => $aid));
                 }
                 if (isset($question['other'])) {
                     $checkboxes[] = Xml::checkLabel(wfMsg($question['other']), "survey-{$id}[]", "survey-{$id}-other-check", in_array('other', $answers, true), array('value' => 'other')) . '&nbsp;' . Xml::input("survey-{$id}-other", false, in_array('other', $answers, true) ? $answerdata : false, array('class' => 'optin-other-checks'));
                 }
                 $retval .= implode(Xml::element('br'), $checkboxes);
                 $retval .= Xml::closeElement('dd');
                 break;
             case 'yesno':
                 $retval .= Xml::tags('dt', null, wfMsgWikiHtml($question['question']));
                 $retval .= Xml::openElement('dd');
                 $retval .= Xml::radioLabel(wfMsg('optin-survey-yes'), "survey-{$id}", 'yes', "survey-{$id}-yes", $answer === 'yes', array('class' => 'survey-yes'));
                 $retval .= Xml::element('br');
                 $retval .= Xml::radioLabel(wfMsg('optin-survey-no'), "survey-{$id}", 'no', "survey-{$id}-no", $answer === 'no', array('class' => 'survey-no'));
                 $retval .= Xml::closeElement('dd');
                 if (isset($question['ifyes'])) {
                     $retval .= Xml::openElement('blockquote', array('id' => "survey-{$id}-ifyes-row", 'class' => 'survey-ifyes'));
                     $retval .= Xml::tags('dt', null, wfMsgWikiHtml($question['ifyes']));
                     $retval .= Xml::tags('dd', null, Xml::textarea("survey-{$id}-ifyes", $answerdata ? $answerdata : ''));
                     $retval .= Xml::closeElement('blockquote');
                 }
                 if (isset($question['ifno'])) {
                     $retval .= Xml::openElement('blockquote', array('id' => "survey-{$id}-ifno-row", 'class' => 'survey-ifno'));
                     $retval .= Xml::tags('dt', null, wfMsgWikiHtml($question['ifno']));
                     $retval .= Xml::tags('dd', null, Xml::textarea("survey-{$id}-ifno", $answerdata ? $answerdata : ''));
                     $retval .= Xml::closeElement('blockquote');
                 }
                 break;
             case 'resolution':
                 if ($answerdata) {
                     list($x, $y) = explode('x', $answerdata);
                 } else {
                     $x = $y = false;
                 }
                 $retval .= Xml::tags('dt', null, wfMsgWikiHtml($question['question']));
                 $retval .= Xml::openElement('dd');
                 $retval .= Xml::input("survey-{$id}-x", 5, $x, array('class' => 'optin-resolution-x', 'id' => "survey-{$id}-x"));
                 $retval .= ' x ';
                 $retval .= Xml::input("survey-{$id}-y", 5, $y, array('class' => 'optin-resolution-y', 'id' => "survey-{$id}-y"));
                 $retval .= Xml::closeElement('dd');
                 break;
             case 'textarea':
                 $retval .= Xml::tags('dt', null, wfMsgWikiHtml($question['question']));
                 $retval .= Xml::tags('dd', null, Xml::textarea("survey-{$id}", $answerdata ? $answerdata : ''));
                 break;
         }
     }
     $retval .= Xml::tags('dt', array('class' => 'optin-survey-submit'), Xml::element('a', array('id' => 'leave'), '', false) . Xml::submitButton(wfMsg($submitMsg)));
     $retval .= Xml::closeElement('dl');
     $retval .= Xml::closeElement('form');
     $wgOut->addHTML($retval);
 }
Esempio n. 9
0
 private function getMappingFormPart($sourceName)
 {
     $isSameSourceAsBefore = $this->sourceName === $sourceName;
     $defaultNamespace = $this->getConfig()->get('ImportTargetNamespace');
     return "<tr>\n\t\t\t\t\t<td>\n\t\t\t\t\t</td>\n\t\t\t\t\t<td class='mw-input'>" . Xml::radioLabel($this->msg('import-mapping-default')->text(), 'mapping', 'default', "mw-import-mapping-{$sourceName}-default", $isSameSourceAsBefore ? $this->mapping === 'default' : is_null($defaultNamespace)) . "</td>\n\t\t\t\t</tr>\n\t\t\t\t<tr>\n\t\t\t\t\t<td>\n\t\t\t\t\t</td>\n\t\t\t\t\t<td class='mw-input'>" . Xml::radioLabel($this->msg('import-mapping-namespace')->text(), 'mapping', 'namespace', "mw-import-mapping-{$sourceName}-namespace", $isSameSourceAsBefore ? $this->mapping === 'namespace' : !is_null($defaultNamespace)) . ' ' . Html::namespaceSelector(['selected' => $isSameSourceAsBefore ? $this->namespace : $defaultNamespace || ''], ['name' => "namespace", 'id' => "mw-import-namespace-{$sourceName}", 'class' => 'namespaceselector']) . "</td>\n\t\t\t\t</tr>\n\t\t\t\t<tr>\n\t\t\t\t\t<td>\n\t\t\t\t\t</td>\n\t\t\t\t\t<td class='mw-input'>" . Xml::radioLabel($this->msg('import-mapping-subpage')->text(), 'mapping', 'subpage', "mw-import-mapping-{$sourceName}-subpage", $isSameSourceAsBefore ? $this->mapping === 'subpage' : '') . ' ' . Xml::input('rootpage', 50, $isSameSourceAsBefore ? $this->rootpage : '', ['id' => "mw-interwiki-rootpage-{$sourceName}", 'type' => 'text']) . ' ' . "</td>\n\t\t\t\t</tr>";
 }
	public function execute( $messages ) {
		global $wgOut, $wgLang;

		$this->out = $wgOut;

		// Set up diff engine
		$diff = new DifferenceEngine;
		$diff->showDiffStyle();
		$diff->setReducedLineNumbers();

		// Check whether we do processing
		$process = $this->allowProcess();

		// Initialise collection
		$group = $this->getGroup();
		$code = $this->getCode();
		$collection = $group->initCollection( $code );
		$collection->loadTranslations();

		$this->out->addHTML( $this->doHeader() );

		// Determine changes
		$alldone = $process;
		$changed = array();

		foreach ( $messages as $key => $value ) {
			$fuzzy = $old = false;

			if ( isset( $collection[$key] ) ) {
				$old = $collection[$key]->translation();
			}

			// No changes at all, ignore
			if ( strval( $old ) === strval( $value ) ) {
				continue;
			}

			if ( $old === false ) {
				$name = wfMsgHtml( 'translate-manage-import-new',
					'<code style="font-weight:normal;">' . htmlspecialchars( $key ) . '</code>'
				);
				$text = TranslateUtils::convertWhiteSpaceToHTML( $value );
				$changed[] = self::makeSectionElement( $name, 'new', $text );
			} else {
				$diff->setText( $old, $value );
				$text = $diff->getDiff( '', '' );
				$type = 'changed';

				global $wgRequest;
				$action = $wgRequest->getVal( self::escapeNameForPHP( "action-$type-$key" ) );

				if ( $process ) {
					if ( !count( $changed ) ) {
						$changed[] = '<ul>';
					}

					if ( $action === null ) {
						$message = wfMsgExt( 'translate-manage-inconsistent', 'parseinline', wfEscapeWikiText( "action-$type-$key" ) );
						$changed[] = "<li>$message</li></ul>";
						$process = false;
					} else {
						// Check processing time
						if ( !isset( $this->time ) ) {
							$this->time = wfTimestamp();
						}

						$message = self::doAction(
							$action,
							$group,
							$key,
							$code,
							$value
						);

						$key = array_shift( $message );
						$params = $message;
						$message = wfMsgExt( $key, 'parseinline', $params );
						$changed[] = "<li>$message</li>";

						if ( $this->checkProcessTime() ) {
							$process = false;
							$duration = $wgLang->formatNum( $this->processingTime );
							$message = wfMsgExt( 'translate-manage-toolong', 'parseinline', $duration );
							$changed[] = "<li>$message</li></ul>";
						}
						continue;
					}
				}

				$alldone = false;

				$actions = $this->getActions();
				$defaction = $this->getDefaultAction( $fuzzy, $action );

				$act = array();

				foreach ( $actions as $action ) {
					$label = wfMsg( "translate-manage-action-$action" );
					$name = self::escapeNameForPHP( "action-$type-$key" );
					$id = Sanitizer::escapeId( "action-$key-$action" );
					$act[] = Xml::radioLabel( $label, $name, $action, $id, $action === $defaction );
				}

				$name = wfMsg( 'translate-manage-import-diff',
					'<code style="font-weight:normal;">' . htmlspecialchars( $key ) . '</code>',
					implode( ' ', $act )
				);

				$changed[] = self::makeSectionElement( $name, $type, $text );
			}
		}

		if ( !$process ) {
			$collection->filter( 'hastranslation', false );
			$keys = $collection->getMessageKeys();

			$diff = array_diff( $keys, array_keys( $messages ) );

			foreach ( $diff as $s ) {
				// @todo FIXME: Use CSS file.
				$name = wfMsgHtml( 'translate-manage-import-deleted',
					'<code style="font-weight:normal;">' . htmlspecialchars( $s ) . '</code>'
				);
				$text = TranslateUtils::convertWhiteSpaceToHTML(  $collection[$s]->translation() );
				$changed[] = self::makeSectionElement( $name, 'deleted', $text );
			}
		}

		if ( $process || ( !count( $changed ) && $code !== 'en' ) ) {
			if ( !count( $changed ) ) {
				$this->out->addWikiMsg( 'translate-manage-nochanges-other' );
			}

			if ( !count( $changed ) || strpos( $changed[count( $changed ) - 1], '<li>' ) !== 0 ) {
				$changed[] = '<ul>';
			}

			$message = wfMsgExt( 'translate-manage-import-done', 'parseinline' );
			$changed[] = "<li>$message</li></ul>";
			$this->out->addHTML( implode( "\n", $changed ) );
		} else {
			// END
			if ( count( $changed ) ) {
				if ( $code === 'en' ) {
					$this->out->addWikiMsg( 'translate-manage-intro-en' );
				} else {
					$lang = TranslateUtils::getLanguageName( $code, false, $wgLang->getCode() );
					$this->out->addWikiMsg( 'translate-manage-intro-other', $lang );
				}
				$this->out->addHTML( Html::hidden( 'language', $code ) );
				$this->out->addHTML( implode( "\n", $changed ) );
				$this->out->addHTML( Xml::submitButton( wfMsg( 'translate-manage-submit' ) ) );
			} else {
				$this->out->addWikiMsg( 'translate-manage-nochanges' );
			}
		}

		$this->out->addHTML( $this->doFooter() );
		return $alldone;
	}
Esempio n. 11
0
/**
 * Generates the namespace selector form with hidden attributes.
 * @param $options Array: the options to be included.
 */
function contributionsForm($options)
{
    global $wgScript, $wgTitle, $wgRequest;
    $options['title'] = $wgTitle->getPrefixedText();
    if (!isset($options['target'])) {
        $options['target'] = '';
    } else {
        //XXCHANGED
        $options['target'] = str_replace('-', ' ', $options['target']);
    }
    if (!isset($options['namespace'])) {
        $options['namespace'] = '';
    }
    if (!isset($options['contribs'])) {
        $options['contribs'] = 'user';
    }
    if (!isset($options['year'])) {
        $options['year'] = '';
    }
    if (!isset($options['month'])) {
        $options['month'] = '';
    }
    if ($options['contribs'] == 'newbie') {
        $options['target'] = '';
    }
    $f = Xml::openElement('form', array('method' => 'get', 'action' => $wgScript));
    foreach ($options as $name => $value) {
        if (in_array($name, array('namespace', 'target', 'contribs', 'year', 'month'))) {
            continue;
        }
        $f .= "\t" . Xml::hidden($name, $value) . "\n";
    }
    $f .= '<fieldset>' . Xml::element('legend', array(), wfMsg('sp-contributions-search')) . Xml::radioLabel(wfMsgExt('sp-contributions-newbies', array('parseinline')), 'contribs', 'newbie', 'newbie', $options['contribs'] == 'newbie' ? true : false) . '<br />' . Xml::radioLabel(wfMsgExt('sp-contributions-username', array('parseinline')), 'contribs', 'user', 'user', $options['contribs'] == 'user' ? true : false) . ' ' . Xml::input('target', 20, $options['target']) . '&nbsp;&nbsp;&nbsp; ' . '<span style="white-space: nowrap">' . Xml::label(wfMsg('namespace'), 'namespace') . ' ' . Xml::namespaceSelector($options['namespace'], '') . '</span>' . Xml::openElement('p') . '<span style="white-space: nowrap">' . Xml::label(wfMsg('year'), 'year') . ' ' . Xml::input('year', 4, $options['year'], array('id' => 'year', 'maxlength' => 4)) . '&nbsp;&nbsp;</span>' . ' ' . '<span style="white-space: nowrap">' . Xml::label(wfMsg('month'), 'month') . ' ' . Xml::monthSelector($options['month'], -1) . ' ' . '&nbsp;&nbsp;</span><br />' . Xml::submitButton(wfMsg('sp-contributions-submit'), array("class" => "button primary", "style" => "float:right; margin-top:5px; margin-right:0;")) . Xml::closeElement('p');
    $explain = wfMsgExt('sp-contributions-explain', 'parseinline');
    if (!wfEmptyMsg('sp-contributions-explain', $explain)) {
        $f .= "<p>{$explain}</p>";
    }
    $f .= '</fieldset>' . Xml::closeElement('form');
    return $f;
}
 /**
  * Constructs and outputs file input form with supported methods.
  */
 protected function outputForm()
 {
     global $wgOut;
     $wgOut->addModules('ext.translate.special.importtranslations');
     TranslateUtils::addSpecialHelpLink($wgOut, 'Help:Extension:Translate/Off-line_translation');
     /**
      * Ugly but necessary form building ahead, ohoy
      */
     $this->out->addHTML(Xml::openElement('form', array('action' => $this->getTitle()->getLocalUrl(), 'method' => 'post', 'enctype' => 'multipart/form-data', 'id' => 'mw-translate-import')) . Html::hidden('token', $this->user->editToken()) . Html::hidden('title', $this->getTitle()->getPrefixedText()) . Xml::openElement('table') . Xml::openElement('tr') . Xml::openElement('td'));
     $class = array('class' => 'mw-translate-import-inputs');
     $this->out->addHTML(Xml::radioLabel(wfMsg('translate-import-from-url'), 'upload-type', 'url', 'mw-translate-up-url', $this->request->getText('upload-type') === 'url') . "\n" . Xml::closeElement('td') . Xml::openElement('td') . "\n" . Xml::input('upload-url', 50, $this->request->getText('upload-url'), array('id' => 'mw-translate-up-url-input') + $class) . "\n" . Xml::closeElement('td') . Xml::closeElement('tr') . Xml::openElement('tr') . Xml::openElement('td') . "\n");
     $this->out->addHTML(Xml::radioLabel(wfMsg('translate-import-from-wiki'), 'upload-type', 'wiki', 'mw-translate-up-wiki', $this->request->getText('upload-type') === 'wiki') . "\n" . Xml::closeElement('td') . Xml::openElement('td') . "\n" . Xml::input('upload-wiki', 50, $this->request->getText('upload-wiki', 'File:'), array('id' => 'mw-translate-up-wiki-input') + $class) . "\n" . Xml::closeElement('td') . Xml::closeElement('tr') . Xml::openElement('tr') . Xml::openElement('td') . "\n" . Xml::radioLabel(wfMsg('translate-import-from-local'), 'upload-type', 'local', 'mw-translate-up-local', $this->request->getText('upload-type') === 'local') . "\n" . Xml::closeElement('td') . Xml::openElement('td') . "\n" . Xml::input('upload-local', 50, $this->request->getText('upload-local'), array('type' => 'file', 'id' => 'mw-translate-up-local-input') + $class) . "\n" . Xml::closeElement('td') . Xml::closeElement('tr') . Xml::closeElement('table') . Xml::submitButton(wfMsg('translate-import-load')) . Xml::closeElement('form'));
 }
    /**
     * @access private
     */
    function mainPrefsForm($status, $message = '')
    {
        global $wgUser, $wgOut, $wgLang, $wgContLang;
        global $wgAllowRealName, $wgImageLimits, $wgThumbLimits;
        global $wgDisableLangConversion;
        global $wgEnotifWatchlist, $wgEnotifUserTalk, $wgEnotifMinorEdits;
        global $wgRCShowWatchingUsers, $wgEnotifRevealEditorAddress;
        global $wgEnableEmail, $wgEnableUserEmail, $wgEmailAuthentication;
        global $wgContLanguageCode, $wgDefaultSkin, $wgSkipSkins, $wgAuth;
        $wgOut->setPageTitle(wfMsg('preferences'));
        $wgOut->setArticleRelated(false);
        $wgOut->setRobotpolicy('noindex,nofollow');
        $wgOut->disallowUserJs();
        # Prevent hijacked user scripts from sniffing passwords etc.
        if ($this->mSuccess || 'success' == $status) {
            $wgOut->addWikitext('<div class="successbox"><strong>' . wfMsg('savedprefs') . '</strong></div>');
        } else {
            if ('error' == $status) {
                $wgOut->addWikitext('<div class="errorbox"><strong>' . $message . '</strong></div>');
            } else {
                if ('' != $status) {
                    $wgOut->addWikitext($message . "\n----");
                }
            }
        }
        $qbs = $wgLang->getQuickbarSettings();
        $skinNames = $wgLang->getSkinNames();
        $mathopts = $wgLang->getMathNames();
        $dateopts = $wgLang->getDatePreferences();
        $togs = User::getToggles();
        $titleObj = SpecialPage::getTitleFor('Preferences');
        $action = $titleObj->escapeLocalURL();
        # Pre-expire some toggles so they won't show if disabled
        $this->mUsedToggles['shownumberswatching'] = true;
        $this->mUsedToggles['showupdated'] = true;
        $this->mUsedToggles['enotifwatchlistpages'] = true;
        $this->mUsedToggles['enotifusertalkpages'] = true;
        $this->mUsedToggles['enotifminoredits'] = true;
        $this->mUsedToggles['enotifrevealaddr'] = true;
        $this->mUsedToggles['ccmeonemails'] = true;
        $this->mUsedToggles['uselivepreview'] = true;
        if (!$this->mEmailFlag) {
            $emfc = 'checked="checked"';
        } else {
            $emfc = '';
        }
        if ($wgEmailAuthentication && $this->mUserEmail != '') {
            if ($wgUser->getEmailAuthenticationTimestamp()) {
                $emailauthenticated = wfMsg('emailauthenticated', $wgLang->timeanddate($wgUser->getEmailAuthenticationTimestamp(), true)) . '<br />';
                $disableEmailPrefs = false;
            } else {
                $disableEmailPrefs = true;
                $skin = $wgUser->getSkin();
                $emailauthenticated = wfMsg('emailnotauthenticated') . '<br />' . $skin->makeKnownLinkObj(SpecialPage::getTitleFor('Confirmemail'), wfMsg('emailconfirmlink')) . '<br />';
            }
        } else {
            $emailauthenticated = '';
            $disableEmailPrefs = false;
        }
        if ($this->mUserEmail == '') {
            $emailauthenticated = wfMsg('noemailprefs') . '<br />';
        }
        $ps = $this->namespacesCheckboxes();
        $enotifwatchlistpages = $wgEnotifWatchlist ? $this->getToggle('enotifwatchlistpages', false, $disableEmailPrefs) : '';
        $enotifusertalkpages = $wgEnotifUserTalk ? $this->getToggle('enotifusertalkpages', false, $disableEmailPrefs) : '';
        $enotifminoredits = $wgEnotifWatchlist && $wgEnotifMinorEdits ? $this->getToggle('enotifminoredits', false, $disableEmailPrefs) : '';
        $enotifrevealaddr = ($wgEnotifWatchlist || $wgEnotifUserTalk) && $wgEnotifRevealEditorAddress ? $this->getToggle('enotifrevealaddr', false, $disableEmailPrefs) : '';
        # </FIXME>
        $wgOut->addHTML("<form action=\"{$action}\" method='post'>");
        $wgOut->addHTML("<div id='preferences'>");
        # User data
        $wgOut->addHTML(Xml::openElement('fieldset ') . Xml::element('legend', null, wfMsg('prefs-personal')) . Xml::openElement('table') . $this->tableRow(Xml::element('h2', null, wfMsg('prefs-personal'))));
        $userInformationHtml = $this->tableRow(wfMsgHtml('username'), htmlspecialchars($wgUser->getName())) . $this->tableRow(wfMsgHtml('uid'), htmlspecialchars($wgUser->getID())) . $this->tableRow(wfMsgHtml('prefs-edits'), $wgLang->formatNum(User::edits($wgUser->getId())));
        if (wfRunHooks('PreferencesUserInformationPanel', array($this, &$userInformationHtml))) {
            $wgOut->addHtml($userInformationHtml);
        }
        if ($wgAllowRealName) {
            $wgOut->addHTML($this->tableRow(Xml::label(wfMsg('yourrealname'), 'wpRealName'), Xml::input('wpRealName', 25, $this->mRealName, array('id' => 'wpRealName')), Xml::tags('div', array('class' => 'prefsectiontip'), wfMsgExt('prefs-help-realname', 'parseinline'))));
        }
        if ($wgEnableEmail) {
            $wgOut->addHTML($this->tableRow(Xml::label(wfMsg('youremail'), 'wpUserEmail'), Xml::input('wpUserEmail', 25, $this->mUserEmail, array('id' => 'wpUserEmail')), Xml::tags('div', array('class' => 'prefsectiontip'), wfMsgExt('prefs-help-email', 'parseinline'))));
        }
        global $wgParser, $wgMaxSigChars;
        if (mb_strlen($this->mNick) > $wgMaxSigChars) {
            $invalidSig = $this->tableRow('&nbsp;', Xml::element('span', array('class' => 'error'), wfMsg('badsiglength', $wgLang->formatNum($wgMaxSigChars))));
        } elseif (!empty($this->mToggles['fancysig']) && false === $wgParser->validateSig($this->mNick)) {
            $invalidSig = $this->tableRow('&nbsp;', Xml::element('span', array('class' => 'error'), wfMsg('badsig')));
        } else {
            $invalidSig = '';
        }
        $wgOut->addHTML($this->tableRow(Xml::label(wfMsg('yournick'), 'wpNick'), Xml::input('wpNick', 25, $this->mNick, array('id' => 'wpNick', 'maxlength' => $wgMaxSigChars))) . $invalidSig . $this->tableRow('&nbsp;', $this->getToggle('fancysig')));
        list($lsLabel, $lsSelect) = Xml::languageSelector($this->mUserLanguage);
        $wgOut->addHTML($this->tableRow($lsLabel, $lsSelect));
        /* see if there are multiple language variants to choose from*/
        if (!$wgDisableLangConversion) {
            $variants = $wgContLang->getVariants();
            $variantArray = array();
            $languages = Language::getLanguageNames(true);
            foreach ($variants as $v) {
                $v = str_replace('_', '-', strtolower($v));
                if (array_key_exists($v, $languages)) {
                    // If it doesn't have a name, we'll pretend it doesn't exist
                    $variantArray[$v] = $languages[$v];
                }
            }
            $options = "\n";
            foreach ($variantArray as $code => $name) {
                $selected = $code == $this->mUserVariant;
                $options .= Xml::option("{$code} - {$name}", $code, $selected) . "\n";
            }
            if (count($variantArray) > 1) {
                $wgOut->addHtml($this->tableRow(Xml::label(wfMsg('yourvariant'), 'wpUserVariant'), Xml::tags('select', array('name' => 'wpUserVariant', 'id' => 'wpUserVariant'), $options)));
            }
        }
        # Password
        if ($wgAuth->allowPasswordChange()) {
            $wgOut->addHTML($this->tableRow(Xml::element('h2', null, wfMsg('changepassword'))) . $this->tableRow(Xml::label(wfMsg('oldpassword'), 'wpOldpass'), Xml::password('wpOldpass', 25, $this->mOldpass, array('id' => 'wpOldpass'))) . $this->tableRow(Xml::label(wfMsg('newpassword'), 'wpNewpass'), Xml::password('wpNewpass', 25, $this->mNewpass, array('id' => 'wpNewpass'))) . $this->tableRow(Xml::label(wfMsg('retypenew'), 'wpRetypePass'), Xml::password('wpRetypePass', 25, $this->mRetypePass, array('id' => 'wpRetypePass'))) . Xml::tags('tr', null, Xml::tags('td', array('colspan' => '2'), $this->getToggle("rememberpassword"))));
        }
        # <FIXME>
        # Enotif
        if ($wgEnableEmail) {
            $moreEmail = '';
            if ($wgEnableUserEmail) {
                $emf = wfMsg('allowemail');
                $disabled = $disableEmailPrefs ? ' disabled="disabled"' : '';
                $moreEmail = "<input type='checkbox' {$emfc} {$disabled} value='1' name='wpEmailFlag' id='wpEmailFlag' /> <label for='wpEmailFlag'>{$emf}</label>";
            }
            $wgOut->addHTML($this->tableRow(Xml::element('h2', null, wfMsg('email'))) . $this->tableRow($emailauthenticated . $enotifrevealaddr . $enotifwatchlistpages . $enotifusertalkpages . $enotifminoredits . $moreEmail . $this->getToggle('ccmeonemails')));
        }
        # </FIXME>
        $wgOut->addHTML(Xml::closeElement('table') . Xml::closeElement('fieldset'));
        # Quickbar
        #
        if ($this->mSkin == 'cologneblue' || $this->mSkin == 'standard') {
            $wgOut->addHtml("<fieldset>\n<legend>" . wfMsg('qbsettings') . "</legend>\n");
            for ($i = 0; $i < count($qbs); ++$i) {
                if ($i == $this->mQuickbar) {
                    $checked = ' checked="checked"';
                } else {
                    $checked = "";
                }
                $wgOut->addHTML("<div><label><input type='radio' name='wpQuickbar' value=\"{$i}\"{$checked} />{$qbs[$i]}</label></div>\n");
            }
            $wgOut->addHtml("</fieldset>\n\n");
        } else {
            # Need to output a hidden option even if the relevant skin is not in use,
            # otherwise the preference will get reset to 0 on submit
            $wgOut->addHtml(wfHidden('wpQuickbar', $this->mQuickbar));
        }
        # Skin
        #
        $wgOut->addHTML("<fieldset>\n<legend>\n" . wfMsg('skin') . "</legend>\n");
        $mptitle = Title::newMainPage();
        $previewtext = wfMsg('skinpreview');
        # Only show members of Skin::getSkinNames() rather than
        # $skinNames (skins is all skin names from Language.php)
        $validSkinNames = Skin::getSkinNames();
        # Sort by UI skin name. First though need to update validSkinNames as sometimes
        # the skinkey & UI skinname differ (e.g. "standard" skinkey is "Classic" in the UI).
        foreach ($validSkinNames as $skinkey => &$skinname) {
            if (isset($skinNames[$skinkey])) {
                $skinname = $skinNames[$skinkey];
            }
        }
        asort($validSkinNames);
        foreach ($validSkinNames as $skinkey => $sn) {
            if (in_array($skinkey, $wgSkipSkins)) {
                continue;
            }
            $checked = $skinkey == $this->mSkin ? ' checked="checked"' : '';
            $mplink = htmlspecialchars($mptitle->getLocalURL("useskin={$skinkey}"));
            $previewlink = "<a target='_blank' href=\"{$mplink}\">{$previewtext}</a>";
            if ($skinkey == $wgDefaultSkin) {
                $sn .= ' (' . wfMsg('default') . ')';
            }
            $wgOut->addHTML("<input type='radio' name='wpSkin' id=\"wpSkin{$skinkey}\" value=\"{$skinkey}\"{$checked} /> <label for=\"wpSkin{$skinkey}\">{$sn}</label> {$previewlink}<br />\n");
        }
        $wgOut->addHTML("</fieldset>\n\n");
        # Math
        #
        global $wgUseTeX;
        if ($wgUseTeX) {
            $wgOut->addHTML("<fieldset>\n<legend>" . wfMsg('math') . '</legend>');
            foreach ($mathopts as $k => $v) {
                $checked = $k == $this->mMath;
                $wgOut->addHTML(Xml::openElement('div') . Xml::radioLabel(wfMsg($v), 'wpMath', $k, "mw-sp-math-{$k}", $checked) . Xml::closeElement('div') . "\n");
            }
            $wgOut->addHTML("</fieldset>\n\n");
        }
        # Files
        #
        $wgOut->addHTML("<fieldset>\n" . Xml::element('legend', null, wfMsg('files')) . "\n");
        $imageLimitOptions = null;
        foreach ($wgImageLimits as $index => $limits) {
            $selected = $index == $this->mImageSize;
            $imageLimitOptions .= Xml::option("{$limits[0]}×{$limits[1]}" . wfMsg('unit-pixel'), $index, $selected);
        }
        $imageSizeId = 'wpImageSize';
        $wgOut->addHTML("<div>" . Xml::label(wfMsg('imagemaxsize'), $imageSizeId) . " " . Xml::openElement('select', array('name' => $imageSizeId, 'id' => $imageSizeId)) . $imageLimitOptions . Xml::closeElement('select') . "</div>\n");
        $imageThumbOptions = null;
        foreach ($wgThumbLimits as $index => $size) {
            $selected = $index == $this->mThumbSize;
            $imageThumbOptions .= Xml::option($size . wfMsg('unit-pixel'), $index, $selected);
        }
        $thumbSizeId = 'wpThumbSize';
        $wgOut->addHTML("<div>" . Xml::label(wfMsg('thumbsize'), $thumbSizeId) . " " . Xml::openElement('select', array('name' => $thumbSizeId, 'id' => $thumbSizeId)) . $imageThumbOptions . Xml::closeElement('select') . "</div>\n");
        $wgOut->addHTML("</fieldset>\n\n");
        # Date format
        #
        # Date/Time
        #
        $wgOut->addHTML("<fieldset>\n<legend>" . wfMsg('datetime') . "</legend>\n");
        if ($dateopts) {
            $wgOut->addHTML("<fieldset>\n<legend>" . wfMsg('dateformat') . "</legend>\n");
            $idCnt = 0;
            $epoch = '20010115161234';
            # Wikipedia day
            foreach ($dateopts as $key) {
                if ($key == 'default') {
                    $formatted = wfMsgHtml('datedefault');
                } else {
                    $formatted = htmlspecialchars($wgLang->timeanddate($epoch, false, $key));
                }
                $key == $this->mDate ? $checked = ' checked="checked"' : ($checked = '');
                $wgOut->addHTML("<div><input type='radio' name=\"wpDate\" id=\"wpDate{$idCnt}\" " . "value=\"{$key}\"{$checked} /> <label for=\"wpDate{$idCnt}\">{$formatted}</label></div>\n");
                $idCnt++;
            }
            $wgOut->addHTML("</fieldset>\n");
        }
        $nowlocal = $wgLang->time($now = wfTimestampNow(), true);
        $nowserver = $wgLang->time($now, false);
        $wgOut->addHTML('<fieldset><legend>' . wfMsg('timezonelegend') . '</legend><table>' . $this->addRow(wfMsg('servertime'), $nowserver) . $this->addRow(wfMsg('localtime'), $nowlocal) . $this->addRow('<label for="wpHourDiff">' . wfMsg('timezoneoffset') . '</label>', "<input type='text' name='wpHourDiff' id='wpHourDiff' value=\"" . htmlspecialchars($this->mHourDiff) . "\" size='6' />") . "<tr><td colspan='2'>\r\n\t\t\t\t<input type='button' value=\"" . wfMsg('guesstimezone') . "\"\r\n\t\t\t\tonclick='javascript:guessTimezone()' id='guesstimezonebutton' style='display:none;' />\r\n\t\t\t\t</td></tr></table><div class='prefsectiontip'>¹" . wfMsg('timezonetext') . "</div></fieldset>\r\n\t\t</fieldset>\n\n");
        # Editing
        #
        global $wgLivePreview;
        $wgOut->addHTML('<fieldset><legend>' . wfMsg('textboxsize') . '</legend>
			<div>' . wfInputLabel(wfMsg('rows'), 'wpRows', 'wpRows', 3, $this->mRows) . ' ' . wfInputLabel(wfMsg('columns'), 'wpCols', 'wpCols', 3, $this->mCols) . "</div>" . $this->getToggles(array('editsection', 'editsectiononrightclick', 'editondblclick', 'editwidth', 'showtoolbar', 'previewonfirst', 'previewontop', 'minordefault', 'externaleditor', 'externaldiff', $wgLivePreview ? 'uselivepreview' : false, 'forceeditsummary')) . '</fieldset>');
        # Recent changes
        $wgOut->addHtml('<fieldset><legend>' . wfMsgHtml('prefs-rc') . '</legend>');
        $rc = '<table><tr>';
        $rc .= '<td>' . Xml::label(wfMsg('recentchangesdays'), 'wpRecentDays') . '</td>';
        $rc .= '<td>' . Xml::input('wpRecentDays', 3, $this->mRecentDays, array('id' => 'wpRecentDays')) . '</td>';
        $rc .= '</tr><tr>';
        $rc .= '<td>' . Xml::label(wfMsg('recentchangescount'), 'wpRecent') . '</td>';
        $rc .= '<td>' . Xml::input('wpRecent', 3, $this->mRecent, array('id' => 'wpRecent')) . '</td>';
        $rc .= '</tr></table>';
        $wgOut->addHtml($rc);
        $wgOut->addHtml('<br />');
        $toggles[] = 'hideminor';
        if ($wgRCShowWatchingUsers) {
            $toggles[] = 'shownumberswatching';
        }
        $toggles[] = 'usenewrc';
        $wgOut->addHtml($this->getToggles($toggles));
        $wgOut->addHtml('</fieldset>');
        # Watchlist
        $wgOut->addHtml('<fieldset><legend>' . wfMsgHtml('prefs-watchlist') . '</legend>');
        $wgOut->addHtml(wfInputLabel(wfMsg('prefs-watchlist-days'), 'wpWatchlistDays', 'wpWatchlistDays', 3, $this->mWatchlistDays));
        $wgOut->addHtml('<br /><br />');
        $wgOut->addHtml($this->getToggle('extendwatchlist'));
        $wgOut->addHtml(wfInputLabel(wfMsg('prefs-watchlist-edits'), 'wpWatchlistEdits', 'wpWatchlistEdits', 3, $this->mWatchlistEdits));
        $wgOut->addHtml('<br /><br />');
        $wgOut->addHtml($this->getToggles(array('watchlisthideown', 'watchlisthidebots', 'watchlisthideminor')));
        if ($wgUser->isAllowed('createpage') || $wgUser->isAllowed('createtalk')) {
            $wgOut->addHtml($this->getToggle('watchcreations'));
        }
        foreach (array('edit' => 'watchdefault', 'move' => 'watchmoves', 'delete' => 'watchdeletion') as $action => $toggle) {
            if ($wgUser->isAllowed($action)) {
                $wgOut->addHtml($this->getToggle($toggle));
            }
        }
        $this->mUsedToggles['watchcreations'] = true;
        $this->mUsedToggles['watchdefault'] = true;
        $this->mUsedToggles['watchmoves'] = true;
        $this->mUsedToggles['watchdeletion'] = true;
        $wgOut->addHtml('</fieldset>');
        # Search
        $wgOut->addHTML('<fieldset><legend>' . wfMsg('searchresultshead') . '</legend><table>' . $this->addRow(wfLabel(wfMsg('resultsperpage'), 'wpSearch'), wfInput('wpSearch', 4, $this->mSearch, array('id' => 'wpSearch'))) . $this->addRow(wfLabel(wfMsg('contextlines'), 'wpSearchLines'), wfInput('wpSearchLines', 4, $this->mSearchLines, array('id' => 'wpSearchLines'))) . $this->addRow(wfLabel(wfMsg('contextchars'), 'wpSearchChars'), wfInput('wpSearchChars', 4, $this->mSearchChars, array('id' => 'wpSearchChars'))) . "</table><fieldset><legend>" . wfMsg('defaultns') . "</legend>{$ps}</fieldset></fieldset>");
        # Misc
        #
        $wgOut->addHTML('<fieldset><legend>' . wfMsg('prefs-misc') . '</legend>');
        $wgOut->addHtml('<label for="wpStubs">' . wfMsg('stub-threshold') . '</label>&nbsp;');
        $wgOut->addHtml(Xml::input('wpStubs', 6, $this->mStubs, array('id' => 'wpStubs')));
        $msgUnderline = htmlspecialchars(wfMsg('tog-underline'));
        $msgUnderlinenever = htmlspecialchars(wfMsg('underline-never'));
        $msgUnderlinealways = htmlspecialchars(wfMsg('underline-always'));
        $msgUnderlinedefault = htmlspecialchars(wfMsg('underline-default'));
        $uopt = $wgUser->getOption("underline");
        $s0 = $uopt == 0 ? ' selected="selected"' : '';
        $s1 = $uopt == 1 ? ' selected="selected"' : '';
        $s2 = $uopt == 2 ? ' selected="selected"' : '';
        $wgOut->addHTML("\r\n<div class='toggle'><p><label for='wpOpunderline'>{$msgUnderline}</label>\r\n<select name='wpOpunderline' id='wpOpunderline'>\r\n<option value=\"0\"{$s0}>{$msgUnderlinenever}</option>\r\n<option value=\"1\"{$s1}>{$msgUnderlinealways}</option>\r\n<option value=\"2\"{$s2}>{$msgUnderlinedefault}</option>\r\n</select></p></div>");
        foreach ($togs as $tname) {
            if (!array_key_exists($tname, $this->mUsedToggles)) {
                $wgOut->addHTML($this->getToggle($tname));
            }
        }
        $wgOut->addHTML('</fieldset>');
        wfRunHooks("RenderPreferencesForm", array($this, $wgOut));
        $token = htmlspecialchars($wgUser->editToken());
        $skin = $wgUser->getSkin();
        $wgOut->addHTML("\r\n\t<div id='prefsubmit'>\r\n\t<div>\r\n\t\t<input type='submit' name='wpSaveprefs' class='btnSavePrefs' value=\"" . wfMsgHtml('saveprefs') . '"' . $skin->tooltipAndAccesskey('save') . " />\r\n\t\t<input type='submit' name='wpReset' value=\"" . wfMsgHtml('resetprefs') . "\" />\r\n\t</div>\r\n\r\n\t</div>\r\n\r\n\t<input type='hidden' name='wpEditToken' value=\"{$token}\" />\r\n\t</div></form>\n");
        $wgOut->addHtml(Xml::tags('div', array('class' => "prefcache"), wfMsgExt('clearyourcache', 'parseinline')));
    }
Esempio n. 14
0
 public function execute()
 {
     if ($this->getVar('_ExistingDBSettings')) {
         return 'skip';
     }
     $r = $this->parent->request;
     if ($r->wasPosted()) {
         $status = $this->submit();
         if ($status->isGood()) {
             $this->setVar('_UpgradeDone', false);
             return 'continue';
         } else {
             $this->parent->showStatusBox($status);
         }
     }
     $this->startForm();
     $types = "<ul class=\"config-settings-block\">\n";
     $settings = '';
     $defaultType = $this->getVar('wgDBtype');
     $dbSupport = '';
     foreach ($this->parent->getDBTypes() as $type) {
         $link = DatabaseBase::newFromType($type)->getSoftwareLink();
         $dbSupport .= wfMsgNoTrans("config-support-{$type}", $link) . "\n";
     }
     $this->addHTML($this->parent->getInfoBox(wfMsg('config-support-info', $dbSupport)));
     foreach ($this->parent->getVar('_CompiledDBs') as $type) {
         $installer = $this->parent->getDBInstaller($type);
         $types .= '<li>' . Xml::radioLabel($installer->getReadableName(), 'DBType', $type, "DBType_{$type}", $type == $defaultType, array('class' => 'dbRadio', 'rel' => "DB_wrapper_{$type}")) . "</li>\n";
         $settings .= Html::openElement('div', array('id' => 'DB_wrapper_' . $type, 'class' => 'dbWrapper')) . Html::element('h3', array(), wfMsg('config-header-' . $type)) . $installer->getConnectForm() . "</div>\n";
     }
     $types .= "</ul><br clear=\"left\"/>\n";
     $this->addHTML($this->parent->label('config-db-type', false, $types) . $settings);
     $this->endForm();
 }
 private function showStatusForm()
 {
     // Allows locking, hiding, locking and hiding.
     $form = '';
     $form .= Xml::fieldset($this->msg('centralauth-admin-status')->text());
     $form .= Html::hidden('wpMethod', 'set-status');
     $form .= Html::hidden('wpEditToken', $this->getUser()->getEditToken());
     $form .= Html::hidden('wpUserState', $this->mGlobalUser->getStateHash(false));
     $form .= $this->msg('centralauth-admin-status-intro')->parseAsBlock();
     // Radio buttons
     $radioLocked = Xml::radioLabel($this->msg('centralauth-admin-status-locked-no')->parse(), 'wpStatusLocked', '0', 'mw-centralauth-status-locked-no', !$this->mGlobalUser->isLocked()) . '<br />' . Xml::radioLabel($this->msg('centralauth-admin-status-locked-yes')->parse(), 'wpStatusLocked', '1', 'mw-centralauth-status-locked-yes', $this->mGlobalUser->isLocked());
     $radioHidden = Xml::radioLabel($this->msg('centralauth-admin-status-hidden-no')->parse(), 'wpStatusHidden', CentralAuthUser::HIDDEN_NONE, 'mw-centralauth-status-hidden-no', $this->mGlobalUser->getHiddenLevel() == CentralAuthUser::HIDDEN_NONE);
     if ($this->mCanOversight) {
         $radioHidden .= '<br />' . Xml::radioLabel($this->msg('centralauth-admin-status-hidden-list')->parse(), 'wpStatusHidden', CentralAuthUser::HIDDEN_LISTS, 'mw-centralauth-status-hidden-list', $this->mGlobalUser->getHiddenLevel() == CentralAuthUser::HIDDEN_LISTS) . '<br />' . Xml::radioLabel($this->msg('centralauth-admin-status-hidden-oversight')->parse(), 'wpStatusHidden', CentralAuthUser::HIDDEN_OVERSIGHT, 'mw-centralauth-status-hidden-oversight', $this->mGlobalUser->getHiddenLevel() == CentralAuthUser::HIDDEN_OVERSIGHT);
     }
     // Reason
     $reasonList = Xml::listDropDown('wpReasonList', $this->msg('centralauth-admin-status-reasons')->inContentLanguage()->text(), $this->msg('centralauth-admin-reason-other-select')->inContentLanguage()->text());
     $reasonField = Xml::input('wpReason', 45, false);
     $form .= Xml::buildForm(array('centralauth-admin-status-locked' => $radioLocked, 'centralauth-admin-status-hidden' => $radioHidden, 'centralauth-admin-reason' => $reasonList, 'centralauth-admin-reason-other' => $reasonField), 'centralauth-admin-status-submit');
     $form .= Xml::closeElement('fieldset');
     $form = Xml::tags('form', array('method' => 'POST', 'action' => $this->getPageTitle()->getFullURL(array('target' => $this->mUserName))), $form);
     $this->getOutput()->addHTML($form);
 }
Esempio n. 16
0
 /**
  * Generates the namespace selector form with hidden attributes.
  * @param $this->opts Array: the options to be included.
  */
 protected function getForm()
 {
     global $wgScript, $wgTitle;
     $this->opts['title'] = $wgTitle->getPrefixedText();
     if (!isset($this->opts['target'])) {
         $this->opts['target'] = '';
     } else {
         $this->opts['target'] = str_replace('_', ' ', $this->opts['target']);
     }
     if (!isset($this->opts['namespace'])) {
         $this->opts['namespace'] = '';
     }
     if (!isset($this->opts['contribs'])) {
         $this->opts['contribs'] = 'user';
     }
     if (!isset($this->opts['year'])) {
         $this->opts['year'] = '';
     }
     if (!isset($this->opts['month'])) {
         $this->opts['month'] = '';
     }
     if ($this->opts['contribs'] == 'newbie') {
         $this->opts['target'] = '';
     }
     $f = Xml::openElement('form', array('method' => 'get', 'action' => $wgScript));
     foreach ($this->opts as $name => $value) {
         if (in_array($name, array('namespace', 'target', 'contribs', 'year', 'month'))) {
             continue;
         }
         $f .= "\t" . Xml::hidden($name, $value) . "\n";
     }
     $f .= '<fieldset>' . Xml::element('legend', array(), wfMsg('sp-contributions-search')) . Xml::radioLabel(wfMsgExt('sp-contributions-newbies', array('parseinline')), 'contribs', 'newbie', 'newbie', $this->opts['contribs'] == 'newbie' ? true : false) . '<br />' . Xml::radioLabel(wfMsgExt('sp-contributions-username', array('parseinline')), 'contribs', 'user', 'user', $this->opts['contribs'] == 'user' ? true : false) . ' ' . Xml::input('target', 20, $this->opts['target']) . ' ' . '<span style="white-space: nowrap">' . Xml::label(wfMsg('namespace'), 'namespace') . ' ' . Xml::namespaceSelector($this->opts['namespace'], '') . '</span>' . Xml::openElement('p') . '<span style="white-space: nowrap">' . Xml::label(wfMsg('year'), 'year') . ' ' . Xml::input('year', 4, $this->opts['year'], array('id' => 'year', 'maxlength' => 4)) . '</span>' . ' ' . '<span style="white-space: nowrap">' . Xml::label(wfMsg('month'), 'month') . ' ' . Xml::monthSelector($this->opts['month'], -1) . ' ' . '</span>' . Xml::submitButton(wfMsg('sp-contributions-submit')) . Xml::closeElement('p');
     $explain = wfMsgExt('sp-contributions-explain', 'parseinline');
     if (!wfEmptyMsg('sp-contributions-explain', $explain)) {
         $f .= "<p>{$explain}</p>";
     }
     $f .= '</fieldset>' . Xml::closeElement('form');
     return $f;
 }
Esempio n. 17
0
    /**
     * @access private
     */
    function mainPrefsForm($status, $message = '')
    {
        global $wgUser, $wgOut, $wgLang, $wgContLang;
        global $wgAllowRealName, $wgImageLimits, $wgThumbLimits;
        global $wgDisableLangConversion;
        global $wgEnotifWatchlist, $wgEnotifUserTalk, $wgEnotifMinorEdits;
        global $wgRCShowWatchingUsers, $wgEnotifRevealEditorAddress;
        global $wgEnableEmail, $wgEnableUserEmail, $wgEmailAuthentication;
        global $wgContLanguageCode, $wgDefaultSkin, $wgSkipSkins, $wgAuth;
        global $wgEmailConfirmToEdit;
        $wgOut->setPageTitle(wfMsg('preferences'));
        $wgOut->setArticleRelated(false);
        $wgOut->setRobotpolicy('noindex,nofollow');
        $wgOut->disallowUserJs();
        # Prevent hijacked user scripts from sniffing passwords etc.
        if ($this->mSuccess || 'success' == $status) {
            $wgOut->wrapWikiMsg('<div class="successbox"><strong>$1</strong></div>', 'savedprefs');
        } else {
            if ('error' == $status) {
                $wgOut->addWikiText('<div class="errorbox"><strong>' . $message . '</strong></div>');
            } else {
                if ('' != $status) {
                    $wgOut->addWikiText($message . "\n----");
                }
            }
        }
        $qbs = $wgLang->getQuickbarSettings();
        $skinNames = $wgLang->getSkinNames();
        $mathopts = $wgLang->getMathNames();
        $dateopts = $wgLang->getDatePreferences();
        $togs = User::getToggles();
        $titleObj = SpecialPage::getTitleFor('Preferences');
        $action = $titleObj->escapeLocalURL();
        # Pre-expire some toggles so they won't show if disabled
        $this->mUsedToggles['shownumberswatching'] = true;
        $this->mUsedToggles['showupdated'] = true;
        $this->mUsedToggles['enotifwatchlistpages'] = true;
        $this->mUsedToggles['enotifusertalkpages'] = true;
        $this->mUsedToggles['enotifminoredits'] = true;
        $this->mUsedToggles['enotifrevealaddr'] = true;
        $this->mUsedToggles['ccmeonemails'] = true;
        $this->mUsedToggles['uselivepreview'] = true;
        if (!$this->mEmailFlag) {
            $emfc = 'checked="checked"';
        } else {
            $emfc = '';
        }
        //XXADDED Marketing emails
        if (!$this->mMarketingEmailFlag) {
            $memfc = 'checked="checked"';
        } else {
            $memfc = '';
        }
        if (!$this->mAuthorEmailNotifications) {
            $auth_emfc = 'checked="checked"';
        } else {
            $auth_emfc = '';
        }
        if ($this->mUserTalkNotifications == '0') {
            $ut_emfc = 'checked="checked"';
        } else {
            $ut_emfc = '';
        }
        if (class_exists('ThumbsUp')) {
            if (intval($this->mThumbsNotifications) === 0) {
                $thumbs_checked = 'checked="checked"';
            } else {
                $thumbs_checked = '';
            }
            if (intval($this->mThumbsEmailNotifications) === 0) {
                $thumbs_email_checked = 'checked="checked"';
            } else {
                $thumbs_email_checked = '';
            }
        }
        if ($wgEmailAuthentication && $this->mUserEmail != '') {
            if ($wgUser->getEmailAuthenticationTimestamp()) {
                $emailauthenticated = wfMsg('emailauthenticated', $wgLang->timeanddate($wgUser->getEmailAuthenticationTimestamp(), true)) . '<br />';
                $disableEmailPrefs = false;
            } else {
                $disableEmailPrefs = true;
                $skin = $wgUser->getSkin();
                $emailauthenticated = wfMsg('emailnotauthenticated') . '<br />' . $skin->makeKnownLinkObj(SpecialPage::getTitleFor('Confirmemail'), wfMsg('emailconfirmlink')) . '<br />';
            }
        } else {
            $emailauthenticated = '';
            $disableEmailPrefs = false;
        }
        if ($this->mUserEmail == '') {
            $emailauthenticated = wfMsg('noemailprefs') . '<br />';
        }
        $enotifwatchlistpages = $wgEnotifWatchlist ? $this->getToggle('enotifwatchlistpages', false, $disableEmailPrefs) : '';
        $enotifusertalkpages = $wgEnotifUserTalk ? $this->getToggle('enotifusertalkpages', false, $disableEmailPrefs) : '';
        $enotifminoredits = $wgEnotifWatchlist && $wgEnotifMinorEdits ? $this->getToggle('enotifminoredits', false, $disableEmailPrefs) : '';
        $enotifrevealaddr = ($wgEnotifWatchlist || $wgEnotifUserTalk) && $wgEnotifRevealEditorAddress ? $this->getToggle('enotifrevealaddr', false, $disableEmailPrefs) : '';
        # </FIXME>
        $wgOut->addHTML("<form action=\"{$action}\" method='post'>");
        $wgOut->addHTML("<div id='preferences'>");
        # User data
        $wgOut->addHTML(Xml::openElement('fieldset ', array('id' => 'prefsection-0', 'class' => 'prefsection')) . "<legend class='mainLegend'>&nbsp;</legend>" . Xml::openElement('table') . $this->tableRow(Xml::element('legend', null, wfMsg('prefs-personal'))));
        $userInformationHtml = $this->tableRow(wfMsgHtml('username'), htmlspecialchars($wgUser->getName())) . $this->tableRow(wfMsgHtml('uid'), htmlspecialchars($wgUser->getID())) . $this->tableRow(wfMsgHtml('prefs-edits'), $wgLang->formatNum(User::edits($wgUser->getId())));
        if (wfRunHooks('PreferencesUserInformationPanel', array($this, &$userInformationHtml))) {
            $wgOut->addHtml($userInformationHtml);
        }
        if ($wgAllowRealName) {
            $wgOut->addHTML($this->tableRow(Xml::label(wfMsg('yourrealname'), 'wpRealName'), Xml::input('wpRealName', 25, $this->mRealName, array('class' => 'input_med', 'id' => 'wpRealName')), Xml::tags('div', array('class' => 'prefsectiontip'), wfMsgExt('prefs-help-realname', 'parseinline'))));
        }
        if ($wgEnableEmail) {
            $wgOut->addHTML($this->tableRow(Xml::label(wfMsg('youremail'), 'wpUserEmail'), Xml::input('wpUserEmail', 25, $this->mUserEmail, array('class' => 'input_med', 'id' => 'wpUserEmail'))));
        }
        global $wgParser, $wgMaxSigChars;
        if (mb_strlen($this->mNick) > $wgMaxSigChars) {
            $invalidSig = $this->tableRow('&nbsp;', Xml::element('span', array('class' => 'error'), wfMsg('badsiglength', $wgLang->formatNum($wgMaxSigChars))));
        } elseif (!empty($this->mToggles['fancysig']) && false === $wgParser->validateSig($this->mNick)) {
            $invalidSig = $this->tableRow('&nbsp;', Xml::element('span', array('class' => 'error'), wfMsg('badsig')));
        } else {
            $invalidSig = '';
        }
        $wgOut->addHTML($this->tableRow(Xml::label(wfMsg('yournick'), 'wpNick'), Xml::input('wpNick', 25, $this->mNick, array('id' => 'wpNick', 'class' => 'input_med', 'maxlength' => $wgMaxSigChars))) . $invalidSig . $this->tableRow('&nbsp;', $this->getToggle('fancysig')));
        list($lsLabel, $lsSelect) = Xml::languageSelector($this->mUserLanguage);
        $wgOut->addHTML($this->tableRow($lsLabel, $lsSelect));
        /* see if there are multiple language variants to choose from*/
        if (!$wgDisableLangConversion) {
            $variants = $wgContLang->getVariants();
            $variantArray = array();
            $languages = Language::getLanguageNames(true);
            foreach ($variants as $v) {
                $v = str_replace('_', '-', strtolower($v));
                if (array_key_exists($v, $languages)) {
                    // If it doesn't have a name, we'll pretend it doesn't exist
                    $variantArray[$v] = $languages[$v];
                }
            }
            $options = "\n";
            foreach ($variantArray as $code => $name) {
                $selected = $code == $this->mUserVariant;
                $options .= Xml::option("{$code} - {$name}", $code, $selected) . "\n";
            }
            if (count($variantArray) > 1) {
                $wgOut->addHtml($this->tableRow(Xml::label(wfMsg('yourvariant'), 'wpUserVariant'), Xml::tags('select', array('name' => 'wpUserVariant', 'id' => 'wpUserVariant'), $options)));
            }
        }
        // TEEN FILTER
        $options = Xml::radioLabel(wfMsg('pref_content_preferences_all'), 'wpContentFilter', 0, 'wpContentFilter_0', $this->mContentFilter == 0, array('class' => 'normal_font')) . "<br/><br/>" . Xml::radioLabel(wfMsg('pref_content_preferences_young'), 'wpContentFilter', 1, 'wpContentFilter_1', $this->mContentFilter == 1, array('class' => 'normal_font')) . "<br/><br/>" . Xml::radioLabel(wfMsg('pref_content_preferences_adult'), 'wpContentFilter', 2, 'wpContentFilter_2', $this->mContentFilter == 2, array('class' => 'normal_font')) . "<br/><br/>";
        $wgOut->addHtml($this->tableRow(wfMsg('pref_content_preferences_info'), $options));
        # Password
        if ($wgAuth->allowPasswordChange()) {
            $wgOut->addHTML($this->tableRow(Xml::element('legend', null, wfMsg('changepassword'))) . $this->tableRow(Xml::label(wfMsg('oldpassword'), 'wpOldpass'), Xml::password('wpOldpass', 25, $this->mOldpass, array('id' => 'wpOldpass', 'class' => 'input_med'))) . $this->tableRow(Xml::label(wfMsg('newpassword'), 'wpNewpass'), Xml::password('wpNewpass', 25, $this->mNewpass, array('id' => 'wpNewpass', 'class' => 'input_med'))) . $this->tableRow(Xml::label(wfMsg('retypenew'), 'wpRetypePass'), Xml::password('wpRetypePass', 25, $this->mRetypePass, array('id' => 'wpRetypePass', 'class' => 'input_med'))) . Xml::tags('tr', null, Xml::tags('td', array('colspan' => '2'), $this->getToggle("rememberpassword"))) . Xml::tags('tr', null, Xml::tags('td', array('colspan' => '2'), "")));
        }
        # <FIXME>
        # Enotif
        if ($wgEnableEmail) {
            $moreEmail = '';
            $marketingEmail = '';
            $authorEmail = '';
            if ($wgEnableUserEmail) {
                $emf = wfMsg('allowemail');
                $disabled = $disableEmailPrefs ? ' disabled="disabled"' : '';
                $moreEmail = "<input type='checkbox' class='input_med' {$emfc} {$disabled} value='1' name='wpEmailFlag' id='wpEmailFlag' /> <label class='normal_font' for='wpEmailFlag'>{$emf}</label>";
                //XXADDED Author emails
                $auth_emf = wfMsg('allowauthornotificationdialog');
                $authorEmail = "<div><input type='checkbox' class='input_med' {$auth_emfc} {$disabled} value='1' name='wpAuthorEmailNotifications' id='wpAuthorEmailNotifications' /> <label class='normal_font' for='wpAuthorEmailNotifications'>{$auth_emf}</label></div>";
                if (class_exists('ThumbsUp')) {
                    // Thumbs up talk notifications
                    $thumbs_label = wfMsg('allowthumbsupnotifications');
                    $thumbsNotifyField = "<div><input type='checkbox' class='input_med' {$thumbs_checked} value='1' name='wpThumbsNotifications' id='wpThumbsNotifications' /> <label class='normal_font' for='wpThumbsNotifications'>" . "{$thumbs_label}</label></div>";
                    // Thumbs up email notifications
                    $thumbs_label = wfMsg('allowthumbsupemailnotifications');
                    $thumbsEmailNotifyField = "<div><input type='checkbox' class='input_med' {$thumbs_email_checked} value='1' name='wpThumbsEmailNotifications' id='wpThumbsNotifications' /> " . "<label class='normal_font' for='wpThumbsEmailNotifications'>{$thumbs_label}</label></div>";
                    //$thumbsboxoptions = "<div style='border:2px solid #DDD;margin:3px 0 3px 0;padding:3px;'>$thumbsNotifyField</div>\n";
                    $thumbsboxoptions = "<div style='margin:3px 0 3px 0;padding:3px;'>{$thumbsNotifyField} {$thumbsEmailNotifyField}</div>\n";
                } else {
                    $thumbsboxoptions = "";
                }
                //XXADDED Marketing emails
                $memf = wfMsg('allowmarketingemail');
                //XXADDED UserTalk emails
                $ut_emf = wfMsg('usertalknotifications');
                $marketingEmail = "<div><input type='checkbox' class='input_med'  {$memfc} {$disabled} value='1' name='wpMarketingEmailFlag' id='wpMarketingEmailFlag' /> <label class='normal_font' for='wpMarketingEmailFlag'>{$memf}</label></div>";
                $usertalkEmail = "<div><input type='checkbox' class='input_med'  {$ut_emfc} {$disabled} value='1' name='wpUserTalkNotifications' id='wpUserTalkNotifications' /> <label class='normal_font' for='wpUserTalkNotifications'>{$ut_emf}</label></div>";
                $articleEmail = "<div><a href='/Special:AuthorEmailNotification'>" . wfMsg('author_emails') . "</a></div>";
                $emailboxoptions = "<div style='margin:3px 0 3px 0;padding:3px;'>{$marketingEmail} {$usertalkEmail} {$articleEmail}</div>\n";
            }
            $wgOut->addHTML($this->tableRow(Xml::element('legend', null, wfMsg('email'))) . $this->tableRow($emailboxoptions . $thumbsboxoptions . $emailauthenticated . $enotifrevealaddr . $enotifwatchlistpages . $enotifusertalkpages . $enotifminoredits . $moreEmail . $authorEmail . $this->getToggle('ccmeonemails')));
        }
        # </FIXME>
        $wgOut->addHTML(Xml::closeElement('table') . Xml::closeElement('fieldset'));
        # Quickbar
        #
        if ($this->mSkin == 'cologneblue' || $this->mSkin == 'standard') {
            $wgOut->addHtml("<fieldset>\n<legend>" . wfMsg('qbsettings') . "</legend>\n");
            for ($i = 0; $i < count($qbs); ++$i) {
                if ($i == $this->mQuickbar) {
                    $checked = ' checked="checked"';
                } else {
                    $checked = "";
                }
                $wgOut->addHTML("<div><label><input type='radio' class='input_med' name='wpQuickbar' value=\"{$i}\"{$checked} />{$qbs[$i]}</label></div>\n");
            }
            $wgOut->addHtml("</fieldset>\n\n");
        } else {
            # Need to output a hidden option even if the relevant skin is not in use,
            # otherwise the preference will get reset to 0 on submit
            $wgOut->addHtml(wfHidden('wpQuickbar', $this->mQuickbar));
        }
        /*
        		# Skin
        		#
        		$wgOut->addHTML( "<fieldset>\n<h2>\n" . wfMsg('skin') . "</h2>\n" );
        		$mptitle = Title::newMainPage();
        		$previewtext = wfMsg('skinpreview');
        		# Only show members of Skin::getSkinNames() rather than
        		# $skinNames (skins is all skin names from Language.php)
        		$validSkinNames = Skin::getSkinNames();
        		# Sort by UI skin name. First though need to update validSkinNames as sometimes
        		# the skinkey & UI skinname differ (e.g. "standard" skinkey is "Classic" in the UI).
        		foreach ($validSkinNames as $skinkey => & $skinname ) {
        			if ( isset( $skinNames[$skinkey] ) )  {
        				$skinname = $skinNames[$skinkey];
        			}
        		}
        		asort($validSkinNames);
        		foreach ($validSkinNames as $skinkey => $sn ) {
        			if ( in_array( $skinkey, $wgSkipSkins ) ) {
        				continue;
        			}
        			$checked = $skinkey == $this->mSkin ? ' checked="checked"' : '';
        
        			$mplink = htmlspecialchars($mptitle->getLocalURL("useskin=$skinkey"));
        			$previewlink = "<a target='_blank' href=\"$mplink\">$previewtext</a>";
        			if( $skinkey == $wgDefaultSkin )
        				$sn .= ' (' . wfMsg( 'default' ) . ')';
        			$wgOut->addHTML( "<input type='radio' name='wpSkin' id=\"wpSkin$skinkey\" value=\"$skinkey\"$checked /> <label for=\"wpSkin$skinkey\">{$sn}</label> $previewlink<br />\n" );
        		}
        		$wgOut->addHTML( "</fieldset>\n\n" );
        
        		# Math
        		#
        		global $wgUseTeX;
        		if( $wgUseTeX ) {
        			$wgOut->addHTML( "<fieldset>\n<h2>" . wfMsg('math') . '</h2>' );
        			foreach ( $mathopts as $k => $v ) {
        				$checked = ($k == $this->mMath);
        				$wgOut->addHTML(
        					Xml::openElement( 'div' ) .
        					Xml::radioLabel( wfMsg( $v ), 'wpMath', $k, "mw-sp-math-$k", $checked ) .
        					Xml::closeElement( 'div' ) . "\n"
        				);
        			}
        			$wgOut->addHTML( "</fieldset>\n\n" );
        		}
        */
        # Files
        #
        $wgOut->addHTML("<fieldset id='prefsection-1' class='prefsection'>\n<legend>" . wfMsg('files') . "</legend>\n");
        $imageLimitOptions = null;
        foreach ($wgImageLimits as $index => $limits) {
            $selected = $index == $this->mImageSize;
            $imageLimitOptions .= Xml::option("{$limits[0]}×{$limits[1]}" . wfMsg('unit-pixel'), $index, $selected);
        }
        $imageSizeId = 'wpImageSize';
        $wgOut->addHTML("<div>" . Xml::label(wfMsg('imagemaxsize'), $imageSizeId) . " " . Xml::openElement('select', array('name' => $imageSizeId, 'id' => $imageSizeId)) . $imageLimitOptions . Xml::closeElement('select') . "</div>\n");
        $imageThumbOptions = null;
        foreach ($wgThumbLimits as $index => $size) {
            $selected = $index == $this->mThumbSize;
            $imageThumbOptions .= Xml::option($size . wfMsg('unit-pixel'), $index, $selected);
        }
        $thumbSizeId = 'wpThumbSize';
        $wgOut->addHTML("<div>" . Xml::label(wfMsg('thumbsize'), $thumbSizeId) . " " . Xml::openElement('select', array('name' => $thumbSizeId, 'id' => $thumbSizeId)) . $imageThumbOptions . Xml::closeElement('select') . "</div>\n");
        $wgOut->addHTML("</fieldset>\n\n");
        # Date format
        #
        # Date/Time
        #
        $wgOut->addHTML("<fieldset id='prefsection-2' class='prefsection'>\n<legend>" . wfMsg('datetime') . "</legend>\n");
        if ($dateopts) {
            $wgOut->addHTML("<fieldset>\n<h5>" . wfMsg('dateformat') . "</h5>\n");
            $idCnt = 0;
            $epoch = '20010115161234';
            # Wikipedia day
            foreach ($dateopts as $key) {
                if ($key == 'default') {
                    $formatted = wfMsgHtml('datedefault');
                } else {
                    $formatted = htmlspecialchars($wgLang->timeanddate($epoch, false, $key));
                }
                $key == $this->mDate ? $checked = ' checked="checked"' : ($checked = '');
                $wgOut->addHTML("<div><input type='radio' class='input_med' name=\"wpDate\" id=\"wpDate{$idCnt}\" " . "value=\"{$key}\"{$checked} /> <label class='normal_font' for=\"wpDate{$idCnt}\">{$formatted}</label></div>\n");
                $idCnt++;
            }
            $wgOut->addHTML("</fieldset>\n");
        }
        $nowlocal = $wgLang->time($now = wfTimestampNow(), true);
        $nowserver = $wgLang->time($now, false);
        $wgOut->addHTML('<fieldset><h5>' . wfMsg('timezonelegend') . '</h5><table>' . $this->addRow(wfMsg('servertime'), $nowserver) . $this->addRow(wfMsg('localtime'), $nowlocal) . $this->addRow('<label for="wpHourDiff">' . wfMsg('timezoneoffset') . '</label>', "<input type='text' class='input_med' name='wpHourDiff' id='wpHourDiff' value=\"" . htmlspecialchars($this->mHourDiff) . "\" size='6' />") . "<tr><td colspan='2'>\n\t\t\t\t<input type='button' class='button' value=\"" . wfMsg('guesstimezone') . "\"\n\t\t\t\tonclick='javascript:guessTimezone()' id='guesstimezonebutton' style='display:none;' />\n\t\t\t\t</td></tr></table><div class='prefsectiontip'>¹" . wfMsg('timezonetext') . "</div></fieldset>\n\t\t</fieldset>\n\n");
        # Editing
        #
        global $wgLivePreview, $wgUser;
        # Editor choice
        $current = $wgUser->getOption('defaulteditor', '');
        if (empty($current)) {
            # backwards compatibility with old advanced editor option
            $current = $wgUser->getOption('useadvanced', false) ? 'advanced' : 'visual';
        }
        $opts = '';
        //$opts .= Xml::option(wfMsg('pref_visual_editor'), 'visual', $current != 'advanced' && $current != 'guided');
        $opts .= Xml::option(wfMsg('pref_advanced_editor'), 'advanced', $current == 'advanced');
        $opts .= Xml::option(wfMsg('pref_guided_editor'), 'guided', $current == 'guided');
        $editorChoice = $this->tableRow(Xml::label(wfMsg('pref_default_editor') . ' ', 'wpDefaultEditor'), Xml::tags('select', array('name' => 'wpDefaultEditor', 'id' => 'wpDefaultEditor'), $opts));
        $wgOut->addHTML('<fieldset id="prefsection-3" class="prefsection"><legend>' . wfMsg('textboxsize') . '</legend>
			<div>' . wfInputLabel(wfMsg('rows'), 'wpRows', 'wpRows', 3, $this->mRows, array('class' => 'input_med')) . '<br />' . wfInputLabel(wfMsg('columns'), 'wpCols', 'wpCols', 3, $this->mCols, array('class' => 'input_med')) . " " . wfMsg('Pref_adv_only') . "</div><br/>" . $this->getToggles(array('editsection', 'editondblclick', 'editwidth', 'disablewarning', 'hidepersistantsavebar', 'ignorefanmail', 'scrolltalk', 'showtoolbar', 'previewonfirst', 'previewontop', 'minordefault', 'externaleditor', 'externaldiff', $wgLivePreview ? 'uselivepreview' : false, $wgUser->isSysop() || in_array('staff', $wgUser->getGroups()) ? 'autopatrol' : false, 'forceeditsummary')) . '<br/>' . $editorChoice . '</fieldset>');
        $this->mUsedToggles['autopatrol'] = true;
        # Don't show this up for users who can't; the handler below is dumb and doesn't know it
        # Recent changes
        $wgOut->addHtml('<fieldset id="prefsection-4" class="prefsection"><legend>' . wfMsgHtml('prefs-rc') . '</legend>');
        $rc = '<table><tr>';
        $rc .= '<td>' . Xml::label(wfMsg('recentchangesdays'), 'wpRecentDays') . '</td>';
        $rc .= '<td>' . Xml::input('wpRecentDays', 3, $this->mRecentDays, array('class' => 'input_med', 'id' => 'wpRecentDays')) . '</td>';
        $rc .= '</tr><tr>';
        $rc .= '<td>' . Xml::label(wfMsg('recentchangescount'), 'wpRecent') . '</td>';
        $rc .= '<td>' . Xml::input('wpRecent', 3, $this->mRecent, array('class' => 'input_med', 'id' => 'wpRecent')) . '</td>';
        $rc .= '</tr></table>';
        $wgOut->addHtml($rc);
        $wgOut->addHtml('<br />');
        $toggles[] = 'hideminor';
        if ($wgRCShowWatchingUsers) {
            $toggles[] = 'shownumberswatching';
        }
        $toggles[] = 'usenewrc';
        $wgOut->addHtml($this->getToggles($toggles));
        if (class_exists('RCTest')) {
            $userGroups = $wgUser->getGroups();
            if (in_array('staff', $userGroups) || in_array('admin', $userGroups) || in_array('newarticlepatrol', $userGroups)) {
                $wgOut->addHtml($this->getToggle('rctest', false, false, intval($this->mRCTest) === 0));
            }
        }
        $wgOut->addHtml('</fieldset>');
        # Watchlist
        $wgOut->addHtml('<fieldset id="prefsection-5" class="prefsection"><legend>' . wfMsgHtml('prefs-watchlist') . '</legend>');
        $wgOut->addHtml(wfInputLabel(wfMsg('prefs-watchlist-days'), 'wpWatchlistDays', 'wpWatchlistDays', 3, $this->mWatchlistDays, array('class' => 'input_med')));
        $wgOut->addHtml('<br /><br />');
        $wgOut->addHtml($this->getToggle('extendwatchlist'));
        $wgOut->addHtml(wfInputLabel(wfMsg('prefs-watchlist-edits'), 'wpWatchlistEdits', 'wpWatchlistEdits', 3, $this->mWatchlistEdits, array('class' => 'input_med')));
        $wgOut->addHtml('<br /><br />');
        $wgOut->addHtml($this->getToggles(array('watchlisthideown', 'watchlisthidebots', 'watchlisthideminor')));
        if ($wgUser->isAllowed('createpage') || $wgUser->isAllowed('createtalk')) {
            $wgOut->addHtml($this->getToggle('watchcreations'));
        }
        foreach (array('edit' => 'watchdefault', 'move' => 'watchmoves', 'delete' => 'watchdeletion') as $action => $toggle) {
            if ($wgUser->isAllowed($action)) {
                $wgOut->addHtml($this->getToggle($toggle));
            }
        }
        $this->mUsedToggles['watchcreations'] = true;
        $this->mUsedToggles['watchdefault'] = true;
        $this->mUsedToggles['watchmoves'] = true;
        $this->mUsedToggles['watchdeletion'] = true;
        $wgOut->addHtml('</fieldset>');
        # Misc
        #
        $wgOut->addHTML('<fieldset id="prefsection-6" class="prefsection"><legend>' . wfMsg('prefs-misc') . '</legend>');
        $wgOut->addHtml('<label for="wpStubs">' . wfMsg('stub-threshold') . '</label>&nbsp;');
        $wgOut->addHtml(Xml::input('wpStubs', 6, $this->mStubs, array('class' => 'input_med', 'id' => 'wpStubs')));
        $msgUnderline = htmlspecialchars(wfMsg('tog-underline'));
        $msgUnderlinenever = htmlspecialchars(wfMsg('underline-never'));
        $msgUnderlinealways = htmlspecialchars(wfMsg('underline-always'));
        $msgUnderlinedefault = htmlspecialchars(wfMsg('underline-default'));
        $uopt = $wgUser->getOption("underline");
        $s0 = $uopt == 0 ? ' selected="selected"' : '';
        $s1 = $uopt == 1 ? ' selected="selected"' : '';
        $s2 = $uopt == 2 ? ' selected="selected"' : '';
        $wgOut->addHTML("\n<div class='toggle'><p><label for='wpOpunderline'>{$msgUnderline}</label>\n<select name='wpOpunderline' id='wpOpunderline'>\n<option value=\"0\"{$s0}>{$msgUnderlinenever}</option>\n<option value=\"1\"{$s1}>{$msgUnderlinealways}</option>\n<option value=\"2\"{$s2}>{$msgUnderlinedefault}</option>\n</select></p></div>");
        $userGroups = $wgUser->getGroups();
        if (!in_array('sysop', $userGroups) && !in_array('newarticlepatrol', $userGroups)) {
            $this->mUsedToggles['welcomer'] = true;
        }
        foreach ($togs as $tname) {
            if (!array_key_exists($tname, $this->mUsedToggles)) {
                $wgOut->addHTML($this->getToggle($tname));
            }
        }
        if ($wgUser->isGPlusUser()) {
            $wgOut->addHTML('<br /><div id="gplus_disco_link" style="display:inline;"><a href="#" id="pb-gp-disco">Disconnect from Google+</a></div><br />');
        }
        $wgOut->addHTML('</fieldset>');
        wfRunHooks('RenderPreferencesForm', array($this, $wgOut));
        $token = htmlspecialchars($wgUser->editToken());
        $skin = $wgUser->getSkin();
        $wgOut->addHTML("\n\t<div id='prefsubmit'>\n\t<div>\n\t\t<input class='button primary' type='submit' name='wpSaveprefs' class='btnSavePrefs' value=\"" . wfMsgHtml('saveprefs') . '"' . $skin->tooltipAndAccesskey('save') . " />\n\t\t<input class='button secondary' type='submit' name='wpReset' value=\"" . wfMsgHtml('resetprefs') . "\" />\n\t\t<div style='clear:both'></div>\n\t</div>\n\n\t</div>\n\n\t<input type='hidden' name='wpEditToken' value=\"{$token}\" />\n\t</div></form>\n");
        /*$wgOut->addHtml( Xml::tags( 'div', array( 'class' => "prefcache" ),
        			wfMsgExt( 'clearyourcache', 'parseinline' ) )
        		);*/
    }
Esempio n. 18
0
 /**
  * Generates the namespace selector form with hidden attributes.
  * @param $this->opts Array: the options to be included.
  */
 protected function getForm()
 {
     global $wgScript;
     $this->opts['title'] = $this->getTitle()->getPrefixedText();
     if (!isset($this->opts['target'])) {
         $this->opts['target'] = '';
     } else {
         $this->opts['target'] = str_replace('_', ' ', $this->opts['target']);
     }
     if (!isset($this->opts['namespace'])) {
         $this->opts['namespace'] = '';
     }
     if (!isset($this->opts['contribs'])) {
         $this->opts['contribs'] = 'user';
     }
     if (!isset($this->opts['year'])) {
         $this->opts['year'] = '';
     }
     if (!isset($this->opts['month'])) {
         $this->opts['month'] = '';
     }
     if ($this->opts['contribs'] == 'newbie') {
         $this->opts['target'] = '';
     }
     if (!isset($this->opts['tagfilter'])) {
         $this->opts['tagfilter'] = '';
     }
     $f = Xml::openElement('form', array('method' => 'get', 'action' => $wgScript));
     # Add hidden params for tracking
     foreach ($this->opts as $name => $value) {
         if (in_array($name, array('namespace', 'target', 'contribs', 'year', 'month'))) {
             continue;
         }
         $f .= "\t" . Xml::hidden($name, $value) . "\n";
     }
     $tagFilter = ChangeTags::buildTagFilterSelector($this->opts['tagfilter']);
     $f .= '<fieldset>' . Xml::element('legend', array(), wfMsg('sp-contributions-search')) . Xml::radioLabel(wfMsgExt('sp-contributions-newbies', array('parsemag')), 'contribs', 'newbie', 'newbie', $this->opts['contribs'] == 'newbie' ? true : false) . '<br />' . Xml::radioLabel(wfMsgExt('sp-contributions-username', array('parsemag')), 'contribs', 'user', 'user', $this->opts['contribs'] == 'user' ? true : false) . ' ' . Html::input('target', $this->opts['target'], 'text', array('size' => '20', 'required' => '') + ($this->opts['target'] ? array() : array('autofocus'))) . ' ' . '<span style="white-space: nowrap">' . Xml::label(wfMsg('namespace'), 'namespace') . ' ' . Xml::namespaceSelector($this->opts['namespace'], '') . '</span>' . ($tagFilter ? Xml::tags('p', null, implode('&nbsp;', $tagFilter)) : '') . Xml::openElement('p') . '<span style="white-space: nowrap">' . Xml::dateMenu($this->opts['year'], $this->opts['month']) . '</span>' . ' ' . Xml::submitButton(wfMsg('sp-contributions-submit')) . Xml::closeElement('p');
     $explain = wfMsgExt('sp-contributions-explain', 'parseinline');
     if (!wfEmptyMsg('sp-contributions-explain', $explain)) {
         $f .= "<p id='mw-sp-contributions-explain'>{$explain}</p>";
     }
     $f .= '</fieldset>' . Xml::closeElement('form');
     return $f;
 }
Esempio n. 19
0
 /**
  * Generates the namespace selector form with hidden attributes.
  * @return string HTML fragment
  */
 protected function getForm()
 {
     $this->opts['title'] = $this->getPageTitle()->getPrefixedText();
     if (!isset($this->opts['target'])) {
         $this->opts['target'] = '';
     } else {
         $this->opts['target'] = str_replace('_', ' ', $this->opts['target']);
     }
     if (!isset($this->opts['namespace'])) {
         $this->opts['namespace'] = '';
     }
     if (!isset($this->opts['nsInvert'])) {
         $this->opts['nsInvert'] = '';
     }
     if (!isset($this->opts['associated'])) {
         $this->opts['associated'] = false;
     }
     if (!isset($this->opts['contribs'])) {
         $this->opts['contribs'] = 'user';
     }
     if (!isset($this->opts['year'])) {
         $this->opts['year'] = '';
     }
     if (!isset($this->opts['month'])) {
         $this->opts['month'] = '';
     }
     if ($this->opts['contribs'] == 'newbie') {
         $this->opts['target'] = '';
     }
     if (!isset($this->opts['tagfilter'])) {
         $this->opts['tagfilter'] = '';
     }
     if (!isset($this->opts['topOnly'])) {
         $this->opts['topOnly'] = false;
     }
     if (!isset($this->opts['newOnly'])) {
         $this->opts['newOnly'] = false;
     }
     if (!isset($this->opts['hideMinor'])) {
         $this->opts['hideMinor'] = false;
     }
     $form = Html::openElement('form', ['method' => 'get', 'action' => wfScript(), 'class' => 'mw-contributions-form']);
     # Add hidden params for tracking except for parameters in $skipParameters
     $skipParameters = ['namespace', 'nsInvert', 'deletedOnly', 'target', 'contribs', 'year', 'month', 'topOnly', 'newOnly', 'hideMinor', 'associated', 'tagfilter'];
     foreach ($this->opts as $name => $value) {
         if (in_array($name, $skipParameters)) {
             continue;
         }
         $form .= "\t" . Html::hidden($name, $value) . "\n";
     }
     $tagFilter = ChangeTags::buildTagFilterSelector($this->opts['tagfilter']);
     if ($tagFilter) {
         $filterSelection = Html::rawElement('div', [], implode('&#160;', $tagFilter));
     } else {
         $filterSelection = Html::rawElement('div', [], '');
     }
     $this->getOutput()->addModules('mediawiki.userSuggest');
     $labelNewbies = Xml::radioLabel($this->msg('sp-contributions-newbies')->text(), 'contribs', 'newbie', 'newbie', $this->opts['contribs'] == 'newbie', ['class' => 'mw-input']);
     $labelUsername = Xml::radioLabel($this->msg('sp-contributions-username')->text(), 'contribs', 'user', 'user', $this->opts['contribs'] == 'user', ['class' => 'mw-input']);
     $input = Html::input('target', $this->opts['target'], 'text', ['size' => '40', 'required' => '', 'class' => ['mw-input', 'mw-ui-input-inline', 'mw-autocomplete-user']] + ($this->opts['contribs'] === 'newbie' || $this->opts['target'] ? [] : ['autofocus' => true]));
     $targetSelection = Html::rawElement('div', [], $labelNewbies . '<br>' . $labelUsername . ' ' . $input . ' ');
     $namespaceSelection = Xml::tags('div', [], Xml::label($this->msg('namespace')->text(), 'namespace', '') . '&#160;' . Html::namespaceSelector(['selected' => $this->opts['namespace'], 'all' => ''], ['name' => 'namespace', 'id' => 'namespace', 'class' => 'namespaceselector']) . '&#160;' . Html::rawElement('span', ['class' => 'mw-input-with-label'], Xml::checkLabel($this->msg('invert')->text(), 'nsInvert', 'nsInvert', $this->opts['nsInvert'], ['title' => $this->msg('tooltip-invert')->text(), 'class' => 'mw-input']) . '&#160;') . Html::rawElement('span', ['class' => 'mw-input-with-label'], Xml::checkLabel($this->msg('namespace_association')->text(), 'associated', 'associated', $this->opts['associated'], ['title' => $this->msg('tooltip-namespace_association')->text(), 'class' => 'mw-input']) . '&#160;'));
     $filters = [];
     if ($this->getUser()->isAllowed('deletedhistory')) {
         $filters[] = Html::rawElement('span', ['class' => 'mw-input-with-label'], Xml::checkLabel($this->msg('history-show-deleted')->text(), 'deletedOnly', 'mw-show-deleted-only', $this->opts['deletedOnly'], ['class' => 'mw-input']));
     }
     $filters[] = Html::rawElement('span', ['class' => 'mw-input-with-label'], Xml::checkLabel($this->msg('sp-contributions-toponly')->text(), 'topOnly', 'mw-show-top-only', $this->opts['topOnly'], ['class' => 'mw-input']));
     $filters[] = Html::rawElement('span', ['class' => 'mw-input-with-label'], Xml::checkLabel($this->msg('sp-contributions-newonly')->text(), 'newOnly', 'mw-show-new-only', $this->opts['newOnly'], ['class' => 'mw-input']));
     $filters[] = Html::rawElement('span', ['class' => 'mw-input-with-label'], Xml::checkLabel($this->msg('sp-contributions-hideminor')->text(), 'hideMinor', 'mw-hide-minor-edits', $this->opts['hideMinor'], ['class' => 'mw-input']));
     Hooks::run('SpecialContributions::getForm::filters', [$this, &$filters]);
     $extraOptions = Html::rawElement('div', [], implode('', $filters));
     $dateSelectionAndSubmit = Xml::tags('div', [], Xml::dateMenu($this->opts['year'] === '' ? MWTimestamp::getInstance()->format('Y') : $this->opts['year'], $this->opts['month']) . ' ' . Html::submitButton($this->msg('sp-contributions-submit')->text(), ['class' => 'mw-submit'], ['mw-ui-progressive']));
     $form .= Xml::fieldset($this->msg('sp-contributions-search')->text(), $targetSelection . $namespaceSelection . $filterSelection . $extraOptions . $dateSelectionAndSubmit, ['class' => 'mw-contributions-table']);
     $explain = $this->msg('sp-contributions-explain');
     if (!$explain->isBlank()) {
         $form .= "<p id='mw-sp-contributions-explain'>{$explain->parse()}</p>";
     }
     $form .= Xml::closeElement('form');
     return $form;
 }
Esempio n. 20
0
function wfRadioLabel($label, $name, $value, $id, $checked = false, $attribs = array())
{
    wfDeprecated(__FUNCTION__);
    return Xml::radioLabel($label, $name, $value, $id, $checked, $attribs);
}
 function lookupRequest($par)
 {
     $dbr = wfGetDB(DB_SLAVE);
     $res = $dbr->selectRow('cw_requests', array('cw_user', 'cw_comment', 'cw_dbname', 'cw_language', 'cw_private', 'cw_sitename', 'cw_status', 'cw_status_comment', 'cw_status_comment_user', 'cw_status_comment_timestamp', 'cw_timestamp', 'cw_url', 'cw_user'), array('cw_id' => $par), __METHOD__, array());
     if (!$res) {
         $this->getOutput()->addWikiMsg('requestwikiqueue-requestnotfound');
         return false;
     }
     $private = $res->cw_private == 0 ? 'No' : 'Yes';
     if ($res->cw_status === 'inreview') {
         $status = 'In review';
     } else {
         $status = ucfirst($res->cw_status);
     }
     $user = User::newFromId($res->cw_user);
     $createwikiparams = array('cwFounder' => $user->getName(), 'cwLanguage' => $res->cw_language, 'cwSitename' => $res->cw_sitename);
     if ($res->cw_private != 0) {
         $createwikiparams['cwPrivate'] = 1;
     }
     if ($res->cw_dbname != 'NULL') {
         $createwikiparams['cwDBname'] = $res->cw_dbname;
     }
     if ($this->getUser()->isAllowed('createwiki')) {
         $columnamount = 7;
     } else {
         $columnamount = 6;
     }
     // Used in 'wikicreatorcomment'
     if ($res->cw_status_comment_user) {
         $wikicreatorobj = User::newFromId($res->cw_status_comment_user);
         $wikicreator = Linker::userLink($wikicreatorobj->getId(), $wikicreatorobj->getName());
     } else {
         $wikicreator = 'a wiki creator';
     }
     $localpage = $this->getPageTitle()->getLocalUrl() . "/{$par}";
     $form = Xml::openElement('form', array('action' => $localpage, 'method' => 'post'));
     $form .= '<fieldset><legend>' . $this->msg('requestwikiqueue-view')->escaped() . '</legend>';
     $form .= Xml::openElement('table', array('class' => 'wikitable'));
     $form .= '<tr><th colspan="' . $columnamount . '">Wiki request #' . $par . ' by ' . Linker::userLink($res->cw_user, User::newFromId($res->cw_user)->getName()) . ' at ' . DateTime::createFromFormat('YmdHis', $res->cw_timestamp)->format('l, j F Y H:i') . '</th></tr>';
     $form .= '<tr>';
     foreach (array('sitename', 'founder', 'url', 'language', 'private', 'status') as $label) {
         $form .= '<th>' . $this->msg('requestwikiqueue-request-label-' . $label)->escaped() . '</th>';
     }
     if ($this->getUser()->isAllowed('createwiki')) {
         $form .= '<th>' . $this->msg('requestwikiqueue-request-label-toolbox')->escaped() . '</th>';
     }
     $form .= '</tr>';
     $form .= '<tr><td>' . htmlspecialchars($res->cw_sitename) . '</td>';
     $form .= '<td>' . htmlspecialchars($user->getName()) . Linker::userToolLinks($res->cw_user, $user->getName()) . '</td>';
     $form .= '<td>' . htmlspecialchars($res->cw_url) . '</td>';
     $form .= '<td>' . htmlspecialchars($res->cw_language) . '</td>';
     $form .= '<td>' . $private . '</td>';
     $form .= '<td>' . $status . '</td>';
     if ($this->getUser()->isAllowed('createwiki')) {
         $form .= '<td>' . Linker::link(Title::newFromText('Special:CreateWiki'), 'Create wiki', array(), $createwikiparams) . '</td>';
     }
     $form .= '</tr>';
     $form .= '<tr><th colspan="' . $columnamount . '">' . $this->msg('requestwikiqueue-request-header-foundercomment')->escaped() . '</th></tr>';
     $form .= '<tr><td colspan="' . $columnamount . '">' . htmlspecialchars($res->cw_comment) . '</td></tr>';
     if (is_numeric($res->cw_status_comment_timestamp)) {
         $form .= '<tr><th colspan="' . $columnamount . '">' . $this->msg('requestwikiqueue-request-header-wikicreatorcomment-withtimestamp')->rawParams($wikicreator)->params(DateTime::createFromFormat('YmdHis', $res->cw_status_comment_timestamp)->format('l, j F Y H:i'))->escaped() . '</th></tr>';
     } else {
         $form .= '<tr><th colspan="' . $columnamount . '">' . $this->msg('requestwikiqueue-request-header-wikicreatorcomment')->rawParams($wikicreator)->escaped() . '</th></tr>';
     }
     $form .= '<tr><td colspan="' . $columnamount . '">' . htmlspecialchars($res->cw_status_comment ? $res->cw_status_comment : 'No comments.') . '</td></tr>';
     if ($this->getUser()->isAllowed('createwiki')) {
         $form .= '<tr><th colspan="' . $columnamount . '">' . $this->msg('requestwikiqueue-request-status')->escaped() . '</th></tr>';
         $form .= '<tr><td colspan="' . $columnamount . '">' . $this->msg('requestwikiqueue-request-label-comment')->escaped() . ' ' . Xml::input('rwqStatusComment', 45, '', array('required' => '')) . ' ';
         $form .= $this->msg('requestwikiqueue-request-label-status-colon')->escaped() . ' ' . Xml::radioLabel('In Review', 'rwqStatus', 'inreview', '', true) . Xml::radioLabel('Approved', 'rwqStatus', 'approved', '', false) . Xml::radioLabel('Declined', 'rwqStatus', 'declined', '', false) . ' ';
         $form .= Xml::submitButton('Submit') . '</td></tr>';
     }
     $form .= Xml::closeElement('table');
     $form .= '</fieldset>';
     $form .= Xml::closeElement('form');
     $this->getOutput()->addHTML($form);
     if ($this->getRequest()->wasPosted()) {
         $this->processRequestStatusChanges($par);
     }
 }
 /**
  * Get a form to select the wiki to configure
  */
 protected function getWikiSelectForm()
 {
     global $wgConfigureWikis, $wgScript;
     if ($wgConfigureWikis === false || !$this->isUserAllowedInterwiki()) {
         return '';
     }
     $form = '<fieldset><legend>' . $this->msg('configure-select-wiki')->escaped() . '</legend>';
     $form .= $this->msg('configure-select-wiki-view-desc')->parseAsBlock();
     $form .= Xml::openElement('form', array('method' => 'get', 'action' => $wgScript));
     $form .= Html::Hidden('title', $this->getTitle()->getPrefixedDBkey());
     $all = $this->getRequest()->getVal('view', 'all') == 'all';
     $form .= Xml::radioLabel($this->msg('configure-select-wiki-view-all')->text(), 'view', 'all', 'wiki-all', $all);
     $form .= "<br />\n";
     $form .= Xml::radioLabel($this->msg('configure-select-wiki-view-specific')->text(), 'view', 'specific', 'wiki-specific', !$all) . ' ';
     if (is_array($wgConfigureWikis)) {
         $selector = new XmlSelect('wiki', 'wiki', $this->mWiki);
         foreach ($wgConfigureWikis as $wiki) {
             $selector->addOption($wiki);
         }
         $form .= $selector->getHTML() . "<br />";
     } else {
         $form .= Xml::input('wiki', false, $this->mWiki) . "<br />";
     }
     $form .= Xml::submitButton($this->msg('configure-select-wiki-submit')->text());
     $form .= '</form></fieldset>';
     return $form;
 }
Esempio n. 23
0
    /**
     * @access private
     */
    function mainPrefsForm($status, $message = '')
    {
        global $wgUser, $wgOut, $wgLang, $wgContLang, $wgAuth;
        global $wgAllowRealName, $wgImageLimits, $wgThumbLimits;
        global $wgDisableLangConversion, $wgDisableTitleConversion;
        global $wgEnotifWatchlist, $wgEnotifUserTalk, $wgEnotifMinorEdits;
        global $wgRCShowWatchingUsers, $wgEnotifRevealEditorAddress;
        global $wgEnableEmail, $wgEnableUserEmail, $wgEmailAuthentication;
        global $wgContLanguageCode, $wgDefaultSkin, $wgCookieExpiration;
        global $wgEmailConfirmToEdit, $wgEnableMWSuggest, $wgLocalTZoffset;
        $wgOut->setPageTitle(wfMsg('preferences'));
        $wgOut->setArticleRelated(false);
        $wgOut->setRobotPolicy('noindex,nofollow');
        $wgOut->addScriptFile('prefs.js');
        $wgOut->disallowUserJs();
        # Prevent hijacked user scripts from sniffing passwords etc.
        if ($this->mSuccess || 'success' == $status) {
            $wgOut->wrapWikiMsg('<div class="successbox"><strong>$1</strong></div>', 'savedprefs');
        } else {
            if ('error' == $status) {
                $wgOut->addWikiText('<div class="errorbox"><strong>' . $message . '</strong></div>');
            } else {
                if ('' != $status) {
                    $wgOut->addWikiText($message . "\n----");
                }
            }
        }
        $qbs = $wgLang->getQuickbarSettings();
        $mathopts = $wgLang->getMathNames();
        $dateopts = $wgLang->getDatePreferences();
        $togs = User::getToggles();
        $titleObj = SpecialPage::getTitleFor('Preferences');
        # Pre-expire some toggles so they won't show if disabled
        $this->mUsedToggles['shownumberswatching'] = true;
        $this->mUsedToggles['showupdated'] = true;
        $this->mUsedToggles['enotifwatchlistpages'] = true;
        $this->mUsedToggles['enotifusertalkpages'] = true;
        $this->mUsedToggles['enotifminoredits'] = true;
        $this->mUsedToggles['enotifrevealaddr'] = true;
        $this->mUsedToggles['ccmeonemails'] = true;
        $this->mUsedToggles['uselivepreview'] = true;
        $this->mUsedToggles['noconvertlink'] = true;
        if (!$this->mEmailFlag) {
            $emfc = 'checked="checked"';
        } else {
            $emfc = '';
        }
        if ($wgEmailAuthentication && $this->mUserEmail != '') {
            if ($wgUser->getEmailAuthenticationTimestamp()) {
                // date and time are separate parameters to facilitate localisation.
                // $time is kept for backward compat reasons.
                // 'emailauthenticated' is also used in SpecialConfirmemail.php
                $time = $wgLang->timeAndDate($wgUser->getEmailAuthenticationTimestamp(), true);
                $d = $wgLang->date($wgUser->getEmailAuthenticationTimestamp(), true);
                $t = $wgLang->time($wgUser->getEmailAuthenticationTimestamp(), true);
                $emailauthenticated = wfMsg('emailauthenticated', $time, $d, $t) . '<br />';
                $disableEmailPrefs = false;
            } else {
                $disableEmailPrefs = true;
                $skin = $wgUser->getSkin();
                $emailauthenticated = wfMsg('emailnotauthenticated') . '<br />' . $skin->makeKnownLinkObj(SpecialPage::getTitleFor('Confirmemail'), wfMsg('emailconfirmlink')) . '<br />';
            }
        } else {
            $emailauthenticated = '';
            $disableEmailPrefs = false;
        }
        if ($this->mUserEmail == '') {
            $emailauthenticated = wfMsg('noemailprefs') . '<br />';
        }
        $ps = $this->namespacesCheckboxes();
        $enotifwatchlistpages = $wgEnotifWatchlist ? $this->getToggle('enotifwatchlistpages', false, $disableEmailPrefs) : '';
        $enotifusertalkpages = $wgEnotifUserTalk ? $this->getToggle('enotifusertalkpages', false, $disableEmailPrefs) : '';
        $enotifminoredits = $wgEnotifWatchlist && $wgEnotifMinorEdits ? $this->getToggle('enotifminoredits', false, $disableEmailPrefs) : '';
        $enotifrevealaddr = ($wgEnotifWatchlist || $wgEnotifUserTalk) && $wgEnotifRevealEditorAddress ? $this->getToggle('enotifrevealaddr', false, $disableEmailPrefs) : '';
        # </FIXME>
        $wgOut->addHTML(Xml::openElement('form', array('action' => $titleObj->getLocalUrl(), 'method' => 'post', 'id' => 'mw-preferences-form')) . Xml::openElement('div', array('id' => 'preferences')));
        # User data
        $wgOut->addHTML(Xml::fieldset(wfMsg('prefs-personal')) . Xml::openElement('table') . $this->tableRow(Xml::element('h2', null, wfMsg('prefs-personal'))));
        # Get groups to which the user belongs
        $userEffectiveGroups = $wgUser->getEffectiveGroups();
        $userEffectiveGroupsArray = array();
        foreach ($userEffectiveGroups as $ueg) {
            if ($ueg == '*') {
                // Skip the default * group, seems useless here
                continue;
            }
            $userEffectiveGroupsArray[] = User::makeGroupLinkHTML($ueg);
        }
        asort($userEffectiveGroupsArray);
        $sk = $wgUser->getSkin();
        $toolLinks = array();
        $toolLinks[] = $sk->makeKnownLinkObj(SpecialPage::getTitleFor('ListGroupRights'), wfMsg('listgrouprights'));
        # At the moment one tool link only but be prepared for the future...
        # FIXME: Add a link to Special:Userrights for users who are allowed to use it.
        # $wgUser->isAllowed( 'userrights' ) seems to strict in some cases
        $userInformationHtml = $this->tableRow(wfMsgHtml('username'), htmlspecialchars($wgUser->getName())) . $this->tableRow(wfMsgHtml('uid'), $wgLang->formatNum(htmlspecialchars($wgUser->getId()))) . $this->tableRow(wfMsgExt('prefs-memberingroups', array('parseinline'), count($userEffectiveGroupsArray)), $wgLang->commaList($userEffectiveGroupsArray) . '<br />(' . implode(' | ', $toolLinks) . ')') . $this->tableRow(wfMsgHtml('prefs-edits'), $wgLang->formatNum($wgUser->getEditCount()));
        if (wfRunHooks('PreferencesUserInformationPanel', array($this, &$userInformationHtml))) {
            $wgOut->addHTML($userInformationHtml);
        }
        if ($wgAllowRealName) {
            $wgOut->addHTML($this->tableRow(Xml::label(wfMsg('yourrealname'), 'wpRealName'), Xml::input('wpRealName', 25, $this->mRealName, array('id' => 'wpRealName')), Xml::tags('div', array('class' => 'prefsectiontip'), wfMsgExt('prefs-help-realname', 'parseinline'))));
        }
        if ($wgEnableEmail) {
            $wgOut->addHTML($this->tableRow(Xml::label(wfMsg('youremail'), 'wpUserEmail'), Xml::input('wpUserEmail', 25, $this->mUserEmail, array('id' => 'wpUserEmail')), Xml::tags('div', array('class' => 'prefsectiontip'), wfMsgExt($wgEmailConfirmToEdit ? 'prefs-help-email-required' : 'prefs-help-email', 'parseinline'))));
        }
        global $wgParser, $wgMaxSigChars;
        if (mb_strlen($this->mNick) > $wgMaxSigChars) {
            $invalidSig = $this->tableRow('&nbsp;', Xml::element('span', array('class' => 'error'), wfMsgExt('badsiglength', 'parsemag', $wgLang->formatNum($wgMaxSigChars))));
        } elseif (!empty($this->mToggles['fancysig']) && false === $wgParser->validateSig($this->mNick)) {
            $invalidSig = $this->tableRow('&nbsp;', Xml::element('span', array('class' => 'error'), wfMsg('badsig')));
        } else {
            $invalidSig = '';
        }
        $wgOut->addHTML($this->tableRow(Xml::label(wfMsg('yournick'), 'wpNick'), Xml::input('wpNick', 25, $this->mNick, array('id' => 'wpNick', 'maxlength' => $wgMaxSigChars))) . $invalidSig . $this->tableRow('&nbsp;', $this->getToggle('fancysig')));
        list($lsLabel, $lsSelect) = Xml::languageSelector($this->mUserLanguage);
        $wgOut->addHTML($this->tableRow($lsLabel, $lsSelect));
        /* see if there are multiple language variants to choose from*/
        if (!$wgDisableLangConversion) {
            $variants = $wgContLang->getVariants();
            $variantArray = array();
            $languages = Language::getLanguageNames(true);
            foreach ($variants as $v) {
                $v = str_replace('_', '-', strtolower($v));
                if (array_key_exists($v, $languages)) {
                    // If it doesn't have a name, we'll pretend it doesn't exist
                    $variantArray[$v] = $languages[$v];
                }
            }
            $options = "\n";
            foreach ($variantArray as $code => $name) {
                $selected = $code == $this->mUserVariant;
                $options .= Xml::option("{$code} - {$name}", $code, $selected) . "\n";
            }
            if (count($variantArray) > 1) {
                $wgOut->addHTML($this->tableRow(Xml::label(wfMsg('yourvariant'), 'wpUserVariant'), Xml::tags('select', array('name' => 'wpUserVariant', 'id' => 'wpUserVariant'), $options)));
            }
            if (count($variantArray) > 1 && !$wgDisableLangConversion && !$wgDisableTitleConversion) {
                $wgOut->addHTML(Xml::tags('tr', null, Xml::tags('td', array('colspan' => '2'), $this->getToggle("noconvertlink"))));
            }
        }
        # Password
        if ($wgAuth->allowPasswordChange()) {
            $link = $wgUser->getSkin()->link(SpecialPage::getTitleFor('ResetPass'), wfMsgHtml('prefs-resetpass'), array(), array('returnto' => SpecialPage::getTitleFor('Preferences')));
            $wgOut->addHTML($this->tableRow(Xml::element('h2', null, wfMsg('changepassword'))) . $this->tableRow('<ul><li>' . $link . '</li></ul>'));
        }
        # <FIXME>
        # Enotif
        if ($wgEnableEmail) {
            $moreEmail = '';
            if ($wgEnableUserEmail) {
                // fixme -- the "allowemail" pseudotoggle is a hacked-together
                // inversion for the "disableemail" preference.
                $emf = wfMsg('allowemail');
                $disabled = $disableEmailPrefs ? ' disabled="disabled"' : '';
                $moreEmail = "<input type='checkbox' {$emfc} {$disabled} value='1' name='wpEmailFlag' id='wpEmailFlag' /> <label for='wpEmailFlag'>{$emf}</label>" . $this->getToggle('ccmeonemails', '', $disableEmailPrefs);
            }
            $wgOut->addHTML($this->tableRow(Xml::element('h2', null, wfMsg('email'))) . $this->tableRow($emailauthenticated . $enotifrevealaddr . $enotifwatchlistpages . $enotifusertalkpages . $enotifminoredits . $moreEmail));
        }
        # </FIXME>
        $wgOut->addHTML(Xml::closeElement('table') . Xml::closeElement('fieldset'));
        # Quickbar
        #
        if ($this->mSkin == 'cologneblue' || $this->mSkin == 'standard') {
            $wgOut->addHTML("<fieldset>\n<legend>" . wfMsg('qbsettings') . "</legend>\n");
            for ($i = 0; $i < count($qbs); ++$i) {
                if ($i == $this->mQuickbar) {
                    $checked = ' checked="checked"';
                } else {
                    $checked = "";
                }
                $wgOut->addHTML("<div><label><input type='radio' name='wpQuickbar' value=\"{$i}\"{$checked} />{$qbs[$i]}</label></div>\n");
            }
            $wgOut->addHTML("</fieldset>\n\n");
        } else {
            # Need to output a hidden option even if the relevant skin is not in use,
            # otherwise the preference will get reset to 0 on submit
            $wgOut->addHTML(Xml::hidden('wpQuickbar', $this->mQuickbar));
        }
        # Skin
        #
        global $wgAllowUserSkin;
        if ($wgAllowUserSkin) {
            $wgOut->addHTML("<fieldset>\n<legend>\n" . wfMsg('skin') . "</legend>\n");
            $mptitle = Title::newMainPage();
            $previewtext = wfMsg('skin-preview');
            # Only show members of Skin::getSkinNames() rather than
            # $skinNames (skins is all skin names from Language.php)
            $validSkinNames = Skin::getUsableSkins();
            # Sort by UI skin name. First though need to update validSkinNames as sometimes
            # the skinkey & UI skinname differ (e.g. "standard" skinkey is "Classic" in the UI).
            foreach ($validSkinNames as $skinkey => &$skinname) {
                $msgName = "skinname-{$skinkey}";
                $localisedSkinName = wfMsg($msgName);
                if (!wfEmptyMsg($msgName, $localisedSkinName)) {
                    $skinname = $localisedSkinName;
                }
            }
            asort($validSkinNames);
            foreach ($validSkinNames as $skinkey => $sn) {
                $checked = $skinkey == $this->mSkin ? ' checked="checked"' : '';
                $mplink = htmlspecialchars($mptitle->getLocalURL("useskin={$skinkey}"));
                $previewlink = "(<a target='_blank' href=\"{$mplink}\">{$previewtext}</a>)";
                if ($skinkey == $wgDefaultSkin) {
                    $sn .= ' (' . wfMsg('default') . ')';
                }
                $wgOut->addHTML("<input type='radio' name='wpSkin' id=\"wpSkin{$skinkey}\" value=\"{$skinkey}\"{$checked} /> <label for=\"wpSkin{$skinkey}\">{$sn}</label> {$previewlink}<br />\n");
            }
            $wgOut->addHTML("</fieldset>\n\n");
        }
        # Math
        #
        global $wgUseTeX;
        if ($wgUseTeX) {
            $wgOut->addHTML("<fieldset>\n<legend>" . wfMsg('math') . '</legend>');
            foreach ($mathopts as $k => $v) {
                $checked = $k == $this->mMath;
                $wgOut->addHTML(Xml::openElement('div') . Xml::radioLabel(wfMsg($v), 'wpMath', $k, "mw-sp-math-{$k}", $checked) . Xml::closeElement('div') . "\n");
            }
            $wgOut->addHTML("</fieldset>\n\n");
        }
        # Files
        #
        $imageLimitOptions = null;
        foreach ($wgImageLimits as $index => $limits) {
            $selected = $index == $this->mImageSize;
            $imageLimitOptions .= Xml::option("{$limits[0]}×{$limits[1]}" . wfMsg('unit-pixel'), $index, $selected);
        }
        $imageThumbOptions = null;
        foreach ($wgThumbLimits as $index => $size) {
            $selected = $index == $this->mThumbSize;
            $imageThumbOptions .= Xml::option($size . wfMsg('unit-pixel'), $index, $selected);
        }
        $imageSizeId = 'wpImageSize';
        $thumbSizeId = 'wpThumbSize';
        $wgOut->addHTML(Xml::fieldset(wfMsg('files')) . "\n" . Xml::openElement('table') . '<tr>
					<td class="mw-label">' . Xml::label(wfMsg('imagemaxsize'), $imageSizeId) . '</td>
					<td class="mw-input">' . Xml::openElement('select', array('name' => $imageSizeId, 'id' => $imageSizeId)) . $imageLimitOptions . Xml::closeElement('select') . '</td>
				</tr><tr>
					<td class="mw-label">' . Xml::label(wfMsg('thumbsize'), $thumbSizeId) . '</td>
					<td class="mw-input">' . Xml::openElement('select', array('name' => $thumbSizeId, 'id' => $thumbSizeId)) . $imageThumbOptions . Xml::closeElement('select') . '</td>
				</tr>' . Xml::closeElement('table') . Xml::closeElement('fieldset'));
        # Date format
        #
        # Date/Time
        #
        $wgOut->addHTML(Xml::openElement('fieldset') . Xml::element('legend', null, wfMsg('datetime')) . "\n");
        if ($dateopts) {
            $wgOut->addHTML(Xml::openElement('fieldset') . Xml::element('legend', null, wfMsg('dateformat')) . "\n");
            $idCnt = 0;
            $epoch = '20010115161234';
            # Wikipedia day
            foreach ($dateopts as $key) {
                if ($key == 'default') {
                    $formatted = wfMsg('datedefault');
                } else {
                    $formatted = $wgLang->timeanddate($epoch, false, $key);
                }
                $wgOut->addHTML(Xml::tags('div', null, Xml::radioLabel($formatted, 'wpDate', $key, "wpDate{$idCnt}", $key == $this->mDate)) . "\n");
                $idCnt++;
            }
            $wgOut->addHTML(Xml::closeElement('fieldset') . "\n");
        }
        $nowlocal = Xml::openElement('span', array('id' => 'wpLocalTime')) . $wgLang->time($now = wfTimestampNow(), true) . Xml::closeElement('span');
        $nowserver = $wgLang->time($now, false) . Xml::hidden('wpServerTime', substr($now, 8, 2) * 60 + substr($now, 10, 2));
        $wgOut->addHTML(Xml::openElement('fieldset') . Xml::element('legend', null, wfMsg('timezonelegend')) . Xml::openElement('table') . $this->addRow(wfMsg('servertime'), $nowserver) . $this->addRow(wfMsg('localtime'), $nowlocal));
        $opt = Xml::openElement('select', array('name' => 'wpTimeZone', 'id' => 'wpTimeZone', 'onchange' => 'javascript:updateTimezoneSelection(false)'));
        $opt .= Xml::option(wfMsg('timezoneuseserverdefault'), "System|{$wgLocalTZoffset}", $this->mTimeZone === "System|{$wgLocalTZoffset}");
        $opt .= Xml::option(wfMsg('timezoneuseoffset'), 'Offset', $this->mTimeZone === 'Offset');
        if (function_exists('timezone_identifiers_list')) {
            $optgroup = '';
            $tzs = timezone_identifiers_list();
            sort($tzs);
            $selZone = explode('|', $this->mTimeZone, 3);
            $selZone = $selZone[0] == 'ZoneInfo' ? $selZone[2] : null;
            $now = date_create('now');
            foreach ($tzs as $tz) {
                $z = explode('/', $tz, 2);
                # timezone_identifiers_list() returns a number of
                # backwards-compatibility entries. This filters them out of the
                # list presented to the user.
                if (count($z) != 2 || !in_array($z[0], array('Africa', 'America', 'Antarctica', 'Arctic', 'Asia', 'Atlantic', 'Australia', 'Europe', 'Indian', 'Pacific'))) {
                    continue;
                }
                if ($optgroup != $z[0]) {
                    if ($optgroup !== '') {
                        $opt .= Xml::closeElement('optgroup');
                    }
                    $optgroup = $z[0];
                    $opt .= Xml::openElement('optgroup', array('label' => $z[0]));
                }
                $minDiff = floor(timezone_offset_get(timezone_open($tz), $now) / 60);
                $opt .= Xml::option(str_replace('_', ' ', $tz), "ZoneInfo|{$minDiff}|{$tz}", $selZone === $tz, array('label' => $z[1]));
            }
            if ($optgroup !== '') {
                $opt .= Xml::closeElement('optgroup');
            }
        }
        $opt .= Xml::closeElement('select');
        $wgOut->addHTML($this->addRow(Xml::label(wfMsg('timezoneselect'), 'wpTimeZone'), $opt));
        $wgOut->addHTML($this->addRow(Xml::label(wfMsg('timezoneoffset'), 'wpHourDiff'), Xml::input('wpHourDiff', 6, $this->mHourDiff, array('id' => 'wpHourDiff', 'onfocus' => 'javascript:updateTimezoneSelection(true)', 'onblur' => 'javascript:updateTimezoneSelection(false)'))) . "<tr>\n\t\t\t\t<td></td>\n\t\t\t\t<td class='mw-submit'>" . Xml::element('input', array('type' => 'button', 'value' => wfMsg('guesstimezone'), 'onclick' => 'javascript:guessTimezone()', 'id' => 'guesstimezonebutton', 'style' => 'display:none;')) . "</td>\n\t\t\t</tr>" . Xml::closeElement('table') . Xml::tags('div', array('class' => 'prefsectiontip'), wfMsgExt('timezonetext', 'parseinline')) . Xml::closeElement('fieldset') . Xml::closeElement('fieldset') . "\n\n");
        # Editing
        #
        global $wgLivePreview;
        $wgOut->addHTML(Xml::fieldset(wfMsg('textboxsize')) . wfMsgHTML('prefs-edit-boxsize') . ' ' . Xml::inputLabel(wfMsg('rows'), 'wpRows', 'wpRows', 3, $this->mRows) . ' ' . Xml::inputLabel(wfMsg('columns'), 'wpCols', 'wpCols', 3, $this->mCols) . $this->getToggles(array('editsection', 'editsectiononrightclick', 'editondblclick', 'editwidth', 'showtoolbar', 'previewonfirst', 'previewontop', 'minordefault', 'externaleditor', 'externaldiff', $wgLivePreview ? 'uselivepreview' : false, 'forceeditsummary')));
        $wgOut->addHTML(Xml::closeElement('fieldset'));
        # Recent changes
        global $wgRCMaxAge;
        $wgOut->addHTML(Xml::fieldset(wfMsg('prefs-rc')) . Xml::openElement('table') . '<tr>
					<td class="mw-label">' . Xml::label(wfMsg('recentchangesdays'), 'wpRecentDays') . '</td>
					<td class="mw-input">' . Xml::input('wpRecentDays', 3, $this->mRecentDays, array('id' => 'wpRecentDays')) . ' ' . wfMsgExt('recentchangesdays-max', 'parsemag', $wgLang->formatNum(ceil($wgRCMaxAge / (3600 * 24)))) . '</td>
				</tr><tr>
					<td class="mw-label">' . Xml::label(wfMsg('recentchangescount'), 'wpRecent') . '</td>
					<td class="mw-input">' . Xml::input('wpRecent', 3, $this->mRecent, array('id' => 'wpRecent')) . '</td>
				</tr>' . Xml::closeElement('table') . '<br />');
        $toggles[] = 'hideminor';
        if ($wgRCShowWatchingUsers) {
            $toggles[] = 'shownumberswatching';
        }
        $toggles[] = 'usenewrc';
        $wgOut->addHTML($this->getToggles($toggles) . Xml::closeElement('fieldset'));
        # Watchlist
        $wgOut->addHTML(Xml::fieldset(wfMsg('prefs-watchlist')) . Xml::inputLabel(wfMsg('prefs-watchlist-days'), 'wpWatchlistDays', 'wpWatchlistDays', 3, $this->mWatchlistDays) . ' ' . wfMsgHTML('prefs-watchlist-days-max') . '<br /><br />' . $this->getToggle('extendwatchlist') . Xml::inputLabel(wfMsg('prefs-watchlist-edits'), 'wpWatchlistEdits', 'wpWatchlistEdits', 3, $this->mWatchlistEdits) . ' ' . wfMsgHTML('prefs-watchlist-edits-max') . '<br /><br />' . $this->getToggles(array('watchlisthideminor', 'watchlisthidebots', 'watchlisthideown', 'watchlisthideanons', 'watchlisthideliu')));
        if ($wgUser->isAllowed('createpage') || $wgUser->isAllowed('createtalk')) {
            $wgOut->addHTML($this->getToggle('watchcreations'));
        }
        foreach (array('edit' => 'watchdefault', 'move' => 'watchmoves', 'delete' => 'watchdeletion') as $action => $toggle) {
            if ($wgUser->isAllowed($action)) {
                $wgOut->addHTML($this->getToggle($toggle));
            }
        }
        $this->mUsedToggles['watchcreations'] = true;
        $this->mUsedToggles['watchdefault'] = true;
        $this->mUsedToggles['watchmoves'] = true;
        $this->mUsedToggles['watchdeletion'] = true;
        $wgOut->addHTML(Xml::closeElement('fieldset'));
        # Search
        $mwsuggest = $wgEnableMWSuggest ? $this->addRow(Xml::label(wfMsg('mwsuggest-disable'), 'wpDisableMWSuggest'), Xml::check('wpDisableMWSuggest', $this->mDisableMWSuggest, array('id' => 'wpDisableMWSuggest'))) : '';
        $wgOut->addHTML(Xml::openElement('fieldset') . Xml::element('legend', null, wfMsg('searchresultshead')) . Xml::openElement('fieldset') . Xml::element('legend', null, wfMsg('prefs-searchoptions')) . Xml::openElement('table') . $this->addRow(Xml::label(wfMsg('resultsperpage'), 'wpSearch'), Xml::input('wpSearch', 4, $this->mSearch, array('id' => 'wpSearch'))) . $this->addRow(Xml::label(wfMsg('contextlines'), 'wpSearchLines'), Xml::input('wpSearchLines', 4, $this->mSearchLines, array('id' => 'wpSearchLines'))) . $this->addRow(Xml::label(wfMsg('contextchars'), 'wpSearchChars'), Xml::input('wpSearchChars', 4, $this->mSearchChars, array('id' => 'wpSearchChars'))) . $mwsuggest . Xml::closeElement('table') . Xml::closeElement('fieldset') . Xml::openElement('fieldset') . Xml::element('legend', null, wfMsg('prefs-namespaces')) . wfMsgExt('defaultns', array('parse')) . $ps . Xml::closeElement('fieldset') . Xml::closeElement('fieldset'));
        # Misc
        #
        $wgOut->addHTML('<fieldset><legend>' . wfMsg('prefs-misc') . '</legend>');
        $wgOut->addHTML('<label for="wpStubs">' . wfMsg('stub-threshold') . '</label>&nbsp;');
        $wgOut->addHTML(Xml::input('wpStubs', 6, $this->mStubs, array('id' => 'wpStubs')));
        $msgUnderline = htmlspecialchars(wfMsg('tog-underline'));
        $msgUnderlinenever = htmlspecialchars(wfMsg('underline-never'));
        $msgUnderlinealways = htmlspecialchars(wfMsg('underline-always'));
        $msgUnderlinedefault = htmlspecialchars(wfMsg('underline-default'));
        $uopt = $wgUser->getOption("underline");
        $s0 = $uopt == 0 ? ' selected="selected"' : '';
        $s1 = $uopt == 1 ? ' selected="selected"' : '';
        $s2 = $uopt == 2 ? ' selected="selected"' : '';
        $wgOut->addHTML("\n<div class='toggle'><p><label for='wpOpunderline'>{$msgUnderline}</label>\n<select name='wpOpunderline' id='wpOpunderline'>\n<option value=\"0\"{$s0}>{$msgUnderlinenever}</option>\n<option value=\"1\"{$s1}>{$msgUnderlinealways}</option>\n<option value=\"2\"{$s2}>{$msgUnderlinedefault}</option>\n</select></p></div>");
        foreach ($togs as $tname) {
            if (!array_key_exists($tname, $this->mUsedToggles)) {
                if ($tname == 'norollbackdiff' && $wgUser->isAllowed('rollback')) {
                    $wgOut->addHTML($this->getToggle($tname));
                } else {
                    $wgOut->addHTML($this->getToggle($tname));
                }
            }
        }
        $wgOut->addHTML('</fieldset>');
        wfRunHooks('RenderPreferencesForm', array($this, $wgOut));
        $token = htmlspecialchars($wgUser->editToken());
        $skin = $wgUser->getSkin();
        $wgOut->addHTML("\n\t<div id='prefsubmit'>\n\t<div>\n\t\t<input type='submit' name='wpSaveprefs' class='btnSavePrefs' value=\"" . wfMsgHtml('saveprefs') . '"' . $skin->tooltipAndAccesskey('save') . " />\n\t\t<input type='submit' name='wpReset' value=\"" . wfMsgHtml('resetprefs') . "\" />\n\t</div>\n\n\t</div>\n\n\t<input type='hidden' name='wpEditToken' value=\"{$token}\" />\n\t</div></form>\n");
        $wgOut->addHTML(Xml::tags('div', array('class' => "prefcache"), wfMsgExt('clearyourcache', 'parseinline')));
    }
 /**
  * Show the Lock and/or Hide form, appropriate for this admin user's rights.
  * The <form> and <fieldset> were started in showTableHeader()
  */
 private function showStatusForm()
 {
     $form = '';
     $radioLocked = Xml::radioLabel($this->msg('centralauth-admin-action-lock-nochange')->parse(), 'wpActionLock', 'nochange', 'mw-centralauth-status-locked-no', true) . '<br />' . Xml::radioLabel($this->msg('centralauth-admin-action-lock-unlock')->parse(), 'wpActionLock', 'unlock', 'centralauth-admin-action-lock-unlock', false) . '<br />' . Xml::radioLabel($this->msg('centralauth-admin-action-lock-lock')->parse(), 'wpActionLock', 'lock', 'centralauth-admin-action-lock-lock', false);
     $radioHidden = Xml::radioLabel($this->msg('centralauth-admin-action-hide-nochange')->parse(), 'wpActionHide', 'nochange', 'mw-centralauth-status-hidden-nochange', true) . '<br />';
     if ($this->mCanOversight) {
         $radioHidden .= Xml::radioLabel($this->msg('centralauth-admin-action-hide-none')->parse(), 'wpActionHide', CentralAuthUser::HIDDEN_NONE, 'mw-centralauth-status-hidden-no', false) . '<br />' . Xml::radioLabel($this->msg('centralauth-admin-action-hide-lists')->parse(), 'wpActionHide', CentralAuthUser::HIDDEN_LISTS, 'mw-centralauth-status-hidden-list', false) . '<br />' . Xml::radioLabel($this->msg('centralauth-admin-action-hide-oversight')->parse(), 'wpActionHide', CentralAuthUser::HIDDEN_OVERSIGHT, 'mw-centralauth-status-hidden-oversight', false);
     }
     $reasonList = Xml::listDropDown('wpReasonList', $this->msg('centralauth-admin-status-reasons')->inContentLanguage()->text(), $this->msg('centralauth-admin-reason-other-select')->inContentLanguage()->text());
     $reasonField = Xml::input('wpReason', 45, false);
     $botField = Xml::check('markasbot') . $this->msg('centralauth-admin-multi-botcheck');
     $form .= Xml::buildForm(array('centralauth-admin-status-locked' => $radioLocked, 'centralauth-admin-status-hidden' => $radioHidden, 'centralauth-admin-reason' => $reasonList, 'centralauth-admin-reason-other' => $reasonField, 'centralauth-admin-multi-bot' => $botField), 'centralauth-admin-status-submit');
     $searchlist = $this->mUserNames;
     if (is_array($this->mUserNames)) {
         $searchlist = implode("\n", $this->mUserNames);
     }
     $form .= Html::hidden('wpTarget', $searchlist);
     $form .= '</fieldset></form>';
     $this->getOutput()->addHTML($form);
 }
Esempio n. 25
0
 function showForm($err = '')
 {
     global $wgOut;
     if ($err) {
         $wgOut->addHTML('<div class="wikierror">' . htmlspecialchars($err) . '</div>');
     }
     $wgOut->addWikiMsg('masseditregextext');
     $titleObj = SpecialPage::getTitleFor('MassEditRegex');
     $wgOut->addHTML(Xml::openElement('form', array('id' => 'masseditregex', 'method' => 'post', 'action' => $titleObj->getLocalURL('action=submit'))) . Xml::element('p', null, wfMsg('masseditregex-pagelisttxt')) . Xml::textarea('wpPageList', join("\n", $this->aPageList)) . Xml::namespaceSelector($this->iNamespace, null, 'namespace', wfMsg('masseditregex-namespace-intro')) . Xml::element('br') . Xml::element('span', null, wfMsg('masseditregex-listtype-intro')) . Xml::openElement('ul', array('style' => 'list-style: none')));
     // Generate HTML for the radio buttons (one for each list type)
     foreach (array('pagenames', 'pagename-prefixes', 'categories', 'backlinks') as $strValue) {
         // Have to use openElement because putting an Xml::xxx return value
         // inside an Xml::element causes the HTML code to be escaped and appear
         // on the page.
         $wgOut->addHTML(Xml::openElement('li') . Xml::radioLabel(wfMsg('masseditregex-listtype-' . $strValue), 'wpPageListType', $strValue, 'masseditregex-radio-' . $strValue, $strValue == $this->strPageListType) . Xml::closeElement('li'));
     }
     $wgOut->addHTML(Xml::closeElement('ul') . Xml::openElement('table', array('style' => 'width: 100%')) . Xml::openElement('tr') . Xml::openElement('td') . Xml::element('p', null, wfMsg('masseditregex-matchtxt')) . Xml::textarea('wpMatch', join("\n", $this->aMatch)) . Xml::closeElement('td') . Xml::openElement('td') . Xml::element('p', null, wfMsg('masseditregex-replacetxt')) . Xml::textarea('wpReplace', $this->strReplace) . Xml::closeElement('td') . Xml::closeElement('tr') . Xml::closeElement('table') . Xml::openElement('div', array('class' => 'editOptions')) . Xml::tags('span', array('class' => 'mw-summary', 'id' => 'wpSummaryLabel'), Xml::tags('label', array('for' => 'wpSummary'), wfMsg('summary'))) . ' ' . Xml::input('wpSummary', 60, $this->strSummary, array('id' => 'wpSummary', 'maxlength' => '200', 'tabindex' => '1')) . Xml::tags('div', array('class' => 'mw-summary-preview'), wfMsgExt('summary-preview', 'parseinline') . $this->sk->commentBlock($this->strSummary)) . Xml::closeElement('div') . Xml::element('input', array('id' => 'wpSave', 'name' => 'wpSave', 'type' => 'submit', 'value' => wfMsg('masseditregex-executebtn'), 'accesskey' => wfMsg('accesskey-save'), 'title' => wfMsg('masseditregex-tooltip-execute') . ' [' . wfMsg('accesskey-save') . ']')) . Xml::element('input', array('id' => 'wpPreview', 'name' => 'wpPreview', 'type' => 'submit', 'value' => wfMsg('showpreview'), 'accesskey' => wfMsg('accesskey-preview'), 'title' => wfMsg('tooltip-preview') . ' [' . wfMsg('accesskey-preview') . ']')));
     $wgOut->addHTML(Xml::closeElement('form'));
 }
Esempio n. 26
0
 /**
  * Generates the namespace selector form with hidden attributes.
  * @return String: HTML fragment
  */
 protected function getForm()
 {
     global $wgScript;
     $this->opts['title'] = $this->getTitle()->getPrefixedText();
     if (!isset($this->opts['target'])) {
         $this->opts['target'] = '';
     } else {
         $this->opts['target'] = str_replace('_', ' ', $this->opts['target']);
     }
     if (!isset($this->opts['namespace'])) {
         $this->opts['namespace'] = '';
     }
     if (!isset($this->opts['nsInvert'])) {
         $this->opts['nsInvert'] = '';
     }
     if (!isset($this->opts['associated'])) {
         $this->opts['associated'] = false;
     }
     if (!isset($this->opts['contribs'])) {
         $this->opts['contribs'] = 'user';
     }
     if (!isset($this->opts['year'])) {
         $this->opts['year'] = '';
     }
     if (!isset($this->opts['month'])) {
         $this->opts['month'] = '';
     }
     if ($this->opts['contribs'] == 'newbie') {
         $this->opts['target'] = '';
     }
     if (!isset($this->opts['tagfilter'])) {
         $this->opts['tagfilter'] = '';
     }
     if (!isset($this->opts['topOnly'])) {
         $this->opts['topOnly'] = false;
     }
     $form = Xml::openElement('form', array('method' => 'get', 'action' => $wgScript, 'class' => 'mw-contributions-form'));
     # Add hidden params for tracking except for parameters in $skipParameters
     $skipParameters = array('namespace', 'nsInvert', 'deletedOnly', 'target', 'contribs', 'year', 'month', 'topOnly', 'associated');
     foreach ($this->opts as $name => $value) {
         if (in_array($name, $skipParameters)) {
             continue;
         }
         $form .= "\t" . Html::hidden($name, $value) . "\n";
     }
     $tagFilter = ChangeTags::buildTagFilterSelector($this->opts['tagfilter']);
     if ($tagFilter) {
         $filterSelection = Xml::tags('td', array('class' => 'mw-label'), array_shift($tagFilter)) . Xml::tags('td', array('class' => 'mw-input'), implode('&#160', $tagFilter));
     } else {
         $filterSelection = Xml::tags('td', array('colspan' => 2), '');
     }
     $targetSelection = Xml::tags('td', array('colspan' => 2), Xml::radioLabel($this->msg('sp-contributions-newbies')->text(), 'contribs', 'newbie', 'newbie', $this->opts['contribs'] == 'newbie', array('class' => 'mw-input')) . '<br />' . Xml::radioLabel($this->msg('sp-contributions-username')->text(), 'contribs', 'user', 'user', $this->opts['contribs'] == 'user', array('class' => 'mw-input')) . ' ' . Html::input('target', $this->opts['target'], 'text', array('size' => '40', 'required' => '', 'class' => 'mw-input') + ($this->opts['target'] ? array() : array('autofocus'))) . ' ');
     $namespaceSelection = Xml::tags('td', array('class' => 'mw-label'), Xml::label($this->msg('namespace')->text(), 'namespace', '')) . Xml::tags('td', null, Html::namespaceSelector(array('selected' => $this->opts['namespace'], 'all' => ''), array('name' => 'namespace', 'id' => 'namespace', 'class' => 'namespaceselector')) . '&#160;' . Html::rawElement('span', array('style' => 'white-space: nowrap'), Xml::checkLabel($this->msg('invert')->text(), 'nsInvert', 'nsInvert', $this->opts['nsInvert'], array('title' => $this->msg('tooltip-invert')->text(), 'class' => 'mw-input')) . '&#160;') . Html::rawElement('span', array('style' => 'white-space: nowrap'), Xml::checkLabel($this->msg('namespace_association')->text(), 'associated', 'associated', $this->opts['associated'], array('title' => $this->msg('tooltip-namespace_association')->text(), 'class' => 'mw-input')) . '&#160;'));
     $extraOptions = Xml::tags('td', array('colspan' => 2), Html::rawElement('span', array('style' => 'white-space: nowrap'), Xml::checkLabel($this->msg('history-show-deleted')->text(), 'deletedOnly', 'mw-show-deleted-only', $this->opts['deletedOnly'], array('class' => 'mw-input'))) . Html::rawElement('span', array('style' => 'white-space: nowrap'), Xml::checkLabel($this->msg('sp-contributions-toponly')->text(), 'topOnly', 'mw-show-top-only', $this->opts['topOnly'], array('class' => 'mw-input'))));
     $dateSelectionAndSubmit = Xml::tags('td', array('colspan' => 2), Xml::dateMenu($this->opts['year'], $this->opts['month']) . ' ' . Xml::submitButton($this->msg('sp-contributions-submit')->text(), array('class' => 'mw-submit')));
     $form .= Xml::fieldset($this->msg('sp-contributions-search')->text()) . Xml::openElement('table', array('class' => 'mw-contributions-table')) . Xml::openElement('tr') . $targetSelection . Xml::closeElement('tr') . Xml::openElement('tr') . $namespaceSelection . Xml::closeElement('tr') . Xml::openElement('tr') . $filterSelection . Xml::closeElement('tr') . Xml::openElement('tr') . $extraOptions . Xml::closeElement('tr') . Xml::openElement('tr') . $dateSelectionAndSubmit . Xml::closeElement('tr') . Xml::closeElement('table');
     $explain = $this->msg('sp-contributions-explain');
     if ($explain->exists()) {
         $form .= "<p id='mw-sp-contributions-explain'>{$explain}</p>";
     }
     $form .= Xml::closeElement('fieldset') . Xml::closeElement('form');
     return $form;
 }
Esempio n. 27
0
 /**
  * @param string $sizetype "min" or "max"
  * @param mixed $size
  * @return string Formatted HTML
  */
 protected function getSizeLimit($sizetype, $size)
 {
     $max = $sizetype === 'max';
     return Xml::radioLabel($this->msg('minimum-size')->text(), 'sizetype', 'min', 'wpmin', !$max) . '&#160;' . Xml::radioLabel($this->msg('maximum-size')->text(), 'sizetype', 'max', 'wpmax', $max) . '&#160;' . Xml::input('size', 9, $size, array('id' => 'wpsize')) . '&#160;' . Xml::label($this->msg('pagesize')->text(), 'wpsize');
 }
Esempio n. 28
0
 /**
  * Generates the namespace selector form with hidden attributes.
  * @return String: HTML fragment
  */
 protected function getForm()
 {
     global $wgScript;
     $this->opts['title'] = $this->getTitle()->getPrefixedText();
     if (!isset($this->opts['target'])) {
         $this->opts['target'] = '';
     } else {
         $this->opts['target'] = str_replace('_', ' ', $this->opts['target']);
     }
     if (!isset($this->opts['namespace'])) {
         $this->opts['namespace'] = '';
     }
     if (!isset($this->opts['contribs'])) {
         $this->opts['contribs'] = 'user';
     }
     if (!isset($this->opts['year'])) {
         $this->opts['year'] = '';
     }
     if (!isset($this->opts['month'])) {
         $this->opts['month'] = '';
     }
     if ($this->opts['contribs'] == 'newbie') {
         $this->opts['target'] = '';
     }
     if (!isset($this->opts['tagFilter'])) {
         $this->opts['tagFilter'] = '';
     }
     if (!isset($this->opts['topOnly'])) {
         $this->opts['topOnly'] = false;
     }
     $f = Xml::openElement('form', array('method' => 'get', 'action' => $wgScript, 'class' => 'mw-contributions-form'));
     # Add hidden params for tracking except for parameters in $skipParameters
     $skipParameters = array('namespace', 'deletedOnly', 'target', 'contribs', 'year', 'month', 'topOnly');
     foreach ($this->opts as $name => $value) {
         if (in_array($name, $skipParameters)) {
             continue;
         }
         $f .= "\t" . Html::hidden($name, $value) . "\n";
     }
     $tagFilter = ChangeTags::buildTagFilterSelector($this->opts['tagFilter']);
     $f .= Xml::fieldset(wfMsg('sp-contributions-search')) . Xml::radioLabel(wfMsgExt('sp-contributions-newbies', array('parsemag')), 'contribs', 'newbie', 'newbie', $this->opts['contribs'] == 'newbie') . '<br />' . Xml::radioLabel(wfMsgExt('sp-contributions-username', array('parsemag')), 'contribs', 'user', 'user', $this->opts['contribs'] == 'user') . ' ' . Html::input('target', $this->opts['target'], 'text', array('size' => '20', 'required' => '') + ($this->opts['target'] ? array() : array('autofocus'))) . ' ' . Html::rawElement('span', array('style' => 'white-space: nowrap'), Xml::label(wfMsg('namespace'), 'namespace') . ' ' . Xml::namespaceSelector($this->opts['namespace'], '')) . Xml::checkLabel(wfMsg('history-show-deleted'), 'deletedOnly', 'mw-show-deleted-only', $this->opts['deletedOnly']) . '<br />' . Xml::tags('p', null, Xml::checkLabel(wfMsg('sp-contributions-toponly'), 'topOnly', 'mw-show-top-only', $this->opts['topOnly'])) . ($tagFilter ? Xml::tags('p', null, implode('&#160;', $tagFilter)) : '') . Html::rawElement('p', array('style' => 'white-space: nowrap'), Xml::dateMenu($this->opts['year'], $this->opts['month']) . ' ' . Xml::submitButton(wfMsg('sp-contributions-submit'))) . ' ';
     $explain = wfMessage('sp-contributions-explain');
     if ($explain->exists()) {
         $f .= "<p id='mw-sp-contributions-explain'>{$explain}</p>";
     }
     $f .= Xml::closeElement('fieldset') . Xml::closeElement('form');
     return $f;
 }
 /**
  * @param string $sizetype "min" or "max"
  * @param mixed $size
  * @return string Formatted HTML
  */
 protected function getSizeLimit($sizetype, $size)
 {
     $max = $sizetype === 'max';
     return '<span class="mw-input-with-label">' . Xml::radioLabel($this->msg('minimum-size')->text(), 'sizetype', 'min', 'wpmin', !$max) . ' ' . Xml::radioLabel($this->msg('maximum-size')->text(), 'sizetype', 'max', 'wpmax', $max) . ' ' . Xml::input('size', 9, $size, array('id' => 'wpsize')) . ' ' . Xml::label($this->msg('pagesize')->text(), 'wpsize') . "</span>\n";
 }
function wfRadioLabel($label, $name, $value, $id, $checked = false, $attribs = array())
{
    return Xml::radioLabel($label, $name, $value, $id, $checked, $attribs);
}