Added providePermissions for SUBSITE_EDIT

Updated domain field editing
This commit is contained in:
Sam Minnee 2007-08-27 05:07:27 +00:00
parent 5aff60efb5
commit fa54508d5e

View File

@ -2,7 +2,7 @@
/** /**
* A dynamically created subdomain. SiteTree objects can now belong to a subdomain * A dynamically created subdomain. SiteTree objects can now belong to a subdomain
*/ */
class Subsite extends DataObject { class Subsite extends DataObject implements PermissionProvider {
static $default_sort = 'Title'; static $default_sort = 'Title';
@ -27,6 +27,9 @@ class Subsite extends DataObject {
static $cached_subsite = null; static $cached_subsite = null;
public static $allowed_domains = array(
);
/** /**
* Return the base domain for this set of subsites. * Return the base domain for this set of subsites.
* You can set this by setting Subsite::$Base_domain, otherwise it defaults to HTTP_HOST * You can set this by setting Subsite::$Base_domain, otherwise it defaults to HTTP_HOST
@ -63,7 +66,10 @@ class Subsite extends DataObject {
new Tab('Configuration', new Tab('Configuration',
new HeaderField($this->getClassName() . ' configuration', 2), new HeaderField($this->getClassName() . ' configuration', 2),
new TextField('Title', 'Name of subsite:', $this->Title), new TextField('Title', 'Name of subsite:', $this->Title),
$this->domainField(), new FieldGroup('URL',
new TextField('Subdomain',"", $this->Subdomain),
new DropdownField('Domain','.', $this->stat('allowed_domains'), $this->Domain)
),
// new TextField('RedirectURL', 'Redirect to URL', $this->RedirectURL), // new TextField('RedirectURL', 'Redirect to URL', $this->RedirectURL),
new CheckboxField('DefaultSite', 'Use this subsite as the default site', $this->DefaultSite), new CheckboxField('DefaultSite', 'Use this subsite as the default site', $this->DefaultSite),
new CheckboxField('IsPublic', 'Can access this subsite publicly?', $this->IsPublic) new CheckboxField('IsPublic', 'Can access this subsite publicly?', $this->IsPublic)
@ -80,20 +86,12 @@ class Subsite extends DataObject {
return $fields; return $fields;
} }
function domainField() {
return new FieldGroup('Subsite domain',
new TextField('Subdomain',"", $this->Subdomain),
new TextField('Domain','.', $this->Domain)
);
}
function getClassName() { function getClassName() {
return $this->class; return $this->class;
} }
function getCMSActions() { function getCMSActions() {
return new FieldSet( return new FieldSet(
new FormAction('savesubsite', 'Save')
); );
} }
@ -241,6 +239,11 @@ SQL;
); );
} }
function providePermissions() {
return array(
'SUBSITE_EDIT' => 'Edit Sub-site Details',
);
}
} }
/** /**