--- Webpacus/root/editor/editor.js 2005/11/29 13:04:44 191 +++ Webpacus/root/editor/editor.js 2005/11/29 14:31:26 193 @@ -93,30 +93,33 @@ var current_edit = ''; function edit_template() { - $('div_css').style.visibility = "hidden"; - $('div_css').style.zIndex = 1; + Element.hide('row_css'); + Element.removeClassName('a_css', 'tab_selected'); Element.addClassName('a_template', 'tab_selected'); - $('div_template').style.visibility = "visible"; - $('div_template').style.zIndex = 2; + + Element.show('row_template'); + Logger.debug("switched to template editor"); var c = $('template_content'); if (c) c.focus(); - Logger.debug('zIndex template:'+$('div_template').style.zIndex+' css:'+$('div_css').style.zIndex); + Logger.debug('zIndex template:'+$('row_template').style.zIndex+' css:'+$('row_css').style.zIndex); return false; } function edit_css() { - $('div_template').style.visibility = "hidden"; - $('div_template').style.zIndex = 1; + + Element.hide('row_template'); + Element.removeClassName('a_template', 'tab_selected'); Element.addClassName('a_css', 'tab_selected'); - $('div_css').style.visibility = "visible"; - $('div_css').style.zIndex = 2; + + Element.show('row_css'); + Logger.debug("switched to CSS editor"); var c = $('css_content'); if (c) c.focus(); - Logger.debug('zIndex template:'+$('div_template').style.zIndex+' css:'+$('div_css').style.zIndex); + Logger.debug('zIndex template:'+$('row_template').style.zIndex+' css:'+$('row_css').style.zIndex); return false; } @@ -156,7 +159,7 @@ var args = '?template_filename='+template_filename; - new Ajax.Updater( 'div_template', url+'template'+args, { + new Ajax.Updater( 'row_template', url+'template'+args, { asynchronous: 1, onLoading: function(request) { loading.template = 1; @@ -164,7 +167,6 @@ }, onLoaded: function(request) { loading.template = 0; - Position.clone('div_template', 'div_css'); hide_working(); Logger.info('load_template.onLoaded: '+template_filename); } @@ -178,9 +180,11 @@ return; } + Logger.info('load_css '+css_filename); + show_working(); - new Ajax.Updater( 'div_css', url+'css', { + new Ajax.Updater( 'row_css', url+'css', { asynchronous: 1, onLoading: function(request) { loading.css = 1; @@ -190,15 +194,17 @@ loading.css = 0; hide_working(); Logger.info('load_css.onLoaded: '+css_filename); - Element.clone('div_template', 'div_css'); + reload_css( css_filename ); } } ) ; }; -function reload_css() { +function reload_css( css_filename ) { + + if (! css_filename) css_filename = 'user.css'; css_rnd++; - var css_url = url + 'css/user.css?'+css_rnd; + var css_url = url + 'css/' + css_filename + '?' + css_rnd; Logger.info('reload_css from '+css_url); $('user_css_link').href = css_url;