diff --git a/README.md b/README.md index aaf5545..ebdd63d 100644 --- a/README.md +++ b/README.md @@ -70,18 +70,12 @@ Note that every site also has a ''www.''-prefixed version of the domain availabl ### Strict Subdomain Matching ### -The module tries to provide sensible defaults, in which it regards `example.com` and `www.example.com` -as the same domains. In case you want to distinguish between these variations, -set `Subsite::$strict_subdomain_matching` to TRUE. This won't affect wildcard/asterisk checks, -but removes the ambiguity about default subdomains. +The module tries to provide sensible defaults, in which it regards `example.com` and `www.example.com` as the same domains. In case you want to distinguish between these variations, set `Subsite::$strict_subdomain_matching` to TRUE. This won't affect wildcard/asterisk checks, but removes the ambiguity about default subdomains. ### Permissions ### Groups can be associated with one or more subsites, in which case the granted permissions -only apply to this subsite. Even the `ADMIN` permission only grants super-user rights on certain -subsites by default. If you want to create a super-user regardless of subsites association, -please use the `Group.AccessAllSubsites` property ("Give this group access to all subsites"), -together with the `ADMIN` permission. +only apply to this subsite. Even the `ADMIN` permission only grants super-user rights on certain subsites by default. If you want to create a super-user regardless of subsites association, please use the `Group.AccessAllSubsites` property ("Give this group access to all subsites"), together with the `ADMIN` permission. ### Access created domains @@ -104,6 +98,65 @@ Not all themes might be suitable or adapted for all subsites. You can optionally :::php Subsite::set_allowed_themes(array('blackcandy','mytheme')); +### Enable Subsite support on DataObjects +To make your DataObject subsite aware, include a SubsiteID on your DataObject. eg: + +*MyDataObject.php* + + :::php + private static $has_one = array( + 'Subsite' => 'Subsite' + ); + +Include the current SubsiteID as a hidden field on getCMSFields, or updateCMSFields. eg: + +*MyDataObject.php* + + :::php + public function getCMSFields() { + $fields = parent::getCMSFields(); + if(class_exists('Subsite')){ + $fields->push(new HiddenField('SubsiteID','SubsiteID', Subsite::currentSubsiteID())); + } + return $fields; + } + +To limit your admin gridfields to the current Subsite records, you can do something like this: + +*MyAdmin.php* + + :::php + public function getEditForm($id = null, $fields = null){ + $form = parent::getEditForm($id, $fields); + + $gridField = $form->Fields()->fieldByName($this->sanitiseClassName($this->modelClass)); + if(class_exists('Subsite')){ + $list = $gridField->getList()->filter(array('SubsiteID'=>Subsite::currentSubsiteID())); + $gridField->setList($list); + } + + return $form; + } + +### Enable menu support for custom areas in subsites + +Custom admin areas, by default, will not show in the menu of a subsite. Not all admins are adapted for or appropriate to show within a subsite. If your admin does have subsite support, or is intentionally global, you can enable the show in menu option either by applying: + +*mysite/_config.php* + + :::php + MyAdmin::add_extension('SubsiteMenuExtension'); + +or by defining the subsiteCMSShowInMenu function in your admin: + +*MyAdmin.php* + + :::php + public function subsiteCMSShowInMenu(){ + return true; + } + + ### Public display of a subsite By default, each subsite is available to the public (= not logged-in), @@ -127,5 +180,4 @@ for all subdomains: ## Screenshots -![](docs/en/_images/subsites-module-adminscreenshot-new.png) -![](docs/en/_images/subsites-module-admindropdown.png) +![](docs/en/_images/subsites-module-adminscreenshot.png) diff --git a/docs/en/_images/group-subsites-access.jpg b/docs/en/_images/group-subsites-access.jpg deleted file mode 100644 index 8a34194..0000000 Binary files a/docs/en/_images/group-subsites-access.jpg and /dev/null differ diff --git a/docs/en/_images/group-subsites-access.png b/docs/en/_images/group-subsites-access.png new file mode 100644 index 0000000..da73845 Binary files /dev/null and b/docs/en/_images/group-subsites-access.png differ diff --git a/docs/en/_images/group-subsites-dropdown.jpg b/docs/en/_images/group-subsites-dropdown.jpg deleted file mode 100644 index 9e665b3..0000000 Binary files a/docs/en/_images/group-subsites-dropdown.jpg and /dev/null differ diff --git a/docs/en/_images/subsites-dropdown.jpg b/docs/en/_images/subsites-dropdown.jpg deleted file mode 100644 index f9b7637..0000000 Binary files a/docs/en/_images/subsites-dropdown.jpg and /dev/null differ diff --git a/docs/en/_images/subsites-dropdown.png b/docs/en/_images/subsites-dropdown.png new file mode 100644 index 0000000..10c1007 Binary files /dev/null and b/docs/en/_images/subsites-dropdown.png differ diff --git a/docs/en/_images/subsites-module-adminscreenshot.png b/docs/en/_images/subsites-module-adminscreenshot.png new file mode 100644 index 0000000..c311c46 Binary files /dev/null and b/docs/en/_images/subsites-module-adminscreenshot.png differ diff --git a/docs/en/index.md b/docs/en/index.md index 3b44f86..ea5a361 100644 --- a/docs/en/index.md +++ b/docs/en/index.md @@ -7,4 +7,4 @@ same templates, or each use different ones. This document assumes that you have full admin rights for your site. 1. [Setting up subsites](set_up) - 1. [Working with subsites](working) \ No newline at end of file + 1. [Working with subsites](working_with) \ No newline at end of file diff --git a/docs/en/set_up.md b/docs/en/set_up.md index 0900011..dea7cf8 100644 --- a/docs/en/set_up.md +++ b/docs/en/set_up.md @@ -41,36 +41,21 @@ site (ie, create, edit, view.) Groups can have access to all sites, or to one or more specific subsites. If you have different staff in charge of each subsite, you probably want to create a separate group for each subsite. -The dropdown in the upper left corner of the CMS indicates which subsite you are currently on. While you are in the -Security section of the CMS, the selection in the subsites dropdown defines what groups you see in the left-hand pane. +The dropdown in the upper left corner of the CMS indicates which subsite you are currently on. -![Group subsites dropdown](_images/group-subsites-dropdown.jpg) +![Group subsites dropdown](_images/subsites-dropdown.png) -The choices are: - - * Groups accessing all sites - * [your main site] - * [a specific subsite] - * All groups - i.e., all above combined - -Once you make a selection from the dropdown, you see the appropriate groups in the *Security* section. In the Security -section, click a group and go to its *Subsites* tab to assign the subsites to which the group has access. Click *Only +Once you make a selection from the dropdown, you see the appropriate groups in the *Security* section. In the Security section, click a group and go to its *Subsites* tab to assign the subsites to which the group has access. Click *Only these subsites* to reveal a checklist of all available sites. -![Group subsites access](_images/group-subsites-access.jpg) +![Group subsites access](_images/group-subsites-access.png) ## Copying subsites -Duplicating subsites can be useful if you want to create several subsites based on the same general site structure. You -can set up a collection of pages, files, and images and use it as a template. When you create a new subsite, instead of -starting from scratch you can copy it all from your existing subsite. This will copy all pages, files and images from -that subsite into your new subsite. +Duplicating subsites can be useful if you want to create several subsites based on the same general site structure. You can set up a collection of pages, files, and images and use it as a template. When you create a new subsite, instead of starting from scratch you can copy it all from your existing subsite. This will copy all pages, files and images from that subsite into your new subsite. -To create a new subsite template, create a new subsite described above under "Creating subsites" but don't add any -domains. Add a name that will make it easy to see that it is a template. Select the new template from the subsites -dropdown in the upper right and create the pages and add the files and images you'd like to become part of the +To create a new subsite template, create a new subsite described above under "Creating subsites" but don't add any domains. Add a name that will make it easy to see that it is a template. Select the new template from the subsites dropdown in the upper right and create the pages and add the files and images you'd like to become part of the template. -When you create a new subsite, you can now choose to Copy structure from your template. All your pages, files and -images will be copied over to your new subsite. +When you create a new subsite, you can now choose to Copy structure from your template. All your pages, files and images will be copied over to your new subsite. ![Group subsites dropdown](_images/copy-structure.jpg) \ No newline at end of file diff --git a/docs/en/working.md b/docs/en/working_with.md similarity index 62% rename from docs/en/working.md rename to docs/en/working_with.md index 486f677..ef577d8 100644 --- a/docs/en/working.md +++ b/docs/en/working_with.md @@ -2,10 +2,9 @@ ## Managing content across subsites -When you are in the *Pages* or *Files* sections of the CMS, select a subsite from the dropdown in the upper left to -display the content for that site in the site tree. +Select a subsite from the dropdown in the upper left to display the content for that site in the site tree. -![Subsites dropdown](_images/subsites-dropdown.jpg) +![Subsites dropdown](_images/subsites-dropdown.png) ## Subsites virtual pages