public function executeIndex() { global $wgCityId, $wgUser, $wgIsPrivateWiki, $wgEnableAdminDashboardExt, $wgTitle; //fb#1090 $this->isInternalWiki = empty($wgCityId); $this->showMenu = !(($this->isInternalWiki || $wgIsPrivateWiki) && $wgUser->isAnon()); if($wgUser->isAllowed('editinterface')) { $editURL['href'] = Title::newFromText('Wiki-navigation', NS_MEDIAWIKI)->getFullURL(); $editURL['text'] = wfMsg('oasis-edit-this-menu'); $this->editURL = $editURL; } $service = new NavigationService(); $this->menuNodes = $service->parseMessage('Wiki-navigation', array(4, 7, 7), 60*60*3 /* 3 hours */, true); $this->displaySearch = !empty($wgEnableAdminDashboardExt) && AdminDashboardLogic::displayAdminDashboard(F::app(), $wgTitle); }
public function init() { global $wgCityId; $this->app->wf->ProfileIn(__METHOD__); $category = WikiFactory::getCategory($wgCityId); $messageName = 'shared-Globalnavigation'; if ($category) { $messageNameWithCategory = $messageName . '-' . $category->cat_id; if (!wfEmptyMsg($messageNameWithCategory, wfMsg($messageNameWithCategory))) { $messageName = $messageNameWithCategory; } } $navigation = new NavigationService(true /* useSharedMemcKey */); $menuNodes = $navigation->parseMessage($messageName, array(3, 4, 5), 10800 /* 3 hours */); wfRunHooks('AfterGlobalHeader', array(&$menuNodes, $category, $messageName)); $this->menuNodes = $menuNodes; $this->app->wf->ProfileOut(__METHOD__); }
/** * Deals with GET actions for checkedout documents. */ public function GET_action() { $RepositoryService = new RepositoryService(); $NavigationService = new NavigationService(KT_cmis_atom_service_helper::getKt()); $repositories = $RepositoryService->getRepositories(); $repositoryId = $repositories[0]['repositoryId']; $checkedout = $NavigationService->getCheckedOutDocs($repositoryId); //print_r($checkedout);exit; //Create a new response feed $feed = new KT_cmis_atom_responseFeed_GET(CMIS_APP_BASE_URI); $workspace = $feed->getWorkspace(); $feed->newField('title', 'Checked out Documents', $feed); // TODO dynamic? $feedElement = $feed->newField('author'); $element = $feed->newField('name', 'admin', $feedElement); $feed->appendChild($feedElement); $feed->appendChild($feed->newElement('id', 'urn:uuid:checkedout')); // TODO get actual most recent update time, only use current if no other available $feed->appendChild($feed->newElement('updated', KT_cmis_atom_service_helper::formatDatestamp())); $link = $feed->newElement('link'); $link->appendChild($feed->newAttr('rel', 'self')); $link->appendChild($feed->newAttr('href', CMIS_APP_BASE_URI . $workspace . '/checkedout')); $feed->appendChild($link); $link = $feed->newElement('link'); $link->appendChild($feed->newAttr('rel', 'first')); $link->appendChild($feed->newAttr('href', CMIS_APP_BASE_URI . $workspace . '/checkedout/pageNo=1&pageSize=0')); $link->appendChild($feed->newAttr('type', 'application/atom+xml;type=feed')); $feed->appendChild($link); $link = $feed->newElement('link'); $link->appendChild($feed->newAttr('rel', 'last')); // TODO set page number correctly - to be done when we support paging the the API $link->appendChild($feed->newAttr('href', CMIS_APP_BASE_URI . $workspace . '/checkedout/pageNo=1&pageSize=0')); $link->appendChild($feed->newAttr('type', 'application/atom+xml;type=feed')); $feed->appendChild($link); foreach ($checkedout as $cmisEntry) { KT_cmis_atom_service_helper::createObjectEntry($feed, $cmisEntry, $folderName, true); // // after each entry, add app:edited tag // $feed->newField('app:edited', KT_cmis_atom_service_helper::formatDatestamp(), $feed); } $feed->newField('cmis:hasMoreItems', 'false', $feed); // $entry = null; // $feed->newField('cmis:hasMoreItems', 'false', $entry, true); //Expose the responseFeed $this->responseFeed = $feed; }
/** * Clear local wikinav cache when local version of global menu * is modified using WikiFactory * * @param string $cv_name WF variable name * @param int $city_id wiki ID * @param mixed $value new variable value * @return bool return true */ public static function onWikiFactoryChanged($cv_name , $city_id, $value) { global $wgMemc; if ($cv_name == WikiNavigationService::WIKIA_GLOBAL_VARIABLE) { $service = new NavigationService(); $memcKey = $service->getMemcKey(WikiNavigationService::WIKIA_GLOBAL_VARIABLE, $city_id); wfDebug(__METHOD__ . ": purging the cache for wiki #{$city_id}\n"); $wgMemc->delete($memcKey); } return true; }
function testParseErrors() { global $wgOasisNavV2; if (empty($wgOasisNavV2)) { $this->markTestSkipped('wgOasisNavV2 set to false'); return; } $service = new NavigationService(); $this->assertEmpty($service->getErrors()); // magic words are not allowed on level #1 $nodes = $service->parseText("*#category1"); $this->assertTrue(count($service->getErrors()) == 1); // magic words are allowed on level #2 $nodes = $service->parseText("*foo\n**#category1"); $this->assertEmpty($service->getErrors()); }