/** helper to test SpecialRecentchanges::buildMainQueryConds() */ private function assertConditions($expected, $requestOptions = null, $message = '') { $context = new RequestContext(); $context->setRequest(new FauxRequest($requestOptions)); # setup the rc object $this->rc = new SpecialRecentChanges(); $this->rc->setContext($context); $formOptions = $this->rc->setup(null); # Filter out rc_timestamp conditions which depends on the test runtime # This condition is not needed as of march 2, 2011 -- hashar # @todo FIXME: Find a way to generate the correct rc_timestamp $queryConditions = array_filter($this->rc->buildMainQueryConds($formOptions), 'SpecialRecentchangesTest::filterOutRcTimestampCondition'); $this->assertEquals($expected, $queryConditions, $message); }
/** * Get a FormOptions object containing the default options * * @return FormOptions */ public function getDefaultOptions() { global $wgUser; $opts = parent::getDefaultOptions(); $opts->add('product', isset($_GET['product']) ? $_GET['product'] : PonyDocsProduct::GetSelectedProduct()); return $opts; }
/** helper to test SpecialRecentchanges::buildMainQueryConds() */ private function assertConditions($expected, $requestOptions = null, $message = '') { global $wgRequest; $savedGlobal = $wgRequest; # Initialize a WebRequest object ... $wgRequest = new FauxRequest($requestOptions); # ... then setup the rc object (which use wgRequest internally) $this->rc = new SpecialRecentChanges(); $formOptions = $this->rc->setup(null); # Filter out rc_timestamp conditions which depends on the test runtime # This condition is not needed as of march 2, 2011 -- hashar # @todo FIXME: Find a way to generate the correct rc_timestamp $queryConditions = array_filter($this->rc->buildMainQueryConds($formOptions), 'SpecialRecentchangesTest::filterOutRcTimestampCondition'); $this->assertEquals($expected, $queryConditions, $message); $wgRequest = $savedGlobal; }
public function feedSetup() { global $wgRequest; $opts = parent::feedSetup(); $opts['target'] = $wgRequest->getVal('target'); return $opts; }
/** * Get options to be displayed in a form * * @param FormOptions $opts * @return array */ function getExtraOptions($opts) { $extraOpts = parent::getExtraOptions($opts); $opts->consumeValues(array('showlinkedto', 'target')); $extraOpts['target'] = array($this->msg('recentchangeslinked-page')->escaped(), Xml::input('target', 40, str_replace('_', ' ', $opts['target'])) . Xml::check('showlinkedto', $opts['showlinkedto'], array('id' => 'showlinkedto')) . ' ' . Xml::label($this->msg('recentchangeslinked-to')->text(), 'showlinkedto')); return $extraOpts; }
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' => 'post', 'action' => $this->getPageTitle()->getLocalURL(), 'id' => 'mw-watchlist-form')); $form .= Xml::fieldset($this->msg('watchlist-options')->text(), false, array('id' => 'mw-watchlist-options')); $form .= SpecialRecentChanges::makeLegend($this->getContext()); $this->getOutput()->addHTML($form); }
public function feedSetup() { $opts = parent::feedSetup(); $opts['target'] = $this->getRequest()->getVal('target'); return $opts; }
/** * Get options to be displayed in a form * * @param FormOptions $opts * @return array */ function getExtraOptions($opts) { $extraOpts = parent::getExtraOptions($opts); $opts->consumeValues(['showlinkedto', 'target']); $extraOpts['target'] = [$this->msg('recentchangeslinked-page')->escaped(), Xml::input('target', 40, str_replace('_', ' ', $opts['target'])) . Xml::check('showlinkedto', $opts['showlinkedto'], ['id' => 'showlinkedto']) . ' ' . Xml::label($this->msg('recentchangeslinked-to')->text(), 'showlinkedto')]; $this->addHelpLink('Help:Related changes'); return $extraOpts; }