return $content;
}
+sub template_list_html($) {
+ my $current = shift || die;
+
+ my $html = qq{ Template\n<ul> };
+
+ foreach my $t (sort @templates) {
+ if ($t eq $current) {
+ $html .= qq{ <li><b>$t</b></li> };
+ } else {
+ $html .= qq{ <li><a href="#" onClick="load_template('$t'); return false;">$t</a></li> };
+ }
+ }
+
+ $html .= qq{ </ul> };
+ return $html;
+}
+
##----
if ($q->path_info =~ m#xml#) {
exit;
}
+} elsif ($q->path_info =~ m#template_list#) {
+
+ print qq{<response>
+<action type='html' target='div_template_list' errorCode='' errorMessage='' >
+<div>} . template_list_html($template_filename) . qq{</div>
+</action>
+</response>
+ };
+
+ exit;
+
} elsif ($q->path_info =~ m#template#) {
my $template_path = $out->{'include_path'} . '/' . $template_filename;
-->
<span id="div_template_status" style="color: #808080;">idle</span>
-<input type='hidden' value='hidden post value' name='hidValue' />
+<input type="hidden" name="template" value="$template_filename" />
</form>
</action>
<action type='js'>
<!--
+iwfOpacity('div_template', 100);
iwfHideGentlyDelay('div_template_status', 2, 2000, 1);
-->
</action>
} else {
- my $template_form = qq{
- <form action="$self" method="get" style="display: inline;">
- <select name="template">
- };
- foreach my $t (@templates) {
- my $s = '';
- $s = ' selected' if ($t eq $template_filename);
- $template_form .= qq{<option$s>$t</option>};
- }
- $template_form .= qq{
- </select>
- <input type="submit" name="ch_template" value="Switch"/>
- </form>
- };
+ my $template_list_html = template_list_html($template_filename);
print <<"_END_OF_HEAD_";
<html>
return false;
}
+function load_template(name) {
+ iwfLog('changing template to '+name);
+ iwfOpacity('div_template', 30);
+ template_filename = name;
+ // load template editor
+ iwfRequest( url+'/template/?template='+template_filename, 'div_template' );
+ load_rec(rec);
+
+ // refresh template list
+ iwfRequest( url+'/template_list/?template='+template_filename, 'div_template_list' );
+}
+
function init_page() {
iwfLog('div_css = ' + iwfX('div_css') + ':' + iwfY('div_css'));
iwfLog('div_template = ' + iwfX('div_template') + ':' + iwfY('div_template'));
iwfLog('div_css = ' + iwfX('div_css') + ':' + iwfY('div_css'));
- load_rec(rec);
+ // load template editor and record
+ load_template(template_filename);
- // load template editor
- iwfRequest( url+'/template/?template='+template_filename, 'div_template' );
// load css editor
iwfRequest( url+'/css/', 'div_css' );
}
</div>
db_path = <tt>$db_path</tt><br/>
-template = $template_form<br/>
css = <tt>$css_file</tt>
<div style="background: #e0e0e0; padding: 0.5em; display: block;">
</div>
+
+<div id="div_template_list" style="display: inline; border: 2px solid #ffcc88; float: right; z-index: 10;">
+$template_list_html
+</div>
+
<div>
-<div style="display: block;">
+<div style="border: 2px solid #ffff80;">
+
Editor
<a id="a_template" href="#" onClick="return edit_template();">template</a>
<a id="a_css" href="#" onClick="return edit_css();">css</a>
+
<div id="div_template">
<span style="color: #808080;"> no template loaded yet. </span>
</div>