MINOR Fixed merge errors

This commit is contained in:
Ingo Schommer 2011-03-15 22:30:31 +13:00
parent dd6f9ed005
commit 31d7a00eb7
5 changed files with 6 additions and 266 deletions

View File

@ -1672,11 +1672,6 @@ class SiteTree extends DataObject implements PermissionProvider,i18nEntityProvid
*/ */
function getCMSFields() { function getCMSFields() {
require_once("forms/Form.php"); require_once("forms/Form.php");
Requirements::javascript(SAPPHIRE_DIR . "/thirdparty/prototype/prototype.js");
Requirements::javascript(SAPPHIRE_DIR . "/thirdparty/behaviour/behaviour.js");
Requirements::javascript(CMS_DIR . "/javascript/SitetreeAccess.js");
Requirements::add_i18n_javascript(SAPPHIRE_DIR . '/javascript/lang');
Requirements::javascript(SAPPHIRE_DIR . '/javascript/UpdateURL.js');
// Status / message // Status / message
// Create a status message for multiple parents // Create a status message for multiple parents

View File

@ -6,12 +6,6 @@ LeftAndMain is the base class of all the admin area controllers.
## Best Practices ## Best Practices
### Refreshing
Please use LeftAndMain::ForceReload to reload the whole form-area after an Ajax-Request. If you just need to refresh
parts of the form, please use javascript-replacement in the response of the original Ajax-Request. Consider using
`[api:Form]` for compiling Ajax-Responses and automatic detection of Ajax/Non-Ajax-Calls.
### Custom Access Checking ### Custom Access Checking
You can customize access control in `[api:LeftAndMain]`. You can customize access control in `[api:LeftAndMain]`.

View File

@ -25,6 +25,12 @@ class Folder extends File {
static $default_sort = "\"Sort\""; static $default_sort = "\"Sort\"";
function populateDefaults() {
parent::populateDefaults();
if(!$this->Name) $this->Name = _t('AssetAdmin.NEWFOLDER',"NewFolder");
}
/** /**
* Find the given folder or create it both as {@link Folder} database records * Find the given folder or create it both as {@link Folder} database records
* and on the filesystem. If necessary, creates parent folders as well. * and on the filesystem. If necessary, creates parent folders as well.

View File

@ -1,169 +0,0 @@
/*
* Stretch an object out to fill its parent. Give space for siblings
* If Mozilla didn't have a funky bug, we could *maybe* do this without JavaScript
*
* A more robust stretchObject() replacement
*/
function fitToParent(el, tweakVal) {
if(typeof el == "string") {
var elName = el;
el = document.getElementById(el);
if(!el) /*throw("fitToParent: Can't find element '" + elName + "'")*/ return;
}
var height = getFittingHeight(el, tweakVal) + 'px';
el.style.height = height;
}
function getFittingHeight(el, tweakVal, ignoreElements) {
if(typeof el == "string") el = document.getElementById(el);
// we set overflow = hidden so that large children don't muck things up
if(el.parentNode && el.parentNode != document.body) {
if(getDimension(el.parentNode,'overflow',true) != 'auto') el.parentNode.style.overflow = 'hidden';
}
var otherHeight = 0;
var notAComment;
if(el.parentNode) {
for(var i=0;i<el.parentNode.childNodes.length;i++) {
var sibling = el.parentNode.childNodes[i];
if(sibling.tagName && el != sibling) {
if(sibling.outerHTML == null) notAComment = true;
else if(sibling.outerHTML.indexOf("<!--") != 0) notAComment = true;
else notAComment = false;
// notAComment used for other checking
if(sibling.className && sibling.className.indexOf('fitToParent_ignore') != -1) notAComment = false;
if(getDimension(sibling,'position',true) == 'absolute') notAComment = false;
else if(getDimension(sibling,'display',true) == 'none') notAComment = false;
else {
var floatVal = getDimension(sibling,'float',true);
if(floatVal == 'left' || floatVal == 'right') notAComment = false;
}
if(ignoreElements) {
for(var j=0;j<ignoreElements.length;j++) {
if(ignoreElements[j] == sibling) {
notAComment = false;
break;
}
}
}
if(sibling.offsetHeight && notAComment && (sibling.tagName.toLowerCase() != 'script')) {
otherHeight += parseInt(sibling.offsetHeight);
}
// Hack for height of menu bar at top
if(sibling.id == 'top') {
otherHeight += 27;
}
}
}
}
if(getDimension(el,'position',true) == 'relative') otherHeight += getDimension(el,'top');
if(!tweakVal) tweakVal = 0;
// if(el.clientHeight) tweakVal += el.offsetHeight - el.clientHeight;
tweakVal += getDimension(el,'marginTop');
tweakVal += getDimension(el,'marginBottom');
tweakVal += getDimension(el,'paddingTop');
tweakVal += getDimension(el,'paddingBottom');
tweakVal += getDimension(el,'borderBottomWidth');
tweakVal += getDimension(el,'borderTopWidth');
//alert(getDimension(el.parentNode,'paddingTop', true));
tweakVal += getDimension(el.parentNode,'paddingTop');
tweakVal += getDimension(el.parentNode,'paddingBottom');
// Body border fucks up in IE
if(el.parentNode && el.parentNode.tagName != "BODY") {
tweakVal += getDimension(el.parentNode,'borderTopWidth');
tweakVal += getDimension(el.parentNode,'borderBottomWidth');
}
if(el.parentNode && el.parentNode.offsetHeight - otherHeight - tweakVal < 0) {
return 0;
}else{
if(el.parentNode) {
return (el.parentNode.offsetHeight - otherHeight - tweakVal);
}
}
}
function getSiblingList(el) {
var i,silbing,result=[];
for(i=0;i<el.parentNode.childNodes.length;i++) {
sibling = el.parentNode.childNodes[i];
if(sibling.tagName) result.push(
sibling.tagName
+ (sibling.id ? ('#' + sibling.id) : '')
+ (sibling.className ? ('.' + sibling.className) : '')
);
}
return result.join(", ");
}
/*
* Returns the value of the given dimension - marginBottom, paddingTop, etc
* Checks both stylesheet and style="" attribute
* Defaults to 0, always returns an integer
*/
function getDimension(el, dim, notAInteger) {
if(!notAInteger) notAInteger = false;
// This differs from browser to browser
if(dim == 'float') {
dim = (typeof el.style.cssFloat == 'string') ? 'cssFloat' : 'styleFloat';
}
var checkForNoneValue = {
'borderBottomWidth' : 'borderBottomStyle',
'borderTopWidth' : 'borderTopStyle',
'borderLeftWidth' : 'borderLeftStyle',
'borderRightWidth' : 'borderRightStyle'
};
// Handle hidden borders
if(checkForNoneValue[dim]) {
if(getDimension(el, checkForNoneValue[dim], true) == 'none') return 0;
}
if(el && el.style && el.style[dim]) {
return notAInteger ? el.style[dim] : parseInt(el.style[dim]);
} else if(el && el.currentStyle) {
if(el.currentStyle[dim] != 'auto') {
return notAInteger ? el.currentStyle[dim] : parseInt(el.currentStyle[dim]);
}
} else if(document.defaultView && document.defaultView.getComputedStyle) {
var val;
try {
var s = document.defaultView.getComputedStyle(el, null);
val = s[dim];
} catch(er) {}
if(val) {
if(notAInteger) {
return val;
} else {
var newVal = parseInt(val);
if(isNaN(newVal)) {
// throw("getDimension: Couldn't turn " + dim + " value '" + val + "' into an integer.");
return 0;
} else {
return newVal;
}
}
}
}
return notAInteger ? null : 0;
}

View File

@ -1,86 +0,0 @@
/*
* common/js/loader.js
* Common file, to be included before any of the other common/js scripts
*/
/*
* Gracefully deal with a whole lot of modules wanting to set the onload() event handler
*/
if(typeof _LOADERS == 'undefined') _LOADERS = Array();
function callAllLoaders() {
var i, loaderFunc;
for(i=0;i<_LOADERS.length;i++) {
loaderFunc = _LOADERS[i];
if(loaderFunc != callAllLoaders) loaderFunc();
}
}
function appendLoader(loaderFunc) {
if(window.onload && window.onload != callAllLoaders)
_LOADERS[_LOADERS.length] = window.onload;
window.onload = callAllLoaders;
_LOADERS[_LOADERS.length] = loaderFunc;
}
/*
* Call the given function on any element of the given tag and class
*/
function setUpHandlers(tagName,className, handlerFunction) {
var allElements = document.getElementsByTagName(tagName);
for(var i = 0;i<allElements.length;i++) {
if(allElements[i].className) {
tester = ' ' + allElements[i].className + ' ';
if(tester.indexOf(' ' + className + ' ') != -1) {
handlerFunction(allElements[i]);
}
}
}
}
/*
* Return an array of all elements
*/
function getAllElements() {
var allElements = document.getElementsByTagName('*');
if(allElements.length == 0) return document.all;
else return allElements;
}
/*
* Functions to add and remove class names
* Mac IE hates unnecessary spaces
*/
function addClass(el, cls, forceBefore) {
if(!el.className) el.className = "";
if(forceBefore != null && el.className.match(new RegExp('(^| )' + forceBefore))) {
el.className = el.className.replace(new RegExp("( |^)" + forceBefore), '$1' + cls + ' ' + forceBefore);
} else if(!el.className.match(new RegExp('(^| )' + cls + '($| )'))) {
el.className += ' ' + cls;
el.className = el.className.replace(/(^ +)|( +$)/g, '');
}
}
function removeClass(el, cls) {
var old = el.className;
var newCls = ' ' + el.className + ' ';
newCls = newCls.replace(new RegExp(' (' + cls + ' +)+','g'), ' ');
el.className = newCls.replace(/(^ +)|( +$)/g, '');
}
function removeClasses(el, cls) {
removeClass(el,cls);
var items = el.getElementsByTagName('*');
var i;
for(i=0;i<items.length;i++) if(items[i].className) removeClass(items[i],cls);
}
/*
* Add an event handler, saving the existing one
*/
function addEventHandler(obj, evt, handler) {
if(obj[evt]) obj['old_' + evt] = obj[evt];
obj[evt] = handler;
}