mirror of
https://github.com/silverstripe/silverstripe-cms
synced 2024-10-22 08:05:56 +02:00
Merged branches/2.3
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/cms/trunk@66109 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
parent
fe0ac4e990
commit
2ee0c0991b
@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Extended URL rules for the CMS module
|
||||
*
|
||||
|
@ -128,6 +128,20 @@ class CMSMain extends LeftAndMain implements CurrentPageIdentifier, PermissionPr
|
||||
//------------------------------------------------------------------------------------------//
|
||||
// Main UI components
|
||||
|
||||
/**
|
||||
* Override {@link LeftAndMain} Link to allow blank URL segment for CMSMain.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function Link($action = null) {
|
||||
return Controller::join_links(
|
||||
$this->stat('url_base', true),
|
||||
$this->stat('url_segment', true), // in case we want to change the segment
|
||||
'/', // trailing slash needed if $action is null!
|
||||
"$action"
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the entire site tree as a nested set of ULs
|
||||
*/
|
||||
@ -443,9 +457,9 @@ JS;
|
||||
|
||||
|
||||
public function addpage() {
|
||||
$className = $_REQUEST['PageType'] ? $_REQUEST['PageType'] : "Page";
|
||||
$parent = $_REQUEST['ParentID'] ? $_REQUEST['ParentID'] : 0;
|
||||
$suffix = $_REQUEST['Suffix'] ? "-" . $_REQUEST['Suffix'] : null;
|
||||
$className = isset($_REQUEST['PageType']) ? $_REQUEST['PageType'] : "Page";
|
||||
$parent = isset($_REQUEST['ParentID']) ? $_REQUEST['ParentID'] : 0;
|
||||
$suffix = isset($_REQUEST['Suffix']) ? "-" . $_REQUEST['Suffix'] : null;
|
||||
|
||||
|
||||
if(is_numeric($parent)) $parentObj = DataObject::get_by_id("SiteTree", $parent);
|
||||
@ -465,7 +479,7 @@ JS;
|
||||
* @uses LeftAndMainDecorator->augmentNewSiteTreeItem()
|
||||
*/
|
||||
public function getNewItem($id, $setID = true) {
|
||||
list($dummy, $className, $parentID, $suffix) = explode('-',$id);
|
||||
list($dummy, $className, $parentID, $suffix) = array_pad(explode('-',$id),4,null);
|
||||
if(Translatable::is_enabled()) {
|
||||
if (!Translatable::is_default_lang()) {
|
||||
$originalItem = Translatable::get_original($className,Session::get("{$id}_originalLangID"));
|
||||
@ -564,12 +578,12 @@ JS;
|
||||
|
||||
public function revert($urlParams, $form) {
|
||||
$id = $_REQUEST['ID'];
|
||||
$obj = DataObject::get_by_id("SiteTree", $id);
|
||||
$record = DataObject::get_by_id("SiteTree", $id);
|
||||
if(isset($record) && $record && !$record->canEdit()) return Security::permissionFailure($this);
|
||||
|
||||
$obj->doRevertToLive();
|
||||
$record->doRevertToLive();
|
||||
|
||||
$title = Convert::raw2js($obj->Title);
|
||||
$title = Convert::raw2js($record->Title);
|
||||
FormResponse::get_page($id);
|
||||
FormResponse::add("$('sitetree').setNodeTitle($id, '$title');");
|
||||
FormResponse::status_message(sprintf(_t('CMSMain.RESTORED',"Restored '%s' successfully",PR_MEDIUM,'Param %s is a title'),$title),'good');
|
||||
@ -793,7 +807,7 @@ HTML;
|
||||
FormResponse::add("\$('sitetree').setNodeTitle($page->ID, '$JS_title');");
|
||||
} else {
|
||||
FormResponse::add("var node = $('sitetree').getTreeNodeByIdx('$page->ID');");
|
||||
FormResponse::add("if(node.parentTreeNode) node.parentTreeNode.removeTreeNode(node);");
|
||||
FormResponse::add("if(node && node.parentTreeNode) node.parentTreeNode.removeTreeNode(node);");
|
||||
FormResponse::add("$('Form_EditForm').reloadIfSetTo($page->ID);");
|
||||
}
|
||||
|
||||
@ -1069,7 +1083,7 @@ HTML;
|
||||
FormResponse::add("$('Form_EditForm').reloadIfSetTo($record->OldID);");
|
||||
} else {
|
||||
FormResponse::add("var node = $('sitetree').getTreeNodeByIdx('$id');");
|
||||
FormResponse::add("if(node.parentTreeNode) node.parentTreeNode.removeTreeNode(node);");
|
||||
FormResponse::add("if(node && node.parentTreeNode) node.parentTreeNode.removeTreeNode(node);");
|
||||
FormResponse::add("$('Form_EditForm').reloadIfSetTo($record->OldID);");
|
||||
}
|
||||
}
|
||||
|
@ -60,7 +60,7 @@ class CMSMenu extends Object implements Iterator
|
||||
* @param string $code A unique identifier (used to create a CSS ID and as it's key in {@link $menu_items}
|
||||
* @param string $menuTitle The link's title in the CMS menu
|
||||
* @param string $url The url of the link
|
||||
* @param integer $priority The menu priority (sorting order) of the menu item
|
||||
* @param integer $priority The menu priority (sorting order) of the menu item. Higher priorities will be further left.
|
||||
* @return boolean The result of the operation.
|
||||
*/
|
||||
public static function add_link($code, $menuTitle, $url, $priority = -1) {
|
||||
@ -82,8 +82,10 @@ class CMSMenu extends Object implements Iterator
|
||||
* @return boolean Success
|
||||
*/
|
||||
public static function add_menu_item($code, $menuTitle, $url, $controllerClass = null, $priority = -1) {
|
||||
// If a class is defined, then force the use of that as a code. This helps prevent menu item duplication
|
||||
if($controllerClass) $code = $controllerClass;
|
||||
|
||||
$menuItems = self::$menu_items;
|
||||
|
||||
if(isset($menuItems[$code])) return false;
|
||||
|
||||
return self::replace_menu_item($code, $menuTitle, $url, $controllerClass, $priority);
|
||||
@ -145,8 +147,13 @@ class CMSMenu extends Object implements Iterator
|
||||
public static function replace_menu_item($code, $menuTitle, $url, $controllerClass = null, $priority = -1) {
|
||||
$menuItems = self::$menu_items;
|
||||
$menuItems[$code] = new CMSMenuItem($menuTitle, $url, $controllerClass, $priority);
|
||||
|
||||
$menuPriority = array();
|
||||
$i = 0;
|
||||
foreach($menuItems as $key => $menuItem) {
|
||||
$menuPriority[$key] = $menuItem->priority;
|
||||
$i++;
|
||||
// This funny litle formula ensures that the first item added with the same priority will be left-most.
|
||||
$menuPriority[$key] = $menuItem->priority*100 - $i;
|
||||
}
|
||||
array_multisort($menuPriority, SORT_DESC, $menuItems);
|
||||
|
||||
|
@ -200,6 +200,9 @@ class LeftAndMain extends Controller {
|
||||
* @return string
|
||||
*/
|
||||
public function Link($action = null) {
|
||||
// Handle missing url_segments
|
||||
if(!$this->stat('url_segment', true))
|
||||
self::$url_segment = $this->class;
|
||||
return Controller::join_links(
|
||||
$this->stat('url_base', true),
|
||||
$this->stat('url_segment', true),
|
||||
@ -287,11 +290,14 @@ class LeftAndMain extends Controller {
|
||||
|
||||
$linkingmode = "";
|
||||
|
||||
if(!(strpos($this->Link(), $menuItem->url) === false)) {
|
||||
if(strpos($this->Link(), $menuItem->url) !== false) {
|
||||
if($this->Link() == $menuItem->url) {
|
||||
$linkingmode = "current";
|
||||
|
||||
// default menu is the one with a blank {@link url_segment}
|
||||
if(singleton($menuItem->controller)->stat('url_segment') == '') {
|
||||
if($this->Link() == $this->stat('url_base').'/')
|
||||
$linkingmode = "current";
|
||||
} else if(singleton($menuItem->controller)->stat('url_segment') == '') {
|
||||
if($this->Link() == $this->stat('url_base').'/') $linkingmode = "current";
|
||||
|
||||
} else {
|
||||
$linkingmode = "current";
|
||||
}
|
||||
@ -317,7 +323,6 @@ class LeftAndMain extends Controller {
|
||||
|
||||
// if no current item is found, assume that first item is shown
|
||||
//if(!isset($foundCurrent))
|
||||
|
||||
return $menu;
|
||||
}
|
||||
|
||||
@ -410,9 +415,12 @@ class LeftAndMain extends Controller {
|
||||
newNode.selectTreeNode();
|
||||
JS;
|
||||
FormResponse::add($response);
|
||||
|
||||
return FormResponse::respond();
|
||||
} else {
|
||||
Director::redirect("admin/show/" . $p->ID);
|
||||
}
|
||||
|
||||
return FormResponse::respond();
|
||||
}
|
||||
|
||||
|
||||
@ -715,7 +723,7 @@ JS;
|
||||
$script = "st = \$('sitetree'); \n";
|
||||
foreach($ids as $id) {
|
||||
if(is_numeric($id)) {
|
||||
$record = DataObject::get_by_id($id);
|
||||
$record = DataObject::get_by_id($this->stat('tree_class'), $id);
|
||||
if($record && !$record->canDelete()) return Security::permissionFailure($this);
|
||||
|
||||
DataObject::delete_by_id($this->stat('tree_class'), $id);
|
||||
|
@ -121,6 +121,12 @@ ul.tree.multiselect li.selected span.a.unexpanded span.b {
|
||||
cursor: default;
|
||||
}
|
||||
|
||||
|
||||
ul.tree span.a a.notinmenu, ul.tree span.a a.notinmenu * {
|
||||
color: #77A;
|
||||
}
|
||||
|
||||
|
||||
ul.tree span.a a.disabled {
|
||||
color: #999;
|
||||
cursor: pointer;
|
||||
@ -153,17 +159,17 @@ ul.tree .deleted {
|
||||
}
|
||||
|
||||
/* Created on stage, never published */
|
||||
ul.tree ins,
|
||||
ul.tree span.a a ins, ul.tree span.a a.notinmenu ins,
|
||||
#publication_key ins {
|
||||
color: orange;
|
||||
text-decoration : none;
|
||||
}
|
||||
/* Deleted on stage */
|
||||
ul.tree del,
|
||||
ul.tree span.a a del, ul.tree span.a a.notinmenu del,
|
||||
#publication_key del {
|
||||
color: red;
|
||||
}
|
||||
ul.tree span.modified,
|
||||
ul.tree span.a span.modified,
|
||||
#publication_key span.modified {
|
||||
color: green;
|
||||
text-decoration : none;
|
||||
@ -342,12 +348,16 @@ ul.tree li.untranslated a:visited {
|
||||
width: 70%;
|
||||
}
|
||||
|
||||
#right ins * {
|
||||
#right ins, #right ins * {
|
||||
background-color: green;
|
||||
color: white;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
#right del *{
|
||||
#right del, #right del *{
|
||||
background-color: red;
|
||||
color: white;
|
||||
text-decoration: strikethough;
|
||||
}
|
||||
|
||||
#sitetree a.contents {
|
||||
|
@ -228,7 +228,7 @@ DragFileItem.prototype = {
|
||||
this.draggable = null;
|
||||
}
|
||||
}
|
||||
DragFileItem.applyTo('#Form_EditForm_Files tr td.markingcheckbox div.dragfile');
|
||||
DragFileItem.applyTo('#Form_EditForm_Files tr .dragfile');
|
||||
|
||||
// Set up folder drop target
|
||||
DropFileItem = Class.create();
|
||||
|
@ -195,7 +195,7 @@ CMSForm.prototype = {
|
||||
}
|
||||
|
||||
statusMessage(ss.i18n._t('CMSMAIN.SAVING'), null, true);
|
||||
console.log(this.action+"?"+data);
|
||||
|
||||
new Ajax.Request(this.action, {
|
||||
method : this.method,
|
||||
postBody: data,
|
||||
|
@ -15,6 +15,7 @@ if((typeof tinyMCE != 'undefined')) {
|
||||
auto_resize : false,
|
||||
theme : "advanced",
|
||||
content_css : "$ContentCSS",
|
||||
body_class : 'typography',
|
||||
document_base_url: "$BaseURL",
|
||||
urlconverter_callback : "nullConverter",
|
||||
|
||||
@ -25,10 +26,10 @@ if((typeof tinyMCE != 'undefined')) {
|
||||
theme_advanced_toolbar_location : "top",
|
||||
theme_advanced_toolbar_align : "left",
|
||||
theme_advanced_toolbar_parent : "right",
|
||||
plugins : "template,contextmenu,table,emotions,paste,../../tinymce_ssbuttons,spellchecker",
|
||||
plugins : "template,contextmenu,table,emotions,paste,../../tinymce_ssbuttons,../../tinymce_advcode,spellchecker",
|
||||
table_inline_editing : true,
|
||||
theme_advanced_buttons1 : "bold,italic,underline,strikethrough,separator,justifyleft,justifycenter,justifyright,justifyfull,styleselect,formatselect,separator,bullist,numlist,outdent,indent,hr,charmap",
|
||||
theme_advanced_buttons2 : "undo,redo,separator,cut,copy,paste,pastetext,pasteword,spellchecker,separator,ssimage,ssflash,sslink,unlink,anchor,separator,template,code,separator,search,replace,selectall,visualaid,separator,tablecontrols",
|
||||
theme_advanced_buttons2 : "undo,redo,separator,cut,copy,paste,pastetext,pasteword,spellchecker,separator,ssimage,ssflash,sslink,unlink,anchor,separator,template,advcode,separator,search,replace,selectall,visualaid,separator,tablecontrols",
|
||||
theme_advanced_buttons3 : "",
|
||||
spellchecker_languages : "$SpellcheckLangs",
|
||||
|
||||
|
@ -6,7 +6,8 @@
|
||||
<table class="data">
|
||||
<thead>
|
||||
<tr>
|
||||
<% if Markable %><th width="36"> </th><% end_if %>
|
||||
<th width="18"> </th>
|
||||
<% if Markable %><th width="18"> </th><% end_if %>
|
||||
<% control Headings %>
|
||||
<th class="$Name">$Title</th>
|
||||
<% end_control %>
|
||||
@ -17,21 +18,24 @@
|
||||
<tbody>
|
||||
<% control Items %>
|
||||
<tr id="record-$Parent.Name-$ID">
|
||||
<% if Markable %><td width="36" class="markingcheckbox"><div 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> $MarkingCheckbox</td><% end_if %>
|
||||
<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">
|
||||
<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 %>
|
||||
<td width="18">
|
||||
<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) %>
|
||||
<td width="18">
|
||||
<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">
|
||||
<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">
|
||||
<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>
|
||||
|
@ -1,3 +1,5 @@
|
||||
<% require javascript(jsparty/tabstrip/tabstrip.js) %>
|
||||
<% require css(jsparty/tabstrip/tabstrip.css) %>
|
||||
<div id="LeftPane">
|
||||
<!-- <h2><% _t('SEARCHLISTINGS','Search Listings') %></h2> -->
|
||||
<div id="SearchForm_holder" class="leftbottom">
|
||||
@ -13,7 +15,7 @@
|
||||
<p id="ModelClassSelector">
|
||||
Search for:
|
||||
<select>
|
||||
<% control SearchForms %>
|
||||
<% control ModelForms %>
|
||||
<option value="{$Form.Name}_$ClassName">$Title</option>
|
||||
<% end_control %>
|
||||
</select>
|
||||
|
Loading…
Reference in New Issue
Block a user