Merged from branches/2.3

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/cms/trunk@71259 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Sean Harvey 2009-02-03 02:50:25 +00:00
parent ad5471afdb
commit 3d4630a2c8
22 changed files with 207 additions and 435 deletions

View File

@ -45,10 +45,6 @@ class AssetAdmin extends LeftAndMain {
'UploadForm',
'deleteUnusedThumbnails' => 'ADMIN'
);
public function getMenuTitle() {
return _t('LeftAndMain.FILESIMAGES', 'Files & Images', PR_HIGH, 'Menu title');
}
/**
* Return fake-ID "root" if no ID is found (needed to upload files into the root-folder)
@ -304,8 +300,8 @@ HTML;
* Called and returns in same way as 'save' function
*/
public function movemarked($urlParams, $form) {
if($_REQUEST['DestFolderID'] && is_numeric($_REQUEST['DestFolderID'])) {
$destFolderID = $_REQUEST['DestFolderID'];
if($_REQUEST['DestFolderID'] && (is_numeric($_REQUEST['DestFolderID']) || ($_REQUEST['DestFolderID']) == 'root')) {
$destFolderID = ($_REQUEST['DestFolderID'] == 'root') ? 0 : $_REQUEST['DestFolderID'];
$fileList = "'" . ereg_replace(' *, *',"','",trim(addslashes($_REQUEST['FileIDs']))) . "'";
$numFiles = 0;

View File

@ -42,7 +42,6 @@ class CMSMain extends LeftAndMain implements CurrentPageIdentifier, PermissionPr
'duplicatewithchildren',
'filtersitetree',
'getpagecount',
'getpagemembers',
'getversion',
'publishall',
'publishitems',
@ -125,10 +124,6 @@ class CMSMain extends LeftAndMain implements CurrentPageIdentifier, PermissionPr
Requirements::javascript(CMS_DIR . '/javascript/CMSMain_right.js');
}
public function getMenuTitle() {
return _t('LeftAndMain.SITECONTENT', 'Site Content', PR_HIGH, 'Menu title');
}
/**
* If this is set to true, the "switchView" context in the
* template is shown, with links to the staging and publish site.
@ -166,6 +161,10 @@ class CMSMain extends LeftAndMain implements CurrentPageIdentifier, PermissionPr
$this->generateDataTreeHints();
$this->generateTreeStylingJS();
// Pre-cache sitetree version numbers for querying efficiency
Versioned::prepopulate_versionnumber_cache("SiteTree", "Stage");
Versioned::prepopulate_versionnumber_cache("SiteTree", "Live");
return $this->getSiteTreeFor("SiteTree");
}
@ -192,6 +191,10 @@ class CMSMain extends LeftAndMain implements CurrentPageIdentifier, PermissionPr
* Returns a filtered Site Tree
*/
public function filtersitetree() {
// Pre-cache sitetree version numbers for querying efficiency
Versioned::prepopulate_versionnumber_cache("SiteTree", "Stage");
Versioned::prepopulate_versionnumber_cache("SiteTree", "Live");
$className = 'SiteTree';
$rootID = null;
$obj = $rootID ? $this->getRecord($rootID) : singleton($className);
@ -655,123 +658,7 @@ 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 .= "<option value=\"$editor->ID\">$editor->FirstName $editor->Surname ($editor->Email)</option>";
}
} else {
$options = "<option>(no-one available)</option>";
}
return <<<HTML
<label class="left">Send to</label>
<select name="RecipientID">$options</select>
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 <b>%d</b> 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 <b>%d</b> 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
*/
function ReportSelector() {
@ -1427,6 +1314,73 @@ HTML;
}
}
/**
* Switch the cms language and reload the site tree
*
*/
function switchlanguage($lang, $donotcreate = null) {
//is it's a clean switch (to an existing language deselect the current page)
if (is_string($lang)) $dontunloadPage = true;
$lang = (is_string($lang) ? $lang : urldecode($this->urlParams['ID']));
if ($lang != Translatable::default_lang()) {
Translatable::set_reading_lang(Translatable::default_lang());
$tree_class = $this->stat('tree_class');
$obj = new $tree_class;
$allIDs = $obj->getDescendantIDList();
$allChildren = $obj->AllChildren();
$classesMap = $allChildren->map('ID','ClassName');
$titlesMap = $allChildren->map();
Translatable::set_reading_lang($lang);
$obj = new $tree_class;
$languageIDs = $obj->getDescendantIDList();
$notcreatedlist = array_diff($allIDs,$languageIDs);
FormResponse::add("$('addpage').getElementsByTagName('button')[0].disabled=true;");
//FormResponse::add("$('Form_AddPageOptionsForm').getElementsByTagName('div')[1].getElementsByTagName('input')[0].disabled=true;");
FormResponse::add("$('Translating_Message').innerHTML = 'Translating mode - ".i18n::get_language_name($lang)."';");
FormResponse::add("Element.removeClassName('Translating_Message','nonTranslating');");
} else {
Translatable::set_reading_lang($lang);
FormResponse::add("$('addpage').getElementsByTagName('button')[0].disabled=false;");
//FormResponse::add("$('Form_AddPageOptionsForm').getElementsByTagName('div')[1].getElementsByTagName('input')[0].disabled=false;");
FormResponse::add("Element.addClassName('Translating_Message','nonTranslating');");
}
$obj = singleton($this->stat('tree_class'));
$obj->markPartialTree();
$siteTree = $obj->getChildrenAsUL("", '
"<li id=\"record-$child->ID\" class=\"" . $child->CMSTreeClasses($extraArg) . "\">" .
"<a href=\"" . Director::link(substr($extraArg->Link(),0,-1), "show", $child->ID) . "\" " . (($child->canEdit() || $child->canAddChildren()) ? "" : "class=\"disabled\"") . " title=\"' . _t('LeftAndMain.PAGETYPE') . '".$child->class."\" >" .
(Convert::raw2js($child->TreeTitle())) .
"</a>"
'
,$this, true);
$rootLink = $this->Link() . '0';
$siteTree = "<li id=\"record-0\" class=\"Root nodelete\"><a href=\"$rootLink\">" .
_t('LeftAndMain.SITECONTENT') . "</a>"
. $siteTree . "</li></ul>";
FormResponse::add("$('sitetree').innerHTML ='". ereg_replace("[\n]","\\\n",$siteTree) ."';");
FormResponse::add("SiteTree.applyTo('#sitetree');");
if (isset($notcreatedlist)) {
foreach ($notcreatedlist as $notcreated) {
if ($notcreated == $donotcreate) continue;
$id = "new-{$classesMap[$notcreated]}-0-$notcreated";
Session::set($id . '_originalLangID',$notcreated);
$treeTitle = Convert::raw2js($titlesMap[$notcreated]);
$response = <<<JS
var tree = $('sitetree');
var newNode = tree.createTreeNode("$id", "$treeTitle", "$classesMap[$notcreated] (untranslated)");
addClass(newNode, 'untranslated');
node = tree.getTreeNodeByIdx(0);
node.open();
node.appendTreeNode(newNode);
JS;
FormResponse::add($response);
}
}
if (!isset($dontunloadPage)) FormResponse::add("node = $('sitetree').getTreeNodeByIdx(0); node.selectTreeNode();");
return FormResponse::respond();
}
/**
* Create a new translation from an existing item, switch to this language and reload the tree.
*/

