Merge branch 'master' into 3.0 (one-off)

This is a one-off merge in the direction master->3.0,
to ensure all bugfixes since we branched off find
their way into the next micro/minor release.
From now on, we'll commit to the latest release branch,
and merge back to master. API changes should go into
the master branch (not merged into a release branch).
This commit is contained in:
Ingo Schommer 2012-07-05 18:13:40 +02:00
commit c1aad0d0c0
7 changed files with 50 additions and 15 deletions

View File

@ -146,7 +146,8 @@ JS
new GridFieldPaginator(15), new GridFieldPaginator(15),
new GridFieldEditButton(), new GridFieldEditButton(),
new GridFieldDeleteAction(), new GridFieldDeleteAction(),
new GridFieldDetailForm() new GridFieldDetailForm(),
GridFieldLevelup::create($folder->ID)->setLinkSpec('admin/assets/show/%d')
); );
$gridField = new GridField('File', $title, $this->getList(), $gridFieldConfig); $gridField = new GridField('File', $title, $this->getList(), $gridFieldConfig);

View File

@ -669,14 +669,16 @@ class CMSMain extends LeftAndMain implements CurrentPageIdentifier, PermissionPr
public function ListViewForm() { public function ListViewForm() {
$params = $this->request->requestVar('q'); $params = $this->request->requestVar('q');
$list = $this->getList($params, $parentID = $this->request->requestVar('ParentID')); $list = $this->getList($params, $parentID = $this->request->requestVar('ParentID'));
$gridFieldConfig = GridFieldConfig::create()->addComponents( $gridFieldConfig = GridFieldConfig::create()->addComponents(
new GridFieldSortableHeader(), new GridFieldSortableHeader(),
new GridFieldDataColumns(), new GridFieldDataColumns(),
new GridFieldPaginator(15) new GridFieldPaginator(15)
); );
if($parentID){ if($parentID){
$gridFieldConfig->addComponent( $gridFieldConfig->addComponent(
new GridFieldLevelup($parentID) GridFieldLevelup::create($parentID)
->setLinkSpec('?ParentID=%d&view=list')
->setAttributes(array('data-pjax' => 'ListViewForm,Breadcrumbs'))
); );
} }
$gridField = new GridField('Page','Pages', $list, $gridFieldConfig); $gridField = new GridField('Page','Pages', $list, $gridFieldConfig);

View File

@ -122,7 +122,9 @@ class CMSPageAddController extends CMSPageEditController {
} }
$record = $this->getNewItem("new-$className-$parentID".$suffix, false); $record = $this->getNewItem("new-$className-$parentID".$suffix, false);
if(class_exists('Translatable') && $record->hasExtension('Translatable')) $record->Locale = $data['Locale']; if(class_exists('Translatable') && $record->hasExtension('Translatable') && isset($data['Locale'])) {
$record->Locale = $data['Locale'];
}
try { try {
$record->write(); $record->write();

View File

@ -2704,8 +2704,8 @@ class SiteTree extends DataObject implements PermissionProvider,i18nEntityProvid
if(isset($entities['Page.SINGULARNAME'])) $entities['Page.SINGULARNAME'][3] = FRAMEWORK_DIR; if(isset($entities['Page.SINGULARNAME'])) $entities['Page.SINGULARNAME'][3] = FRAMEWORK_DIR;
if(isset($entities['Page.PLURALNAME'])) $entities['Page.PLURALNAME'][3] = FRAMEWORK_DIR; if(isset($entities['Page.PLURALNAME'])) $entities['Page.PLURALNAME'][3] = FRAMEWORK_DIR;
$types = self::page_type_classes(); $types = ClassInfo::subclassesFor('SiteTree');
foreach($types as $type) { foreach($types as $k => $type) {
$inst = singleton($type); $inst = singleton($type);
$entities[$type . '.DESCRIPTION'] = array( $entities[$type . '.DESCRIPTION'] = array(
$inst->stat('description'), $inst->stat('description'),

View File

@ -127,13 +127,13 @@
* (Function) callback * (Function) callback
*/ */
suggest: function(val, callback) { suggest: function(val, callback) {
var field = this.find(':text'); var field = this.find(':text'), urlParts = $.path.parseUrl(this.closest('form').attr('action')),
url = urlParts.hrefNoSearch + '/field/' + field.attr('name') + '/suggest/?value=' + encodeURIComponent(val);
if(urlParts.search) url += '&' + urlParts.search.replace(/^\?/, '');
$.get( $.get(
this.closest('form').attr('action') + url,
'/field/' + field.attr('name') + '/suggest/?value=' + encodeURIComponent(val), function(data) {callback.apply(this, arguments);}
function(data) {
callback.apply(this, arguments);
}
); );
}, },

View File

@ -37,6 +37,8 @@ en:
Back: Back Back: Back
BasicFieldsTestPage: BasicFieldsTestPage:
DESCRIPTION: 'Generic content page' DESCRIPTION: 'Generic content page'
BigFamilyPage:
DESCRIPTION: 'Generic content page'
BrokenLinksReport: BrokenLinksReport:
Any: Any Any: Any
BROKENLINKS: 'Broken links report' BROKENLINKS: 'Broken links report'
@ -91,6 +93,7 @@ en:
PUBALLFUN: '"Publish All" functionality' PUBALLFUN: '"Publish All" functionality'
PUBALLFUN2: "Pressing this button will do the equivalent of going to every page and pressing \"publish\". It's\n intended to be used after there have been massive edits of the content, such as when the site was\n first built." PUBALLFUN2: "Pressing this button will do the equivalent of going to every page and pressing \"publish\". It's\n intended to be used after there have been massive edits of the content, such as when the site was\n first built."
PUBPAGES: 'Done: Published {count} pages' PUBPAGES: 'Done: Published {count} pages'
PageAdded: 'Successfully created page'
REMOVED: 'Deleted ''%s''%s from live site' REMOVED: 'Deleted ''%s''%s from live site'
REMOVEDPAGE: 'Removed ''{title}'' from the published site' REMOVEDPAGE: 'Removed ''{title}'' from the published site'
REMOVEDPAGEFROMDRAFT: 'Removed ''%s'' from the draft site' REMOVEDPAGEFROMDRAFT: 'Removed ''%s'' from the draft site'
@ -211,6 +214,7 @@ en:
GridFieldTestPage: GridFieldTestPage:
DESCRIPTION: 'Generic content page' DESCRIPTION: 'Generic content page'
LeftAndMain: LeftAndMain:
DELETED: Deleted.
PreviewButton: Preview PreviewButton: Preview
SAVEDUP: Saved. SAVEDUP: Saved.
STATUSPUBLISHEDSUCCESS: 'Published ''{title}'' successfully' STATUSPUBLISHEDSUCCESS: 'Published ''{title}'' successfully'
@ -218,6 +222,16 @@ en:
VersionUnknown: Unknown VersionUnknown: Unknown
LegacyTableFieldsTestPage: LegacyTableFieldsTestPage:
DESCRIPTION: 'Generic content page' DESCRIPTION: 'Generic content page'
MyNonRootPage:
DESCRIPTION: 'Generic content page'
MyOtherPage:
DESCRIPTION: 'Generic content page'
MyPage:
DESCRIPTION: 'Generic content page'
MyRandomPage:
DESCRIPTION: 'Generic content page'
PackageManagerPage:
DESCRIPTION: 'Generic content page'
Page: Page:
DESCRIPTION: 'Generic content page' DESCRIPTION: 'Generic content page'
Permission: Permission:
@ -264,8 +278,6 @@ en:
EDITHEADER: 'Who can edit pages on this site?' EDITHEADER: 'Who can edit pages on this site?'
EDIT_PERMISSION: 'Manage site configuration' EDIT_PERMISSION: 'Manage site configuration'
EDIT_PERMISSION_HELP: 'Ability to edit global access settings/top-level page permissions.' EDIT_PERMISSION_HELP: 'Ability to edit global access settings/top-level page permissions.'
PLURALNAME: 'Site Configs'
SINGULARNAME: 'Site Config'
SITENAMEDEFAULT: 'Your Site Name' SITENAMEDEFAULT: 'Your Site Name'
SITETAGLINE: 'Site Tagline/Slogan' SITETAGLINE: 'Site Tagline/Slogan'
SITETITLE: 'Site title' SITETITLE: 'Site title'
@ -289,7 +301,6 @@ en:
BUTTONSAVEPUBLISH: 'Save & Publish' BUTTONSAVEPUBLISH: 'Save & Publish'
BUTTONUNPUBLISH: Unpublish BUTTONUNPUBLISH: Unpublish
BUTTONUNPUBLISHDESC: 'Remove this page from the published site' BUTTONUNPUBLISHDESC: 'Remove this page from the published site'
CHANGETO: 'Change to "%s"'
CREATED: 'Date Created' CREATED: 'Date Created'
Comments: Comments Comments: Comments
Content: Content Content: Content

View File

@ -891,6 +891,25 @@ class SiteTreeTest extends SapphireTest {
$this->assertContains('InheritedTitle', $treeTitle); $this->assertContains('InheritedTitle', $treeTitle);
$this->assertContains('inherited-class', $treeTitle); $this->assertContains('inherited-class', $treeTitle);
} }
function testMenuTitleIsUnsetWhenEqualsTitle() {
$page = new SiteTree();
$page->Title = 'orig';
$page->MenuTitle = 'orig';
$page->write();
// change menu title
$page->MenuTitle = 'changed';
$page->write();
$page = SiteTree::get()->byID($page->ID);
$this->assertEquals('changed', $page->getField('MenuTitle'));
// change menu title back
$page->MenuTitle = 'orig';
$page->write();
$page = SiteTree::get()->byID($page->ID);
$this->assertEquals(null, $page->getField('MenuTitle'));
}
} }