/[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 191 by dpavlin, Tue Nov 29 13:04:44 2005 UTC revision 244 by dpavlin, Wed Dec 14 23:04:13 2005 UTC
# Line 27  function load_rec(nr, tmp_template_filen Line 27  function load_rec(nr, tmp_template_filen
27                  return false;                  return false;
28          }          }
29    
30            var rec_uri = $F('rec_uri_prefix');
31            if (! rec_uri) Logger.error('rec_uri_prefix field not found in form!');
32            rec_uri += '/' + nr;
33    
34          if (! tmp_template_filename) tmp_template_filename = template_filename;          if (! tmp_template_filename) tmp_template_filename = template_filename;
35          Logger.info('load_rec '+nr+' in '+tmp_template_filename);          Logger.info('load_rec '+rec_uri+' in '+tmp_template_filename);
36    
37          if (loading.record) {          if (loading.record) {
38                  Logger.info('loading of record '+nr+' skipped, load in progress');                  Logger.info('loading of record '+rec_uri+' skipped, load in progress');
39                  return false;                  return false;
40          }          }
41    
# Line 44  function load_rec(nr, tmp_template_filen Line 48  function load_rec(nr, tmp_template_filen
48                  Element.removeClassName('a_left_arr', 'nav_disable');                  Element.removeClassName('a_left_arr', 'nav_disable');
49          }          }
50    
51          var args = '?mfn='+nr+'&template_filename='+tmp_template_filename;          var args = '?record_uri='+rec_uri+'&template_filename='+tmp_template_filename;
52    
53          new Ajax.Updater( 'div_record',  url+'record'+args, {          new Ajax.Updater( 'div_record',  url+'record'+args, {
54                  asynchronous: 1,                  asynchronous: 1,
# Line 93  function reload_rec() { Line 97  function reload_rec() {
97  var current_edit = '';  var current_edit = '';
98    
99  function edit_template() {  function edit_template() {
100          $('div_css').style.visibility = "hidden";          Element.hide('row_css');
101          $('div_css').style.zIndex = 1;  
102          Element.removeClassName('a_css', 'tab_selected');          Element.removeClassName('a_css', 'tab_selected');
103          Element.addClassName('a_template', 'tab_selected');          Element.addClassName('a_template', 'tab_selected');
104          $('div_template').style.visibility = "visible";  
105          $('div_template').style.zIndex = 2;          Element.show('row_template');
106    
107          Logger.debug("switched to template editor");          Logger.debug("switched to template editor");
108          var c = $('template_content');          var c = $('template_content');
109          if (c) c.focus();          if (c) c.focus();
110          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);
111          return false;          return false;
112  }  }
113    
114  function edit_css() {  function edit_css() {
115          $('div_template').style.visibility = "hidden";  
116          $('div_template').style.zIndex = 1;          Element.hide('row_template');
117    
118          Element.removeClassName('a_template', 'tab_selected');          Element.removeClassName('a_template', 'tab_selected');
119          Element.addClassName('a_css', 'tab_selected');          Element.addClassName('a_css', 'tab_selected');
120          $('div_css').style.visibility = "visible";  
121          $('div_css').style.zIndex = 2;          Element.show('row_css');
122    
123          Logger.debug("switched to CSS editor");          Logger.debug("switched to CSS editor");
124          var c = $('css_content');          var c = $('css_content');
125          if (c) c.focus();          if (c) c.focus();
126          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);
127          return false;          return false;
128  }  }
129    
# Line 156  function load_template( template_filenam Line 163  function load_template( template_filenam
163    
164          var args = '?template_filename='+template_filename;          var args = '?template_filename='+template_filename;
165    
166          new Ajax.Updater( 'div_template',  url+'template'+args, {          new Ajax.Updater( 'row_template',  url+'template'+args, {
167                  asynchronous: 1,                  asynchronous: 1,
168                  onLoading: function(request) {                  onLoading: function(request) {
169                          loading.template = 1;                          loading.template = 1;
# Line 164  function load_template( template_filenam Line 171  function load_template( template_filenam
171                  },                  },
172                  onLoaded: function(request) {                  onLoaded: function(request) {
173                          loading.template = 0;                          loading.template = 0;
                         Position.clone('div_template', 'div_css');  
174                          hide_working();                          hide_working();
175                          Logger.info('load_template.onLoaded: '+template_filename);                          Logger.info('load_template.onLoaded: '+template_filename);
176                  }                  }
177          } ) ;          } ) ;
178  }  }
179    
180  function load_css(css_filename) {  function load_css( css_filename ) {
181    
182          if (loading.css) {          if (loading.css) {
183                  Logger.info('loading of css '+css_filename+' skipped, load in progress');                  Logger.info('loading of css '+css_filename+' skipped, load in progress');
184                  return;                  return;
185          }          }
186    
187            var css_url = url + 'css?css_filename='+css_filename;
188    
189            Logger.info('load_css '+css_url);
190    
191          show_working();          show_working();
192    
193          new Ajax.Updater( 'div_css',  url+'css', {          new Ajax.Updater( 'row_css', css_url, {
194                  asynchronous: 1,                  asynchronous: 1,
195                  onLoading: function(request) {                  onLoading: function(request) {
196                          loading.css = 1;                          loading.css = 1;
# Line 190  function load_css(css_filename) { Line 200  function load_css(css_filename) {
200                          loading.css = 0;                          loading.css = 0;
201                          hide_working();                          hide_working();
202                          Logger.info('load_css.onLoaded: '+css_filename);                          Logger.info('load_css.onLoaded: '+css_filename);
203                          Element.clone('div_template', 'div_css');                          reload_css( css_filename );
204                  }                  }
205          } ) ;          } ) ;
206  };  };
207    
208  function reload_css() {  function reload_css( css_filename ) {
209    
210            if (! css_filename) css_filename = 'user.css';
211    
212          css_rnd++;          css_rnd++;
213          var css_url = url + 'css/user.css?'+css_rnd;          var css_url = '/css/' + css_filename + '?' + css_rnd;
214          Logger.info('reload_css from '+css_url);          Logger.info('reload_css from '+css_url);
215          $('user_css_link').href = css_url;          $('user_css_link').href = css_url;
216    
# Line 220  function hide_working() { Line 232  function hide_working() {
232  }  }
233    
234  function init_page() {  function init_page() {
   
235          show_working();          show_working();
236    
237          edit_template();          edit_template();
238    
         // load css editor  
         load_css();  
   
         // load template editor and record  
         switch_template(template_filename);  
   
239          hide_working();          hide_working();
   
240  }  }
241    

Legend:
Removed from v.191  
changed lines
  Added in v.244

  ViewVC Help
Powered by ViewVC 1.1.26