";
+ 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 = <<getLastFormIn($this->renderWith('CommentAdmin_right'));
}
diff --git a/code/LeftAndMain.php b/code/LeftAndMain.php
index 82d6b9a1..7e87dba4 100644
--- a/code/LeftAndMain.php
+++ b/code/LeftAndMain.php
@@ -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 /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) {
diff --git a/code/ReportAdmin.php b/code/ReportAdmin.php
index d59375b3..c512b3d8 100755
--- a/code/ReportAdmin.php
+++ b/code/ReportAdmin.php
@@ -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
diff --git a/code/SecurityAdmin.php b/code/SecurityAdmin.php
index 51531cb3..90c4b380 100644
--- a/code/SecurityAdmin.php
+++ b/code/SecurityAdmin.php
@@ -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 {
"";
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'),
diff --git a/javascript/AssetAdmin.js b/javascript/AssetAdmin.js
index c04ca8ed..67afd5de 100755
--- a/javascript/AssetAdmin.js
+++ b/javascript/AssetAdmin.js
@@ -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:
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:
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:
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
-