Merged revisions 51920 via svnmerge from

svn://svn.silverstripe.com/silverstripe/modules/cms/branches/2.2.0-mesq

........
  r51920 | ischommer | 2008-03-31 21:22:13 +1300 (Mon, 31 Mar 2008) | 1 line
  
  ENHANCEMENT Using static $tree_class to get Groups (allows for custom subclasses)
........


git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/cms/trunk@52416 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Ingo Schommer 2008-04-09 11:46:27 +00:00
parent 1bf68baa26
commit e607848e9b

View File

@ -51,7 +51,7 @@ class SecurityAdmin extends LeftAndMain implements PermissionProvider {
}
public function getEditForm($id) {
$record = DataObject::get_by_id("Group", $id);
$record = DataObject::get_by_id($this->stat('tree_class'), $id);
if(!$record) return false;
$fields = $record->getCMSFields();
@ -206,9 +206,7 @@ class SecurityAdmin extends LeftAndMain implements PermissionProvider {
* Return the entire site tree as a nested set of ULs
*/
public function SiteTreeAsUL() {
$className = "Group";
$obj = singleton($className);
$obj = singleton($this->stat('tree_class'));
// getChildrenAsUL is a flexible and complex way of traversing the tree
$siteTree = $obj->getChildrenAsUL("",
@ -228,13 +226,13 @@ class SecurityAdmin extends LeftAndMain implements PermissionProvider {
}
public function addgroup() {
$parent = $_REQUEST['ParentID'] ? $_REQUEST['ParentID'] : 0;
$p = new Group();
$p->Title = _t('SecurityAdmin.NEWGROUP',"New Group");
$p->Code = "new-group";
$p->ParentID = $parent;
$p->write();
return $this->returnItemToUser($p);
$newGroup = Object::create($this->stat('tree_class'));
$newGroup->Title = _t('SecurityAdmin.NEWGROUP',"New Group");
$newGroup->Code = "new-group";
$newGroup->ParentID = (is_numeric($_REQUEST['ParentID'])) ? (int)$_REQUEST['ParentID'] : 0;
$newGroup->write();
return $this->returnItemToUser($newGroup);
}
public function newmember() {