/** * @see SpecialWikibasePage::execute * * @param string|null $subPage */ public function execute($subPage) { parent::execute($subPage); $this->getOutput()->addHTML($this->msg('wikibase-listdatatypes-intro')); $this->getOutput()->addHTML(Html::openElement('dl')); // some of the datatype descriptions // 'wikibase-listdatatypes-wikibase-item-head' // 'wikibase-listdatatypes-wikibase-item-body' // 'wikibase-listdatatypes-wikibase-property-head' // 'wikibase-listdatatypes-wikibase-property-body' // 'wikibase-listdatatypes-commonsmedia-head' // 'wikibase-listdatatypes-commonsmedia-body' // 'wikibase-listdatatypes-globe-coordinate-head' // 'wikibase-listdatatypes-globe-coordinate-body' // 'wikibase-listdatatypes-quantity-head' // 'wikibase-listdatatypes-quantity-body' // 'wikibase-listdatatypes-monolingualtext-head' // 'wikibase-listdatatypes-monolingualtext-body' // 'wikibase-listdatatypes-multilingualtext-head' // 'wikibase-listdatatypes-multilingualtext-body' // 'wikibase-listdatatypes-time-head' // 'wikibase-listdatatypes-time-body' // 'wikibase-listdatatypes-string-head' // 'wikibase-listdatatypes-string-body' // 'wikibase-listdatatypes-url-head' // 'wikibase-listdatatypes-url-body' foreach ($this->getDataTypeIds() as $dataTypeId) { $this->getOutput()->addHTML($this->getHtmlForDataTypeId($dataTypeId)); } $this->getOutput()->addHTML(Html::closeElement('dl')); }
/** * @see SpecialWikibasePage::execute * * @param string|null $subPage */ public function execute($subPage) { parent::execute($subPage); $lang = $this->getContext()->getLanguage(); $stats = new DispatchStats(); $stats->load(); $this->getOutput()->addHTML(Html::rawElement('p', array(), $this->msg('wikibase-dispatchstats-intro')->parse())); if (!$stats->hasStats()) { $this->getOutput()->addHTML(Html::rawElement('p', array(), $this->msg('wikibase-dispatchstats-no-stats')->parse())); return; } // changes ------ $this->getOutput()->addHTML(Html::rawElement('h2', array(), $this->msg('wikibase-dispatchstats-changes')->parse())); $this->getOutput()->addHTML(Html::openElement('table', array('class' => 'wikitable'))); $this->outputRow(array('', $this->msg('wikibase-dispatchstats-change-id')->text(), $this->msg('wikibase-dispatchstats-change-timestamp')->text()), 'th'); $this->outputRow(array($this->msg('wikibase-dispatchstats-oldest-change')->text(), $stats->getMinChangeId(), $lang->timeanddate($stats->getMinChangeTimestamp(), true))); $this->outputRow(array($this->msg('wikibase-dispatchstats-newest-change')->text(), $stats->getMaxChangeId(), $lang->timeanddate($stats->getMaxChangeTimestamp(), true))); $this->getOutput()->addHTML(Html::closeElement('table')); // dispatch stats ------ $this->getOutput()->addHTML(Html::rawElement('h2', array(), $this->msg('wikibase-dispatchstats-stats')->parse())); $this->getOutput()->addHTML(Html::openElement('table', array('class' => 'wikitable'))); $this->outputRow(array('', $this->msg('wikibase-dispatchstats-site-id')->text(), $this->msg('wikibase-dispatchstats-pos')->text(), $this->msg('wikibase-dispatchstats-lag-num')->text(), $this->msg('wikibase-dispatchstats-lag-time')->text(), $this->msg('wikibase-dispatchstats-touched')->text()), 'th'); $this->outputStateRow($this->msg('wikibase-dispatchstats-freshest')->text(), $stats->getFreshest()); $this->outputStateRow($this->msg('wikibase-dispatchstats-median')->text(), $stats->getMedian()); $this->outputStateRow($this->msg('wikibase-dispatchstats-stalest')->text(), $stats->getStalest()); $this->outputStateRow($this->msg('wikibase-dispatchstats-average')->text(), $stats->getAverage()); $this->getOutput()->addHTML(Html::closeElement('table')); }
/** * @see SpecialWikibasePage::execute * * @since 0.1 * * @param string|null $subPage */ public function execute($subPage) { parent::execute($subPage); // Setup $request = $this->getRequest(); $parts = $subPage === '' ? array() : explode('/', $subPage, 2); $site = trim($request->getVal('site', isset($parts[0]) ? $parts[0] : '')); $page = trim($request->getVal('page', isset($parts[1]) ? $parts[1] : '')); $itemContent = null; // If there are enough data, then try to lookup the item content if ($site !== '' && $page !== '') { // FIXME: This code is duplicated in ItemByTitleHelper::getItemId! // Try to get a item content $siteId = $this->stringNormalizer->trimToNFC($site); // no stripping of underscores here! $pageName = $this->stringNormalizer->trimToNFC($page); if (!$this->sites->getSite($siteId)) { // HACK: If the site ID isn't known, add "wiki" to it; this allows the wikipedia // subdomains to be used to refer to wikipedias, instead of requiring their // full global id to be used. // @todo: Ideally, if the site can't be looked up by global ID, we // should try to look it up by local navigation ID. // Support for this depends on bug T50934. $siteId .= 'wiki'; } /* @var ItemHandler $itemHandler */ $itemId = $this->siteLinkLookup->getItemIdForLink($siteId, $pageName); // Do we have an item content, and if not can we try harder? if ($itemId === null) { // Try harder by requesting normalization on the external site $siteObj = $this->sites->getSite($siteId); if ($siteObj instanceof Site) { $pageName = $siteObj->normalizePageName($page); $itemId = $this->siteLinkLookup->getItemIdForLink($siteId, $pageName); } } // Redirect to the item page if we found its content if ($itemId !== null) { $title = $this->titleLookup->getTitleForId($itemId); $query = $request->getValues(); unset($query['title']); unset($query['site']); unset($query['page']); $itemUrl = $title->getFullUrl($query); $this->getOutput()->redirect($itemUrl); return; } } // If there is no item content post the switch form $this->switchForm($site, $page); }
/** * @see SpecialWikibasePage::execute * * @since 0.5 * * @param string|null $subPage */ public function execute($subPage) { parent::execute($subPage); $output = $this->getOutput(); $output->setSquidMaxage(static::CACHE_TTL_IN_SECONDS); }
/** * @see SpecialWikibasePage::execute * * @since 0.1 * * @param string|null $subPage */ public function execute($subPage) { parent::execute($subPage); $request = $this->getRequest(); $subPageParts = $subPage === '' ? array() : explode('/', $subPage, 2); $languageCode = $this->extractLanguageCode($request, $subPageParts); $label = $this->extractLabel($request, $subPageParts); $this->switchForm($languageCode, $label); // Display the result set if (isset($languageCode) && isset($label) && $label !== '') { // @todo We could have a LanguageCodeValidator or something and handle this // in the search interactor or some place else. if (!$this->contentLanguages->hasLanguage($languageCode)) { $this->showErrorHTML($this->msg('wikibase-itemdisambiguation-invalid-langcode')->escaped()); } else { $searchResults = $this->getSearchResults($label, $languageCode); if (!empty($searchResults)) { $this->displaySearchResults($searchResults, $label); } else { $this->showNothingFound($languageCode, $label); } } } }
/** * @since 0.4 */ public function __construct() { parent::__construct('EntityData'); }
/** * @see SpecialWikibasePage::execute * * @since 0.5 * * @param string|null $subPage */ public function execute($subPage) { parent::execute($subPage); $this->checkReadOnly(); $this->setHeaders(); $this->outputHeader(); try { $fromId = $this->getItemIdParam('fromid'); $toId = $this->getItemIdParam('toid'); $ignoreConflicts = $this->getStringListParam('ignoreconflicts'); $summary = $this->getTextParam('summary'); if ($fromId && $toId) { $this->mergeItems($fromId, $toId, $ignoreConflicts, $summary); } } catch (Exception $ex) { $this->showExceptionMessage($ex); } $this->createForm(); }
/** * @see SpecialWikibasePage::execute * * @since 0.5 * * @param string|null $subPage */ public function execute($subPage) { parent::execute($subPage); $this->checkReadOnly(); $this->setHeaders(); $this->outputHeader(); try { $fromId = $this->getEntityIdParam('fromid'); $toId = $this->getEntityIdParam('toid'); if ($fromId && $toId) { $this->redirectEntity($fromId, $toId); } } catch (Exception $ex) { $this->showExceptionMessage($ex); } $this->createForm(); }
/** * @since 0.5 * * @param string $title The title of the special page * @param string $restriction The required user right */ public function __construct($title, $restriction) { parent::__construct($title, $restriction); $wikibaseRepo = WikibaseRepo::getDefaultInstance(); $this->setSpecialWikibaseRepoPageServices($wikibaseRepo->getSummaryFormatter(), $wikibaseRepo->getEntityRevisionLookup('uncached'), $wikibaseRepo->getEntityTitleLookup(), $wikibaseRepo->getSiteStore(), $wikibaseRepo->newEditEntityFactory($this->getContext())); }
/** * @see SpecialWikibasePage::execute * * @param string|null $subPage */ public function execute($subPage) { parent::execute($subPage); list($site, $itemString) = $this->getArguments($subPage); if (!empty($site) || !empty($itemString)) { $url = $this->getTargetUrl($site, $itemString); if (null !== $url) { $this->getOutput()->redirect($url); return; } } $this->outputError(); $this->outputForm($site, $itemString); }