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 update_status(text) { |
function _ts(text) { |
14 |
var el = $('div_record_nr'); |
var el = $('div_template_status'); |
15 |
|
if (el) el.innerHTML = text; |
16 |
|
} |
17 |
|
|
18 |
|
function _cs(text) { |
19 |
|
var el = $('div_css_status'); |
20 |
if (el) el.innerHTML = text; |
if (el) el.innerHTML = text; |
21 |
} |
} |
22 |
|
|
23 |
function load_rec(nr) { |
function load_rec(nr, tmp_template_filename) { |
24 |
Logger.debug('load_rec '+nr); |
|
25 |
|
if (! nr) { |
26 |
|
Logger.error('load_rec called without nr'); |
27 |
|
return false; |
28 |
|
} |
29 |
|
|
30 |
|
if (! tmp_template_filename) tmp_template_filename = template_filename; |
31 |
|
Logger.info('load_rec '+nr+' in '+tmp_template_filename); |
32 |
|
|
33 |
if (loading.record) { |
if (loading.record) { |
34 |
Logger.info('loading of record '+nr+' skipped, load in progress'); |
Logger.info('loading of record '+nr+' skipped, load in progress'); |
44 |
Element.removeClassName('a_left_arr', 'nav_disable'); |
Element.removeClassName('a_left_arr', 'nav_disable'); |
45 |
} |
} |
46 |
|
|
47 |
var args = '?mfn='+nr+'&template_filename='+template_filename; |
var args = '?mfn='+nr+'&template_filename='+tmp_template_filename; |
48 |
|
|
49 |
new Ajax.Updater( 'div_record', url+'record'+args, { |
new Ajax.Updater( 'div_record', url+'record'+args, { |
50 |
asynchronous: 1, |
asynchronous: 1, |
93 |
|
|
94 |
function edit_template() { |
function edit_template() { |
95 |
$('div_css').style.visibility = "hidden"; |
$('div_css').style.visibility = "hidden"; |
96 |
|
$('div_css').style.zIndex = 1; |
97 |
Element.removeClassName('a_css', 'tab_selected'); |
Element.removeClassName('a_css', 'tab_selected'); |
98 |
Element.addClassName('a_template', 'tab_selected'); |
Element.addClassName('a_template', 'tab_selected'); |
99 |
$('div_template').style.visibility = "visible"; |
$('div_template').style.visibility = "visible"; |
100 |
|
$('div_template').style.zIndex = 2; |
101 |
Logger.debug("switched to template editor"); |
Logger.debug("switched to template editor"); |
102 |
var c = $('template_content'); |
var c = $('template_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 edit_css() { |
function edit_css() { |
109 |
$('div_template').style.visibility = "hidden"; |
$('div_template').style.visibility = "hidden"; |
110 |
|
$('div_template').style.zIndex = 1; |
111 |
Element.removeClassName('a_template', 'tab_selected'); |
Element.removeClassName('a_template', 'tab_selected'); |
112 |
Element.addClassName('a_css', 'tab_selected'); |
Element.addClassName('a_css', 'tab_selected'); |
113 |
$('div_css').style.visibility = "visible"; |
$('div_css').style.visibility = "visible"; |
114 |
|
$('div_css').style.zIndex = 2; |
115 |
Logger.debug("switched to CSS editor"); |
Logger.debug("switched to CSS editor"); |
116 |
var c = $('css_content'); |
var c = $('css_content'); |
117 |
if (c) c.focus(); |
if (c) c.focus(); |
118 |
|
Logger.debug('zIndex template:'+$('div_template').style.zIndex+' css:'+$('div_css').style.zIndex); |
119 |
return false; |
return false; |
120 |
} |
} |
121 |
|
|
131 |
Logger.debug('refresh record'); |
Logger.debug('refresh record'); |
132 |
load_rec(rec); |
load_rec(rec); |
133 |
|
|
134 |
|
edKill('template_content'); |
135 |
|
|
136 |
hide_working(); |
hide_working(); |
137 |
|
|
138 |
return false; |
return false; |
151 |
return; |
return; |
152 |
} |
} |
153 |
|
|
154 |
|
show_working(); |
155 |
|
|
156 |
var args = '?template_filename='+template_filename; |
var args = '?template_filename='+template_filename; |
157 |
|
|
158 |
new Ajax.Updater( 'div_template', url+'template'+args, { |
new Ajax.Updater( 'div_template', url+'template'+args, { |
159 |
asynchronous: 1, |
asynchronous: 1, |
160 |
onLoading: function(request) { |
onLoading: function(request) { |
161 |
loading.template = 1; |
loading.template = 1; |
|
show_working(); |
|
162 |
Logger.info('load_template.onLoading: '+template_filename); |
Logger.info('load_template.onLoading: '+template_filename); |
163 |
}, |
}, |
164 |
onLoaded: function(request) { |
onLoaded: function(request) { |
177 |
return; |
return; |
178 |
} |
} |
179 |
|
|
180 |
|
show_working(); |
181 |
|
|
182 |
new Ajax.Updater( 'div_css', url+'css', { |
new Ajax.Updater( 'div_css', url+'css', { |
183 |
asynchronous: 1, |
asynchronous: 1, |
184 |
onLoading: function(request) { |
onLoading: function(request) { |
185 |
loading.css = 1; |
loading.css = 1; |
|
show_working(); |
|
186 |
Logger.info('load_css.onLoading: '+css_filename); |
Logger.info('load_css.onLoading: '+css_filename); |
187 |
}, |
}, |
188 |
onLoaded: function(request) { |
onLoaded: function(request) { |
194 |
}; |
}; |
195 |
|
|
196 |
function reload_css() { |
function reload_css() { |
197 |
Logger.error('reload_css is not yet implemented!'); |
|
198 |
|
css_rnd++; |
199 |
|
Logger.info('loading user.css?'+css_rnd); |
200 |
|
$('user_css_link').href = 'css/user.css?'+css_rnd; |
201 |
|
|
202 |
return false; |
return false; |
203 |
} |
} |
204 |
|
|