public function executeIndex() { OasisController::addBodyClass('wikinav2'); $themeSettings = new ThemeSettings(); $settings = $themeSettings->getSettings(); $this->wordmarkText = $settings["wordmark-text"]; $this->wordmarkType = $settings["wordmark-type"]; $this->wordmarkSize = $settings["wordmark-font-size"]; $this->wordmarkFont = $settings["wordmark-font"]; if ($this->wordmarkType == "graphic") { wfProfileIn(__METHOD__ . 'graphicWordmarkV2'); $this->wordmarkUrl = wfReplaceImageServer($settings['wordmark-image-url'], SassUtil::getCacheBuster()); $imageTitle = Title::newFromText($themeSettings::WordmarkImageName,NS_IMAGE); if($imageTitle instanceof Title) { $attributes = array(); $file = wfFindFile($imageTitle); if($file instanceof File) { $attributes []= 'width="' . $file->width . '"'; $attributes []= 'height="' . $file->height. '"'; if(!empty($attributes)) { $this->wordmarkStyle = ' ' . implode(' ',$attributes) . ' '; } } } wfProfileOut(__METHOD__. 'graphicWordmarkV2'); } $this->mainPageURL = Title::newMainPage()->getLocalURL(); $this->displaySearch = !empty($this->wg->EnableAdminDashboardExt) && AdminDashboardLogic::displayAdminDashboard($this, $this->wg->Title); }
public function executeIndex() { OasisController::addBodyClass('wikinav2'); $themeSettings = new ThemeSettings(); $settings = $themeSettings->getSettings(); $this->wordmarkText = $settings["wordmark-text"]; $this->wordmarkType = $settings["wordmark-type"]; $this->wordmarkSize = $settings["wordmark-font-size"]; $this->wordmarkFont = $settings["wordmark-font"]; if ($this->wordmarkType == "graphic") { wfProfileIn(__METHOD__ . 'graphicWordmarkV2'); $this->wordmarkUrl = $themeSettings->getWordmarkUrl(); $imageTitle = Title::newFromText($themeSettings::WordmarkImageName, NS_IMAGE); if ($imageTitle instanceof Title) { $attributes = array(); $file = wfFindFile($imageTitle); if ($file instanceof File) { $attributes[] = 'width="' . $file->width . '"'; $attributes[] = 'height="' . $file->height . '"'; if (!empty($attributes)) { $this->wordmarkStyle = ' ' . implode(' ', $attributes) . ' '; } } } wfProfileOut(__METHOD__ . 'graphicWordmarkV2'); } $this->mainPageURL = Title::newMainPage()->getLocalURL(); $this->displaySearch = !empty($this->wg->EnableAdminDashboardExt) && AdminDashboardLogic::displayAdminDashboard($this, $this->wg->Title); $this->setVal('displayHeader', !$this->wg->HideNavigationHeaders); $this->displayHeaderButtons = !WikiaPageType::isWikiaHubMain(); }
/** * Show notifications */ public function executeIndex() { wfProfileIn(__METHOD__); // add testing notification /* self::addNotification('test test test test test test test test test test test test test test test test test test test test'); self::addNotification('new talk page', array(), self::NOTIFICATION_TALK_PAGE_MESSAGE); self::addNotification('test test <a href="#">test</a> test', array(), self::NOTIFICATION_COMMUNITY_MESSAGE); self::addNotification('test test test test test <details>test <a href="#">test</a> test</details>', array('points' => 10, 'picture' => '', 'name' => 'foo bar'), self::NOTIFICATION_NEW_ACHIEVEMENTS_BADGE); self::addNotification('custom notifiation', array( 'name' => 'foo-bar', 'dismissUrl' => '/index.php?action=test', ), self::NOTIFICATION_CUSTOM); /**/ // render notifications $this->notifications = self::$notificationsStack; // add CSS class to <body> (add padding to the bottom of article content) if (!empty($this->notifications)) { OasisController::addBodyClass('notifications'); } #var_dump($this->notifications); wfProfileOut(__METHOD__); }
public function Setup() { if (F::app()->checkSkin('venus')) { VenusController::addBodyClass('MiniEditor'); } else { OasisController::addBodyClass('MiniEditor'); } }
/** * Show notifications */ public function executeIndex() { // render notifications $this->notifications = self::$notificationsStack; // add CSS class to <body> (add padding to the bottom of article content) if (!empty($this->notifications)) { OasisController::addBodyClass('notifications'); } }
/** * This is the main search action. Special:Search points here. */ public function index() { $this->wg->Out->addHTML(F::build('JSSnippets')->addToStack(array("/extensions/wikia/Search/js/WikiaSearch.js"))); $this->wg->SuppressRail = true; $this->handleSkinSettings($this->wg->User->getSkin()); $searchConfig = F::build('WikiaSearchConfig'); $searchConfig->setQuery($this->getVal('query', $this->getVal('search')))->setCityId($this->wg->CityId)->setLimit($this->getVal('limit', self::RESULTS_PER_PAGE))->setPage($this->getVal('page', 1))->setRank($this->getVal('rank', 'default'))->setDebug($this->request->getBool('debug', false))->setSkipCache($this->request->getBool('skipCache', false))->setAdvanced($this->request->getBool('advanced', false))->setHub($this->getVal('nohub') != '1' ? $this->getVal('hub', false) : false)->setRedirs($searchConfig->getAdvanced() ? $this->request->getBool('redirs', false) : false)->setIsInterWiki($this->request->getBool('crossWikia', false) || $this->isCorporateWiki())->setVideoSearch($this->getVal('videoSearch', false))->setGroupResults($searchConfig->isInterWiki() || $this->getVal('grouped', false)); $this->setNamespacesFromRequest($searchConfig, $this->wg->User); if ($this->isCorporateWiki()) { OasisController::addBodyClass('inter-wiki-search'); } if ($searchConfig->getQueryNoQuotes(true)) { $articleMatch = null; $this->wikiaSearch->getArticleMatch($searchConfig); if ($searchConfig->getPage() == 1) { $this->handleArticleMatchTracking($searchConfig); } $this->wikiaSearch->doSearch($searchConfig); $this->app->wg->Out->setPageTitle($this->wf->msg('wikiasearch2-page-title-with-query', array(ucwords($searchConfig->getQuery(WikiaSearchConfig::QUERY_RAW)), $this->wg->Sitename))); } else { if ($searchConfig->getIsInterWiki()) { $this->app->wg->Out->setPageTitle($this->wf->msg('wikiasearch2-page-title-no-query-interwiki')); } else { $this->app->wg->Out->setPageTitle($this->wf->msg('wikiasearch2-page-title-no-query-intrawiki', array($this->wg->Sitename))); } } if (!$searchConfig->getIsInterWiki()) { $this->setVal('advancedSearchBox', $this->sendSelfRequest('advancedBox', array('config' => $searchConfig))); } $format = $this->response->getFormat(); if (($format == 'json' || $format == 'jsonp') && $searchConfig->getResultsFound() > 0) { $searchConfig->setResults($searchConfig->getResults()->toNestedArray()); } $this->setVal('results', $searchConfig->getResults()); $this->setVal('resultsFound', $searchConfig->getResultsFound()); $this->setVal('resultsFoundTruncated', $this->wg->Lang->formatNum($searchConfig->getTruncatedResultsNum())); $this->setVal('isOneResultsPageOnly', $searchConfig->getNumPages() < 2); $this->setVal('pagesCount', $searchConfig->getNumPages()); $this->setVal('currentPage', $searchConfig->getPage()); $this->setVal('paginationLinks', $this->sendSelfRequest('pagination', array('config' => $searchConfig))); $this->setVal('tabs', $this->sendSelfRequest('tabs', array('config' => $searchConfig))); $this->setVal('query', $searchConfig->getQuery(WikiaSearchConfig::QUERY_ENCODED)); $this->setVal('resultsPerPage', $searchConfig->getLimit()); $this->setVal('pageUrl', $this->wg->Title->getFullUrl()); $this->setVal('debug', $searchConfig->getDebug()); $this->setVal('solrHost', $this->wg->SolrHost); $this->setVal('isInterWiki', $searchConfig->getIsInterWiki()); $this->setVal('relevancyFunctionId', WikiaSearch::RELEVANCY_FUNCTION_ID); //@todo do we need this? $this->setVal('namespaces', $searchConfig->getNamespaces()); $this->setVal('hub', $searchConfig->getHub()); $this->setVal('hasArticleMatch', $searchConfig->hasArticleMatch()); $this->setVal('isMonobook', $this->wg->User->getSkin() instanceof SkinMonobook); $this->setVal('isCorporateWiki', $this->isCorporateWiki()); }
/** * @desc Template for wrapper containing Weebo / Admin Toolbar */ public function index() { if ($this->isWikiaBarSuppressed()) { $this->wgSuppressWikiaBar = true; OasisController::addBodyClass('nowikiabar'); } $this->lang = F::app()->wg->contLang->getCode(); if (WikiaPageType::isWikiaHub()) { $this->vertical = HubService::getCategoryInfoForCurrentPage()->cat_id; } else { $this->vertical = HubService::getCategoryInfoForCity(F::app()->wg->cityId)->cat_id; } }
/** * Render HTML for whole edit page */ public function executeIndex() { // render edit page content $body = $this->app->renderView('EditPageLayout', 'EditPage'); // page has one column OasisController::addBodyClass('oasis-one-column'); // adding 'editor' class as a CSS helper OasisController::addBodyClass('editor'); // temporary grid transition code, remove after transition OasisController::addBodyClass('WikiaGrid'); // render Oasis module $this->html = F::app()->renderView('Oasis', 'Index', array('body' => $body)); }
public function Index() { global $wgUser, $wgEnableWallExt, $wgEnableForumExt; wfProfileIn(__METHOD__); $loggedIn = $wgUser->isLoggedIn(); $suppressWallNotifications = $this->areNotificationsSuppressedByExtensions(); if ($loggedIn && !$suppressWallNotifications) { OasisController::addSkinAssetGroup('wall_notifications_js'); $this->response->addAsset('extensions/wikia/WallNotifications/styles/WallNotifications.scss'); $this->response->setVal('prehide', empty($wgEnableWallExt) && empty($wgEnableForumExt)); } $this->response->setVal('loggedIn', $loggedIn); $this->response->setVal('suppressWallNotifications', $suppressWallNotifications); wfProfileOut(__METHOD__); }
/** * Display the Video Home Page * @responseParam boolean haveProgram * @responseParam string featuredContent * @responseParam string categoryContent * @responseParam string fanContent * @responseParam string popularContent */ public function index() { OasisController::addBodyClass('WikiaVideo'); $this->response->addAsset('videohomepage_js'); $this->response->addAsset('videohomepage_scss'); $this->response->addAsset('videohomepage_css'); $program = $this->getProgram(); if ($program instanceof VideoPageToolProgram && $program->exists()) { $this->haveProgram = true; $this->featuredContent = $this->app->renderView('VideoHomePage', 'featured'); $this->categoryContent = $this->app->renderView('VideoHomePage', 'category'); // $this->fanContent = $this->app->renderView( 'VideoHomePage', 'fan' ); // $this->popularContent = $this->app->renderView( 'VideoHomePage', 'popular' ); } else { $this->haveProgram = false; } }
public static function onOutputPageBeforeHTML($out, $text) { $category = HubService::getComscoreCategory(F::app()->wg->cityId); switch ($category->cat_id) { case WikiFactoryHub::CATEGORY_ID_ENTERTAINMENT: $categoryName = 'WikiaHubsEntertainment'; break; case WikiFactoryHub::CATEGORY_ID_GAMING: $categoryName = 'WikiaHubsVideoGames'; break; case WikiFactoryHub::CATEGORY_ID_LIFESTYLE: $categoryName = 'WikiaHubsLifestyle'; break; default: $categoryName = 'Wikia'; break; } OasisController::addBodyClass($categoryName); return true; }
public static function onBeforePageDisplay(OutputPage &$out, &$skin) { OasisController::addBodyClass('wikia-contentlang-' . self::getContentLang()); return true; }
/** * @desc Sets hubs specific settings: page title, hub type, vertical body class */ protected function initVerticalSettings() { $this->wg->out->setPageTitle($this->verticalName); if ($this->format != 'json') { $this->wgWikiaHubType = $this->verticalName; } RequestContext::getMain()->getRequest()->setVal('vertical', $this->verticalName); OasisController::addBodyClass('WikiaHubs' . mb_ereg_replace(' ', '', $this->verticalName)); }
/** * Render header for edit page */ public function executeEditPage() { global $wgTitle, $wgRequest, $wgSuppressToolbar, $wgShowMyToolsOnly, $wgEnableWallExt; wfProfileIn(__METHOD__); // special handling for special pages (CreateBlogPost, CreatePage) $ns = $wgTitle->getNamespace(); if ($ns == NS_SPECIAL) { wfProfileOut(__METHOD__); return; } // detect section edit $isSectionEdit = is_numeric($wgRequest->getVal('section')); // show proper message in the header $action = $wgRequest->getVal('action', 'view'); $isPreview = $wgRequest->getCheck('wpPreview') || $wgRequest->getCheck('wpLivePreview'); $isShowChanges = $wgRequest->getCheck('wpDiff'); $isDiff = !is_null($wgRequest->getVal('diff')); // RT #69931 $isEdit = in_array($action, array('edit', 'submit')); $isHistory = $action == 'history'; /** start of wikia changes @author nAndy */ $this->isHistory = $isHistory; $this->isUserTalkArchiveModeEnabled = !empty($wgEnableWallExt) && $ns == NS_USER_TALK; /** end of wikia changes */ // add editor's right rail when not editing main page if (!Wikia::isMainPage()) { OasisController::addBodyClass('editor-rail'); } // hide floating toolbar when on edit page / in preview mode / show changes if ($isEdit || $isPreview) { $wgSuppressToolbar = true; } // choose header message if ($isPreview) { $titleMsg = 'oasis-page-header-preview'; } else { if ($isShowChanges) { $titleMsg = 'oasis-page-header-changes'; } else { if ($isDiff) { $titleMsg = 'oasis-page-header-diff'; } else { if ($isSectionEdit) { $titleMsg = 'oasis-page-header-editing-section'; } else { if ($isHistory) { $titleMsg = 'oasis-page-header-history'; } else { $titleMsg = 'oasis-page-header-editing'; } } } } } $this->displaytitle = true; $this->title = wfMsg($titleMsg, htmlspecialchars($wgTitle->getPrefixedText())); // back to article link if (!$isPreview && !$isShowChanges) { $this->subtitle = Wikia::link($wgTitle, wfMsg('oasis-page-header-back-to-article'), array('accesskey' => 'c'), array(), 'known'); } // add edit button if ($isDiff || $isHistory && !$this->isUserTalkArchiveModeEnabled) { $this->prepareActionButton(); // show only "My Tools" dropdown on toolbar $wgShowMyToolsOnly = true; } // render edit dropdown / commments chicklet on history pages if ($isHistory) { // FB#1137 - re-add missing log and undelete links $logPage = SpecialPage::getTitleFor('Log'); $this->subtitle .= ' | ' . Wikia::link($logPage, wfMsgHtml('viewpagelogs'), array(), array('page' => $wgTitle->getPrefixedText()), array('known', 'noclasses')); // FIXME: Skin is now an abstract class (MW1.19) // (wladek) created non-abstract FakeSkin class, is it the correct solution? $sk = new FakeSkin(); $sk->setRelevantTitle($wgTitle); $undeleteLink = $sk->getUndeleteLink(); if (!empty($undeleteLink)) { $this->subtitle .= ' | ' . $undeleteLink; } // dropdown actions $this->dropdown = $this->getDropdownActions(); // use service to get data $service = new PageStatsService($wgTitle->getArticleId()); // comments $this->comments = $service->getCommentsCount(); } wfRunHooks('PageHeaderEditPage', array(&$this, $ns, $isPreview, $isShowChanges, $isDiff, $isEdit, $isHistory)); wfProfileOut(__METHOD__); }
public function init() { $this->response->addAsset('wampage_scss'); $this->response->addAsset('wampage_js'); OasisController::addBodyClass('WAMPage'); }
public function executeIndex() { global $wgOut, $wgTitle, $wgEnableInfoBoxTest, $wgMaximizeArticleAreaArticleIds, $wgEnableAdminDashboardExt, $wgEnableWikiaHomePageExt; wfProfileIn(__METHOD__); // set up global vars if (is_array($wgMaximizeArticleAreaArticleIds) && in_array($wgTitle->getArticleId(), $wgMaximizeArticleAreaArticleIds)) { $this->wg->SuppressRail = true; $this->wg->SuppressPageHeader = true; } // Double-click to edit $this->body_ondblclick = ''; // FIXME handling moved to OutputPage::addDefaultModules() // InfoBox - Testing $this->wg->EnableInfoBoxTest = $wgEnableInfoBoxTest; // Replaces ContentDisplayModule->index() $this->bodytext = $this->app->getSkinTemplateObj()->data['bodytext']; $this->railModuleList = $this->getRailModuleList(); // this hook allows adding extra HTML just after <body> opening tag // append your content to $html variable instead of echoing // (taken from Monaco skin) $skin = RequestContext::getMain()->getSkin(); $afterBodyHtml = ''; wfRunHooks('GetHTMLAfterBody', array($skin, &$afterBodyHtml)); $this->afterBodyHtml = $afterBodyHtml; // this hook is needed for SMW's factbox $afterContentHookText = ''; wfRunHooks('SkinAfterContent', array(&$afterContentHookText)); $this->afterContentHookText = $afterContentHookText; $this->headerModuleAction = 'Index'; $this->headerModuleParams = array('showSearchBox' => false); // show user pages header on this page? if (self::showUserPagesHeader()) { $this->headerModuleName = 'UserPagesHeader'; // is this page a blog post? if (self::isBlogPost()) { $this->headerModuleAction = 'BlogPost'; } else { if (self::isBlogListing()) { $this->headerModuleAction = 'BlogListing'; } } // show corporate header on this page? } else { if (WikiaPageType::isCorporatePage() || WikiaPageType::isWikiaHub()) { $this->headerModuleName = 'PageHeader'; if (self::isEditPage()) { $this->headerModuleAction = 'EditPage'; } else { $this->headerModuleAction = 'Corporate'; } if (WikiaPageType::isWikiaHubMain()) { $this->headerModuleAction = 'Hubs'; } elseif (WikiaPageType::isMainPage()) { $this->wg->SuppressFooter = true; $this->wg->SuppressArticleCategories = true; $this->wg->SuppressPageHeader = true; $this->wg->SuppressWikiHeader = true; $this->wg->SuppressSlider = true; } } else { $this->headerModuleName = 'PageHeader'; if (self::isEditPage()) { $this->headerModuleAction = 'EditPage'; } } } // Display Control Center Header on certain special pages if (!empty($wgEnableAdminDashboardExt) && AdminDashboardLogic::displayAdminDashboard($this->app, $wgTitle)) { $this->headerModuleName = null; $this->wgSuppressAds = true; $this->displayAdminDashboard = true; $this->displayAdminDashboardChromedArticle = $wgTitle->getText() != SpecialPage::getTitleFor('AdminDashboard')->getText(); } else { $this->displayAdminDashboard = false; $this->displayAdminDashboardChromedArticle = false; } $this->railModulesExist = true; // use one column layout for pages with no right rail modules if (count($this->railModuleList) == 0 || !empty($this->wg->SuppressRail)) { // Special:AdminDashboard doesn't need this class, but pages chromed with it do if (!$this->displayAdminDashboard || $this->displayAdminDashboardChromedArticle) { OasisController::addBodyClass('oasis-one-column'); } $this->headerModuleParams = array('showSearchBox' => true); $this->railModulesExist = false; } // determine if WikiaGridLayout needs to be enabled $this->isGridLayoutEnabled = self::isGridLayoutEnabled(); if ($this->isGridLayoutEnabled) { OasisController::addBodyClass('wikia-grid'); } if ($this->isOasisBreakpoints()) { OasisController::addBodyClass('oasis-breakpoints'); } //@TODO remove this check after deprecating responsive (July 2015) if ($this->isResponsiveLayoutEnabled()) { OasisController::addBodyClass('oasis-responsive'); } // if we are on a special search page, pull in the css file and don't render a header if ($wgTitle && $wgTitle->isSpecial('Search') && !$this->wg->WikiaSearchIsDefault) { $wgOut->addStyle(AssetsManager::getInstance()->getSassCommonURL("skins/oasis/css/modules/SpecialSearch.scss")); $this->headerModuleName = null; } // Inter-wiki search if ($wgTitle && ($wgTitle->isSpecial('WikiaSearch') || $wgTitle->isSpecial('Search') && $this->wg->WikiaSearchIsDefault)) { $this->headerModuleName = null; } // load CSS for Special:Preferences if (!empty($wgTitle) && $wgTitle->isSpecial('Preferences')) { $wgOut->addStyle(AssetsManager::getInstance()->getSassCommonURL('skins/oasis/css/modules/SpecialPreferences.scss')); } // load CSS for Special:Upload if (!empty($wgTitle) && $wgTitle->isSpecial('Upload')) { $wgOut->addStyle(AssetsManager::getInstance()->getSassCommonURL('skins/oasis/css/modules/SpecialUpload.scss')); } // load CSS for Special:MultipleUpload if (!empty($wgTitle) && $wgTitle->isSpecial('MultipleUpload')) { $wgOut->addStyle(AssetsManager::getInstance()->getSassCommonURL('skins/oasis/css/modules/SpecialMultipleUpload.scss')); } // load CSS for Special:Allpages if (!empty($wgTitle) && $wgTitle->isSpecial('Allpages')) { $wgOut->addStyle(AssetsManager::getInstance()->getSassCommonURL('skins/oasis/css/modules/SpecialAllpages.scss')); } // Forum Extension if (!empty($this->wg->EnableForumExt) && ForumHelper::isForum()) { $this->wg->SuppressPageHeader = true; } // MonetizationModule Extension if (!empty($this->wg->EnableMonetizationModuleExt)) { if (empty($this->wg->AdDriverUseMonetizationService)) { $this->monetizationModules = $this->sendRequest('MonetizationModule', 'index')->getData()['data']; $this->headerModuleParams['monetizationModules'] = $this->monetizationModules; } else { $this->monetizationModules = [MonetizationModuleHelper::SLOT_TYPE_IN_CONTENT => $this->app->renderView('Ad', 'Index', ['slotName' => 'MON_IN_CONTENT']), MonetizationModuleHelper::SLOT_TYPE_BELOW_CATEGORY => $this->app->renderView('Ad', 'Index', ['slotName' => 'MON_BELOW_CATEGORY'])]; } $this->bodytext = MonetizationModuleHelper::insertIncontentUnit($this->bodytext, $this->monetizationModules); } $namespace = $wgTitle->getNamespace(); // extra logic for subpages (RT #74091) if (!empty($this->subtitle)) { switch ($namespace) { // for user subpages add link to theirs talk pages case NS_USER: $talkPage = $wgTitle->getTalkPage(); // get number of revisions for talk page $service = new PageStatsService($wgTitle->getArticleId()); $comments = $service->getCommentsCount(); // render comments bubble $bubble = F::app()->renderView('CommentsLikes', 'Index', array('comments' => $comments, 'bubble' => true)); $this->subtitle .= ' | '; $this->subtitle .= $bubble; $this->subtitle .= Wikia::link($talkPage); break; case NS_USER_TALK: $subjectPage = $wgTitle->getSubjectPage(); $this->subtitle .= ' | '; $this->subtitle .= Wikia::link($subjectPage); break; } } // bugid-70243: optionally hide navigation h1s for SEO $this->setVal('displayHeader', !$this->wg->HideNavigationHeaders); wfProfileOut(__METHOD__); }
public static function onArticleFromTitle(&$title) { $currentNs = MWNamespace::getSubject($title->getNamespace()); if ($currentNs == NS_WIKIA_FORUM_BOARD || $currentNs == NS_WIKIA_FORUM_TOPIC_BOARD || $currentNs == NS_WIKIA_FORUM_BOARD_THREAD) { OasisController::addBodyParameter(' itemscope itemtype="http://schema.org/WebPage"'); } return true; }
public function Setup() { OasisController::addBodyClass('MiniEditor'); }
/** * Render template for <body> tag content */ public function executeEditPage() { wfProfileIn(__METHOD__); $helper = EditPageLayoutHelper::getInstance(); $editPage = $helper->getEditPage(); $this->showPreview = true; if ($helper->fullScreen) { $wgJsMimeType = $this->wg->JsMimeType; // add stylesheet $this->wg->Out->addStyle(AssetsManager::getInstance()->getSassCommonURL('extensions/wikia/EditPageLayout/css/EditPageLayout.scss')); if ($helper->isCodeSyntaxHighlightingEnabled($editPage->getTitle())) { $this->wg->Out->addScript("<script type=\"{$wgJsMimeType}\" src=\"/resources/Ace/ace.js\"></script>"); $srcs = AssetsManager::getInstance()->getGroupCommonURL('ace_editor_js'); OasisController::addBodyClass('codeeditor'); $this->showPreview = $helper->isCodePageWithPreview($editPage->getTitle()); } else { $packageName = 'epl'; if (class_exists('RTE') && RTE::isEnabled() && !$editPage->isReadOnlyPage()) { $packageName = 'eplrte'; } $srcs = AssetsManager::getInstance()->getGroupCommonURL($packageName); } foreach ($srcs as $src) { $this->wg->Out->addScript("<script type=\"{$wgJsMimeType}\" src=\"{$src}\"></script>"); } } // render WikiLogo $response = $this->app->sendRequest('WikiHeader', 'Wordmark'); // move wordmark data $this->wordmark = $response->getData(); // render global and user navigation $this->header = F::app()->renderView('GlobalNavigation', 'index'); // Editing [foo] $this->title = $editPage->getEditedTitle(); $section = $this->wg->Request->getVal('section'); // Is user logged in? $this->isLoggedIn = $this->wg->User->isLoggedIn(); // Can the user minor edit? $this->canMinorEdit = $this->title->exists() && $this->isLoggedIn && $this->wg->User->isAllowed('minoredit'); // Text for Edit summary label $wpSummaryLabelText = 'editpagelayout-edit-summary-label'; // Should show mobile preview icon $this->showMobilePreview = $helper->showMobilePreview($editPage->getTitle()); if ($section == 'new') { $msgKey = 'editingcomment'; // If adding new section to page, change label text (BugId: 7243) $wpSummaryLabelText = 'editpagelayout-subject-headline-label'; } else { if (is_numeric($section)) { $msgKey = 'editingsection'; } else { $msgKey = 'editing'; } } // title $this->titleText = $this->title->getPrefixedText(); if ($this->titleText == '') { $this->titleText = ' '; } // limit title length if (mb_strlen($this->titleText) > self::TITLE_MAX_LENGTH) { $this->titleShortText = htmlspecialchars(mb_substr($this->titleText, 0, self::TITLE_MAX_LENGTH)) . '…'; } else { $this->titleShortText = htmlspecialchars($this->titleText); } $this->editing = wfMessage($msgKey, '')->escaped(); $this->wpSummaryLabelText = wfMessage($wpSummaryLabelText)->escaped(); // render help link and point the link to new tab $this->helpLink = wfMessage('editpagelayout-helpLink')->parse(); $this->helpLink = str_replace('<a ', '<a target="_blank" ', $this->helpLink); // action for edit form $this->editFormAction = $editPage->getFormAction(); // preloads $this->editPagePreloads = $editPage->getEditPagePreloads(); // minor edit checkbox (BugId:6461) $this->minorEditCheckbox = !empty($editPage->minoredit); // summary box $this->summaryBox = $editPage->renderSummaryBox(); // extra checkboxes $this->customCheckboxes = $editPage->getCustomCheckboxes(); // dismissable notifications $this->notices = $editPage->getNotices(); $this->noticesHtml = $editPage->getNoticesHtml(); // notifications link (BugId:7951) $this->notificationsLink = count($this->notices) == 0 ? wfMessage('editpagelayout-notificationsLink-none')->escaped() : wfMessage('editpagelayout-notificationsLink', count($this->notices))->parse(); // check if we're in read only mode // disable edit form when in read-only mode if (wfReadOnly()) { $this->bodytext = '<div id="mw-read-only-warning" class="WikiaArticle">' . wfMessage('oasis-editpage-readonlywarning', wfReadOnlyReason())->escaped() . '</div>'; wfDebug(__METHOD__ . ": edit form disabled because read-only mode is on\n"); } $this->hideTitle = $editPage->hideTitle; wfRunHooks('EditPageLayoutExecute', array($this)); wfProfileOut(__METHOD__); }
/** * Called in index action to manipulate the view based on the user's skin * @return boolean true */ protected function handleSkinSettings() { global $wgCityId; $this->wg->Out->addHTML(JSSnippets::addToStack(array("/extensions/wikia/Search/js/WikiaSearch.js"))); $this->wg->SuppressRail = true; if ($this->isCorporateWiki()) { OasisController::addBodyClass('inter-wiki-search'); $this->setVal('corporateWikiId', $wgCityId); $this->overrideTemplate('CrossWiki_index'); } $skin = $this->wg->User->getSkin(); if ($skin instanceof SkinMonoBook) { $this->response->addAsset('extensions/wikia/Search/monobook/monobook.scss'); } if ($skin instanceof SkinOasis || $skin instanceof SkinVenus) { $this->response->addAsset('extensions/wikia/Search/css/WikiaSearch.scss'); } if ($skin instanceof SkinWikiaMobile) { $this->overrideTemplate('WikiaMobileIndex'); } return true; }
public function __construct() { parent::__construct('Forum', '', false); OasisController::addBodyParameter('itemscope itemtype="http://schema.org/WebPage"'); }
/** * @param OutputPage $out * @param $text * * Add needed messages to page and add JS assets * * @return bool */ public static function onOutputPageBeforeHTML(OutputPage $out, &$text) { $app = F::app(); $wg = $app->wg; $request = $app->wg->Request; $title = $wg->Title; $am = AssetsManager::getInstance(); $relatedPagesGroupName = 'relatedpages_js'; if ($out->isArticle() && $request->getVal('action', 'view') == 'view') { JSMessages::enqueuePackage('RelatedPages', JSMessages::INLINE); if (!(Wikia::isMainPage() || !empty($title) && !in_array($title->getNamespace(), $wg->ContentNamespaces)) && !$app->checkSkin('wikiamobile') && $am->checkIfGroupForSkin($relatedPagesGroupName, $out->getSkin())) { if ($app->checkSkin('oasis')) { OasisController::addSkinAssetGroup($relatedPagesGroupName); } else { $scripts = $am->getURL($relatedPagesGroupName); foreach ($scripts as $script) { $wg->Out->addScript("<script src='{$script}'></script>"); } } } } return true; }
public function executeIndex() { global $wgOut, $wgTitle, $wgUser, $wgEnableCorporatePageExt, $wgEnableInfoBoxTest, $wgMaximizeArticleAreaArticleIds, $wgEnableAdminDashboardExt, $wgEnableTopButton, $wgTopButtonPosition, $wgEnableWikiaHomePageExt; wfProfileIn(__METHOD__); // set up global vars if (is_array($wgMaximizeArticleAreaArticleIds) && in_array($wgTitle->getArticleId(), $wgMaximizeArticleAreaArticleIds)) { $this->wg->SuppressRail = true; $this->wg->SuppressPageHeader = true; } // Double-click to edit $this->body_ondblclick = ''; // FIXME handling moved to OutputPage::addDefaultModules() // InfoBox - Testing $this->wg->EnableInfoBoxTest = $wgEnableInfoBoxTest; $this->isMainPage = WikiaPageType::isMainPage(); // Replaces ContentDisplayModule->index() $this->bodytext = $this->app->getSkinTemplateObj()->data['bodytext']; $this->railModuleList = $this->getRailModuleList(); // this hook allows adding extra HTML just after <body> opening tag // append your content to $html variable instead of echoing // (taken from Monaco skin) $skin = RequestContext::getMain()->getSkin(); $afterBodyHtml = ''; wfRunHooks('GetHTMLAfterBody', array($skin, &$afterBodyHtml)); $this->afterBodyHtml = $afterBodyHtml; // this hook is needed for SMW's factbox $afterContentHookText = ''; wfRunHooks('SkinAfterContent', array( &$afterContentHookText ) ); $this->afterContentHookText = $afterContentHookText; $this->headerModuleAction = 'Index'; $this->headerModuleParams = array ('showSearchBox' => false); // show user pages header on this page? if (self::showUserPagesHeader()) { $this->headerModuleName = 'UserPagesHeader'; // is this page a blog post? if( self::isBlogPost() ) { $this->headerModuleAction = 'BlogPost'; } // is this page a blog listing? else if (self::isBlogListing()) { $this->headerModuleAction = 'BlogListing'; } } else { $this->headerModuleName = 'PageHeader'; if (self::isEditPage()) { $this->headerModuleAction = 'EditPage'; } // FIXME: move to separate module if ( $wgEnableWikiaHomePageExt && WikiaPageType::isMainPage() ) { $this->wg->SuppressFooter = true; $this->wg->SuppressArticleCategories = true; $this->wg->SuppressPageHeader = true; $this->wg->SuppressWikiHeader = true; $this->wg->SuppressSlider = true; } else if ($wgEnableCorporatePageExt) { // RT:71681 AutoHubsPages extension is skipped when follow is clicked $wgOut->addStyle(AssetsManager::getInstance()->getSassCommonURL("extensions/wikia/CorporatePage/css/CorporateSite.scss")); global $wgExtensionsPath, $wgJsMimeType; $wgOut->addScript("<script src=\"{$wgExtensionsPath}/wikia/CorporatePage/js/CorporateSlider.js\" type=\"{$wgJsMimeType}\"></script>"); // $this->wgSuppressFooter = true; $this->wgSuppressArticleCategories = true; if (WikiaPageType::isMainPage()) { $this->wg->SuppressPageHeader = true; } else { $this->headerModuleAction = 'Corporate'; } } } $this->railModulesExist = true; // use one column layout for pages with no right rail modules if( count($this->railModuleList ) == 0 || !empty($this->wg->SuppressRail) ) { OasisController::addBodyClass('oasis-one-column'); $this->headerModuleParams = array ('showSearchBox' => true); $this->railModulesExist = false; } // determine if WikiaGridLayout needs to be enabled $this->isGridLayoutEnabled = self::isGridLayoutEnabled(); if($this->isGridLayoutEnabled) { OasisController::addBodyClass('wikia-grid'); } // if we are on a special search page, pull in the css file and don't render a header if($wgTitle && $wgTitle->isSpecial( 'Search' ) && !$this->wg->WikiaSearchIsDefault) { $wgOut->addStyle(AssetsManager::getInstance()->getSassCommonURL("skins/oasis/css/modules/SpecialSearch.scss")); $this->headerModuleName = null; $this->bodytext = F::app()->renderView('Search', "Index'") . $this->bodytext; } // Inter-wiki search if($wgTitle && ($wgTitle->isSpecial( 'WikiaSearch' ) || ($wgTitle->isSpecial( 'Search' ) && $this->wg->WikiaSearchIsDefault ))) { $this->headerModuleName = null; } // load CSS for Special:Preferences if (!empty($wgTitle) && $wgTitle->isSpecial('Preferences')) { $wgOut->addStyle(AssetsManager::getInstance()->getSassCommonURL('skins/oasis/css/modules/SpecialPreferences.scss')); } // load CSS for Special:Upload if (!empty($wgTitle) && $wgTitle->isSpecial('Upload')) { $wgOut->addStyle(AssetsManager::getInstance()->getSassCommonURL('skins/oasis/css/modules/SpecialUpload.scss')); } // load CSS for Special:Allpages if (!empty($wgTitle) && $wgTitle->isSpecial('Allpages')) { $wgOut->addStyle(AssetsManager::getInstance()->getSassCommonURL('skins/oasis/css/modules/SpecialAllpages.scss')); } // Display Control Center Header on certain special pages if (!empty($wgEnableAdminDashboardExt) && AdminDashboardLogic::displayAdminDashboard($this->app, $wgTitle)) { $this->headerModuleName = null; $this->wgSuppressAds = true; $this->displayAdminDashboard = true; $this->displayAdminDashboardChromedArticle = ($wgTitle->getText() != Title::newFromText("AdminDashboard", NS_SPECIAL)->getText()); } else { $this->displayAdminDashboard = false; $this->displayAdminDashboardChromedArticle = false; } // Forum Extension if (!empty($this->wg->EnableForumExt) && !empty($this->wg->IsForum)) { $this->wg->SuppressPageHeader = true; } $namespace = $wgTitle->getNamespace(); // extra logic for subpages (RT #74091) if (!empty($this->subtitle)) { switch($namespace) { // for user subpages add link to theirs talk pages case NS_USER: $talkPage = $wgTitle->getTalkPage(); // get number of revisions for talk page $service = new PageStatsService($wgTitle->getArticleId()); $comments = $service->getCommentsCount(); // render comments bubble $bubble = F::app()->renderView('CommentsLikes', 'Index', array('comments' => $comments, 'bubble' => true)); $this->subtitle .= ' | '; $this->subtitle .= $bubble; $this->subtitle .= Wikia::link($talkPage); break; case NS_USER_TALK: $subjectPage = $wgTitle->getSubjectPage(); $this->subtitle .= ' | '; $this->subtitle .= Wikia::link($subjectPage); break; } } wfProfileOut(__METHOD__); }