3 |
use Cwd qw/abs_path/; |
use Cwd qw/abs_path/; |
4 |
use CGI::Carp qw(fatalsToBrowser); |
use CGI::Carp qw(fatalsToBrowser); |
5 |
use CGI::Simple; |
use CGI::Simple; |
6 |
|
use File::Slurp; |
7 |
|
|
8 |
use lib '../lib'; |
use lib '../lib'; |
9 |
|
|
14 |
$abs_path =~ s#/[^/]*$#/../#; |
$abs_path =~ s#/[^/]*$#/../#; |
15 |
|
|
16 |
my $db_path = $abs_path . '/db/'; |
my $db_path = $abs_path . '/db/'; |
17 |
|
my $template = 'html_ffzg.tt'; |
18 |
|
|
19 |
my $db = new WebPAC::DB( |
my $db = new WebPAC::DB( |
20 |
path => $db_path, |
path => $db_path, |
38 |
|
|
39 |
my @ds = $db->load_ds($rec); |
my @ds = $db->load_ds($rec); |
40 |
|
|
41 |
if (@ds) { |
if (@ds && $#ds > 0) { |
42 |
print qq{<response> |
print qq{<response> |
43 |
<action type='html' target='divRecord' errorCode='' errorMessage='' > |
<action type='html' target='div_record' errorCode='' errorMessage='' > |
44 |
}, $out->apply( |
}, $out->apply( |
45 |
template => 'html_ffzg.tt', |
template => $template, |
46 |
data => \@ds, |
data => \@ds, |
47 |
), qq{ |
), qq{ |
48 |
|
|
49 |
<script type='text/javascript'> |
<script type='text/javascript'> |
50 |
<!-- |
<!-- |
51 |
var el = iwfGetById('divRecordNr'); |
var el = iwfGetById('div_record_nr'); |
52 |
if (el) el.innerHTML = '# <b>$rec</b>'; |
if (el) el.innerHTML = '# <b>$rec</b>'; |
53 |
//iwfShow('divRecord'); |
//iwfShow('div_record'); |
54 |
iwfOpacity('divRecord', 100); |
iwfOpacity('div_record', 100); |
55 |
//--> |
//--> |
56 |
</script> |
</script> |
57 |
|
|
60 |
}; |
}; |
61 |
exit; |
exit; |
62 |
} else { |
} else { |
63 |
print qq{ |
print qq{<response> |
64 |
<b>Record $rec not found!</b> |
<action type='html' target='div_record' errorCode='' errorMessage='' > |
65 |
}; |
|
66 |
|
<b>Record $rec not found!</b> |
67 |
|
<script type='text/javascript'> |
68 |
|
<!-- |
69 |
|
var el = iwfGetById('div_record_nr'); |
70 |
|
if (el) el.innerHTML = '<strike>$rec</strike>'; |
71 |
|
//--> |
72 |
|
</script> |
73 |
|
|
74 |
|
</action> |
75 |
|
</response> |
76 |
|
}; |
77 |
|
exit; |
78 |
} |
} |
79 |
|
|
80 |
|
} elsif ($q->path_info =~ m#template#) { |
81 |
|
|
82 |
|
my $tmpl = read_file($out->{'include_path'} . '/' . $template); |
83 |
|
$tmpl = $q->escapeHTML($tmpl); |
84 |
|
|
85 |
|
print qq{<response> |
86 |
|
<action type='html' target='div_template' errorCode='' errorMessage='' > |
87 |
|
<textarea name="tt_template" cols="80" rows="10"> |
88 |
|
$tmpl |
89 |
|
</textarea> |
90 |
|
<br/><input type="button" name="save" value="Save"> |
91 |
|
</action> |
92 |
|
</response> |
93 |
|
}; |
94 |
|
|
95 |
} else { |
} else { |
96 |
print qq{ |
print qq{ |
97 |
<html> |
<html> |
107 |
var url = '$self'; |
var url = '$self'; |
108 |
|
|
109 |
function update_status(text) { |
function update_status(text) { |
110 |
var el = iwfGetById('divRecordNr'); |
var el = iwfGetById('div_record_nr'); |
111 |
if (el) el.innerHTML = text; |
if (el) el.innerHTML = text; |
112 |
} |
} |
|
|
|
113 |
|
|
114 |
function load_rec(nr) { |
function load_rec(nr) { |
115 |
update_status(nr+'...'); |
update_status(nr+'...'); |
116 |
iwfRequest( url+'/xml/?rec='+nr, 'divRecord' ); |
iwfRequest( url+'/xml/?rec='+nr, 'div_record' ); |
117 |
iwfOpacity('divRecord', 30); |
iwfOpacity('div_record', 30); |
118 |
} |
} |
119 |
|
|
120 |
function inc_rec() { |
function inc_rec() { |
134 |
return false; |
return false; |
135 |
} |
} |
136 |
|
|
137 |
|
function init_page() { |
138 |
|
load_rec(rec); |
139 |
|
// load template |
140 |
|
iwfRequest( url+'/template/', 'div_template' ); |
141 |
|
} |
142 |
|
|
143 |
</script> |
</script> |
144 |
</head> |
</head> |
145 |
<body onload="load_rec($rec);"> |
<body onload="init_page();"> |
146 |
|
|
147 |
db_path = <tt>$db_path</tt><br/> |
db_path = <tt>$db_path</tt><br/> |
148 |
|
|
149 |
|
<div id="iwfLog" style="display: none;"> |
150 |
|
</div> |
151 |
|
|
152 |
<div style="background: #e0e0e0; padding: 0.5em; display: block;"> |
<div style="background: #e0e0e0; padding: 0.5em; display: block;"> |
153 |
<a href="$self?rec=}, $rec - 1, qq{" onClick="return dec_rec();">⇦</a> |
<a href="$self?rec=}, $rec - 1, qq{" onClick="return dec_rec();">⇦</a> |
154 |
<span id="divRecordNr"> none </span> |
<span id="div_record_nr"> none </span> |
155 |
|
|
156 |
<a href="$self?rec=}, $rec + 1, qq{" onClick="return inc_rec();">⇨</a> |
<a href="$self?rec=}, $rec + 1, qq{" onClick="return inc_rec();">⇨</a> |
157 |
<a href="$self?rec=}, $rec, qq{" onClick="return reload_rec();">↺</a> |
<a href="$self?rec=}, $rec, qq{" onClick="return reload_rec();">↺</a> |
158 |
|
<a href="#" onClick="iwfRefreshLog(); return false;">▤</a> |
159 |
</div> |
</div> |
160 |
|
|
161 |
<div id="divRecord"> |
<div id="div_template"> |
162 |
|
<span style="color: #808080;"> no template loaded yet. </span> |
163 |
|
</div> |
164 |
|
|
165 |
|
<div id="div_record" style="display: block;"> |
166 |
<span style="color: #808080;"> no record loaded yet. </span> |
<span style="color: #808080;"> no record loaded yet. </span> |
167 |
</div> |
</div> |
168 |
|
|
169 |
|
|
170 |
</body> |
</body> |
171 |
</html>}; |
</html>}; |
172 |
|
|