diff --git a/code/CMSMain.php b/code/CMSMain.php index fd6f5b03..fe7cff93 100644 --- a/code/CMSMain.php +++ b/code/CMSMain.php @@ -41,7 +41,6 @@ class CMSMain extends LeftAndMain implements CurrentPageIdentifier, PermissionPr 'duplicatewithchildren', 'filtersitetree', 'getpagecount', - 'getpagemembers', 'getversion', 'publishall', 'publishitems', @@ -606,122 +605,6 @@ JS; } } - //------------------------------------------------------------------------------------------// - // Workflow handlers - - /** - * Send this page on to another user for review - */ - function submit() { - $page = DataObject::get_by_id("SiteTree", $_REQUEST['ID']); - $recipient = DataObject::get_by_id("Member", $_REQUEST['RecipientID']); - if(!$recipient) user_error("CMSMain::submit() Can't find recipient #$_REQUEST[RecipientID]", E_USER_ERROR); - - $comment = new WorkflowPageComment(); - $comment->Comment = $_REQUEST['Message']; - $comment->PageID = $page->ID; - $comment->AuthorID = Member::currentUserID(); - $comment->Recipient = $recipient; - $comment->Action = $_REQUEST['Status']; - $comment->write(); - - $emailData = $page->customise(array( - "Message" => $_REQUEST['Message'], - "Recipient" => $recipient, - "Sender" => Member::currentUser(), - "ApproveLink" => "admin/approve/$page->ID", - "EditLink" => "admin/show/$page->ID", - "StageLink" => "$page->URLSegment/?stage=Stage", - )); - - $email = new Page_WorkflowSubmitEmail(); - $email->populateTemplate($emailData); - $email->send(); - - $page->AssignedToID = $recipient->ID; - $page->RequestedByID = Member::currentUserID(); - $page->Status = $_REQUEST['Status']; - $page->writeWithoutVersion(); - - FormResponse::status_message(sprintf(_t('CMSMain.SENTTO',"Sent to %s %s for approval.",PR_LOW,"First param is first name, and second is surname"), - $recipient->FirstName, $recipient->Surname), "good"); - - return FormResponse::respond(); - } - - function getpagemembers() { - $relationName = $_REQUEST['SecurityLevel']; - $pageID = $this->urlParams['ID']; - $page = DataObject::get_by_id('SiteTree',$pageID); - if($page) { - foreach($page->$relationName() as $editorGroup) $groupIDs[] = $editorGroup->ID; - if($groupIDs) { - $groupList = implode(", ", $groupIDs); - $members = DataObject::get("Member","","", - "INNER JOIN `Group_Members` ON `Group_Members`.MemberID = `Member`.ID AND `Group_Members`.GroupID IN ($groupList)"); - } - - if($members) { - - if( $page->RequestedByID ) - $members->shift( $page->RequestedBy() ); - - foreach($members as $editor) { - $options .= ""; - } - } else { - $options = ""; - } - - return <<Send to - -HTML; - } else { - user_error("CMSMain::getpagemembers() Cannot find page #$pageID", E_USER_ERROR); - } - } - - function tasklist() { - $tasks = DataObject::get("Page", "AssignedToID = " . Member::currentUserID(), "Created DESC"); - if($tasks) { - $data = new ArrayData(array( - "Tasks" => $tasks, - "Message" => sprintf(_t('CMSMain.WORKTODO',"You have work to do on these %d pages."),$tasks->Count()), - )); - } else { - $data = new ArrayData(array( - "Message" => _t('CMSMain.NOTHINGASSIGNED',"You have nothing assigned to you."), - )); - } - return $data->renderWith("TaskList"); - } - - function waitingon() { - $tasks = DataObject::get("Page", "RequestedByID = " . Member::currentUserID(), "Created DESC"); - if($tasks) { - $data = new ArrayData(array( - "Tasks" => $tasks, - "Message" => sprintf(_t('CMSMain.WAITINGON',"You are waiting on other people to work on these %d pages."),$tasks->Count()), - )); - } else { - $data = new ArrayData(array( - "Message" => _t('CMSMain.NOWAITINGON','You aren\'t waiting on anybody.'), - )); - } - return $data->renderWith("WaitingOn"); - } - - function comments() { - if($this->urlParams['ID']) { - $comments = DataObject::get("WorkflowPageComment", "PageID = " . $this->urlParams['ID'], "Created DESC"); - $data = new ArrayData(array( - "Comments" => $comments, - )); - return $data->renderWith("CommentList"); - } - } - /** * Return a dropdown for selecting reports */ diff --git a/javascript/CMSMain_right.js b/javascript/CMSMain_right.js index 6318d328..b26e2e2c 100755 --- a/javascript/CMSMain_right.js +++ b/javascript/CMSMain_right.js @@ -14,18 +14,7 @@ function action_revert_right() { } }); } -/*function action_submit_right() { - $('action_submit_options').configure('CanApprove', 'Awaiting editor approval'); - $('action_submit_options').toggle(); -}*/ -function action_reject_right() { - $('action_submit_options').configure('CanReject', 'Content declined'); - $('action_submit_options').toggle(); -} -function action_submit_right() { - $('action_submit_options').configure('CanPublish', 'Awaiting final approval'); - $('action_submit_options').toggle(); -} + function action_rollback_right() { var options = { OK: function() { @@ -66,21 +55,6 @@ function action_print_right() { window.open(printURL, 'printable'); } - - -Submit_ActionPropertiesForm = Class.extend('ActionPropertiesForm'); -Submit_ActionPropertiesForm.applyTo('#action_submit_options'); -Submit_ActionPropertiesForm.prototype = { - /** - * Define how this form is to be used - */ - configure : function(securityLevel, status) { - this.securityLevel = securityLevel; - this.elements.Status.value = status - this.elements.Status.parentNode.getElementsByTagName('span')[0].innerHTML= status; - } -} - function suggestStageSiteLink() { var el = $('viewStageSite'); el.flasher = setInterval(flashColor.bind(el), 300); diff --git a/javascript/CommentList.js b/javascript/CommentList.js deleted file mode 100755 index 4578c026..00000000 --- a/javascript/CommentList.js +++ /dev/null @@ -1,13 +0,0 @@ -CommentList = Class.extend('SidePanel'); -CommentList.prototype = { - destroy: function() { - if(this.SidePanel) this.SidePanel.destroy(); - this.SidePanel = null; - }, - onpagechanged : function() { - this.body.innerHTML = '

