--- trunk/web/browse.cgi 2005/11/14 16:14:49 47 +++ trunk/web/browse.cgi 2005/11/14 16:15:27 49 @@ -3,6 +3,7 @@ use Cwd qw/abs_path/; use CGI::Carp qw(fatalsToBrowser); use CGI::Simple; +use File::Slurp; use lib '../lib'; @@ -13,6 +14,7 @@ $abs_path =~ s#/[^/]*$#/../#; my $db_path = $abs_path . '/db/'; +my $template = 'html_ffzg.tt'; my $db = new WebPAC::DB( path => $db_path, @@ -36,20 +38,20 @@ my @ds = $db->load_ds($rec); - if (@ds) { + if (@ds && $#ds > 0) { print qq{ - + }, $out->apply( - template => 'html_ffzg.tt', + template => $template, data => \@ds, ), qq{ @@ -58,11 +60,38 @@ }; exit; } else { - print qq{ - Record $rec not found! - }; + print qq{ + + +Record $rec not found! + + + + +}; + exit; } +} elsif ($q->path_info =~ m#template#) { + + my $tmpl = read_file($out->{'include_path'} . '/' . $template); + $tmpl = $q->escapeHTML($tmpl); + + print qq{ + + +
+
+
+}; + } else { print qq{ @@ -78,15 +107,14 @@ var url = '$self'; function update_status(text) { - var el = iwfGetById('divRecordNr'); + var el = iwfGetById('div_record_nr'); if (el) el.innerHTML = text; } - function load_rec(nr) { update_status(nr+'...'); - iwfRequest( url+'/xml/?rec='+nr, 'divRecord' ); - iwfOpacity('divRecord', 30); + iwfRequest( url+'/xml/?rec='+nr, 'div_record' ); + iwfOpacity('div_record', 30); } function inc_rec() { @@ -106,24 +134,39 @@ return false; } +function init_page() { + load_rec(rec); + // load template + iwfRequest( url+'/template/', 'div_template' ); +} + - + db_path = $db_path
+ +
  - none + none     +  
-
+
+ no template loaded yet. +
+ +
no record loaded yet.
+ };