8 |
|
|
9 |
var css_rnd = 0; |
var css_rnd = 0; |
10 |
|
|
|
function iwfRequest( url, div ) { |
|
|
Logger.info('iwfRequest('+url+','+div+')'); |
|
|
return; |
|
|
} |
|
|
|
|
11 |
function update_status(text) { |
function update_status(text) { |
12 |
var el = $('div_record_nr'); |
var el = $('div_record_nr'); |
13 |
if (el) el.innerHTML = text; |
if (el) el.innerHTML = text; |
21 |
return; |
return; |
22 |
} |
} |
23 |
|
|
24 |
|
show_working(); |
25 |
|
$('record_nr').disabled = 'true'; |
26 |
|
|
27 |
if (nr == 1) { |
if (nr == 1) { |
28 |
Element.addClassName('a_left_arr', 'nav_disable'); |
Element.addClassName('a_left_arr', 'nav_disable'); |
29 |
} else { |
} else { |
36 |
asynchronous: 1, |
asynchronous: 1, |
37 |
onLoading: function(request) { |
onLoading: function(request) { |
38 |
loading.record = 1; |
loading.record = 1; |
|
update_status(nr+'...'); |
|
39 |
Logger.info('load_rec.onLoading: '+nr); |
Logger.info('load_rec.onLoading: '+nr); |
40 |
}, |
}, |
41 |
onLoaded: function(request) { |
onLoaded: function(request) { |
42 |
loading.record = 0; |
loading.record = 0; |
43 |
update_status('# '+nr); |
hide_working(); |
44 |
|
$('record_nr').value = nr; |
45 |
|
$('record_nr').disabled = ''; |
46 |
|
rec = nr; |
47 |
Logger.info('load_rec.onLoaded: '+nr); |
Logger.info('load_rec.onLoaded: '+nr); |
48 |
} |
} |
49 |
} ) ; |
} ) ; |
51 |
} |
} |
52 |
|
|
53 |
function inc_rec() { |
function inc_rec() { |
54 |
|
show_working(); |
55 |
rec++; |
rec++; |
56 |
load_rec(rec); |
load_rec(rec); |
57 |
|
hide_working(); |
58 |
return false; |
return false; |
59 |
} |
} |
60 |
|
|
61 |
function dec_rec() { |
function dec_rec() { |
62 |
if (rec > 1) { |
if (rec > 1) { |
63 |
|
show_working(); |
64 |
rec--; |
rec--; |
65 |
load_rec(rec); |
load_rec(rec); |
66 |
|
hide_working(); |
67 |
} |
} |
68 |
return false; |
return false; |
69 |
} |
} |
70 |
|
|
71 |
function reload_rec() { |
function reload_rec() { |
72 |
|
show_working(); |
73 |
load_rec(rec); |
load_rec(rec); |
74 |
|
hide_working(); |
75 |
return false; |
return false; |
76 |
} |
} |
77 |
|
|
79 |
|
|
80 |
function edit_template() { |
function edit_template() { |
81 |
$('div_css').style.visibility = "hidden"; |
$('div_css').style.visibility = "hidden"; |
82 |
|
$('div_css').style.zIndex = 1; |
83 |
Element.removeClassName('a_css', 'tab_selected'); |
Element.removeClassName('a_css', 'tab_selected'); |
84 |
Element.addClassName('a_template', 'tab_selected'); |
Element.addClassName('a_template', 'tab_selected'); |
85 |
$('div_template').style.visibility = "visible"; |
$('div_template').style.visibility = "visible"; |
86 |
|
$('div_template').style.zIndex = 2; |
87 |
Logger.debug("switched to template editor"); |
Logger.debug("switched to template editor"); |
88 |
var c = $('template_content'); |
var c = $('template_content'); |
89 |
if (c) c.focus(); |
if (c) c.focus(); |
90 |
|
Logger.debug('zIndex template:'+$('div_template').style.zIndex+' css:'+$('div_css').style.zIndex); |
91 |
return false; |
return false; |
92 |
} |
} |
93 |
|
|
94 |
function edit_css() { |
function edit_css() { |
95 |
$('div_template').style.visibility = "hidden"; |
$('div_template').style.visibility = "hidden"; |
96 |
|
$('div_template').style.zIndex = 1; |
97 |
Element.removeClassName('a_template', 'tab_selected'); |
Element.removeClassName('a_template', 'tab_selected'); |
98 |
Element.addClassName('a_css', 'tab_selected'); |
Element.addClassName('a_css', 'tab_selected'); |
99 |
$('div_css').style.visibility = "visible"; |
$('div_css').style.visibility = "visible"; |
100 |
|
$('div_css').style.zIndex = 2; |
101 |
Logger.debug("switched to CSS editor"); |
Logger.debug("switched to CSS editor"); |
102 |
var c = $('css_content'); |
var c = $('css_content'); |
103 |
if (c) c.focus(); |
if (c) c.focus(); |
104 |
|
Logger.debug('zIndex template:'+$('div_template').style.zIndex+' css:'+$('div_css').style.zIndex); |
105 |
return false; |
return false; |
106 |
} |
} |
107 |
|
|
108 |
function switch_template(new_template_filename) { |
function switch_template(new_template_filename) { |
109 |
|
|
110 |
Logger.info('switch_template to '+new_template_filename); |
Logger.info('switch_template to '+new_template_filename); |
111 |
|
show_working(); |
112 |
|
|
113 |
Logger.debug('load template editor'); |
Logger.debug('load template editor'); |
114 |
template_filename = new_template_filename; |
template_filename = new_template_filename; |
117 |
Logger.debug('refresh record'); |
Logger.debug('refresh record'); |
118 |
load_rec(rec); |
load_rec(rec); |
119 |
|
|
120 |
|
hide_working(); |
121 |
|
|
122 |
return false; |
return false; |
123 |
} |
} |
124 |
|
|
135 |
return; |
return; |
136 |
} |
} |
137 |
|
|
138 |
|
show_working(); |
139 |
|
|
140 |
var args = '?template_filename='+template_filename; |
var args = '?template_filename='+template_filename; |
141 |
|
|
142 |
new Ajax.Updater( 'div_template', url+'template'+args, { |
new Ajax.Updater( 'div_template', url+'template'+args, { |
148 |
onLoaded: function(request) { |
onLoaded: function(request) { |
149 |
loading.template = 0; |
loading.template = 0; |
150 |
Position.clone('div_template', 'div_css'); |
Position.clone('div_template', 'div_css'); |
151 |
|
hide_working(); |
152 |
Logger.info('load_template.onLoaded: '+template_filename); |
Logger.info('load_template.onLoaded: '+template_filename); |
153 |
} |
} |
154 |
} ) ; |
} ) ; |
161 |
return; |
return; |
162 |
} |
} |
163 |
|
|
164 |
|
show_working(); |
165 |
|
|
166 |
new Ajax.Updater( 'div_css', url+'css', { |
new Ajax.Updater( 'div_css', url+'css', { |
167 |
asynchronous: 1, |
asynchronous: 1, |
168 |
onLoading: function(request) { |
onLoading: function(request) { |
171 |
}, |
}, |
172 |
onLoaded: function(request) { |
onLoaded: function(request) { |
173 |
loading.css = 0; |
loading.css = 0; |
174 |
|
hide_working(); |
175 |
Logger.info('load_css.onLoaded: '+css_filename); |
Logger.info('load_css.onLoaded: '+css_filename); |
176 |
} |
} |
177 |
} ) ; |
} ) ; |
178 |
}; |
}; |
179 |
|
|
180 |
function init_page() { |
function reload_css() { |
181 |
|
|
182 |
|
css_rnd++; |
183 |
|
Logger.info('loading user.css?'+css_rnd); |
184 |
|
$('user_css_link').href = 'css/user.css?'+css_rnd; |
185 |
|
|
186 |
|
return false; |
187 |
|
} |
188 |
|
|
189 |
// Element.hide('div_css'); |
var working_count = 0; |
|
// Element.show('div_template'); |
|
190 |
|
|
191 |
// Position.clone('div_template', 'div_css'); |
function show_working() { |
192 |
|
working_count++; |
193 |
|
if (working_count > 1) Element.show('working'); |
194 |
|
Logger.debug('show_working, count = '+working_count); |
195 |
|
} |
196 |
|
|
197 |
|
function hide_working() { |
198 |
|
working_count--; |
199 |
|
if (working_count < 1) Element.hide('working'); |
200 |
|
Logger.debug('hide_working, count = '+working_count); |
201 |
|
} |
202 |
|
|
203 |
|
function init_page() { |
204 |
|
|
205 |
|
show_working(); |
206 |
|
|
207 |
edit_template(); |
edit_template(); |
208 |
|
|
212 |
// load template editor and record |
// load template editor and record |
213 |
switch_template(template_filename); |
switch_template(template_filename); |
214 |
|
|
215 |
|
hide_working(); |
216 |
|
|
217 |
} |
} |
218 |
|
|