X-Git-Url: http://git.rot13.org/?p=webpac2;a=blobdiff_plain;f=web%2Fbrowse.cgi;h=bc9340f82e557fb04f361af72753dbf27e2a75dc;hp=a10d17561c291fbec240da6eecdc3b335fea3cfb;hb=118ee5e3baceecea12902cd801999559edc50c7e;hpb=7a90434422239603e90db854430b0507957a7520
diff --git a/web/browse.cgi b/web/browse.cgi
index a10d175..bc9340f 100755
--- a/web/browse.cgi
+++ b/web/browse.cgi
@@ -75,6 +75,23 @@ sub get_file_in_html($) {
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 @@ if ($q->path_info =~ m#xml#) {
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 @@ $tmpl
@@ -231,20 +260,7 @@ iwfLog('loaded CSS template');
} else {
- my $template_form = qq{
-
- };
+ my $template_list_html = template_list_html($template_filename);
print <<"_END_OF_HEAD_";
@@ -313,6 +329,18 @@ function edit_css() {
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 @@ function init_page() {
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 @@ function init_page() {
db_path = $db_path
-template = $template_form
css = $css_file
@@ -352,13 +378,20 @@ css = $css_file
+
+
+$template_list_html
+
+