From fa54508d5eb66b4e6dd3d9111f7575e0f38da2be Mon Sep 17 00:00:00 2001 From: Sam Minnee Date: Mon, 27 Aug 2007 05:07:27 +0000 Subject: [PATCH] Added providePermissions for SUBSITE_EDIT Updated domain field editing --- code/Subsite.php | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/code/Subsite.php b/code/Subsite.php index 2d5b47d..6a06b50 100644 --- a/code/Subsite.php +++ b/code/Subsite.php @@ -2,7 +2,7 @@ /** * 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'; @@ -27,6 +27,9 @@ class Subsite extends DataObject { static $cached_subsite = null; + public static $allowed_domains = array( + ); + /** * Return the base domain for this set of subsites. * 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 HeaderField($this->getClassName() . ' configuration', 2), 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 CheckboxField('DefaultSite', 'Use this subsite as the default site', $this->DefaultSite), new CheckboxField('IsPublic', 'Can access this subsite publicly?', $this->IsPublic) @@ -80,20 +86,12 @@ class Subsite extends DataObject { return $fields; } - function domainField() { - return new FieldGroup('Subsite domain', - new TextField('Subdomain',"", $this->Subdomain), - new TextField('Domain','.', $this->Domain) - ); - } - function getClassName() { return $this->class; } function getCMSActions() { return new FieldSet( - new FormAction('savesubsite', 'Save') ); } @@ -241,6 +239,11 @@ SQL; ); } + function providePermissions() { + return array( + 'SUBSITE_EDIT' => 'Edit Sub-site Details', + ); + } } /**