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 GridFieldEditButton(),
new GridFieldDeleteAction(),
new GridFieldDetailForm()
new GridFieldDetailForm(),
GridFieldLevelup::create($folder->ID)->setLinkSpec('admin/assets/show/%d')
);
$gridField = new GridField('File', $title, $this->getList(), $gridFieldConfig);

View File

@ -676,7 +676,9 @@ class CMSMain extends LeftAndMain implements CurrentPageIdentifier, PermissionPr
);
if($parentID){
$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);

View File

@ -122,7 +122,9 @@ class CMSPageAddController extends CMSPageEditController {
}
$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 {
$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.PLURALNAME'])) $entities['Page.PLURALNAME'][3] = FRAMEWORK_DIR;
$types = self::page_type_classes();
foreach($types as $type) {
$types = ClassInfo::subclassesFor('SiteTree');
foreach($types as $k => $type) {
$inst = singleton($type);
$entities[$type . '.DESCRIPTION'] = array(
$inst->stat('description'),

View File

@ -127,13 +127,13 @@
* (Function) 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(
this.closest('form').attr('action') +
'/field/' + field.attr('name') + '/suggest/?value=' + encodeURIComponent(val),
function(data) {
callback.apply(this, arguments);
}
url,
function(data) {callback.apply(this, arguments);}
);
},

View File

@ -37,6 +37,8 @@ en:
Back: Back
BasicFieldsTestPage:
DESCRIPTION: 'Generic content page'
BigFamilyPage:
DESCRIPTION: 'Generic content page'
BrokenLinksReport:
Any: Any
BROKENLINKS: 'Broken links report'
@ -91,6 +93,7 @@ en:
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."
PUBPAGES: 'Done: Published {count} pages'
PageAdded: 'Successfully created page'
REMOVED: 'Deleted ''%s''%s from live site'
REMOVEDPAGE: 'Removed ''{title}'' from the published site'
REMOVEDPAGEFROMDRAFT: 'Removed ''%s'' from the draft site'
@ -211,6 +214,7 @@ en:
GridFieldTestPage:
DESCRIPTION: 'Generic content page'
LeftAndMain:
DELETED: Deleted.
PreviewButton: Preview
SAVEDUP: Saved.
STATUSPUBLISHEDSUCCESS: 'Published ''{title}'' successfully'
@ -218,6 +222,16 @@ en:
VersionUnknown: Unknown
LegacyTableFieldsTestPage:
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:
DESCRIPTION: 'Generic content page'
Permission:
@ -264,8 +278,6 @@ en:
EDITHEADER: 'Who can edit pages on this site?'
EDIT_PERMISSION: 'Manage site configuration'
EDIT_PERMISSION_HELP: 'Ability to edit global access settings/top-level page permissions.'
PLURALNAME: 'Site Configs'
SINGULARNAME: 'Site Config'
SITENAMEDEFAULT: 'Your Site Name'
SITETAGLINE: 'Site Tagline/Slogan'
SITETITLE: 'Site title'
@ -289,7 +301,6 @@ en:
BUTTONSAVEPUBLISH: 'Save & Publish'
BUTTONUNPUBLISH: Unpublish
BUTTONUNPUBLISHDESC: 'Remove this page from the published site'
CHANGETO: 'Change to "%s"'
CREATED: 'Date Created'
Comments: Comments
Content: Content

View File

@ -892,6 +892,25 @@ class SiteTreeTest extends SapphireTest {
$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'));
}
}
/**#@+