View File

@ -83,7 +83,7 @@ class CMSMenu extends Object implements Iterator, i18nEntityProvider
/**
* Add a navigation item to the main administration menu showing in the top bar.
*
* @uses {@link CMSMenu::$menu_items}
* uses {@link CMSMenu::$menu_items}
*
* @param string $code Unique identifier for this menu item (e.g. used by {@link replace_menu_item()} and
* {@link remove_menu_item}. Also used as a CSS-class for icon customization.

View File

@ -29,10 +29,6 @@ class CommentAdmin extends LeftAndMain {
Requirements::css(CMS_DIR . 'css/CommentAdmin.css');
}
public function getMenuTitle() {
return _t('LeftAndMain.COMMENTS', 'Comments', PR_HIGH, 'Menu title');
}
public function showtable($params) {
return $this->getLastFormIn($this->renderWith('CommentAdmin_right'));
}

View File

@ -306,15 +306,6 @@ class LeftAndMain extends Controller {
);
}
/**
* Override {@link getMenuTitle} in child classes to make the menu title translatable for that class.
* Uses {@link $menu_title} if present, otherwise falls back to the classname without the "Admin" suffix.
*
* @return string
*/
public function getMenuTitle() {
return ($this->stat('menu_title')) ? $this->stat('menu_title') : preg_replace('/Admin$/', '', $this->class);
}
/**
* Returns the menu title for the given LeftAndMain subclass.
@ -411,7 +402,7 @@ class LeftAndMain extends Controller {
// already set in CMSMenu::populate_menu(), but from a static pre-controller
// context, so doesn't respect the current user locale in _t() calls - as a workaround,
// we simply call getMenuTitle() again if we're dealing with a controller
// we simply call LeftAndMain::menu_title_for_class() again if we're dealing with a controller
if($menuItem->controller) {
$defaultTitle = LeftAndMain::menu_title_for_class($menuItem->controller);
$title = _t("{$menuItem->controller}.MENUTITLE", $defaultTitle);
@ -434,6 +425,10 @@ class LeftAndMain extends Controller {
}
public function CMSTopMenu() {
return $this->renderWith(array('CMSTopMenu_alternative','CMSTopMenu'));
}
/**
* Return a list of appropriate templates for this class, with the given suffix
*/
@ -461,7 +456,7 @@ class LeftAndMain extends Controller {
function getSiteTreeFor($className, $rootID = null) {
$obj = $rootID ? $this->getRecord($rootID) : singleton($className);
$obj->markPartialTree(null, $this);
$obj->markPartialTree(30, $this);
if($p = $this->currentPage()) $obj->markToExpose($p);
// getChildrenAsUL is a flexible and complex way of traversing the tree
@ -927,7 +922,11 @@ JS;
}
/**
* Return the version number of this application
* Return the version number of this application.
* Uses the subversion path information in <mymodule>/silverstripe_version
* (automacially replaced $URL$ placeholder).
*
* @return string
*/
public function CMSVersion() {
$sapphireVersionFile = file_get_contents('../sapphire/silverstripe_version');
@ -938,21 +937,21 @@ JS;
$sapphireVersion = "trunk";
} else {
preg_match("/sapphire\/(?:(?:branches)|(?:tags))(?:\/rc)?\/([A-Za-z0-9._-]+)\/silverstripe_version/", $sapphireVersionFile, $matches);
$sapphireVersion = $matches[1];
$sapphireVersion = ($matches) ? $matches[1] : null;
}
if(strstr($jspartyVersionFile, "/jsparty/trunk")) {
$jspartyVersion = "trunk";
} else {
preg_match("/jsparty\/(?:(?:branches)|(?:tags))(?:\/rc)?\/([A-Za-z0-9._-]+)\/silverstripe_version/", $jspartyVersionFile, $matches);
$jspartyVersion = $matches[1];
$jspartyVersion = ($matches) ? $matches[1] : null;
}
if(strstr($cmsVersionFile, "/cms/trunk")) {
$cmsVersion = "trunk";
} else {
preg_match("/cms\/(?:(?:branches)|(?:tags))(?:\/rc)?\/([A-Za-z0-9._-]+)\/silverstripe_version/", $cmsVersionFile, $matches);
$cmsVersion = $matches[1];
$cmsVersion = ($matches) ? $matches[1] : null;
}
if($sapphireVersion == $jspartyVersion && $jspartyVersion == $cmsVersion) {

View File

@ -43,10 +43,6 @@ class ReportAdmin extends LeftAndMain {
Requirements::block(SAPPHIRE_DIR . '/javascript/HtmlEditorField.js');
}
public function getMenuTitle() {
return _t('LeftAndMain.REPORTS', 'Reports', PR_HIGH, 'Menu title');
}
/**
* Does the parent permission checks, but also
* makes sure that instantiatable subclasses of

View File

@ -65,7 +65,6 @@ class SecurityAdmin extends LeftAndMain implements PermissionProvider {
return $form;
}
public function AddRecordForm() {
$m = Object::create('MemberTableField',
$this,
@ -103,29 +102,29 @@ class SecurityAdmin extends LeftAndMain implements PermissionProvider {
public function MemberForm() {
$id = $_REQUEST['ID'] ? $_REQUEST['ID'] : Session::get('currentMember');
if($id)
return $this->getMemberForm($id);
if($id) return $this->getMemberForm($id);
}
public function getMemberForm($id) {
if($id && $id != 'new') $record = DataObject::get_by_id("Member",$id);
if($id && $id != 'new') $record = DataObject::get_by_id('Member', (int) $id);
if($record || $id == 'new') {
$fields = new FieldSet(
new HiddenField('MemberListBaseGroup', '', $this->currentPageID() )
);
if( $extraFields = $record->getCMSFields() )
foreach( $extraFields as $extra )
if($extraFields = $record->getCMSFields()) {
foreach($extraFields as $extra) {
$fields->push( $extra );
}
}
$fields->push($idField = new HiddenField("ID"));
$fields->push($groupIDField = new HiddenField("GroupID"));
$fields->push($idField = new HiddenField('ID'));
$fields->push($groupIDField = new HiddenField('GroupID'));
$actions = new FieldSet();
$actions->push(new FormAction('savemember',_t('SecurityAdmin.SAVE')));
$actions->push(new FormAction('savemember', _t('SecurityAdmin.SAVE')));
$form = new Form($this, "MemberForm", $fields, $actions);
$form = new Form($this, 'MemberForm', $fields, $actions);
if($record) $form->loadDataFrom($record);
$idField->setValue($id);
@ -137,7 +136,6 @@ class SecurityAdmin extends LeftAndMain implements PermissionProvider {
function savemember() {
$data = $_REQUEST;
$className = $this->stat('subitem_class');
$id = $_REQUEST['ID'];
@ -155,7 +153,6 @@ class SecurityAdmin extends LeftAndMain implements PermissionProvider {
$record->Groups()->add($data['GroupID']);
FormResponse::add("reloadMemberTableField();");
return FormResponse::respond();
@ -164,14 +161,14 @@ class SecurityAdmin extends LeftAndMain implements PermissionProvider {
function addmember($className=null) {
$data = $_REQUEST;
unset($data['ID']);
if($className == null)
$className = $this->stat('subitem_class');
if($className == null) $className = $this->stat('subitem_class');
$record = new $className();
$record->update($data);
$record->write();
if($data['GroupID'])
$record->Groups()->add($data['GroupID']);
if($data['GroupID']) $record->Groups()->add($data['GroupID']);
FormResponse::add("reloadMemberTableField();");
@ -182,10 +179,9 @@ class SecurityAdmin extends LeftAndMain implements PermissionProvider {
$groupID = $this->urlParams['ID'];
$memberID = $this->urlParams['OtherID'];
if(is_numeric($groupID) && is_numeric($memberID)) {
$member = DataObject::get_by_id('Member', $memberID);
$member = DataObject::get_by_id('Member', (int) $memberID);
$member->Groups()->remove($groupID);
FormResponse::add("reloadMemberTableField();");
} else {
user_error("SecurityAdmin::removememberfromgroup: Bad parameters: Group=$groupID, Member=$memberID", E_USER_ERROR);
}
@ -213,7 +209,6 @@ class SecurityAdmin extends LeftAndMain implements PermissionProvider {
"</ul>";
return $siteTree;
}
public function addgroup() {
@ -227,14 +222,9 @@ class SecurityAdmin extends LeftAndMain implements PermissionProvider {
}
public function EditedMember() {
if(Session::get('currentMember'))
return DataObject::get_by_id("Member", Session::get('currentMember'));
if(Session::get('currentMember')) return DataObject::get_by_id('Member', (int) Session::get('currentMember'));
}
public function getMenuTitle() {
return _t('LeftAndMain.SECURITY', 'Security', PR_HIGH, 'Menu title');
}
function providePermissions() {
return array(
'EDIT_PERMISSIONS' => _t('SecurityAdmin.EDITPERMISSIONS', 'Edit permissions and IP addresses on each group'),

View File

@ -228,7 +228,7 @@ DragFileItem.prototype = {
this.draggable = null;
}
}
DragFileItem.applyTo('#Form_EditForm_Files tr .dragfile');
DragFileItem.applyTo('#Form_EditForm_Files tr td .dragfile');
// Set up folder drop target
DropFileItem = Class.create();
@ -238,30 +238,27 @@ DropFileItem.prototype = {
// eg: <li id="treenode-6"> would give a recordID of 6
if(this.id && this.id.match(/-([^-]+)$/))
this.recordID = RegExp.$1;
// Do not allow files to be dropped to the root
if (this.recordID != 'root') {
this.droppable = Droppables.add(this.id, {accept:'dragfile', hoverclass:'filefolderhover',
onDrop:function(droppedElement) {
// Get this.recordID from the last "-" separated chunk of the id HTML attribute
// eg: <li id="treenode-6"> would give a recordID of 6
if(this.element.id && this.element.id.match(/-([^-]+)$/))
this.recordID = RegExp.$1;
$('Form_EditForm').elements['DestFolderID'].value = this.recordID;
this.droppable = Droppables.add(this.id, {accept:'dragfile', hoverclass:'filefolderhover',
onDrop:function(droppedElement) {
// Get this.recordID from the last "-" separated chunk of the id HTML attribute
// eg: <li id="treenode-6"> would give a recordID of 6
if(this.element.id && this.element.id.match(/-([^-]+)$/))
this.recordID = RegExp.$1;
$('Form_EditForm').elements['DestFolderID'].value = this.recordID;
// Add the dropped file to the list of files to move
var list = droppedElement.getElementsByTagName('img')[0].id.replace('drag-img-Files-','');
var i, checkboxes = $('Form_EditForm').elements['Files[]'];
if(!checkboxes) checkboxes = [];
if(!checkboxes.length) checkboxes = [ checkboxes ];
// Add each checked file to the list of ones to move
for(i=0;i<checkboxes.length;i++) {
if(checkboxes[i].checked) list += (list?',':'') + checkboxes[i].value;
}
$('Form_EditForm_FileIDs').value = list;
$('Form_EditForm').save(false, null, 'movemarked')
// Add the dropped file to the list of files to move
var list = droppedElement.getElementsByTagName('img')[0].id.replace('drag-img-Files-','');
var i, checkboxes = $('Form_EditForm').elements['Files[]'];
if(!checkboxes) checkboxes = [];
if(!checkboxes.length) checkboxes = [ checkboxes ];
// Add each checked file to the list of ones to move
for(i=0;i<checkboxes.length;i++) {
if(checkboxes[i].checked) list += (list?',':'') + checkboxes[i].value;
}
});
}
$('Form_EditForm_FileIDs').value = list;
$('Form_EditForm').save(false, null, 'movemarked')
}
});
},
destroy: function() {
this.droppable = null;

View File

@ -177,7 +177,7 @@ showonlydrafts.prototype = {
new Ajax.Request( 'admin/filterSiteTree?Status=Saved&ajax=1', {
onSuccess: function( response ) {
$('sitetree_ul').innerHTML = response.responseText;
Behaviour.apply();
Behaviour.apply($('sitetree_ul'));
$('SiteTreeIsFiltered').value = 1;
$('batchactions').multiselectTransform();
statusMessage(ss.i18n._t('CMSMAIN.FILTEREDTREE'),'good');
@ -240,8 +240,7 @@ batchActionGlobals = {
},
getCsvIds : function() {
var csvIDs = "";
batchActionGlobals.count = 0;
var csvIDs = new Array();
var st = $('sitetree');
batchActionGlobals.newNodes = new Array();
for(var idx in batchActionGlobals.selectedNodes) {
@ -253,15 +252,18 @@ batchActionGlobals = {
} else {
var i, item, childrenTopublish = st.getTreeNodeByIdx(idx).getElementsByTagName('li');
for(i=0;item=childrenTopublish[i];i++) {
csvIDs += (csvIDs ? "," : "") + st.getIdxOf(childrenTopublish[i]);
batchActionGlobals.count++;
if(csvIDs.indexOf(st.getIdxOf(childrenTopublish[i])) == -1) {
csvIDs.push(st.getIdxOf(childrenTopublish[i]));
}
}
if(csvIDs.indexOf(idx) == -1) {
csvIDs.push(idx);
}
csvIDs += (csvIDs ? "," : "") + idx;
batchActionGlobals.count++;
}
}
}
return csvIDs;
batchActionGlobals.count=csvIDs.length;
return (csvIDs.toString());
},
unfilterSiteTree : function() {
// Reload the site tree if it has been filtered
@ -270,7 +272,7 @@ batchActionGlobals = {
new Ajax.Request( 'admin/SiteTreeAsUL' + '&ajax=1', {
onSuccess: function( response ) {
$('sitetree_ul').innerHTML = response.responseText;
Behaviour.apply();
Behaviour.apply($('sitetree_ul'));
$('SiteTreeIsFiltered').value = 0;
$('batchactions').multiselectTransform();
statusMessage(ss.i18n._t('CMSMAIN.SUCCESSUNFILTER'),'good');

View File

@ -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);

View File

@ -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 = '<p>loading...</p>';
this.ajaxGetPanel(this.afterPanelLoaded);
}
}
CommentList.applyTo('#comments_holder');

View File

@ -115,7 +115,7 @@ Behaviour.register({
'#EditMemberProfile': {
onclick: function(e) {
var el = Event.element(e);
GB_show('Edit Profile', el.attributes.href.value, ComplexTableField.prototype.popupHeight, ComplexTableField.prototype.popupWidth);
GB_show('Edit Profile', el.attributes.href.value, 390, 560);
Event.stop(e);
}
}

View File

@ -485,7 +485,7 @@ SiteTreeFilterForm.prototype = {
$('SiteTreeIsFiltered').value = 1;
$('SiteTreeSearchButton').className = '';
$('sitetree_ul').innerHTML = response.responseText;
Behaviour.apply();
Behaviour.apply($('sitetree_ul'));
statusMessage('Filtered tree','good');
},
onFailure : function(response) {

View File

@ -340,75 +340,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.

View File

@ -30,6 +30,8 @@ PageCommentInterface.prototype = {
var spamQuestionDiv = $('Math');
var mathLabel = spamQuestionDiv.getElementsByTagName('label')[0];
mathLabel.innerHTML = response.responseText;
var mathQuestion = spamQuestionDiv.getElementsByTagName('input')[0];
mathQuestion.value = '';
},
postComment: function() {
@ -253,4 +255,6 @@ function loadSpamQuestion(response) {
var spamQuestionDiv = $('Math');
var mathLabel = spamQuestionDiv.getElementsByTagName('label')[0];
mathLabel.innerHTML = response.responseText;
var mathQuestion = spamQuestionDiv.getElementsByTagName('input')[0];
mathQuestion.value = '';
}

View File

@ -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');

View File

@ -1,14 +0,0 @@
<% if Comments %>
<ul id="CommentList">
<% control Comments %>
<li class="$EvenOdd">
$Comment
<div class="extra">$Action $Created.Ago - $Author.FirstName&nbsp;$Author.Surname.Initial</div>
</li>
<% end_control %>
</ul>
<% else %>
<p><% _t('NOCOM','There are no comments on this page.') %></p>
<p><% _t('CREATEDW',"Comments are created whenever one of the 'workflow actions'
are undertaken - Publish, Reject, Submit.") %></p>
<% end_if %>

View File

@ -16,32 +16,43 @@
</tr>
</thead>
<tbody>
<% control Items %>
<tr id="record-$Parent.Name-$ID">
<td class="dragfile" id="drag-$Parent.Name-$ID">
<img id="drag-img-$Parent.Name-$ID" alt="Drag" title="<% _t('DRAGTOFOLDER','Drag to folder on left to move file') %>" src="sapphire/images/drag.gif" />
</div>
<% if Markable %><td class="markingcheckbox">$MarkingCheckbox</td><% end_if %>
<% control Fields %>
<td>$Value</td>
<% end_control %>
<% if Can(show) %>
<td width="18" class="action">
<a class="popuplink showlink" href="$ShowLink" target="_blank" title="<% _t('SHOW', 'Show asset') %>"><img src="cms/images/show.png" alt="<% _t('SHOW', 'Show asset') %>" /></a>
</td>
<% end_if %>
<% if Can(edit) %>
<% if Items %>
<% control Items %>
<tr id="record-$Parent.Name-$ID">
<td class="dragfile" id="drag-$Parent.Name-$ID">
<img id="drag-img-$Parent.Name-$ID" alt="Drag" title="<% _t('DRAGTOFOLDER','Drag to folder on left to move file') %>" src="sapphire/images/drag.gif" />
</div>
<% if Markable %><td class="markingcheckbox">$MarkingCheckbox</td><% end_if %>
<% control Fields %>
<td>$Value</td>
<% end_control %>
<% if Can(show) %>
<td width="18" class="action">
<a class="popuplink editlink" href="$EditLink" target="_blank" title="<% _t('EDIT', 'Edit asset') %>"><img src="cms/images/edit.gif" alt="<% _t('EDIT', 'Edit asset') %>" /></a>
<a class="popuplink showlink" href="$ShowLink" target="_blank" title="<% _t('SHOW', 'Show asset') %>"><img src="cms/images/show.png" alt="<% _t('SHOW', 'Show asset') %>" /></a>
</td>
<% end_if %>
<% if Can(delete) %>
<td width="18" class="action">
<a class="deletelink" href="admin/assets/removefile/$ID" title="<% _t('DELFILE', 'Delete this file') %>"><img src="cms/images/delete.gif" alt="<% _t('DELFILE', 'Delete this file') %>" title="<% _t('DELFILE','Delete this file') %>" /></a>
</td>
<% end_if %>
</tr>
<% end_control %>
<% end_if %>
<% if Can(edit) %>
<td width="18" class="action">
<a class="popuplink editlink" href="$EditLink" target="_blank" title="<% _t('EDIT', 'Edit asset') %>"><img src="cms/images/edit.gif" alt="<% _t('EDIT', 'Edit asset') %>" /></a>
</td>
<% end_if %>
<% if Can(delete) %>
<td width="18" class="action">
<a class="deletelink" href="admin/assets/removefile/$ID" title="<% _t('DELFILE', 'Delete this file') %>"><img src="cms/images/delete.gif" alt="<% _t('DELFILE', 'Delete this file') %>" title="<% _t('DELFILE','Delete this file') %>" /></a>
</td>
<% end_if %>
</tr>
<% end_control %>
<% else %>
<tr class="notfound">
<td>&nbsp;</td>
<% if Markable %><td width="18">&nbsp;</td><% end_if %>
<td colspan="$Headings.Count"><i>No $NamePlural found</i></td>
<% if Can(show) %><td width="18">&nbsp;</td><% end_if %>
<% if Can(edit) %><td width="18">&nbsp;</td><% end_if %>
<% if Can(delete) %><td width="18">&nbsp;</td><% end_if %>
</tr>
<% end_if %>
</tbody>
</table>
</div>

View File

@ -1,26 +1,6 @@
<div id="form_actions_right" class="ajaxActions">
</div>
<form class="actionparams" id="action_submit_options" style="display:none" action="admin/submit">
<fieldset>
<input type="hidden" name="ID" />
<div class="field" id="action_submit_options_recipient">
<label class="left"><% _t('SENDTO','Send to') %></label>
<span><% _t('LOADING','loading...') %></span>
</div>
<div class="field" id="action_submit_options_status">
<label class="left"><% _t('STATUS','Status') %></label>
<input type="hidden" name="Status" />
<span></span>
</div>
<p class="label"><% _t('ANYMESSAGE','Do you have any message for your editor?') %></p>
<textarea name="<% _t('MESSAGE','Message') %>" rows="4" cols="20"></textarea>
</fieldset>
<p class="actions">
<input type="submit" value="<% _t('SUBMIT','Submit for approval') %>" />
</p>
</form>
<% if EditForm %>
$EditForm
<% else %>

View File

@ -10,16 +10,19 @@
<body class="stillLoading $CSSClasses">
<div id="Loading" style="background: #FFF url($LoadingImage) 50% 50% no-repeat; position: absolute;z-index: 100000;height: 100%;width: 100%;margin: 0;padding: 0;z-index: 100000;position: absolute;"><% _t('LOADING','Loading...',PR_HIGH) %><noscript><h1><% _t('REQUIREJS','The CMS requires that you have JavaScript enabled.',PR_HIGH) %></h1></noscript></div>
<div id="top">
<% include CMSTopMenu %>
</div><div id="left" style="float:left">
$Left
<div id="top">
$CMSTopMenu
</div>
<div id="left" style="float:left">
$Left
</div>
<div id="separator" style="float:left">
&nbsp;
</div>
<div class="right" id="right">
$Right
</div>
@ -34,25 +37,24 @@
<div id="bottom">
<div class="holder">
<div id="logInStatus">
<a href="$ApplicationLink" title="<% _t('SSWEB','Silverstripe Website') %>">$ApplicationName</a>&nbsp;-&nbsp;
<abbr style="border-style: none" title="<% _t('APPVERSIONTEXT1',"This is the") %> $ApplicationName <% _t('APPVERSIONTEXT2',"version that you are currently running, technically it's the CVS branch") %>">$CMSVersion</abbr> &nbsp; &nbsp; &nbsp;
<% control CurrentMember %>
<% _t('LOGGEDINAS','Logged in as') %> <strong><% if FirstName && Surname %>$FirstName $Surname<% else_if FirstName %>$FirstName<% else %>$Email<% end_if %></strong> | <a href="{$BaseHref}admin/myprofile" id="EditMemberProfile"><% _t('EDITPROFILE','Profile') %></a> | <a href="Security/logout" id="LogoutLink"><% _t('LOGOUT','log out') %></a>
<% end_control %>
</div>
<div id="logInStatus">
<a href="$ApplicationLink" title="<% _t('SSWEB','Silverstripe Website') %>">$ApplicationName</a>&nbsp;-&nbsp;
<abbr style="border-style: none" title="<% _t('APPVERSIONTEXT1',"This is the") %> $ApplicationName <% _t('APPVERSIONTEXT2',"version that you are currently running, technically it's the CVS branch") %>">$CMSVersion</abbr> &nbsp; &nbsp; &nbsp;
<% control CurrentMember %>
<% _t('LOGGEDINAS','Logged in as') %> <strong><% if FirstName && Surname %>$FirstName $Surname<% else_if FirstName %>$FirstName<% else %>$Email<% end_if %></strong> | <a href="{$BaseHref}admin/myprofile" id="EditMemberProfile"><% _t('EDITPROFILE','Profile') %></a> | <a href="Security/logout" id="LogoutLink"><% _t('LOGOUT','log out') %></a>
<% end_control %>
</div>
<div id="switchView" class="bottomTabs">
<% if ShowSwitchView %>
<div class="blank"> <% _t('VIEWPAGEIN','Page view:') %> </div>
<span class="current" title="<% _t('EDITINCMS', 'Edit this page in the CMS') %>"><% _t('EDIT','Edit') %></span>
| <a id="viewStageSite" title="<% _t('VIEWINDRAFT', 'View the Page in the Draft Site') %>" href="home/?stage=Stage"><% _t('DRAFTS','Draft Site') %></a>
| <a id="viewLiveSite" title="<% _t('VIEWINPUBLISHED', 'View the Page in the Published Site') %>" href="home/?stage=Live"><% _t('PUBLIS','Published Site') %></a>
<a style="display: none; margin-left: 20px;" id="viewArchivedSite" href="home/"><% _t('ARCHS','Archived Site') %></a>
<% end_if %>
</div>
<div id="switchView" class="bottomTabs">
<% if ShowSwitchView %>
<div class="blank"> <% _t('VIEWPAGEIN','Page view:') %> </div>
<span class="current" title="<% _t('EDITINCMS', 'Edit this page in the CMS') %>"><% _t('EDIT','Edit') %></span>
| <a id="viewStageSite" title="<% _t('VIEWINDRAFT', 'View the Page in the Draft Site') %>" href="home/?stage=Stage"><% _t('DRAFTS','Draft Site') %></a>
| <a id="viewLiveSite" title="<% _t('VIEWINPUBLISHED', 'View the Page in the Published Site') %>" href="home/?stage=Live"><% _t('PUBLIS','Published Site') %></a>
<a style="display: none; margin-left: 20px;" id="viewArchivedSite" href="home/"><% _t('ARCHS','Archived Site') %></a>
<% end_if %>
</div>
</div>
</div>
</body>
</html>
</html>

View File

@ -1,10 +0,0 @@
<p>$Message</p>
<ul id="TaskList">
<% control Tasks %>
<li class="$EvenOdd">
<a href="admin/show/$ID">$Title</a>
<div class="extra"><% _t('ATO','assigned to') %> $AssignedTo.FirstName&nbsp;$AssignedTo.Surname.Initial $LastEdited.Ago</div>
</li>
<% end_control %>
</ul>

View File

@ -17,7 +17,6 @@ class CMSMenuTest extends SapphireTest implements TestOnly {
$menuItems = CMSMenu::get_menu_items();
$menuItem = $menuItems['CMSMain'];
$this->assertType('CMSMenuItem', $menuItem, 'Controller menu item is of class CMSMenuItem');
$this->assertEquals($menuItem->title, singleton('CMSMain')->getMenuTitle(), 'Controller menu item has the correct title');
$this->assertEquals($menuItem->url, singleton('CMSMain')->Link(), 'Controller menu item has the correct link');
$this->assertEquals($menuItem->controller, 'CMSMain', 'Controller menu item has the correct controller class');
$this->assertEquals($menuItem->priority, singleton('CMSMain')->stat('menu_priority'), 'Controller menu item has the correct priority');
@ -55,7 +54,6 @@ class CMSMenuTest extends SapphireTest implements TestOnly {
CMSMenu::populate_menu();
$menuItem = CMSMenu::get_menu_item('CMSMain');
$this->assertType('CMSMenuItem', $menuItem, 'CMSMain menu item exists');
$this->assertEquals($menuItem->title, singleton('CMSMain')->getMenuTitle(), 'Menu item has the correct title');
$this->assertEquals($menuItem->url, singleton('CMSMain')->Link(), 'Menu item has the correct link');
$this->assertEquals($menuItem->controller, 'CMSMain', 'Menu item has the correct controller class');
$this->assertEquals(