mirror of
https://github.com/silverstripe/silverstripe-subsites
synced 2024-10-22 09:05:55 +00:00
More globalisation
This commit is contained in:
parent
dcae115723
commit
5ff3b691d7
@ -12,7 +12,11 @@ class SubsiteReportWrapper extends SS_ReportWrapper {
|
||||
$subsites = Subsite::accessible_sites('CMS_ACCESS_CMSMain', true);
|
||||
$options = $subsites->toDropdownMap('ID', 'Title');
|
||||
|
||||
$subsiteField = new TreeMultiselectField('Subsites', 'Sites', $options);
|
||||
$subsiteField = new TreeMultiselectField(
|
||||
'Subsites',
|
||||
_t('SubsiteReportWrapper.ReportDropdown', 'Sites'),
|
||||
$options
|
||||
);
|
||||
$subsiteField->setValue(array_keys($options));
|
||||
|
||||
// We don't need to make the field editable if only one subsite is available
|
||||
|
@ -24,7 +24,7 @@ class SubsitesVirtualPage extends VirtualPage {
|
||||
|
||||
$subsiteSelectionField = new DropdownField(
|
||||
"CopyContentFromID_SubsiteID",
|
||||
"Subsite",
|
||||
_t('SubsitesVirtualPage.SubsiteField',"Subsite"),
|
||||
$subsites->map('ID', 'Title'),
|
||||
($this->CopyContentFromID) ? $this->CopyContentFrom()->SubsiteID : Session::get('SubsiteID')
|
||||
);
|
||||
@ -66,13 +66,51 @@ class SubsitesVirtualPage extends VirtualPage {
|
||||
}
|
||||
|
||||
|
||||
$fields->addFieldToTab('Root.Main', new TextField('CustomMetaTitle', 'Title (overrides inherited value from the source)'), 'MetaTitle');
|
||||
$fields->addFieldToTab('Root.Main', new TextareaField('CustomMetaKeywords', 'Keywords (overrides inherited value from the source)'), 'MetaKeywords');
|
||||
$fields->addFieldToTab('Root.Main', new TextareaField('CustomMetaDescription', 'Description (overrides inherited value from the source)'), 'MetaDescription');
|
||||
$fields->addFieldToTab('Root.Main', new TextField('CustomExtraMeta', 'Custom Meta Tags (overrides inherited value from the source)'), 'ExtraMeta');
|
||||
$fields->addFieldToTab(
|
||||
'Root.Main',
|
||||
TextField::create(
|
||||
'CustomMetaTitle',
|
||||
$this->fieldLabel('CustomMetaTitle')
|
||||
)->setDescription(_t('SubsitesVirtualPage.OverrideNote', 'Overrides inherited value from the source')),
|
||||
'MetaTitle'
|
||||
);
|
||||
$fields->addFieldToTab(
|
||||
'Root.Main',
|
||||
TextareaField::create(
|
||||
'CustomMetaKeywords',
|
||||
$this->fieldLabel('CustomMetaTitle')
|
||||
)->setDescription(_t('SubsitesVirtualPage.OverrideNote')),
|
||||
'MetaKeywords'
|
||||
);
|
||||
$fields->addFieldToTab(
|
||||
'Root.Main',
|
||||
TextareaField::create(
|
||||
'CustomMetaDescription',
|
||||
$this->fieldLabel('CustomMetaTitle')
|
||||
)->setDescription(_t('SubsitesVirtualPage.OverrideNote')),
|
||||
'MetaDescription'
|
||||
);
|
||||
$fields->addFieldToTab(
|
||||
'Root.Main',
|
||||
TextField::create(
|
||||
'CustomExtraMeta',
|
||||
$this->fieldLabel('CustomMetaTitle')
|
||||
)->setDescription(_t('SubsitesVirtualPage.OverrideNote')),
|
||||
'ExtraMeta'
|
||||
);
|
||||
|
||||
return $fields;
|
||||
}
|
||||
|
||||
public function fieldLabels($includerelations = true) {
|
||||
$labels = parent::fieldLabels($includerelations);
|
||||
$labels['CustomMetaTitle'] = _t('Subsite.CustomMetaTitle','Title');
|
||||
$labels['CustomMetaKeywords'] = _t('Subsite.CustomMetaKeywords','Keywords');
|
||||
$labels['CustomMetaDescription'] = _t('Subsite.CustomMetaDescription','Description');
|
||||
$labels['CustomExtraMeta'] = _t('Subsite.CustomExtraMeta','Custom Meta Tags');
|
||||
|
||||
return $labels;
|
||||
}
|
||||
|
||||
public function getVirtualFields() {
|
||||
$fields = parent::getVirtualFields();
|
||||
|
@ -30,21 +30,26 @@ class FileSubsites extends DataExtension {
|
||||
if($this->owner instanceof Folder) {
|
||||
$sites = Subsite::accessible_sites('CMS_ACCESS_AssetAdmin');
|
||||
$values = array();
|
||||
$values[0] = 'All sites';
|
||||
$values[0] = _t('FileSubsites.AllSitesDropdownOpt','All sites');
|
||||
foreach ($sites as $site) {
|
||||
$values[$site->ID] = $site->Title;
|
||||
}
|
||||
ksort($values);
|
||||
if($sites){
|
||||
//Dropdown needed to move folders between subsites
|
||||
$fields->push($dropdown = new DropdownField('SubsiteID', 'Subsite', $values));
|
||||
$dropdown = new DropdownField(
|
||||
'SubsiteID',
|
||||
_t('FileSubsites.SubsiteFieldLabel','Subsite'),
|
||||
$values
|
||||
);
|
||||
$dropdown->addExtraClass('subsites-move-dropdown');
|
||||
$fields->push($dropdown);
|
||||
$fields->push(new LiteralField(
|
||||
'Message',
|
||||
'<p class="message notice">'.
|
||||
_t('ASSETADMIN.SUBSITENOTICE', 'Folders and files created in the main site are accessible by all subsites.')
|
||||
.'</p>'
|
||||
));
|
||||
$dropdown->addExtraClass('subsites-move-dropdown');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -93,7 +93,8 @@ class GroupSubsites extends DataExtension implements PermissionProvider {
|
||||
*/
|
||||
function alternateTreeTitle() {
|
||||
if($this->owner->AccessAllSubsites) {
|
||||
return htmlspecialchars($this->owner->Title, ENT_QUOTES) . ' <i>(global group)</i>';
|
||||
$title = _t('GroupSubsites.GlobalGroup', 'global group');
|
||||
return htmlspecialchars($this->owner->Title, ENT_QUOTES) . ' <i>(' . $title . ')</i>';
|
||||
} else {
|
||||
$subsites = Convert::raw2xml(implode(", ", $this->owner->Subsites()->column('Title')));
|
||||
return htmlspecialchars($this->owner->Title) . " <i>($subsites)</i>";
|
||||
|
@ -40,6 +40,10 @@ class LeftAndMainSubsites extends Extension {
|
||||
* @return ArrayList of {@link Subsite} instances.
|
||||
*/
|
||||
function sectionSites($includeMainSite = true, $mainSiteTitle = "Main site", $member = null) {
|
||||
if($mainSiteTitle == 'Main site') {
|
||||
$mainSiteTitle = _t('Subsites.MainSiteTitle', 'Main site');
|
||||
}
|
||||
|
||||
// Rationalise member arguments
|
||||
if(!$member) $member = Member::currentUser();
|
||||
if(!$member) return new ArrayList();
|
||||
|
@ -112,8 +112,8 @@ class SiteTreeSubsites extends DataExtension {
|
||||
if(!$sc) {
|
||||
$sc = new SiteConfig();
|
||||
$sc->SubsiteID = $this->owner->SubsiteID;
|
||||
$sc->Title = 'Your Site Name';
|
||||
$sc->Tagline = 'your tagline here';
|
||||
$sc->Title = _t('Subsite.SiteConfigTitle','Your Site Name');
|
||||
$sc->Tagline = _t('Subsite.SiteConfigSubtitle','Your tagline here');
|
||||
$sc->write();
|
||||
}
|
||||
return $sc;
|
||||
|
@ -63,23 +63,11 @@ class Subsite extends DataObject implements PermissionProvider {
|
||||
);
|
||||
|
||||
private static $searchable_fields = array(
|
||||
'Title' => array(
|
||||
'title' => 'Subsite Name'
|
||||
),
|
||||
'Domains.Domain' => array(
|
||||
'title' => 'Domain name'
|
||||
),
|
||||
'IsPublic' => array(
|
||||
'title' => 'Active subsite',
|
||||
),
|
||||
'Title',
|
||||
'Domains.Domain',
|
||||
'IsPublic',
|
||||
);
|
||||
|
||||
private static $summary_fields = array(
|
||||
'Title' => 'Subsite Name',
|
||||
'PrimaryDomain' => 'Primary Domain',
|
||||
'IsPublic' => 'Active subsite',
|
||||
);
|
||||
|
||||
/**
|
||||
* Memory cache of accessible sites
|
||||
*/
|
||||
@ -204,12 +192,24 @@ class Subsite extends DataObject implements PermissionProvider {
|
||||
*/
|
||||
function getCMSFields() {
|
||||
if($this->ID!=0) {
|
||||
$domainTable = new GridField("Domains", "Domains", $this->Domains(), GridFieldConfig_RecordEditor::create(10));
|
||||
$domainTable = new GridField(
|
||||
"Domains",
|
||||
_t('Subsite.DomainsListTitle',"Domains"),
|
||||
$this->Domains(),
|
||||
GridFieldConfig_RecordEditor::create(10)
|
||||
);
|
||||
}else {
|
||||
$domainTable = new LiteralField('Domains', '<p>'._t('Subsite.DOMAINSAVEFIRST', 'You can only add domains after saving for the first time').'</p>');
|
||||
$domainTable = new LiteralField(
|
||||
'Domains',
|
||||
'<p>'._t('Subsite.DOMAINSAVEFIRST', 'You can only add domains after saving for the first time').'</p>'
|
||||
);
|
||||
}
|
||||
|
||||
$languageSelector = new DropdownField('Language', 'Language', i18n::get_common_locales());
|
||||
$languageSelector = new DropdownField(
|
||||
'Language',
|
||||
$this->fieldLabel('Language'),
|
||||
i18n::get_common_locales()
|
||||
);
|
||||
|
||||
$pageTypeMap = array();
|
||||
$pageTypes = SiteTree::page_type_classes();
|
||||
@ -220,18 +220,22 @@ class Subsite extends DataObject implements PermissionProvider {
|
||||
|
||||
$fields = new FieldList(
|
||||
$subsiteTabs = new TabSet('Root',
|
||||
new Tab('Configuration',
|
||||
new Tab(
|
||||
'Configuration',
|
||||
_t('Subsite.TabTitleConfig', 'Configuration'),
|
||||
new HeaderField($this->getClassName() . ' configuration', 2),
|
||||
new TextField('Title', 'Name of subsite:', $this->Title),
|
||||
new TextField('Title', $this->fieldLabel('Title'), $this->Title),
|
||||
|
||||
new HeaderField("Domains for this subsite"),
|
||||
new HeaderField(
|
||||
_t('Subsite.DomainsHeadline',"Domains for this subsite")
|
||||
),
|
||||
$domainTable,
|
||||
$languageSelector,
|
||||
// new TextField('RedirectURL', 'Redirect to URL', $this->RedirectURL),
|
||||
new CheckboxField('DefaultSite', 'Default site', $this->DefaultSite),
|
||||
new CheckboxField('IsPublic', 'Enable public access', $this->IsPublic),
|
||||
new CheckboxField('DefaultSite', $this->fieldLabel('DefaultSite'), $this->DefaultSite),
|
||||
new CheckboxField('IsPublic', $this->fieldLabel('IsPublic'), $this->IsPublic),
|
||||
|
||||
new DropdownField('Theme','Theme', $this->allowedThemes(), $this->Theme),
|
||||
new DropdownField('Theme',$this->fieldLabel('Theme'), $this->allowedThemes(), $this->Theme),
|
||||
|
||||
|
||||
new LiteralField(
|
||||
@ -258,6 +262,29 @@ class Subsite extends DataObject implements PermissionProvider {
|
||||
return $fields;
|
||||
}
|
||||
|
||||
public function fieldLabels($includerelations = true) {
|
||||
$labels = parent::fieldLabels($includerelations);
|
||||
$labels['Title'] = _t('Subsites.TitleFieldLabel', 'Subsite Name');
|
||||
$labels['RedirectURL'] = _t('Subsites.RedirectURLFieldLabel', 'Redirect URL');
|
||||
$labels['DefaultSite'] = _t('Subsites.DefaultSiteFieldLabel', 'Default site');
|
||||
$labels['Theme'] = _t('Subsites.ThemeFieldLabel', 'Theme');
|
||||
$labels['Language'] = _t('Subsites.LanguageFieldLabel', 'Language');
|
||||
$labels['IsPublic'] = _t('Subsites.IsPublicFieldLabel', 'Enable public access');
|
||||
$labels['PageTypeBlacklist'] = _t('Subsites.PageTypeBlacklistFieldLabel', 'Page Type Blacklist');
|
||||
$labels['Domains.Domain'] = _t('Subsites.DomainFieldLabel', 'Domain');
|
||||
$labels['PrimaryDomain'] = _t('Subsites.PrimaryDomainFieldLabel', 'Primary Domain');
|
||||
|
||||
return $labels;
|
||||
}
|
||||
|
||||
public function summaryFields() {
|
||||
return array(
|
||||
'Title' => $this->fieldLabel('Title'),
|
||||
'PrimaryDomain' => $this->fieldLabel('PrimaryDomain'),
|
||||
'IsPublic' => _t('Subsite.IsPublicHeaderField','Active subsite'),
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @todo getClassName is redundant, already stored as a database field?
|
||||
*/
|
||||
@ -267,15 +294,25 @@ class Subsite extends DataObject implements PermissionProvider {
|
||||
|
||||
function getCMSActions() {
|
||||
return new FieldList(
|
||||
new FormAction('callPageMethod', "Create copy", null, 'adminDuplicate')
|
||||
new FormAction(
|
||||
'callPageMethod',
|
||||
_t('Subsite.ButtonLabelCopy',"Create copy"),
|
||||
null,
|
||||
'adminDuplicate'
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
function adminDuplicate() {
|
||||
$newItem = $this->duplicate();
|
||||
$JS_title = Convert::raw2js($this->Title);
|
||||
$message = _t(
|
||||
'Subsite.CopyMessage',
|
||||
'Created a copy of {title}',
|
||||
array('title' => Convert::raw2js($this->Title))
|
||||
);
|
||||
|
||||
return <<<JS
|
||||
statusMessage('Created a copy of $JS_title', 'good');
|
||||
statusMessage($message, 'good');
|
||||
$('Form_EditForm').loadURLFromServer('admin/subsites/show/$newItem->ID');
|
||||
JS;
|
||||
}
|
||||
|
@ -12,8 +12,8 @@ class SubsiteDomain extends DataObject {
|
||||
);
|
||||
|
||||
private static $summary_fields=array(
|
||||
'Domain'=>'Domain',
|
||||
'IsPrimary'=>'Is Primary Domain'
|
||||
'Domain',
|
||||
'IsPrimary',
|
||||
);
|
||||
|
||||
/**
|
||||
@ -27,8 +27,16 @@ class SubsiteDomain extends DataObject {
|
||||
|
||||
public function getCMSFields() {
|
||||
return new FieldList(
|
||||
new TextField('Domain', _t('SubsiteDomain.DOMAIN', 'Domain'), null, 255),
|
||||
new CheckboxField('IsPrimary', _t('SubsiteDomain.IS_PRIMARY', 'Is Primary Domain'))
|
||||
new TextField('Domain', $this->fieldLabel('Domain'), null, 255),
|
||||
new CheckboxField('IsPrimary', $this->fieldLabel('IsPrimary'))
|
||||
);
|
||||
}
|
||||
|
||||
public function fieldLabels($includerelations = true) {
|
||||
$labels = parent::fieldLabels($includerelations);
|
||||
$labels['Domain'] = _t('SubsiteDomain.DOMAIN', 'Domain');
|
||||
$labels['IsPrimary'] = _t('SubsiteDomain.IS_PRIMARY', 'Is Primary Domain');
|
||||
|
||||
return $labels;
|
||||
}
|
||||
}
|
||||
|
118
lang/en.yml
118
lang/en.yml
@ -1,39 +1,81 @@
|
||||
en:
|
||||
SubsiteAdmin:
|
||||
MENUTITLE: "Subsites"
|
||||
GroupSubsites:
|
||||
ACCESSALL: "All subsites"
|
||||
ACCESSONLY: "Only these subsites"
|
||||
ACCESSRADIOTITLE: "Give this group access to"
|
||||
SECURITYTABTITLE: "Subsites"
|
||||
ModelAdmin:
|
||||
LOADEDFOREDITING: "Loaded \'%s\' for editing."
|
||||
RelatedPageLink:
|
||||
PLURALNAME: "Related Page Links"
|
||||
SINGULARNAME: "Related Page Link"
|
||||
Subsite:
|
||||
PLURALNAME: "Subsits"
|
||||
SINGULARNAME: "Subsite"
|
||||
DOMAINSAVEFIRST: "You can only add domains after saving for the first time"
|
||||
SubsiteDomain:
|
||||
PLURALNAME: "Subsite Domains"
|
||||
SINGULARNAME: "Subsite Domain"
|
||||
DOMAIN: "Domain"
|
||||
IS_PRIMARY: "Is Primary Domain"
|
||||
Subsite_Template:
|
||||
PLURALNAME: "Subsite Templats"
|
||||
SINGULARNAME: "Subsite Template"
|
||||
SubsitesVirtualPage:
|
||||
PLURALNAME: "Subsites Virtual Pags"
|
||||
SINGULARNAME: "Subsites Virtual Page"
|
||||
VirtualPage:
|
||||
CHOOSE: "Choose a page to link to"
|
||||
EDITCONTENT: "Click here to edit the content"
|
||||
GridFieldAddFromTemplateButton:
|
||||
AddFromTemplate: "Add New from Template"
|
||||
GridFieldAddFromTemplate:
|
||||
NewFromTemplate: "New %s from template"
|
||||
TEMPLATE_NOT_FOUND: "The selected template could not be found"
|
||||
TEMPLATE: "Template"
|
||||
LeftAndMainSubsites:
|
||||
DEFAULT_SITE: "Default Site"
|
||||
SubsiteAdmin:
|
||||
MENUTITLE: Subsites
|
||||
SubsiteXHRController:
|
||||
MENUTITLE: SubsiteXHRController
|
||||
ASSETADMIN:
|
||||
SUBSITENOTICE: 'Folders and files created in the main site are accessible by all subsites.'
|
||||
FileSubsites:
|
||||
AllSitesDropdownOpt: 'All sites'
|
||||
SubsiteFieldLabel: Subsite
|
||||
GridFieldAddFromTemplateButton:
|
||||
AddFromTemplate: 'Add New from Template'
|
||||
GroupSubsites:
|
||||
ACCESSALL: 'All subsites'
|
||||
ACCESSONLY: 'Only these subsites'
|
||||
ACCESSRADIOTITLE: 'Give this group access to'
|
||||
GlobalGroup: 'global group'
|
||||
MANAGE_SUBSITES: 'Manage subsites for groups'
|
||||
MANAGE_SUBSITES_HELP: 'Ability to limit the permissions for a group to one or more subsites.'
|
||||
SECURITYTABTITLE: Subsites
|
||||
LeftAndMainSubsites:
|
||||
Saved: 'Saved, please update related pages.'
|
||||
LeftAndMain_Menu.ss:
|
||||
Hello: Hi
|
||||
LOGOUT: 'Log out'
|
||||
Permissions:
|
||||
PERMISSIONS_CATEGORY: 'Roles and access permissions'
|
||||
SiteTree:
|
||||
PLURALNAME: Pages
|
||||
SINGULARNAME: Page
|
||||
SiteTreeSubsites:
|
||||
CopyAction: Copy
|
||||
CopyToSubsite: 'Copy page to subsite'
|
||||
Subsite:
|
||||
ButtonLabelCopy: 'Create copy'
|
||||
COPYSTRUCTURE: 'Copy structure from:'
|
||||
CopyMessage: 'Created a copy of {title}'
|
||||
CustomExtraMeta: 'Custom Meta Tags'
|
||||
CustomMetaDescription: Description
|
||||
CustomMetaKeywords: Keywords
|
||||
CustomMetaTitle: Title
|
||||
DOMAINSAVEFIRST: 'You can only add domains after saving for the first time'
|
||||
DomainsHeadline: 'Domains for this subsite'
|
||||
DomainsListTitle: Domains
|
||||
IsPublicHeaderField: 'Active subsite'
|
||||
MANAGE_ASSETS: 'Manage assets for subsites'
|
||||
MANAGE_ASSETS_HELP: 'Ability to select the subsite to which an asset folder belongs. Requires "Access to Files & Images."'
|
||||
NOTEMPLATE: 'No template'
|
||||
PLURALNAME: Subsits
|
||||
PageTypeBlacklistField: 'Disallow page types?'
|
||||
SINGULARNAME: Subsite
|
||||
SiteConfigSubtitle: 'Your tagline here'
|
||||
SiteConfigTitle: 'Your Site Name'
|
||||
TabTitleConfig: Configuration
|
||||
ValidateTitle: 'Please add a "Title"'
|
||||
SubsiteDomain:
|
||||
DOMAIN: Domain
|
||||
IS_PRIMARY: 'Is Primary Domain'
|
||||
PLURALNAME: 'Subsite Domains'
|
||||
SINGULARNAME: 'Subsite Domain'
|
||||
SubsiteReportWrapper:
|
||||
ReportDropdown: Sites
|
||||
Subsites:
|
||||
DefaultSiteFieldLabel: 'Default site'
|
||||
DomainFieldLabel: Domain
|
||||
IsPublicFieldLabel: 'Enable public access'
|
||||
LanguageFieldLabel: Language
|
||||
MainSiteTitle: 'Main site'
|
||||
PageTypeBlacklistFieldLabel: 'Page Type Blacklist'
|
||||
PrimaryDomainFieldLabel: 'Primary Domain'
|
||||
RedirectURLFieldLabel: 'Redirect URL'
|
||||
ThemeFieldLabel: Theme
|
||||
TitleFieldLabel: 'Subsite Name'
|
||||
SubsitesVirtualPage:
|
||||
DESCRIPTION: 'Displays the content of a page on another subsite'
|
||||
PLURALNAME: 'Base Pages'
|
||||
SINGULARNAME: 'Subsites Virtual Page'
|
||||
SubsiteField: Subsite
|
||||
VirtualPage:
|
||||
CHOOSE: 'Choose a page to link to'
|
||||
EDITCONTENT: 'Click here to edit the content'
|
||||
|
@ -1 +1 @@
|
||||
<a href="$NewFromTemplateLink" class="action ss-ui-action-constructive ss-ui-button ui-button ui-widget ui-state-default ui-corner-all new new-link" data-icon="add"><% _t('GridFieldAddFromTemplateButton.AddFromTemplate', '_Add New from Template') %></a>
|
||||
<a href="$NewFromTemplateLink" class="action ss-ui-action-constructive ss-ui-button ui-button ui-widget ui-state-default ui-corner-all new new-link" data-icon="add"><% _t('GridFieldAddFromTemplateButton.AddFromTemplate', 'Add New from Template') %></a>
|
@ -105,7 +105,6 @@ class SubsiteAdminFunctionalTest extends FunctionalTest {
|
||||
// Check forbidden site, on a section that's not allowed on any other subsite
|
||||
$this->getAndFollowAll("admin/assets/?SubsiteID=0");
|
||||
$this->assertEquals(Subsite::currentSubsiteID(), $subsite1->ID, 'Is redirected to first permitted subsite.');
|
||||
var_dump($this->mainSession->lastUrl());
|
||||
$this->assertNotRegExp('#^Security/login.*#', $this->mainSession->lastUrl(), 'Is not denied access');
|
||||
|
||||
// Check the standalone XHR controller.
|
||||
|
Loading…
x
Reference in New Issue
Block a user