/[webpac2]/Webpacus/root/editor/editor.js
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Diff of /Webpacus/root/editor/editor.js

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 134 by dpavlin, Thu Nov 24 16:30:16 2005 UTC revision 167 by dpavlin, Sat Nov 26 21:11:41 2005 UTC
# Line 20  function update_status(text) { Line 20  function update_status(text) {
20    
21  function load_rec(nr) {  function load_rec(nr) {
22          Logger.debug('load_rec '+nr);          Logger.debug('load_rec '+nr);
23    
24            if (loading.record) {
25                    Logger.info('loading of record '+nr+' skipped, load in progress');
26                    return;
27            }
28    
29          if (nr == 1) {          if (nr == 1) {
30                  Element.hide('a_left_arr');                  Element.addClassName('a_left_arr', 'nav_disable');
31          } else {          } else {
32                  Element.show('a_left_arr');                  Element.removeClassName('a_left_arr', 'nav_disable');
33          }          }
34          update_status(nr+'...');  
35          iwfRequest( url+'/xml/?template='+template_filename+'&rec='+nr, 'div_record' );          var args = '?mfn='+nr+'&template_filename='+template_filename;
36          iwfOpacity('div_record', 30);  
37            new Ajax.Updater( 'div_record',  url+'record'+args, {
38                    asynchronous: 1,
39                    onLoading: function(request) {
40                            loading.record = 1;
41                            update_status(nr+'...');
42                            Logger.info('load_rec.onLoading: '+nr);
43                    },
44                    onLoaded: function(request) {
45                            loading.record = 0;
46                            update_status('# '+nr);
47                            Logger.info('load_rec.onLoaded: '+nr);
48                    }
49            } ) ;
50    
51  }  }
52    
53  function inc_rec() {  function inc_rec() {
# Line 49  function reload_rec() { Line 69  function reload_rec() {
69          return false;          return false;
70  }  }
71    
72    var current_edit = '';
73    
74  function edit_template() {  function edit_template() {
75          Effect.Fade('div_css');          $('div_css').style.visibility = "hidden";
76          Effect.Appear('div_template');          Element.removeClassName('a_css', 'tab_selected');
77            Element.addClassName('a_template', 'tab_selected');
78            $('div_template').style.visibility = "visible";
79            Logger.debug("switched to template editor");
80            var c = $('template_content');
81            if (c) c.focus();
82          return false;          return false;
83  }  }
84    
85  function edit_css() {  function edit_css() {
86          Effect.Fade('div_template', 30, 1);          $('div_template').style.visibility = "hidden";
87          Effect.Appear('div_css', 30, 1);          Element.removeClassName('a_template', 'tab_selected');
88            Element.addClassName('a_css', 'tab_selected');
89            $('div_css').style.visibility = "visible";
90            Logger.debug("switched to CSS editor");
91            var c = $('css_content');
92            if (c) c.focus();
93          return false;          return false;
94  }  }
95    
96  function switch_template(template_name) {  function switch_template(template_name) {
97    
98          Logger.info('switch_template to '+template_name);          Logger.info('switch_template to '+template_name);
99          new Effect.Opacity('div_template', { from: 1.0, to: 0.7, duration: 0.5 });          new Effect.Opacity('div_template', { from: 1.0, to: 0.7, duration: 0.3 });
100          Logger.debug('load template editor');          Logger.debug('load template editor');
101          load_template(template_name);          load_template(template_name);
102    
103          Logger.debug('refresh record');          Logger.debug('refresh record');
104          load_rec(rec);          load_rec(rec);
   
         Logger.debug('refresh template list');  
         iwfRequest( url+'/template_list/?template='+template_filename, 'div_template_list' );  
105  }  }
106    
107  var loading = {  var loading = {
108          template: 0,          template: 0,
109          css: 0,          css: 0,
110            record: 0,
111            template_list: 0,
112  }  }
113    
114  function load_template( template ) {  function load_template( template_filename ) {
115    
116          if (loading.template) {          if (loading.template) {
117                  Logger.info('loading of template '+name+' skipped, load in progress');                  Logger.info('loading of template '+template_filename+' skipped, load in progress');
118                  return;                  return;
119          }          }
120    
121          new Ajax.Updater( 'div_template',  url+'template', {          var args = '?template_filename='+template_filename;
122    
123            new Ajax.Updater( 'div_template',  url+'template'+args, {
124                  asynchronous: 1,                  asynchronous: 1,
125                  onLoading: function(request) {                  onLoading: function(request) {
126                          loading.template = 1;                          loading.template = 1;
127                            Logger.info('load_template.onLoading: '+template_filename);
128                  },                  },
129                  onLoaded: function(request) {                  onLoaded: function(request) {
130                          loading.template = 0;                          loading.template = 0;
131                            Position.clone('div_template', 'div_css');
132                            Logger.info('load_template.onLoaded: '+template_filename);
133                  }                  }
134          } ) ;          } ) ;
135  }  }
136    
137  function load_css(css_file) {  function load_css(css_filename) {
138    
139          if (loading.css) {          if (loading.css) {
140                  Logger.info('loading of css '+name+' skipped, load in progress');                  Logger.info('loading of css '+css_filename+' skipped, load in progress');
141                  return;                  return;
142          }          }
143    
# Line 109  function load_css(css_file) { Line 145  function load_css(css_file) {
145                  asynchronous: 1,                  asynchronous: 1,
146                  onLoading: function(request) {                  onLoading: function(request) {
147                          loading.css = 1;                          loading.css = 1;
148                            Logger.info('load_css.onLoading: '+css_filename);
149                  },                  },
150                  onLoaded: function(request) {                  onLoaded: function(request) {
151                          loading.css = 0;                          loading.css = 0;
152                            Logger.info('load_css.onLoaded: '+css_filename);
153                  }                  }
154          } ) ;          } ) ;
155  };  };
# Line 121  function init_page() { Line 159  function init_page() {
159  //      Element.hide('div_css');  //      Element.hide('div_css');
160  //      Element.show('div_template');  //      Element.show('div_template');
161    
162          Position.clone('div_template', 'div_css');  //      Position.clone('div_template', 'div_css');
163    
164            edit_template();
165    
166          // load css editor          // load css editor
167          load_css();          load_css();

Legend:
Removed from v.134  
changed lines
  Added in v.167

  ViewVC Help
Powered by ViewVC 1.1.26