/** * @param FieldSet $actions * @parma SiteTree $page */ public static function update_cms_actions(&$actions, $page) { $openRequest = $page->OpenWorkflowRequest(); // if user doesn't have publish rights if (!$page->canPublish() || $openRequest) { // authors shouldn't be able to revert, as this republishes the page. // they should rather change the page and re-request publication $actions->removeByName('action_revert'); } // Remove the one click publish if they are not an admin/workflow admin. if (self::$force_publishers_to_use_workflow && !Permission::checkMember(Member::currentUser(), 'IS_WORKFLOW_ADMIN')) { $actions->removeByName('action_publish'); } // Remove the save & publish button if you don't have edit rights if (!$page->canEdit()) { $actions->removeByName('action_publish'); } $liveVersion = Versioned::get_one_by_stage('SiteTree', 'Live', "\"SiteTree_Live\".\"ID\" = {$page->ID}"); if ($liveVersion && $liveVersion->ExpiryDate != null && $liveVersion->ExpiryDate != '0000-00-00 00:00:00') { if ($page->canApprove()) { $actions->push(new FormAction('cms_cancelexpiry', _t('WorkflowPublicationRequest.BUTTONCANCELEXPIRY', 'Cancel expiry'))); } } // Optional method $isPublishable = $page->hasMethod('isPublishable') ? $page->isPublishable() : true; if (!$openRequest && $page->canEdit() && $isPublishable && $page->stagesDiffer('Stage', 'Live') && ($page->Version > 1 || $page->Title != "New Page") && !$page->IsDeletedFromStage && (!$page->canPublish() || self::$publisher_can_create_wf_requests)) { $actions->push($requestPublicationAction = new FormAction('cms_requestpublication', _t('SiteTreeCMSWorkflow.BUTTONREQUESTPUBLICATION', 'Request Publication'))); // don't allow creation of a second request by another author if (!self::can_create(null, $page)) { $actions->makeFieldReadonly($requestPublicationAction->Name()); } } }
/** * @param FieldSet $actions * @parma SiteTree $page */ public static function update_cms_actions(&$actions, $page) { $openRequest = $page->OpenWorkflowRequest(); // if user doesn't have publish rights, exchange the behavior from // "publish" to "request publish" etc. if (!$page->canDeleteFromLive() || $openRequest) { // "request removal" $actions->removeByName('action_deletefromlive'); } if (!$openRequest && $page->canEdit() && (!$page->canPublish() || self::$publisher_can_create_wf_requests) && $page->IsDeletedFromStage) { if ($page->ExistsOnLive) { $actions->push($requestDeletionAction = new FormAction('cms_requestdeletefromlive', _t('SiteTreeCMSWorkflow.BUTTONREQUESTREMOVAL', 'Request Removal'))); } // don't allow creation of a second request by another author if (!self::can_create(null, $page)) { $actions->makeFieldReadonly($requestDeletionAction->Name()); } } // @todo deny deletion }