if (!console) {
var console;
function createConsole() {
var Dom = YAHOO.util.Dom,
Event = YAHOO.util.Event,
Lang = YAHOO.lang;
var console = {
consoleElement: null,
consoleHeader: null,
consoleBody: null,
isVisible: true,
consoleWith: 250,
render: function() {
this.consoleElement = document.createElement('div');
document.body.appendChild(this.consoleElement);
Dom.setStyle(this.consoleElement, 'position', 'absolute');
Dom.setStyle(this.consoleElement, 'background-color', '#eeeeee');
Dom.setStyle(this.consoleElement, 'border', 'solid 1px #888888');
Dom.setStyle(this.consoleElement, 'padding', '2px');
Dom.setStyle(this.consoleElement, 'top', '10px');
Dom.setStyle(this.consoleElement, 'left', (Dom.getDocumentWidth()-this.consoleWith-25)+'px');
Dom.setStyle(this.consoleElement, 'width', this.consoleWith+'px');
Dom.setStyle(this.consoleElement, 'height', (Dom.getDocumentHeight()-40)+'px');
Dom.setStyle(this.consoleElement, 'overflow', 'auto');
Event.addListener(window, 'resize', function(event) {
Dom.setStyle(this.consoleElement, 'left', (Dom.getDocumentWidth()-this.consoleWith-25)+'px');
}, null, this)
this.consoleHeader = document.createElement('div');
this.consoleElement.appendChild(this.consoleHeader);
Dom.setStyle(this.consoleHeader, 'background-color', '#888888');
Dom.setStyle(this.consoleHeader, 'padding', '2px');
Dom.setStyle(this.consoleHeader, 'font-size', '11px');
Dom.setStyle(this.consoleHeader, 'cursor', 'pointer');
Dom.setStyle(this.consoleHeader, 'overflow', 'auto');
this.consoleHeader.innerHTML = 'Console';
this.consoleBody = document.createElement('div');
this.consoleElement.appendChild(this.consoleBody);
Dom.setStyle(this.consoleBody, 'height', (this.consoleElement.clientHeight-this.consoleHeader.clientHeight-8)+'px');
Dom.setStyle(this.consoleBody, 'font-size', '9px');
Dom.setStyle(this.consoleBody, 'overflow', 'auto');
Event.addListener(this.consoleHeader, 'click', function() {
(this.isVisible) ? hide() : show();
}, null, this);
this.hideConsole();
},
hideConsole: function() {
this.isVisible = false;
if (this.consoleElement && this.consoleBody && this.consoleHeader) {
Dom.setStyle(this.consoleElement, 'top', '-9999px');
Dom.setStyle(this.consoleElement, 'left', '-9999px');
}
},
showConsole: function() {
this.isVisible = true;
if (this.consoleElement) {
Dom.setStyle(this.consoleElement, 'top', '10px');
Dom.setStyle(this.consoleElement, 'left', (Dom.getDocumentWidth()-this.consoleWith-25)+'px');
}
},
log: function(msg) {
if (this.consoleElement && this.consoleBody) {
var content = this.consoleBody.innerHTML;
this.consoleBody.innerHTML = msg+'
'+content;
}
},
info: function(msg) {
if (this.consoleElement && this.consoleBody) {
var content = this.consoleBody.innerHTML;
this.consoleBody.innerHTML = 'INFO: '+msg+'
'+content;
}
},
warn: function(msg) {
if (this.consoleElement && this.consoleBody) {
var content = this.consoleBody.innerHTML;
// this.consoleBody.innerHTML = 'WARNING: '+msg+'
'+content;
this.consoleBody.innerHTML = '
WARNING: '+msg+'
'+content;
}
},
error: function(msg) {
if (this.consoleElement && this.consoleBody) {
var content = this.consoleBody.innerHTML;
this.consoleBody.innerHTML = 'ERROR: '+msg+'
'+content;
}
}
};
return console;
};
YAHOO.util.Event.onDOMReady(function() {
console = createConsole();
console.render();
});
}
YAHOO.namespace('POTISCOM');
(function() {
var Dom = YAHOO.util.Dom,
Event = YAHOO.util.Event,
Lang = YAHOO.lang;
var Application = function() {
var _singleton = function() {
}
_singleton.prototype = {
YUI_SKIN_CLASS: 'yui-skin-sam',
INIT_PROGRESS_CLASS: 'initializing',
CSS_CLASS_INVISIBLE: 'invisible',
fileUploaderUrl: '',
host: '',
basePath: '',
dispatchers: {},
dialogs: {},
renderedDialogs: {},
documentRoot: '',
applicationPath: '',
resourceHost: '',
editorLocale: null,
availableLocales: {},
fallbackLocale: null,
loader: null,
loaderEventId: null, // initial loader event id
clickHandlers: {},
mousedownHandlers: {},
mouseupHandlers: {},
mouseoverHandlers: {},
mouseoutHandlers: {},
changeHandlers: {},
currentLocale: 'de',
loadModulesSilent: false,
getDispatcher: function(id) {
id = id || 'default';
return this.dispatchers[id];
},
addDispatcher: function(dispatcher, id) {
id = id || 'default';
this.dispatchers[id] = dispatcher;
},
getDispatchers: function() {
return this.dispatchers;
},
setDispatchers: function(dispatchers) {
this.dispatchers = dispatchers;
},
getDialog: function(id, callback, scope) {
if (!callback || !scope) {
throw new Exception('GetDialog: callback and scope must be defined');
}
if (!this.renderedDialogs[id]) {
this.dialogs[id].call(this, callback, scope);
} else {
callback.call(scope, this.renderedDialogs[id]);
}
},
addDialog: function(dialog, id) {
id = id || 'default';
this.dialogs[id] = dialog;
},
getDialogs: function() {
return this.dialogs;
},
setDialogs: function(dialogs) {
this.dialogs = dialogs;
},
getHost: function() {
return this.host;
},
setHost: function(host) {
this.host = host;
},
getBasePath: function() {
return this.basePath;
},
setBasePath: function(basePath) {
this.basePath = basePath;
},
getDocumentRoot: function() {
return this.documentRoot;
},
setDocumentRoot: function(documentRoot) {
this.documentRoot = documentRoot;
},
getApplicationPath: function() {
return this.applicationPath;
},
setApplicationPath: function(applicationPath) {
this.applicationPath = applicationPath;
},
getLoader: function() {
return this.loader;
},
initialize: function(config) {
this.host = config.host || this.host;
this.basePath = config.basePath || this.basePath;
this.dispatchers = config.dispatchers || this.dispatchers;
this.documentRoot = config.documentRoot || this.documentRoot;
this.applicationPath = config.applicationPath || this.applicationPath;
this.resourceHost = config.resourceHost || 'http://'+this.host+'/potiscomjsvcl/libs/yui/build/';
this.loadModulesSilent = config.loadModulesSilent || false;
var customModuleRegistry = config.customModuleRegistry || null;
var customModuleRegistries = config.customModuleRegistries || null;
var loadModules = config.loadModules || [];
this._initLoader(customModuleRegistry, customModuleRegistries, loadModules, this.resourceHost);
},
_initLoader: function(customModuleRegistry, customModuleRegistries, loadModules, base) {
var loader;
if (customModuleRegistry) {
loader = new YAHOO.POTISCOM.Loader({
addCustomModulesToLoader: [customModuleRegistry],
base: base,
loadSilent: this.loadModulesSilent
});
} else if (customModuleRegistries) {
loader = new YAHOO.POTISCOM.Loader({
addCustomModulesToLoader: customModuleRegistries,
base: base,
loadSilent: this.loadModulesSilent
});
}
this.loaderEventId = loader.addModuleSet({
moduleNames: loadModules
});
this.loader = loader;
},
getInitModule: function() {
throw new Exception('Implement this Method');
},
initModule: function() {
var m = this.getInitModule();
Application.getLoader().load([
m.getDependencies()
], m.execute, m);
},
getEditorLocale: function() {
return this.editorLocale;
},
setEditorLocale: function(editorLocale) {
this.editorLocale = editorLocale;
},
addAvailableLocale: function(locale, name) {
if (locale && name) {
this.availableLocales[locale] = name;
}
},
getAvailableLocales: function() {
return this.availableLocales;
},
getAvailableLocale: function(locale) {
return this.availableLocales[locale];
},
setFallbackLocale: function(fallbackLocale) {
this.fallbackLocale = fallbackLocale;
},
getFallbackLocale: function() {
return this.fallbackLocale;
},
getCurrentLocale: function() {
return this.currentLocale;
},
setCurrentLocale: function(currentLocale) {
this.currentLocale = currentLocale;
},
execute: function() {
Event.onDOMReady(function() {
this.registerPageEventListeners();
this.loader[this.loaderEventId].subscribe(function() {
Dom.removeClass(document.body, this.INIT_PROGRESS_CLASS);
Dom.addClass(document.body, this.YUI_SKIN_CLASS);
this.initModule();
}, null, this);
this.loader.loadModuleSet(this.loaderEventId);
}, null, this);
},
/*** CLICK HANDLERS ***********************************************************************************************/
registerClickPageListener: function() {
Event.addListener(document, 'click', function(event) {
if (this.isValidEventTarget(Event.getTarget(event))) {
for (var i in this.clickHandlers) {
if (this.clickHandlers.hasOwnProperty(i) && this.clickHandlers[i].handleClick) {
this.clickHandlers[i].handleClick.call(this.clickHandlers[i], event);
}
}
}
}, null, this);
},
addClickHandler: function(name, handler) {
this.clickHandlers[name] = handler;
},
removeClickHandler: function(name) {
if (this.clickHandlers.hasOwnProperty(name)) {
delete(this.clickHandlers[name]);
}
},
/*** MOUSEDOWN HANDLERS *******************************************************************************************/
registerMousedownPageListener: function() {
Event.addListener(document, 'mousedown', function(event) {
if (this.isValidEventTarget(Event.getTarget(event))) {
for (var i in this.mousedownHandlers) {
if (this.mousedownHandlers.hasOwnProperty(i) && this.mousedownHandlers[i].handleMousedown) {
this.mousedownHandlers[i].handleMousedown.call(this.mousedownHandlers[i], event);
}
}
}
}, null, this);
},
addMousedownHandler: function(name, handler) {
this.mousedownHandlers[name] = handler;
},
removeMousedownHandler: function(name) {
if (this.mousedownHandlers.hasOwnProperty(name)) {
delete(this.mousedownHandlers[name]);
}
},
/*** MOUSEUP HANDLERS *********************************************************************************************/
registerMouseupPageListener: function() {
Event.addListener(document, 'mouseup', function(event) {
if (this.isValidEventTarget(Event.getTarget(event))) {
for (var i in this.mouseupHandlers) {
if (this.mouseupHandlers.hasOwnProperty(i) && this.mouseupHandlers[i].handleMouseup) {
this.mouseupHandlers[i].handleMouseup.call(this.mouseupHandlers[i], event);
}
}
}
}, null, this);
},
addMouseupHandler: function(name, handler) {
this.mouseupHandlers[name] = handler;
},
removeMouseupHandler: function(name) {
if (this.mouseupHandlers.hasOwnProperty(name)) {
delete(this.mouseupHandlers[name]);
}
},
/*** CHANGE HANDLERS *******************************************************************************************/
registerChangePageListener: function() {
Event.addListener(document, 'change', this._handleChangeEvent, null, this);
},
_handleChangeEvent: function(event) {
for (var i in this.changeHandlers) {
if (this.changeHandlers.hasOwnProperty(i) && this.changeHandlers[i].handleChange) {
this.changeHandlers[i].handleChange.call(this.changeHandlers[i], event);
}
}
},
registerIeChangePageListener: function() {
// Event.addListener(document, 'mousedown', this._handleIeChangeDownEvent, null, this);
// Event.addListener(document, 'mouseup', this._handleIeChangeUpEvent, null, this);
Event.addListener(document, 'click', this._handleIeChangeUpEvent, null, this);
// Event.addListener(document, 'keyup', this._handleIeChangeEvent, null, this);
},
ieChangeSelectValues: {},
_handleIeChangeDownEvent: function(event) {
// var element = Event.getTarget(event);
// var item = element;
// if (element.tagName.toUpperCase()==='OPTION') {
// item = element.parentNode;
// }
// var tagName = item.tagName;
// var changed = false;
// if (tagName==='SELECT') {
// if (!this.ieChangeSelectValues[item.id]) {
//// this.ieChangeSelectValues[item.id] = item.value;
// }
// }
},
_handleIeChangeUpEvent: function(event) {
var element = Event.getTarget(event);
var item = element;
if (element.tagName.toUpperCase()==='OPTION') {
item = element.parentNode;
}
var tagName = item.tagName;
var changed = false;
if (tagName==='SELECT') {
if (this.ieChangeSelectValues[item.id] && this.ieChangeSelectValues[item.id]!==item.value) {
this.ieChangeSelectValues[item.id] = null;
changed = true;
} else if (this.ieChangeSelectValues[item.id] && this.ieChangeSelectValues[item.id]===item.value) {
// this.ieChangeSelectValues[item.id] = null;
} else {
this.ieChangeSelectValues[item.id] = item.value;
}
}
if (changed) {
this._handleChangeEvent(event);
}
},
addChangeHandler: function(name, handler) {
this.changeHandlers[name] = handler;
},
removeChangeHandler: function(name) {
if (this.changeHandlers.hasOwnProperty(name)) {
delete(this.changeHandlers[name]);
}
},
/*** MOUSEOVER HANDLERS *******************************************************************************************/
registerMouseoverPageListener: function() {
Event.addListener(document, 'mouseover', function(event) {
if (this.isValidEventTarget(Event.getTarget(event), true)) {
for (var i in this.mouseoverHandlers) {
if (this.mouseoverHandlers.hasOwnProperty(i) && this.mouseoverHandlers[i].handleMouseover) {
this.mouseoverHandlers[i].handleMouseover.call(this.mouseoverHandlers[i], event);
}
}
}
}, null, this);
},
addMouseoverHandler: function(name, handler) {
this.mouseoverHandlers[name] = handler;
},
removeMouseoverHandler: function(name) {
if (this.mouseoverHandlers.hasOwnProperty(name)) {
delete(this.mouseoverHandlers[name]);
}
},
/*** MOUSEOUT HANDLERS ********************************************************************************************/
registerMouseoutPageListener: function() {
Event.addListener(document, 'mouseout', function(event) {
if (this.isValidEventTarget(Event.getTarget(event), true)) {
for (var i in this.mouseoutHandlers) {
if (this.mouseoutHandlers.hasOwnProperty(i) && this.mouseoutHandlers[i].handleMouseout) {
this.mouseoutHandlers[i].handleMouseout.call(this.mouseoutHandlers[i], event);
}
}
}
}, null, this);
},
addMouseoutHandler: function(name, handler) {
this.mouseoutHandlers[name] = handler;
},
removeMouseoutHandler: function(name) {
if (this.mouseoutHandlers.hasOwnProperty(name)) {
delete(this.mouseoutHandlers[name]);
}
},
/*** PAGE EVENT HANDLER HELPERS ***********************************************************************************/
registerPageEventListeners: function() {
this.registerClickPageListener();
this.registerMousedownPageListener();
this.registerMouseupPageListener();
this.registerMouseoverPageListener();
this.registerMouseoutPageListener();
(YAHOO.env.ua.ie) ? this.registerIeChangePageListener() : this.registerChangePageListener();
},
isValidEventTarget: function(element, doNotFocusElement) {
if (element.tagName.toUpperCase()==='TEXTAREA') {
if (!element.id || element.id.match('_override'+"$")!='_override') {
if (!doNotFocusElement) {
element.focus();
}
return false;
}
}
if (element.tagName.toUpperCase()==='INPUT' && element.type.toUpperCase()==='TEXT') {
if (!doNotFocusElement) {
element.focus();
}
return false;
}
if (element.tagName.toUpperCase()==='INPUT' && element.type.toUpperCase()==='CHECKBOX') {
return false;
}
if (element.tagName.toUpperCase()==='INPUT' && element.type.toUpperCase()==='RADIO') {
return false;
}
return true;
}
}
return new _singleton();
} ();
YAHOO.POTISCOM.Application = Application;
})();
YAHOO.register('POTISCOM.Application', YAHOO.POTISCOM.Application, {version: "0.1", build: '1'});
YAHOO.namespace('POTISCOM');
(function() {
var Dom = YAHOO.util.Dom,
Event = YAHOO.util.Event,
Lang = YAHOO.lang,
Application = YAHOO.POTISCOM.Application;
var Loader = function(config) {
config = config || {};
this.init(config);
};
Loader.prototype = {
yuiLoader: null,
moduleSetsCount: 0,
moduleSets: {},
currentModuleSet: {},
moduleSetsToLoad: [],
loadInProgress: false,
loadSilent: false,
/**
* overwrite this method in the config object
* @param {Object} ldr
*/
addCustomModulesToLoader: function(yuiLoader) {},
init: function(config) {
this.loadSilent = config.loadSilent || false;
loaderConfig = {
allowRollup: true,
loadOptional: true,
timeout: 10000,
base: config.base,
//comboBase: '/combo/?b=libs&f=',
//filter: {
// 'searchExp': /&2/g,
// 'replaceStr': ",2"
//},
//skin: {
// defaultSkin: 'sam',
// base: 'assets/skins/',
// path: 'skin.css',
// rollup: 1
//},
combine: false
};
this.yuiLoader = new YAHOO.util.YUILoader(loaderConfig);
var closureThis = this;
this.yuiLoader.onProgress = function(o) {
closureThis.onProgress(o);
};
this.yuiLoader.onSuccess = function() {
closureThis.onSuccess();
};
this.yuiLoader.onFailure = function(o) {
closureThis.onFailure(o);
};
this.addCustomModulesToLoader = config.addCustomModulesToLoader || this.addCustomModulesToLoader;
YAHOO.POTISCOM.addModulesToLoader(this.yuiLoader);
for (var i in this.addCustomModulesToLoader) {
if (this.addCustomModulesToLoader.hasOwnProperty(i)) {
this.addCustomModulesToLoader[i](this.yuiLoader);
}
}
},
addModuleSet: function(loadDefinition) {
this.moduleSetsCount += 1;
var eventName = 'ModuleSetsChain_'+this.moduleSetsCount;
var event = new YAHOO.util.CustomEvent('subcategorySelected', this);
event.signature = YAHOO.util.CustomEvent.FLAT;
loadDefinition.moduleNames = loadDefinition.moduleNames || [];
loadDefinition.eventName = eventName;
this.moduleSets[eventName] = loadDefinition;
this[eventName] = event;
return eventName;
},
loadModuleSet: function(eventId) {
if (!Dom.hasClass(document.body, 'initializing')) {
Dom.addClass(document.body, 'moduleprogress');
}
if (!this.loadInProgress>0 && this.moduleSets[eventId]) {
this.loadInProgress = 1;
this.showLoadingDialog();
this.currentModuleSet = this.moduleSets[eventId];
this._loadModuleSet();
} else {
this.moduleSetsToLoad.push(eventId);
}
},
_loadModuleSet: function() {
var mSet = this.currentModuleSet;
for (var i in mSet.moduleNames) {
if (mSet.moduleNames.hasOwnProperty(i)) {
this.yuiLoader.require(mSet.moduleNames[i]);
}
}
this.yuiLoader.insert(null, 'js');
},
showLoadingDialog: function() {
if (YAHOO.POTISCOM.Tools && !this.loadSilent) {
YAHOO.POTISCOM.Tools.disableElement('SYSTEM_WINDOW', true);
}
},
hideLoadingDialog: function() {
if (YAHOO.POTISCOM.Tools && !this.loadSilent) {
YAHOO.POTISCOM.Tools.enableElement('SYSTEM_WINDOW');
}
},
onProgress: function(o) {
console.log("Module loaded: " + o.name);
},
onSuccess: function() {
this.loadInProgress -= 1;
var mSet = this.currentModuleSet;
this[mSet.eventName].fire();
if (this.loadInProgress<=0) {
this.hideLoadingDialog();
}
},
onFailure: function(o) {
console.error('Failed to load module\n'+Lang.dump(o));
},
load: function(dependencies, callback, scope) {
var eventId = this.addModuleSet({
moduleNames: dependencies
});
this[eventId].subscribe(callback, null, scope);
this.loadModuleSet(eventId);
}
}
YAHOO.POTISCOM.Loader = Loader;
})();
YAHOO.namespace('POTISCOM');
//YAHOO.namespace('POTISCOM.Singletons');
(function() {
var Dom = YAHOO.util.Dom,
Event = YAHOO.util.Event,
Lang = YAHOO.lang,
Application = YAHOO.POTISCOM.Application;
var Tools = function() {
var _singleton = function() {
}
_singleton.prototype = {
/**
*
* @param {Object} containerId
*/
collectSubmittables_OLD: function(containerId) {
var data = [];
var item = 0;
if(containerId) {
Dom.getElementsByClassName('submittable', null, containerId, function(elem) {
var elemName = elem.name;
if(!elem.disabled && elemName) {
elemName = encodeURIComponent(elemName) + '=';
switch(elem.type) {
case 'radio':
case 'checkbox':
if(elem.checked){
data[item++] = elemName + encodeURIComponent(elem.value);
}
break;
default:
data[item++] = elemName + encodeURIComponent(elem.value);
}
}
});
}
data = data.join('&');
Conn.asyncRequest(method, url, {
success: function(o) {
// ...
}
}, data);
},
/**
*
* @param {Object} containerId
*/
collectSubmittables: function(containerId) {
var result = {};
var elements = YAHOO.util.Selector.query('#'+containerId+' .submittable');
elements.each(function(submittable) {
if (submittable.type=='checkbox') {
var resultKey = submittable.name || submittable.id;
result[resultKey] = submittable.checked;
} else if (submittable.value!=undefined) {
var resultKey = submittable.name || submittable.id;
result[resultKey] = submittable.value;
} else {
result[submittable.id] = submittable.innerHTML;
}
});
return result;
},
collectSubmittables_Michi: function(containerId) {
var data = [];
if(containerId) {
var item = 0;
Dom.getElementsByClassName('submittable', null, containerId, function(elem) {
var elemName = elem.name;
if(!elem.disabled && elemName) {
elemName = encodeURIComponent(elemName) + '=';
switch(elem.type) {
case 'radio':
case 'checkbox':
if(elem.checked){
data[item++] = elemName + encodeURIComponent(elem.value);
}
break;
default:
data[item++] = elemName + encodeURIComponent(elem.value);
}
}
});
}
return data.join('&');
},
/**
*
* @param {Object} element
* @param {Object} contents
*/
cloneElement: function(element) {
if (!Dom.hasClass(element, 'clonable')) {
var clonedElement = document.createElement('div');
var reg = Dom.getRegion(element);
Dom.setStyle(clonedElement, 'width', (reg.right-reg.left)+'px');
Dom.setStyle(clonedElement, 'height', (reg.bottom-reg.top)+'px');
Dom.addClass(clonedElement, 'draggingproxy');
return clonedElement;
}
function removeId(element) {
if (element.removeAttribute) {
element.removeAttribute('id');
}
for (var i=0, k=element.childNodes.length; i=0) {
toRemove.push(clonedElement.childNodes[i]);
}
}
for (var i = 0, k = toRemove.length; i < k; i++) {
clonedElement.removeChild(toRemove[i]);
}
removeId(clonedElement);
Dom.addClass(clonedElement, 'cloneddraggingproxy');
return clonedElement;
},
isInputElement: function(element, autofocus) {
if (element.tagName.toUpperCase()==='TEXTAREA') {
if (autofocus) {
element.focus();
}
return true;
}
if (element.tagName.toUpperCase()==='INPUT' && element.type.toUpperCase()==='TEXT') {
if (autofocus) {
element.focus();
}
return true;
}
if (element.tagName.toUpperCase()==='SELECT' || element.tagName.toUpperCase()==='OPTION') {
return true;
}
},
getCommandObject: function(elementId) {
var element = Dom.get(elementId);
if (!element.id) {
Dom.generateId(element, 'yui-gen-');
}
return YAHOO.util.Selector.query('#'+element.id+' > div.commandobject', element.parentNode, true);
},
getCommand: function(commandObjectId, name) {
var commandObject = Dom.get(this.getCommandObject(commandObjectId));
if (commandObject) {
var el = Dom.getFirstChildBy(commandObject, function(element) {
return element.name == name;
});
if (el) {
return (el.value) ? el.value : '';
}
throw 'YAHOO.POTISCOM.Module: Command with name '+name+' not found';
}
throw 'YAHOO.POTISCOM.Module: No command object found for this module';
},
getCommando: function(commandObjectId, name) {
return this.getCommand(commandObjectId, name);
},
setCommand: function(commandObjectId, name, newValue) {
var commandObject = Dom.get(this.getCommandObject(commandObjectId));
if (commandObject) {
var el = Dom.getFirstChildBy(commandObject, function(element) {
return element.name == name;
});
if (el) {
el.value = newValue;
return true;
} else {
var cmd = document.createElement('input');
cmd.type = "text";
cmd.value = newValue;
commandObject.appendChild(cmd);
return true;
}
throw 'YAHOO.POTISCOM.Module: Command with name '+name+' not found';
}
throw 'YAHOO.POTISCOM.Module: No command object found for this module';
},
setCommando: function(commandObjectId, name, newValue) {
this.setCommand(commandObjectId, name, newValue);
},
blockers: {},
disableElement: function(id, dark) {
// var element = Dom.get(id);
// Dom.addClass(id, 'containerloading');
if (!YAHOO.widget.Overlay) {
return;
}
var over;
if (id==='SYSTEM_WINDOW') {
// var w = Dom.getClientWidth();
// var h = Dom.getClientHeight();
over = new YAHOO.widget.Overlay('SYSTEM_WINDOW', {
visible: true,
xy: [0,0]
// width: '100%',
// height: '100%',
// width: '5px',
// height: '5px'
// constraintoviewport: true,
// fixedcenter: true,
// context: [document.body, 'tl', 'tl']
// width: w+'px',
// height: h+'px'
});
this.blockers['SYSTEM_WINDOW'] = over;
if (dark) {
over.setBody('');
} else {
over.setBody('
');
}
over.render(document.body);
} else {
id = Dom.get(id);
if (!id.id) {
Dom.generateId(id, 'yui-gen-');
}
var reg = Dom.getRegion(id);
var w = reg.right-reg.left;
var h = reg.bottom-reg.top;
if (this.blockers.hasOwnProperty(id.id)) {
over = this.blockers[id.id];
over.cfg.setProperty('width', w+'px');
over.cfg.setProperty('height', h+'px');
} else {
var newId = id.id+'-blocker';
over = new YAHOO.widget.Overlay(newId, {
context:[id, 'tl', 'tl', ['beforeShow', 'windowResize']],
visible: true,
width: w+'px',
height: h+'px'
});
this.blockers[id.id] = over;
if (dark) {
over.setBody('');
} else {
over.setBody('
');
}
over.render(document.body);
}
}
over.show();
over.bringToTop();
},
enableElement: function(id) {
var lookupId = id;
if (id!=='SYSTEM_WINDOW') {
id = Dom.get(id);
if (!id.id) {
Dom.generateId(id, 'yui-gen-');
}
lookupId = id.id;
} else {
}
if (this.blockers.hasOwnProperty(lookupId)) {
var over = this.blockers[lookupId];
over.hide();
}
},
/**
* @param element
* @param command optional
*/
isDoHandler: function(element, command) {
if (!element.id) {
return false;
}
var params = element.id.split('_');
if (params.length <= 0) {
return false;
}
if (params[0].toLowerCase() != 'do') {
return false;
}
if (!command) {
return true;
}
if (params[1].toLowerCase() === command.toLowerCase()) {
return true;
}
return false;
},
/**
* @param element
* @param command optional
*/
getDoHandler: function(element, command) {
if (this.isDoHandler(element, command)) {
return element;
}
while (element.parentNode) {
return this.getDoHandler(element.parentNode, command);
}
return undefined;
},
/**
* @param String id
* @return array
*/
tokenizeDoHandler: function(id) {
var elementId = id.replace('-button', '');
return elementId.split('_');
},
getInternalDerefer: function(href) {
throw 'Method deprecated';
},
showContainer: function(containerOrId) {
throw 'Method deprecated';
},
hideContainer: function(containerOrId) {
throw 'Method deprecated';
},
isContainerVisible: function(containerOrId) {
throw 'Method deprecated';
},
arrayContains: function(arr, obj) {
var i, listed = false;
for (i=0; i -1 : this.indexOf(string) > -1;
},
trim: function(){
return this.replace(/^\s+|\s+$/g, '');
},
clean: function(){
return this.replace(/\s+/g, ' ').trim();
},
camelCase: function(){
return this.replace(/-\D/g, function(match){
return match.charAt(1).toUpperCase();
});
},
hyphenate: function(){
return this.replace(/[A-Z]/g, function(match){
return ('-' + match.charAt(0).toLowerCase());
});
},
capitalize: function(){
return this.replace(/\b[a-z]/g, function(match){
return match.toUpperCase();
});
},
escapeRegExp: function(){
return this.replace(/([-.*+?^${}()|[\]\/\\])/g, '\\$1');
},
toInt: function(base){
return parseInt(this, base || 10);
},
toFloat: function(){
return parseFloat(this);
},
hexToRgb: function(array){
var hex = this.match(/^#?(\w{1,2})(\w{1,2})(\w{1,2})$/);
return (hex) ? hex.slice(1).hexToRgb(array) : null;
},
rgbToHex: function(array){
var rgb = this.match(/\d{1,3}/g);
return (rgb) ? rgb.rgbToHex(array) : null;
},
stripScripts: function(option){
var scripts = '';
var text = this.replace(/