loading...

'; - this.ajaxGetPanel(this.afterPanelLoaded); - } -} - -CommentList.applyTo('#comments_holder'); \ No newline at end of file diff --git a/javascript/LeftAndMain_right.js b/javascript/LeftAndMain_right.js index 36dd40f9..4802636a 100755 --- a/javascript/LeftAndMain_right.js +++ b/javascript/LeftAndMain_right.js @@ -334,75 +334,6 @@ function action_save_right() { $('Form_EditForm').save(false); } - -ActionPropertiesForm = Class.create(); -ActionPropertiesForm.prototype = { - /** - * Open the form - */ - - open : function() { - var allInputs = this.getElementsByTagName('input'); - this.submitButton = allInputs[allInputs.length-1]; - this.submitButton.onclick = this.send.bind(this); - this.style.display = ''; - - // This detects whether we've opened a new page - if($('Form_EditForm').elements.ID.value != this.elements.ID.value) { - this.elements.ID.value = $('Form_EditForm').elements.ID.value; - - new Ajax.Updater( - 'action_submit_options_recipient', - 'admin/getpagemembers/' + this.elements.ID.value + '?SecurityLevel=' + this.securityLevel - ); - } - }, - close : function() { - this.style.display = 'none'; - }, - toggle : function() { - if(this.style.display == '') this.close(); - else this.open(); - }, - - /** - * Submit the option form and carry out the action - */ - send : function() { - // Show a "submitting..." box - if(!this.sendingText) { - this.sendingText = document.createElement('div'); - this.sendingText.innerHTML = 'Submitting...'; - this.sendingText.className = 'sendingText'; - Element.setOpacity(this.sendingText, 0.9); - this.appendChild(this.sendingText); - } - this.sendingText.style.display = ''; - - // Send the request - var buttons = document.getElementsBySelector('#' + this.id + ' .Actions input'); - var actionButton = null; - - if( buttons ) - actionButton = buttons[0]; - ajaxSubmitForm(false, this.onComplete.bind(this), this, actionButton ? actionButton.name : '', 'submit'); - - return false; - }, - - /** - * Process the action's Ajax response - */ - onComplete: function() { - this.sendingText.style.display = 'none'; - if(this.elements.Message) this.elements.Message.value = ''; - this.close(); - $('Form_EditForm').getPageFromServer($('Form_EditForm_ID').value); - } -} - - - /** * Handle auto-saving. Detects if changes have been made, and if so save everything on the page. * If confirmation is true it will ask for confirmation. diff --git a/javascript/TaskList.js b/javascript/TaskList.js deleted file mode 100755 index e27dc6a0..00000000 --- a/javascript/TaskList.js +++ /dev/null @@ -1,21 +0,0 @@ -TaskList = Class.extend('SidePanel'); -TaskList.prototype = { - destroy: function() { - if(this.SidePanel) this.SidePanel.destroy(); - this.SidePanel = null; - }, - /** - * Called after the panel has been ajax-loaded in - */ - afterPanelLoaded : function() { - TaskListRecord.applyTo('#' + this.id + ' a'); - } -} - -TaskListRecord = SidePanelRecord; - -TaskListRecord.applyTo('#tasklist_holder a'); -TaskList.applyTo('#tasklist_holder'); - -TaskListRecord.applyTo('#waiting_holder a'); -TaskList.applyTo('#waitingon_holder'); diff --git a/templates/CommentList.ss b/templates/CommentList.ss deleted file mode 100755 index a7f7a28b..00000000 --- a/templates/CommentList.ss +++ /dev/null @@ -1,14 +0,0 @@ -<% if Comments %> - -<% else %> -

<% _t('NOCOM','There are no comments on this page.') %>

-

<% _t('CREATEDW',"Comments are created whenever one of the 'workflow actions' - are undertaken - Publish, Reject, Submit.") %>

-<% end_if %> \ No newline at end of file diff --git a/templates/Includes/CMSMain_right.ss b/templates/Includes/CMSMain_right.ss index a4151c7b..ea6491a9 100755 --- a/templates/Includes/CMSMain_right.ss +++ b/templates/Includes/CMSMain_right.ss @@ -3,26 +3,6 @@
- <% if EditForm %> $EditForm <% else %> diff --git a/templates/WaitingOn.ss b/templates/WaitingOn.ss deleted file mode 100755 index 636970a8..00000000 --- a/templates/WaitingOn.ss +++ /dev/null @@ -1,10 +0,0 @@ -

$Message

- - \ No newline at end of file