Index: openacs-4/packages/acs-templating/www/resources/xinha-nightly/modules/Dialogs/panel-dialog.js =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-templating/www/resources/xinha-nightly/modules/Dialogs/panel-dialog.js,v diff -u -r1.3 -r1.4 --- openacs-4/packages/acs-templating/www/resources/xinha-nightly/modules/Dialogs/panel-dialog.js 13 May 2008 18:53:45 -0000 1.3 +++ openacs-4/packages/acs-templating/www/resources/xinha-nightly/modules/Dialogs/panel-dialog.js 16 Jan 2009 09:05:46 -0000 1.4 @@ -1,51 +1,77 @@ -/* This compressed file is part of Xinha. For uncompressed sources, forum, and bug reports, go to xinha.org */ -/* This file is part of version 0.95 released Mon, 12 May 2008 17:33:15 +0200 */ -/* The URL of the most recent version of this file is http://svn.xinha.webfactional.com/trunk/modules/Dialogs/panel-dialog.js */ -Xinha.PanelDialog=function(_1,_2,_3,_4){ -this.id={}; -this.r_id={}; -this.editor=_1; -this.document=document; -this.rootElem=_1.addPanel(_2); -var _5=this; -if(typeof _4=="function"){ -this._lc=_4; -}else{ -if(_4){ -this._lc=function(_6){ -return Xinha._lc(_6,_4); + +Xinha.PanelDialog = function(editor, side, html, localizer) +{ + this.id = { }; + this.r_id = { }; // reverse lookup id + this.editor = editor; + this.document = document; + this.rootElem = editor.addPanel(side); + + var dialog = this; + if(typeof localizer == 'function') + { + this._lc = localizer; + } + else if(localizer) + { + this._lc = function(string) + { + return Xinha._lc(string,localizer); + }; + } + else + { + this._lc = function(string) + { + return string; + }; + } + + html = html.replace(/\[([a-z0-9_]+)\]/ig, + function(fullString, id) + { + if(typeof dialog.id[id] == 'undefined') + { + dialog.id[id] = Xinha.uniq('Dialog'); + dialog.r_id[dialog.id[id]] = id; + } + return dialog.id[id]; + } + ).replace(/(.*?)<\/l10n>/ig, + function(fullString,translate) + { + return dialog._lc(translate) ; + } + ).replace(/="_\((.*?)\)"/g, + function(fullString, translate) + { + return '="' + dialog._lc(translate) + '"'; + } + ); + + this.rootElem.innerHTML = html; }; -}else{ -this._lc=function(_7){ -return _7; + +Xinha.PanelDialog.prototype.show = function(values) +{ + this.setValues(values); + this.editor.showPanel(this.rootElem); }; -} -} -_3=_3.replace(/\[([a-z0-9_]+)\]/ig,function(_8,id){ -if(typeof _5.id[id]=="undefined"){ -_5.id[id]=Xinha.uniq("Dialog"); -_5.r_id[_5.id[id]]=id; -} -return _5.id[id]; -}).replace(/(.*?)<\/l10n>/ig,function(_a,_b){ -return _5._lc(_b); -}).replace(/="_\((.*?)\)"/g,function(_c,_d){ -return "=\""+_5._lc(_d)+"\""; -}); -this.rootElem.innerHTML=_3; + +Xinha.PanelDialog.prototype.hide = function() +{ + this.editor.hidePanel(this.rootElem); + return this.getValues(); }; -Xinha.PanelDialog.prototype.show=function(_e){ -this.setValues(_e); -this.editor.showPanel(this.rootElem); -}; -Xinha.PanelDialog.prototype.hide=function(){ -this.editor.hidePanel(this.rootElem); -return this.getValues(); -}; -Xinha.PanelDialog.prototype.onresize=Xinha.Dialog.prototype.onresize; -Xinha.PanelDialog.prototype.toggle=Xinha.Dialog.prototype.toggle; -Xinha.PanelDialog.prototype.setValues=Xinha.Dialog.prototype.setValues; -Xinha.PanelDialog.prototype.getValues=Xinha.Dialog.prototype.getValues; -Xinha.PanelDialog.prototype.getElementById=Xinha.Dialog.prototype.getElementById; -Xinha.PanelDialog.prototype.getElementsByName=Xinha.Dialog.prototype.getElementsByName; +Xinha.PanelDialog.prototype.onresize = Xinha.Dialog.prototype.onresize; + +Xinha.PanelDialog.prototype.toggle = Xinha.Dialog.prototype.toggle; + +Xinha.PanelDialog.prototype.setValues = Xinha.Dialog.prototype.setValues; + +Xinha.PanelDialog.prototype.getValues = Xinha.Dialog.prototype.getValues; + +Xinha.PanelDialog.prototype.getElementById = Xinha.Dialog.prototype.getElementById; + +Xinha.PanelDialog.prototype.getElementsByName = Xinha.Dialog.prototype.getElementsByName; \ No newline at end of file