--- trunk/web/browse.cgi 2005/11/20 20:59:39 78
+++ trunk/web/browse.cgi 2005/11/20 21:45:09 79
@@ -75,6 +75,23 @@
return $content;
}
+sub template_list_html($) {
+ my $current = shift || die;
+
+ my $html = qq{ Template\n
};
+
+ foreach my $t (sort @templates) {
+ if ($t eq $current) {
+ $html .= qq{ - $t
};
+ } else {
+ $html .= qq{ - $t
};
+ }
+ }
+
+ $html .= qq{
};
+ return $html;
+}
+
##----
if ($q->path_info =~ m#xml#) {
@@ -118,6 +135,17 @@
exit;
}
+} elsif ($q->path_info =~ m#template_list#) {
+
+ print qq{
+
+} . template_list_html($template_filename) . qq{
+
+
+ };
+
+ exit;
+
} elsif ($q->path_info =~ m#template#) {
my $template_path = $out->{'include_path'} . '/' . $template_filename;
@@ -167,6 +195,7 @@
@@ -231,20 +260,7 @@
} else {
- my $template_form = qq{
-
- };
+ my $template_list_html = template_list_html($template_filename);
print <<"_END_OF_HEAD_";
@@ -313,6 +329,18 @@
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'));
@@ -322,10 +350,9 @@
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' );
}
@@ -339,7 +366,6 @@
db_path = $db_path
-template = $template_form
css = $css_file
@@ -352,13 +378,20 @@
+
+
+$template_list_html
+
+