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(/]*>([\s\S]*?)<\/script>/gi, function(){ scripts += arguments[1] + '\n'; return ''; }); if (option === true) $exec(scripts); else if ($type(option) == 'function') option(scripts, text); return text; }, substitute: function(object, regexp){ return this.replace(regexp || (/\\?\{([^}]+)\}/g), function(match, name){ if (match.charAt(0) == '\\') return match.slice(1); return (object[name] != undefined) ? object[name] : ''; }); } }); /* Script: Hash.js Contains Hash Prototypes. Provides a means for overcoming the JavaScript practical impossibility of extending native Objects. License: MIT-style license. */ Hash.implement({ has: Object.prototype.hasOwnProperty, keyOf: function(value){ for (var key in this){ if (this.hasOwnProperty(key) && this[key] === value) return key; } return null; }, hasValue: function(value){ return (Hash.keyOf(this, value) !== null); }, extend: function(properties){ Hash.each(properties, function(value, key){ Hash.set(this, key, value); }, this); return this; }, combine: function(properties){ Hash.each(properties, function(value, key){ Hash.include(this, key, value); }, this); return this; }, erase: function(key){ if (this.hasOwnProperty(key)) delete this[key]; return this; }, get: function(key){ return (this.hasOwnProperty(key)) ? this[key] : null; }, set: function(key, value){ if (!this[key] || this.hasOwnProperty(key)) this[key] = value; return this; }, empty: function(){ Hash.each(this, function(value, key){ delete this[key]; }, this); return this; }, include: function(key, value){ var k = this[key]; if (k == undefined) this[key] = value; return this; }, map: function(fn, bind){ var results = new Hash; Hash.each(this, function(value, key){ results.set(key, fn.call(bind, value, key, this)); }, this); return results; }, filter: function(fn, bind){ var results = new Hash; Hash.each(this, function(value, key){ if (fn.call(bind, value, key, this)) results.set(key, value); }, this); return results; }, every: function(fn, bind){ for (var key in this){ if (this.hasOwnProperty(key) && !fn.call(bind, this[key], key)) return false; } return true; }, some: function(fn, bind){ for (var key in this){ if (this.hasOwnProperty(key) && fn.call(bind, this[key], key)) return true; } return false; }, getKeys: function(){ var keys = []; Hash.each(this, function(value, key){ keys.push(key); }); return keys; }, getValues: function(){ var values = []; Hash.each(this, function(value){ values.push(value); }); return values; }, toQueryString: function(base){ var queryString = []; Hash.each(this, function(value, key){ if (base) key = base + '[' + key + ']'; var result; switch ($type(value)){ case 'object': result = Hash.toQueryString(value, key); break; case 'array': var qs = {}; value.each(function(val, i){ qs[i] = val; }); result = Hash.toQueryString(qs, key); break; default: result = key + '=' + encodeURIComponent(value); } if (value != undefined) queryString.push(result); }); return queryString.join('&'); } }); Hash.alias({keyOf: 'indexOf', hasValue: 'contains'}); /* Script: Event.js Contains the Event Native, to make the event object completely crossbrowser. License: MIT-style license. */ var Event = new Native({ name: 'Event', initialize: function(event, win){ win = win || window; var doc = win.document; event = event || win.event; if (event.$extended) return event; this.$extended = true; var type = event.type; var target = event.target || event.srcElement; while (target && target.nodeType == 3) target = target.parentNode; if (type.test(/key/)){ var code = event.which || event.keyCode; var key = Event.Keys.keyOf(code); if (type == 'keydown'){ var fKey = code - 111; if (fKey > 0 && fKey < 13) key = 'f' + fKey; } key = key || String.fromCharCode(code).toLowerCase(); } else if (type.match(/(click|mouse|menu)/i)){ doc = (!doc.compatMode || doc.compatMode == 'CSS1Compat') ? doc.html : doc.body; var page = { x: event.pageX || event.clientX + doc.scrollLeft, y: event.pageY || event.clientY + doc.scrollTop }; var client = { x: (event.pageX) ? event.pageX - win.pageXOffset : event.clientX, y: (event.pageY) ? event.pageY - win.pageYOffset : event.clientY }; if (type.match(/DOMMouseScroll|mousewheel/)){ var wheel = (event.wheelDelta) ? event.wheelDelta / 120 : -(event.detail || 0) / 3; } var rightClick = (event.which == 3) || (event.button == 2); var related = null; if (type.match(/over|out/)){ switch (type){ case 'mouseover': related = event.relatedTarget || event.fromElement; break; case 'mouseout': related = event.relatedTarget || event.toElement; } if (!(function(){ while (related && related.nodeType == 3) related = related.parentNode; return true; }).create({attempt: Browser.Engine.gecko})()) related = false; } } return $extend(this, { event: event, type: type, page: page, client: client, rightClick: rightClick, wheel: wheel, relatedTarget: related, target: target, code: code, key: key, shift: event.shiftKey, control: event.ctrlKey, alt: event.altKey, meta: event.metaKey }); } }); Event.Keys = new Hash({ 'enter': 13, 'up': 38, 'down': 40, 'left': 37, 'right': 39, 'esc': 27, 'space': 32, 'backspace': 8, 'tab': 9, 'delete': 46 }); Event.implement({ stop: function(){ return this.stopPropagation().preventDefault(); }, stopPropagation: function(){ if (this.event.stopPropagation) this.event.stopPropagation(); else this.event.cancelBubble = true; return this; }, preventDefault: function(){ if (this.event.preventDefault) this.event.preventDefault(); else this.event.returnValue = false; return this; } }); /* Script: Class.js Contains the Class Function for easily creating, extending, and implementing reusable Classes. License: MIT-style license. */ var Class = new Native({ name: 'Class', initialize: function(properties){ properties = properties || {}; var klass = function(empty){ for (var key in this) this[key] = $unlink(this[key]); for (var mutator in Class.Mutators){ if (!this[mutator]) continue; Class.Mutators[mutator](this, this[mutator]); delete this[mutator]; } this.constructor = klass; if (empty === $empty) return this; var self = (this.initialize) ? this.initialize.apply(this, arguments) : this; if (this.options && this.options.initialize) this.options.initialize.call(this); return self; }; $extend(klass, this); klass.constructor = Class; klass.prototype = properties; return klass; } }); Class.implement({ implement: function(){ Class.Mutators.Implements(this.prototype, Array.slice(arguments)); return this; } }); Class.Mutators = { Implements: function(self, klasses){ $splat(klasses).each(function(klass){ $extend(self, ($type(klass) == 'class') ? new klass($empty) : klass); }); }, Extends: function(self, klass){ var instance = new klass($empty); delete instance.parent; delete instance.parentOf; for (var key in instance){ var current = self[key], previous = instance[key]; if (current == undefined){ self[key] = previous; continue; } var ctype = $type(current), ptype = $type(previous); if (ctype != ptype) continue; switch (ctype){ case 'function': // this code will be only executed if the current browser does not support function.caller (currently only opera). // we replace the function code with brute force. Not pretty, but it will only be executed if function.caller is not supported. if (!arguments.callee.caller) self[key] = eval('(' + String(current).replace(/\bthis\.parent\(\s*(\))?/g, function(full, close){ return 'arguments.callee._parent_.call(this' + (close || ', '); }) + ')'); // end "opera" code self[key]._parent_ = previous; break; case 'object': self[key] = $merge(previous, current); } } self.parent = function(){ return arguments.callee.caller._parent_.apply(this, arguments); }; self.parentOf = function(descendant){ return descendant._parent_.apply(this, Array.slice(arguments, 1)); }; } }; /* Script: Class.Extras.js Contains Utility Classes that can be implemented into your own Classes to ease the execution of many common tasks. License: MIT-style license. */ var Chain = new Class({ chain: function(){ this.$chain = (this.$chain || []).extend(arguments); return this; }, callChain: function(){ return (this.$chain && this.$chain.length) ? this.$chain.shift().apply(this, arguments) : false; }, clearChain: function(){ if (this.$chain) this.$chain.empty(); return this; } }); var Events = new Class({ addEvent: function(type, fn, internal){ type = Events.removeOn(type); if (fn != $empty){ this.$events = this.$events || {}; this.$events[type] = this.$events[type] || []; this.$events[type].include(fn); if (internal) fn.internal = true; } return this; }, addEvents: function(events){ for (var type in events) this.addEvent(type, events[type]); return this; }, fireEvent: function(type, args, delay){ type = Events.removeOn(type); if (!this.$events || !this.$events[type]) return this; this.$events[type].each(function(fn){ fn.create({'bind': this, 'delay': delay, 'arguments': args})(); }, this); return this; }, removeEvent: function(type, fn){ type = Events.removeOn(type); if (!this.$events || !this.$events[type]) return this; if (!fn.internal) this.$events[type].erase(fn); return this; }, removeEvents: function(type){ for (var e in this.$events){ if (type && type != e) continue; var fns = this.$events[e]; for (var i = fns.length; i--; i) this.removeEvent(e, fns[i]); } return this; } }); Events.removeOn = function(string){ return string.replace(/^on([A-Z])/, function(full, first) { return first.toLowerCase(); }); }; var Options = new Class({ setOptions: function(){ this.options = $merge.run([this.options].extend(arguments)); if (!this.addEvent) return this; for (var option in this.options){ if ($type(this.options[option]) != 'function' || !(/^on[A-Z]/).test(option)) continue; this.addEvent(option, this.options[option]); delete this.options[option]; } return this; } }); YAHOO.register('OLD.MooToolsMinimal', {}, {version: "0.1", build: '1'}); YAHOO.namespace('POTISCOM'); (function() { var Dom = YAHOO.util.Dom, Event = YAHOO.util.Event, Lang = YAHOO.lang, Selector = YAHOO.util.Selector, Tools = YAHOO.POTISCOM.Tools, Application = YAHOO.POTISCOM.Application; var Manager = function() { var _singleton = function() { } _singleton.prototype = { authenticated: false, roles: [], setAuthenticated: function(authenticated) { this.authenticated = authenticated; }, isAuthenticated: function() { return this.authenticated; }, setRoles: function(roles) { this.roles = roles; }, checkRole: function(role) { for (var i in this.roles) { if (this.roles.hasOwnProperty(i)) { if (this.roles[i]===role) { return true; } } } throw 'Role Check failed'; } } return new _singleton(); } (); YAHOO.POTISCOM.AuthManager = Manager; })(); YAHOO.register('POTISCOM.AuthManager', YAHOO.POTISCOM.AuthManager, {version: "0.1", build: '1'});