/[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

Annotation of /Webpacus/root/editor/editor.js

Parent Directory Parent Directory | Revision Log Revision Log


Revision 163 - (hide annotations)
Sat Nov 26 18:18:10 2005 UTC (18 years, 6 months ago) by dpavlin
File MIME type: application/javascript
File size: 3114 byte(s)
 r11162@llin:  dpavlin | 2005-11-26 19:20:32 +0100
 more work on editor

1 dpavlin 134 /*
2     Webpacus template editor
3     */
4    
5     var rec = null;
6     var url = null;
7     var template_filename = null;
8    
9     var css_rnd = 0;
10    
11     function iwfRequest( url, div ) {
12     Logger.info('iwfRequest('+url+','+div+')');
13     return;
14     }
15    
16     function update_status(text) {
17     var el = $('div_record_nr');
18     if (el) el.innerHTML = text;
19     }
20    
21     function load_rec(nr) {
22     Logger.debug('load_rec '+nr);
23     if (nr == 1) {
24     Element.hide('a_left_arr');
25     } else {
26     Element.show('a_left_arr');
27     }
28     update_status(nr+'...');
29     iwfRequest( url+'/xml/?template='+template_filename+'&rec='+nr, 'div_record' );
30 dpavlin 137 new Effect.Opacity('div_record', { from: 1.0, to: 0.7, duration: 0.3 });
31 dpavlin 134 }
32    
33     function inc_rec() {
34     rec++;
35     load_rec(rec);
36     return false;
37     }
38    
39     function dec_rec() {
40     if (rec > 1) {
41     rec--;
42     load_rec(rec);
43     }
44     return false;
45     }
46    
47     function reload_rec() {
48     load_rec(rec);
49     return false;
50     }
51    
52 dpavlin 163 var current_edit = '';
53    
54 dpavlin 134 function edit_template() {
55 dpavlin 163 $('div_css').style.visibility = "hidden";
56     Element.removeClassName('a_css', 'tab_selected');
57     Element.addClassName('a_template', 'tab_selected');
58     $('div_template').style.visibility = "visible";
59     Logger.debug("switched to template editor");
60     $('template_content').focus();
61 dpavlin 134 return false;
62     }
63    
64     function edit_css() {
65 dpavlin 163 $('div_template').style.visibility = "hidden";
66     Element.removeClassName('a_template', 'tab_selected');
67     Element.addClassName('a_css', 'tab_selected');
68     $('div_css').style.visibility = "visible";
69     Logger.debug("switched to CSS editor");
70     $('css_content').focus();
71 dpavlin 134 return false;
72     }
73    
74     function switch_template(template_name) {
75    
76     Logger.info('switch_template to '+template_name);
77 dpavlin 137 new Effect.Opacity('div_template', { from: 1.0, to: 0.7, duration: 0.3 });
78 dpavlin 134 Logger.debug('load template editor');
79     load_template(template_name);
80    
81     Logger.debug('refresh record');
82     load_rec(rec);
83    
84     Logger.debug('refresh template list');
85     iwfRequest( url+'/template_list/?template='+template_filename, 'div_template_list' );
86     }
87    
88     var loading = {
89     template: 0,
90     css: 0,
91     }
92    
93     function load_template( template ) {
94    
95     if (loading.template) {
96     Logger.info('loading of template '+name+' skipped, load in progress');
97     return;
98     }
99    
100     new Ajax.Updater( 'div_template', url+'template', {
101     asynchronous: 1,
102     onLoading: function(request) {
103     loading.template = 1;
104 dpavlin 163 Logger.info('load_template.onLoading: '+template);
105 dpavlin 134 },
106     onLoaded: function(request) {
107     loading.template = 0;
108 dpavlin 163 Position.clone('div_template', 'div_css');
109     Logger.info('load_template.onLoaded: '+template);
110 dpavlin 134 }
111     } ) ;
112     }
113    
114     function load_css(css_file) {
115    
116     if (loading.css) {
117     Logger.info('loading of css '+name+' skipped, load in progress');
118     return;
119     }
120    
121     new Ajax.Updater( 'div_css', url+'css', {
122     asynchronous: 1,
123     onLoading: function(request) {
124     loading.css = 1;
125 dpavlin 163 Logger.info('load_css.onLoading: '+css_file);
126 dpavlin 134 },
127     onLoaded: function(request) {
128     loading.css = 0;
129 dpavlin 163 Logger.info('load_css.onLoaded: '+css_file);
130 dpavlin 134 }
131     } ) ;
132     };
133    
134     function init_page() {
135    
136     // Element.hide('div_css');
137     // Element.show('div_template');
138    
139 dpavlin 163 // Position.clone('div_template', 'div_css');
140 dpavlin 134
141     // load css editor
142     load_css();
143    
144     // load template editor and record
145     switch_template(template_filename);
146    
147     }
148    

  ViewVC Help
Powered by ViewVC 1.1.26