getHTML($record); if($text) $items .= $text; $newMessage = $obj->getMessage($record); if($newMessage) $message = $newMessage; } return array( 'items' => $items, 'message' => $message ); } } /** * Navigator items are links that appear in the $SilverStripeNavigator bar. * To add an item, extends this class. * * @package cms * @subpackage content */ class SilverStripeNavigatorItem extends Object { function getHTML($page) {} function getMessage($page) {} } /** * @package cms * @subpackage content */ class SilverStripeNavigatorItem_CMSLink extends SilverStripeNavigatorItem { static $priority = 10; function getHTML($page) { if(is_a(Controller::curr(), 'CMSMain')) { return 'CMS'; } else { $cmsLink = 'admin/show/' . $page->ID; $cmsLink = "". _t('ContentController.CMS', 'CMS') .""; return $cmsLink; } } function getLink($page) { if(is_a(Controller::curr(), 'CMSMain')) { return Controller::curr()->AbsoluteLink('show') . $page->ID; } } } /** * @package cms * @subpackage content */ class SilverStripeNavigatorItem_StageLink extends SilverStripeNavigatorItem { static $priority = 20; function getHTML($page) { // TODO cmsworkflow module coupling if(Versioned::current_stage() == 'Stage' && !(ClassInfo::exists('SiteTreeFutureState') && SiteTreeFutureState::get_future_datetime())) { return "". _t('ContentController.DRAFTSITE', 'Draft Site') .""; } else { $draftPage = Versioned::get_one_by_stage('SiteTree', 'Stage', '"SiteTree"."ID" = ' . $page->ID); if($draftPage) { $pageLink = Controller::join_links($draftPage->AbsoluteLink(), "?stage=Stage"); return "". _t('ContentController.DRAFTSITE', 'Draft Site') .""; } } } function getMessage($page) { if(Versioned::current_stage() == 'Stage') { return "
"; } } function getLink($page) { if(Versioned::current_stage() == 'Stage') { return Controller::join_links($page->AbsoluteLink(), '?stage=Stage'); } } } /** * @package cms * @subpackage content */ class SilverStripeNavigatorItem_LiveLink extends SilverStripeNavigatorItem { static $priority = 30; function getHTML($page) { if(Versioned::current_stage() == 'Live') { return "". _t('ContentController.PUBLISHEDSITE', 'Published Site') .""; } else { $livePage = Versioned::get_one_by_stage('SiteTree', 'Live', '"SiteTree"."ID" = ' . $page->ID); if($livePage) { $pageLink = Controller::join_links($livePage->AbsoluteLink(), "?stage=Live"); return "". _t('ContentController.PUBLISHEDSITE', 'Published Site') .""; } } } function getMessage($page) { if(Versioned::current_stage() == 'Live') { return " "; } } function getLink($page) { if(Versioned::current_stage() == 'Live') { return Controller::join_links($page->AbsoluteLink(), '?stage=Live'); } } } /** * @package cms * @subpackage content */ class SilverStripeNavigatorItem_ArchiveLink extends SilverStripeNavigatorItem { static $priority = 40; function getHTML($page) { if(Versioned::current_archived_date()) { return "". _t('ContentController.ARCHIVEDSITE', 'Archived Site') .""; } else { // Display the archive link if the page currently displayed in the CMS is other version than live and draft $currentDraft = Versioned::get_one_by_stage('SiteTree', 'Draft', '"SiteTree"."ID" = ' . $page->ID); $currentLive = Versioned::get_one_by_stage('SiteTree', 'Live', '"SiteTree"."ID" = ' . $page->ID); if( (!$currentDraft || ($currentDraft && $page->Version != $currentDraft->Version)) && (!$currentLive || ($currentLive && $page->Version != $currentLive->Version)) ) { $pageLink = $page->AbsoluteLink(); return "LastEdited}\" class=\"newWindow\" target=\"site\" style=\"left : -3px;\">". _t('ContentController.ARCHIVEDSITE', 'Archived Site') .""; } } } function getMessage($page) { if($date = Versioned::current_archived_date()) { $dateObj = Object::create('Datetime'); $dateObj->setValue($date); return " "; } } function getLink($page) { if($date = Versioned::current_archived_date()) { return $page->AbsoluteLink() . '?archiveDate=' . $date; } } } ?>