/[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 193 by dpavlin, Tue Nov 29 14:31:26 2005 UTC revision 357 by dpavlin, Sat Jan 7 23:43:38 2006 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 173  function load_template( template_filenam Line 177  function load_template( template_filenam
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          Logger.info('load_css '+css_filename);          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( 'row_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 204  function reload_css( css_filename ) { Line 210  function reload_css( css_filename ) {
210          if (! css_filename) css_filename = 'user.css';          if (! css_filename) css_filename = 'user.css';
211    
212          css_rnd++;          css_rnd++;
213          var css_url = url + 'css/' + css_filename + '?' + 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 225  function hide_working() { Line 231  function hide_working() {
231          Logger.debug('hide_working, count = '+working_count);          Logger.debug('hide_working, count = '+working_count);
232  }  }
233    
234  function init_page() {  /* called body.onLoad */
235    
236    function init_page() {
237          show_working();          show_working();
238    
239          edit_template();          textarea_reset_size( 'template_content' );
240            textarea_reset_size( 'css_content' );
         // load css editor  
         load_css();  
241    
242          // load template editor and record          edit_template();
         switch_template(template_filename);  
243    
244          hide_working();          hide_working();
245    }
246    
247    /* resize textarea */
248    
249    function textarea_reset_size( id ) {
250            var textarea = $( id );
251            if (! textarea) {
252                    Logger.error('can\'t reset size to non-existant textarea '+id);
253                    return;
254            }
255            var hgt = Cookie.get('webpacus_ta_'+id);
256            if (! hgt) hgt='20em';
257            textarea.style.height = hgt;
258            Logger.debug('reset textarea '+id+' height to '+hgt);
259  }  }
260    
261    function textarea_resize( id, val ){
262            var textarea = $( id );
263            var height = parseInt(textarea.style.height.substr(0,textarea.style.height.length-2));
264            height += val;
265            Logger.debug('resize_textarea('+id+','+val+') '+textarea.style.height+' '+height);
266            textarea.style.height = height+'px';
267            Cookie.set('webpacus_ta_'+id,textarea.style.height,365);
268    }

Legend:
Removed from v.193  
changed lines
  Added in v.357

  ViewVC Help
Powered by ViewVC 1.1.26