/[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 168 by dpavlin, Sat Nov 26 23:26:45 2005 UTC revision 175 by dpavlin, Sun Nov 27 04:45:56 2005 UTC
# Line 6  var rec = null; Line 6  var rec = null;
6  var url = null;  var url = null;
7  var template_filename = null;  var template_filename = null;
8    
9    var pending_js = null;
10    
11  var css_rnd = 0;  var css_rnd = 0;
12    
13  function iwfRequest( url, div ) {  function _ts(text) {
14          Logger.info('iwfRequest('+url+','+div+')');          var el = $('div_template_status');
15          return;          if (el) el.innerHTML = text;
16  }  }
17    
18  function update_status(text) {  function _cs(text) {
19          var el = $('div_record_nr');          var el = $('div_css_status');
20          if (el) el.innerHTML = text;          if (el) el.innerHTML = text;
21  }  }
22    
# Line 26  function load_rec(nr) { Line 28  function load_rec(nr) {
28                  return;                  return;
29          }          }
30    
31            show_working();
32            $('record_nr').disabled = 'true';
33    
34          if (nr == 1) {          if (nr == 1) {
35                  Element.addClassName('a_left_arr', 'nav_disable');                  Element.addClassName('a_left_arr', 'nav_disable');
36          } else {          } else {
# Line 38  function load_rec(nr) { Line 43  function load_rec(nr) {
43                  asynchronous: 1,                  asynchronous: 1,
44                  onLoading: function(request) {                  onLoading: function(request) {
45                          loading.record = 1;                          loading.record = 1;
                         update_status(nr+'...');  
46                          Logger.info('load_rec.onLoading: '+nr);                          Logger.info('load_rec.onLoading: '+nr);
47                  },                  },
48                  onLoaded: function(request) {                  onLoaded: function(request) {
49                          loading.record = 0;                          loading.record = 0;
50                          update_status('# '+nr);                          hide_working();
51                            $('record_nr').value = nr;
52                            $('record_nr').disabled = '';
53                            rec = nr;
54                          Logger.info('load_rec.onLoaded: '+nr);                          Logger.info('load_rec.onLoaded: '+nr);
55                  }                  }
56          } ) ;          } ) ;
# Line 51  function load_rec(nr) { Line 58  function load_rec(nr) {
58  }  }
59    
60  function inc_rec() {  function inc_rec() {
61            show_working();
62          rec++;          rec++;
63          load_rec(rec);          load_rec(rec);
64            hide_working();
65          return false;          return false;
66  }  }
67    
68  function dec_rec() {  function dec_rec() {
69          if (rec > 1) {          if (rec > 1) {
70                    show_working();
71                  rec--;                  rec--;
72                  load_rec(rec);                  load_rec(rec);
73                    hide_working();
74          }          }
75          return false;          return false;
76  }  }
77    
78  function reload_rec() {  function reload_rec() {
79            show_working();
80          load_rec(rec);          load_rec(rec);
81            hide_working();
82          return false;          return false;
83  }  }
84    
# Line 73  var current_edit = ''; Line 86  var current_edit = '';
86    
87  function edit_template() {  function edit_template() {
88          $('div_css').style.visibility = "hidden";          $('div_css').style.visibility = "hidden";
89            $('div_css').style.zIndex = 1;
90          Element.removeClassName('a_css', 'tab_selected');          Element.removeClassName('a_css', 'tab_selected');
91          Element.addClassName('a_template', 'tab_selected');          Element.addClassName('a_template', 'tab_selected');
92          $('div_template').style.visibility = "visible";          $('div_template').style.visibility = "visible";
93            $('div_template').style.zIndex = 2;
94          Logger.debug("switched to template editor");          Logger.debug("switched to template editor");
95          var c = $('template_content');          var c = $('template_content');
96          if (c) c.focus();          if (c) c.focus();
97            Logger.debug('zIndex template:'+$('div_template').style.zIndex+' css:'+$('div_css').style.zIndex);
98          return false;          return false;
99  }  }
100    
101  function edit_css() {  function edit_css() {
102          $('div_template').style.visibility = "hidden";          $('div_template').style.visibility = "hidden";
103            $('div_template').style.zIndex = 1;
104          Element.removeClassName('a_template', 'tab_selected');          Element.removeClassName('a_template', 'tab_selected');
105          Element.addClassName('a_css', 'tab_selected');          Element.addClassName('a_css', 'tab_selected');
106          $('div_css').style.visibility = "visible";          $('div_css').style.visibility = "visible";
107            $('div_css').style.zIndex = 2;
108          Logger.debug("switched to CSS editor");          Logger.debug("switched to CSS editor");
109          var c = $('css_content');          var c = $('css_content');
110          if (c) c.focus();          if (c) c.focus();
111            Logger.debug('zIndex template:'+$('div_template').style.zIndex+' css:'+$('div_css').style.zIndex);
112          return false;          return false;
113  }  }
114    
115  function switch_template(new_template_filename) {  function switch_template(new_template_filename) {
116    
117          Logger.info('switch_template to '+new_template_filename);          Logger.info('switch_template to '+new_template_filename);
118            show_working();
119    
120          Logger.debug('load template editor');          Logger.debug('load template editor');
121          template_filename = new_template_filename;          template_filename = new_template_filename;
# Line 104  function switch_template(new_template_fi Line 124  function switch_template(new_template_fi
124          Logger.debug('refresh record');          Logger.debug('refresh record');
125          load_rec(rec);          load_rec(rec);
126    
127            edKill('template_content');
128    
129            hide_working();
130    
131          return false;          return false;
132  }  }
133    
134  var loading = {  var loading = {
135          template: 0,          template: 0,
136          css: 0,          css: 0,
137          record: 0,          record: 0
138  }  };
139    
140  function load_template( template_filename ) {  function load_template( template_filename ) {
141    
# Line 120  function load_template( template_filenam Line 144  function load_template( template_filenam
144                  return;                  return;
145          }          }
146    
147            show_working();
148    
149          var args = '?template_filename='+template_filename;          var args = '?template_filename='+template_filename;
150    
151          new Ajax.Updater( 'div_template',  url+'template'+args, {          new Ajax.Updater( 'div_template',  url+'template'+args, {
# Line 131  function load_template( template_filenam Line 157  function load_template( template_filenam
157                  onLoaded: function(request) {                  onLoaded: function(request) {
158                          loading.template = 0;                          loading.template = 0;
159                          Position.clone('div_template', 'div_css');                          Position.clone('div_template', 'div_css');
160                            hide_working();
161                          Logger.info('load_template.onLoaded: '+template_filename);                          Logger.info('load_template.onLoaded: '+template_filename);
162                  }                  }
163          } ) ;          } ) ;
# Line 143  function load_css(css_filename) { Line 170  function load_css(css_filename) {
170                  return;                  return;
171          }          }
172    
173            show_working();
174    
175          new Ajax.Updater( 'div_css',  url+'css', {          new Ajax.Updater( 'div_css',  url+'css', {
176                  asynchronous: 1,                  asynchronous: 1,
177                  onLoading: function(request) {                  onLoading: function(request) {
# Line 151  function load_css(css_filename) { Line 180  function load_css(css_filename) {
180                  },                  },
181                  onLoaded: function(request) {                  onLoaded: function(request) {
182                          loading.css = 0;                          loading.css = 0;
183                            hide_working();
184                          Logger.info('load_css.onLoaded: '+css_filename);                          Logger.info('load_css.onLoaded: '+css_filename);
185                  }                  }
186          } ) ;          } ) ;
187  };  };
188    
189  function init_page() {  function reload_css() {
190    
191  //      Element.hide('div_css');          css_rnd++;
192  //      Element.show('div_template');          Logger.info('loading user.css?'+css_rnd);
193            $('user_css_link').href = 'css/user.css?'+css_rnd;
194    
195  //      Position.clone('div_template', 'div_css');          return false;
196    }
197    
198    var working_count = 0;
199    
200    function show_working() {
201            working_count++;
202            if (working_count > 1) Element.show('working');
203            Logger.debug('show_working, count = '+working_count);
204    }
205    
206    function hide_working() {
207            working_count--;
208            if (working_count < 1) Element.hide('working');
209            Logger.debug('hide_working, count = '+working_count);
210    }
211    
212    function init_page() {
213    
214            show_working();
215    
216          edit_template();          edit_template();
217    
# Line 171  function init_page() { Line 221  function init_page() {
221          // load template editor and record          // load template editor and record
222          switch_template(template_filename);          switch_template(template_filename);
223    
224            hide_working();
225    
226  }  }
227    

Legend:
Removed from v.168  
changed lines
  Added in v.175

  ViewVC Help
Powered by ViewVC 1.1.26