--- Webpacus/root/editor/editor.js 2005/11/26 18:18:10 163 +++ Webpacus/root/editor/editor.js 2005/11/26 20:21:59 166 @@ -20,14 +20,34 @@ function load_rec(nr) { Logger.debug('load_rec '+nr); + + if (loading.record) { + Logger.info('loading of record '+nr+' skipped, load in progress'); + return; + } + if (nr == 1) { - Element.hide('a_left_arr'); + Element.addClassName('a_left_arr', 'nav_disable'); } else { - Element.show('a_left_arr'); + Element.removeClassName('a_left_arr', 'nav_disable'); } - update_status(nr+'...'); - iwfRequest( url+'/xml/?template='+template_filename+'&rec='+nr, 'div_record' ); - new Effect.Opacity('div_record', { from: 1.0, to: 0.7, duration: 0.3 }); + + var args = '?mfn='+nr+'&template_filename='+template_filename; + + new Ajax.Updater( 'div_record', url+'record'+args, { + asynchronous: 1, + onLoading: function(request) { + loading.record = 1; + update_status(nr+'...'); + Logger.info('load_rec.onLoading: '+nr); + }, + onLoaded: function(request) { + loading.record = 0; + update_status('# '+nr); + Logger.info('load_rec.onLoaded: '+nr); + } + } ) ; + } function inc_rec() { @@ -57,7 +77,8 @@ Element.addClassName('a_template', 'tab_selected'); $('div_template').style.visibility = "visible"; Logger.debug("switched to template editor"); - $('template_content').focus(); + var c = $('template_content'); + if (c) c.focus(); return false; } @@ -67,7 +88,8 @@ Element.addClassName('a_css', 'tab_selected'); $('div_css').style.visibility = "visible"; Logger.debug("switched to CSS editor"); - $('css_content').focus(); + var c = $('css_content'); + if (c) c.focus(); return false; } @@ -88,6 +110,7 @@ var loading = { template: 0, css: 0, + record: 0, } function load_template( template ) { @@ -97,7 +120,9 @@ return; } - new Ajax.Updater( 'div_template', url+'template', { + var args = '?template_filename='+template_filename; + + new Ajax.Updater( 'div_template', url+'template'+args, { asynchronous: 1, onLoading: function(request) { loading.template = 1; @@ -138,6 +163,8 @@ // Position.clone('div_template', 'div_css'); + edit_template(); + // load css editor load_css();