BUGFIX: Removed project-specific code.

BUGFIX: Don't throw an error if you try to create a template without a subdomain
This commit is contained in:
Sam Minnee 2009-02-24 22:36:09 +00:00
parent e2220c0b07
commit 3acc4aae80
1 changed files with 3 additions and 43 deletions

View File

@ -93,21 +93,7 @@ class SubsiteAdmin extends GenericDataAdmin {
}
function addintranet($data, $form) {
if($data['Name'] && $data['Subdomain']) {
/*
$SQL_email = Convert::raw2sql($data['AdminEmail']);
$member = DataObject::get_one('Member', "`Email`='$SQL_email'");
if(!$member) {
$member = Object::create('Member');
$nameParts = explode(' ', $data['AdminName']);
$member->FirstName = array_shift($nameParts);
$member->Surname = join(' ', $nameParts);
$member->Email = $data['AdminEmail'];
$member->write();
}
*/
if($data['Name'] && ($data['Subdomain'] || $data['Type'] == 'template')) {
if(isset($data['TemplateID']) && $data['TemplateID']) {
$template = DataObject::get_by_id('Subsite_Template', $data['TemplateID']);
} else {
@ -133,39 +119,13 @@ class SubsiteAdmin extends GenericDataAdmin {
$intranet->Subdomain = $data['Subdomain'];
$intranet->write();
}
break;
}
// NOTE: This stuff is pretty oriwave2-specific...
$groupObjects = array();
// create Staff, Management and Administrator groups
$groups = array(
'Administrators' => array('CL_ADMIN', 'CMS_ACCESS_CMSMain', 'CMS_ACCESS_AssetAdmin', 'CMS_ACCESS_SecurityAdmin', 'CMS_ACCESS_IntranetAdmin'),
'Management' => array('CL_MGMT'),
'Staff' => array('CL_STAFF')
);
foreach($groups as $name => $perms) {
$group = new Group();
$group->SubsiteID = $intranet->ID;
$group->Title = $name;
$group->write();
foreach($perms as $perm) {
Permission::grant($group->ID, $perm);
}
$groupObjects[$name] = $group;
}
/*
$member->Groups()->add($groupObjects['Administrators']);
*/
Director::redirect('admin/subsites/show/' . $intranet->ID);
} else {
echo "You must provide a Name and Subdomain.";
if($data['Type'] == 'template') echo "You must provide a name for your new template.";
else echo "You must provide a name and subdomain for your new site.";
}
}