protected function filterLinks()
 {
     // show/hide links
     $showhide = array($this->msg('show')->escaped(), $this->msg('hide')->escaped());
     // Option value -> message mapping
     $filters = array('hideliu' => 'rcshowhideliu', 'hidepatrolled' => 'rcshowhidepatr', 'hidebots' => 'rcshowhidebots', 'hideredirs' => 'whatlinkshere-hideredirs');
     foreach ($this->customFilters as $key => $params) {
         $filters[$key] = $params['msg'];
     }
     // Disable some if needed
     if (!User::groupHasPermission('*', 'createpage')) {
         unset($filters['hideliu']);
     }
     if (!$this->getUser()->useNPPatrol()) {
         unset($filters['hidepatrolled']);
     }
     $links = array();
     $changed = $this->opts->getChangedValues();
     unset($changed['offset']);
     // Reset offset if query type changes
     $self = $this->getTitle();
     foreach ($filters as $key => $msg) {
         $onoff = 1 - $this->opts->getValue($key);
         $link = Linker::link($self, $showhide[$onoff], array(), array($key => $onoff) + $changed);
         $links[$key] = $this->msg($msg)->rawParams($link)->escaped();
     }
     return $this->getLanguage()->pipeList($links);
 }
Esempio n. 2
0
 protected function filterLinks()
 {
     global $wgGroupPermissions;
     // show/hide links
     $showhide = array(wfMsgHtml('show'), wfMsgHtml('hide'));
     // Option value -> message mapping
     $filters = array('hideliu' => 'rcshowhideliu', 'hidepatrolled' => 'rcshowhidepatr', 'hidebots' => 'rcshowhidebots', 'hideredirs' => 'whatlinkshere-hideredirs');
     foreach ($this->customFilters as $key => $params) {
         $filters[$key] = $params['msg'];
     }
     // Disable some if needed
     # @todo FIXME: Throws E_NOTICEs if not set; and doesn't obey hooks etc.
     if ($wgGroupPermissions['*']['createpage'] !== true) {
         unset($filters['hideliu']);
     }
     if (!$this->getUser()->useNPPatrol()) {
         unset($filters['hidepatrolled']);
     }
     $links = array();
     $changed = $this->opts->getChangedValues();
     unset($changed['offset']);
     // Reset offset if query type changes
     $self = $this->getTitle();
     foreach ($filters as $key => $msg) {
         $onoff = 1 - $this->opts->getValue($key);
         $link = Linker::link($self, $showhide[$onoff], array(), array($key => $onoff) + $changed);
         $links[$key] = wfMsgHtml($msg, $link);
     }
     return $this->getLanguage()->pipeList($links);
 }
 protected function getSearchInput($query)
 {
     $attribs = array('placeholder' => $this->msg('tux-sst-search-ph'), 'class' => 'searchinputbox', 'dir' => $this->getLanguage()->getDir());
     $title = Html::hidden('title', $this->getPageTitle()->getPrefixedText());
     $input = Xml::input('query', false, $query, $attribs);
     $submit = Xml::submitButton($this->msg('tux-sst-search'), array('class' => 'button'));
     $nondefaults = $this->opts->getChangedValues();
     $checkLabel = Xml::checkLabel($this->msg('tux-sst-case-sensitive')->text(), 'case', 'tux-case-sensitive', isset($nondefaults['case']));
     $checkLabel = Html::openElement('div', array('class' => 'tux-search-operators')) . $checkLabel . Html::closeElement('div');
     $lang = $this->getRequest()->getVal('language');
     $language = is_null($lang) ? '' : Html::hidden('language', $lang);
     $form = Html::rawElement('form', array('action' => wfScript(), 'name' => 'searchform'), $title . $input . $submit . $checkLabel . $language);
     return $form;
 }
Esempio n. 4
0
 /**
  * Create filter panel
  *
  * @return string HTML fieldset and filter panel with the show/hide links
  */
 function getFilterPanel()
 {
     $show = wfMsgHtml('show');
     $hide = wfMsgHtml('hide');
     $changed = $this->opts->getChangedValues();
     unset($changed['target']);
     // Already in the request title
     $links = array();
     $types = array('hidetrans', 'hidelinks', 'hideredirs');
     if ($this->target->getNamespace() == NS_FILE) {
         $types[] = 'hideimages';
     }
     // Combined message keys: 'whatlinkshere-hideredirs', 'whatlinkshere-hidetrans', 'whatlinkshere-hidelinks', 'whatlinkshere-hideimages'
     // To be sure they will be find by grep
     foreach ($types as $type) {
         $chosen = $this->opts->getValue($type);
         $msg = $chosen ? $show : $hide;
         $overrides = array($type => !$chosen);
         $links[] = wfMsgHtml("whatlinkshere-{$type}", $this->makeSelfLink($msg, array_merge($changed, $overrides)));
     }
     return Xml::fieldset(wfMsg('whatlinkshere-filters'), $this->getLanguage()->pipeList($links));
 }
Esempio n. 5
0
 function setTopText(FormOptions $opts)
 {
     $nondefaults = $opts->getChangedValues();
     $form = "";
     $user = $this->getUser();
     $dbr = $this->getDB();
     $numItems = $this->countItems($dbr);
     $showUpdatedMarker = $this->getConfig()->get('ShowUpdatedMarker');
     // Show watchlist header
     $form .= "<p>";
     if ($numItems == 0) {
         $form .= $this->msg('nowatchlist')->parse() . "\n";
     } else {
         $form .= $this->msg('watchlist-details')->numParams($numItems)->parse() . "\n";
         if ($this->getConfig()->get('EnotifWatchlist') && $user->getOption('enotifwatchlistpages')) {
             $form .= $this->msg('wlheader-enotif')->parse() . "\n";
         }
         if ($showUpdatedMarker) {
             $form .= $this->msg('wlheader-showupdated')->parse() . "\n";
         }
     }
     $form .= "</p>";
     if ($numItems > 0 && $showUpdatedMarker) {
         $form .= Xml::openElement('form', array('method' => 'post', 'action' => $this->getPageTitle()->getLocalURL(), 'id' => 'mw-watchlist-resetbutton')) . "\n" . Xml::submitButton($this->msg('enotif_reset')->text(), array('name' => 'dummy')) . "\n" . Html::hidden('reset', 'all') . "\n";
         foreach ($nondefaults as $key => $value) {
             $form .= Html::hidden($key, $value) . "\n";
         }
         $form .= Xml::closeElement('form') . "\n";
     }
     $form .= Xml::openElement('form', array('method' => 'get', 'action' => $this->getPageTitle()->getLocalURL(), 'id' => 'mw-watchlist-form'));
     $form .= Xml::fieldset($this->msg('watchlist-options')->text(), false, array('id' => 'mw-watchlist-options'));
     $form .= $this->makeLegend();
     $this->getOutput()->addHTML($form);
 }
Esempio n. 6
0
 protected function selfLink2($title, $overrides)
 {
     $changed = $this->opts->getChangedValues();
     $target = $this->title->getLocalURL(wfArrayToCGI($overrides, $changed));
     return Xml::tags('a', array('href' => $target), $title);
 }