public function isActive()
 {
     return Versioned::current_stage() == 'Stage' && !(ClassInfo::exists('SiteTreeFutureState') && SiteTreeFutureState::get_future_datetime()) && !$this->isArchived();
 }
 function getHTML($page)
 {
     if (Versioned::current_stage() == 'Stage' && !(ClassInfo::exists('SiteTreeFutureState') && SiteTreeFutureState::get_future_datetime())) {
         return "<a class=\"current\">" . _t('ContentController.DRAFTSITE', 'Draft Site') . "</a>";
     } else {
         $draftPage = Versioned::get_one_by_stage('SiteTree', 'Stage', '"SiteTree"."ID" = ' . $page->ID);
         if ($draftPage) {
             $pageLink = Controller::join_links($draftPage->AbsoluteLink(), "?stage=Stage");
             return "<a href=\"{$pageLink}\" class=\"newWindow\" target=\"site\" style=\"left : -1px;\">" . _t('ContentController.DRAFTSITE', 'Draft Site') . "</a>";
         }
     }
 }
 function testManipulatingGroupsDuringAWorkflow()
 {
     $page = $this->objFromFixture('SiteTree', 'custompublisherpage');
     $custompublisher = $this->objFromFixture('Member', 'custompublisher');
     $customauthor = $this->objFromFixture('Member', 'customauthor');
     $customauthorgroup = $this->objFromFixture('Group', 'customauthorsgroup');
     // awaiting approval
     $customauthor->logIn();
     $request = $page->openOrNewWorkflowRequest('WorkflowPublicationRequest');
     // Asset publisher can publish but author cannot
     $this->assertFalse($page->canPublish($customauthor));
     $this->assertTrue($page->canPublish($custompublisher));
     // Add the author group, assert they can now publish
     $page->CanPublishType = 'OnlyTheseUsers';
     $page->write();
     $page->PublisherGroups()->add($customauthorgroup);
     SiteTreeFutureState::on_db_reset();
     $this->assertTrue($page->canPublish($customauthor));
     $custompublisher->logIn();
 }
	function isActive() {
		return (
			Versioned::current_stage() == 'Stage' 
			&& !(ClassInfo::exists('SiteTreeFutureState') && SiteTreeFutureState::get_future_datetime())
		);
	}
 function tearDown()
 {
     SiteTreeFutureState::set_future_datetime(null);
     Versioned::reading_stage('Stage');
     parent::tearDown();
     // Static publishing will just confuse things
     StaticPublisher::$disable_realtime = false;
 }
 function getLink($page)
 {
     if ($date = SiteTreeFutureState::get_future_datetime()) {
         return $page->AbsoluteLink() . '?futureDate=' . $date;
     }
 }