mirror of
https://github.com/silverstripe/silverstripe-cms
synced 2024-10-22 08:05:56 +02:00
MINOR Merged from branches/2.3
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/cms/trunk@69958 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
parent
7e09cc8a18
commit
300435fb13
@ -82,9 +82,14 @@ class CMSMain extends LeftAndMain implements CurrentPageIdentifier, PermissionPr
|
||||
public function init() {
|
||||
parent::init();
|
||||
|
||||
if(Translatable::is_enabled()) {
|
||||
$this->Lang = $this->requestParams["lang"] ? $this->requestParams["lang"] : Translatable::default_lang();
|
||||
Translatable::set_reading_lang($this->Lang);
|
||||
}
|
||||
|
||||
// collect languages for TinyMCE spellchecker plugin
|
||||
if(Translatable::is_enabled()) {
|
||||
$spellcheckLangs = i18n::get_existing_content_languages();
|
||||
$spellcheckLangs = Translatable::get_existing_content_languages();
|
||||
} else {
|
||||
$defaultLang = Translatable::default_lang();
|
||||
$spellcheckLangs = array($defaultLang => i18n::get_language_name($defaultLang));
|
||||
@ -458,6 +463,10 @@ JS;
|
||||
$parent = isset($_REQUEST['ParentID']) ? $_REQUEST['ParentID'] : 0;
|
||||
$suffix = isset($_REQUEST['Suffix']) ? "-" . $_REQUEST['Suffix'] : null;
|
||||
|
||||
if(!$parent && isset($_REQUEST['Parent'])) {
|
||||
$page = SiteTree::get_by_url($_REQUEST['Parent']);
|
||||
if($page) $parent = $page->ID;
|
||||
}
|
||||
|
||||
if(is_numeric($parent)) $parentObj = DataObject::get_by_id("SiteTree", $parent);
|
||||
if(!$parentObj || !$parentObj->ID) $parent = 0;
|
||||
@ -476,6 +485,7 @@ JS;
|
||||
*/
|
||||
public function getNewItem($id, $setID = true) {
|
||||
list($dummy, $className, $parentID, $suffix) = array_pad(explode('-',$id),4,null);
|
||||
|
||||
if(Translatable::is_enabled()) {
|
||||
if (!Translatable::is_default_lang()) {
|
||||
$originalItem = Translatable::get_original($className,Session::get("{$id}_originalLangID"));
|
||||
@ -487,6 +497,7 @@ JS;
|
||||
return $originalItem;
|
||||
}
|
||||
}
|
||||
|
||||
$newItem = new $className();
|
||||
|
||||
if( !$suffix ) {
|
||||
@ -1350,7 +1361,7 @@ HTML;
|
||||
|
||||
return $response;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Restore a previously deleted page.
|
||||
* Internal action which shouldn't be executed through URL-handlers.
|
||||
@ -1540,7 +1551,7 @@ JS
|
||||
* Return a dropdown with existing languages
|
||||
*/
|
||||
function LangSelector() {
|
||||
$langs = i18n::get_existing_content_languages('SiteTree');
|
||||
$langs = Translatable::get_existing_content_languages('SiteTree');
|
||||
|
||||
return new DropdownField("LangSelector","Language",$langs,Translatable::current_lang());
|
||||
}
|
||||
@ -1549,7 +1560,7 @@ JS
|
||||
* Determine if there are more than one languages in our site tree
|
||||
*/
|
||||
function MultipleLanguages() {
|
||||
$langs = i18n::get_existing_content_languages('SiteTree');
|
||||
$langs = Translatable::get_existing_content_languages('SiteTree');
|
||||
|
||||
return (count($langs) > 1);
|
||||
}
|
||||
|
@ -116,7 +116,7 @@ class LeftAndMain extends Controller {
|
||||
|
||||
// set reading lang
|
||||
if(Translatable::is_enabled() && !Director::is_ajax()) {
|
||||
Translatable::choose_site_lang(array_keys(i18n::get_existing_content_languages('SiteTree')));
|
||||
Translatable::choose_site_lang(array_keys(Translatable::get_existing_content_languages('SiteTree')));
|
||||
}
|
||||
|
||||
// Allow customisation of the access check by a decorator
|
||||
@ -461,7 +461,7 @@ class LeftAndMain extends Controller {
|
||||
|
||||
function getSiteTreeFor($className, $rootID = null) {
|
||||
$obj = $rootID ? $this->getRecord($rootID) : singleton($className);
|
||||
$obj->markPartialTree();
|
||||
$obj->markPartialTree(null, $this);
|
||||
if($p = $this->currentPage()) $obj->markToExpose($p);
|
||||
|
||||
// getChildrenAsUL is a flexible and complex way of traversing the tree
|
||||
|
@ -379,14 +379,25 @@ div.originallang_holder.field.CompositeField.nolabel {
|
||||
font-style: italic;
|
||||
}
|
||||
|
||||
.right form .field.CompositeField .originallang label.left,
|
||||
.right form .field.CompositeField.originallang_holder label.left {
|
||||
margin-left: 0;
|
||||
width: auto;
|
||||
float: none;
|
||||
}
|
||||
|
||||
.right form div.field.CompositeField .originallang .middleColumn {
|
||||
clear: left;
|
||||
}
|
||||
|
||||
.right form div.languageDropdown {
|
||||
clear: right;
|
||||
float: left;
|
||||
padding-right: 4px;
|
||||
}
|
||||
|
||||
.right form div.createTranslationButton {
|
||||
clear: right;
|
||||
.right form .field.createTranslationButton .middleColumn {
|
||||
background: none;
|
||||
}
|
||||
|
||||
.translatingMessage {
|
||||
|
@ -300,6 +300,12 @@ CMSRightForm.prototype = {
|
||||
var sep = (SiteTreeHandlers.loadPage_url.indexOf('?') == -1) ? '?' : '&';
|
||||
url = SiteTreeHandlers.loadPage_url + sep + 'ID=' + id;
|
||||
}
|
||||
|
||||
// used to set language in CMSMain->init()
|
||||
var lang = $('LangSelector') ? $F('LangSelector') : null;
|
||||
if(lang) {
|
||||
url += '&lang='+lang;
|
||||
}
|
||||
|
||||
statusMessage("loading...");
|
||||
this.loadURLFromServer(url);
|
||||
|
@ -40,7 +40,8 @@ if((typeof tinyMCE != 'undefined')) {
|
||||
|
||||
safari_warning : false,
|
||||
relative_urls : true,
|
||||
verify_html : true
|
||||
verify_html : true,
|
||||
use_native_selects : true // fancy selects are bug as of SS 2.3.0
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -41,7 +41,6 @@ $lang['en_US']['AssetTableField']['CAPTION'] = 'Caption';
|
||||
$lang['en_US']['AssetTableField']['CREATED'] = 'First uploaded';
|
||||
$lang['en_US']['AssetTableField']['DIM'] = 'Dimensions';
|
||||
$lang['en_US']['AssetTableField']['DIMLIMT'] = 'Limit The Dimensions In The Popup Window';
|
||||
$lang['en_US']['AssetTableField']['EDITIMAGE'] = 'Edit this image';
|
||||
$lang['en_US']['AssetTableField']['FILENAME'] = 'Filename';
|
||||
$lang['en_US']['AssetTableField']['GALLERYOPTIONS'] = 'Gallery Options';
|
||||
$lang['en_US']['AssetTableField']['IMAGE'] = 'Image';
|
||||
|
@ -65,8 +65,9 @@ class RebuildStaticCacheTask extends Controller {
|
||||
|
||||
$urls = array_slice($urls, $start, $count);
|
||||
|
||||
if(!isset($_GET['urls']) && $start == 0) {
|
||||
echo "Removing old cache... ";
|
||||
if(!isset($_GET['urls']) && $start == 0 && file_exists("../cache")) {
|
||||
echo "Removing old cache... \n";
|
||||
flush();
|
||||
Filesystem::removeFolder("../cache", true);
|
||||
echo "done.\n\n";
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user