1 package C4::Output; #asummes C4/Output
3 #package to deal with marking up output
4 #You will need to edit parts of this pm
5 #set the value of path to be where your html lives
10 use vars qw($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS);
12 # set the version for version checking
16 @EXPORT = qw(&startpage &endpage &mktablehdr &mktableft &mktablerow &mklink
17 &startmenu &endmenu &mkheadr ¢er &endcenter &mkform &mkform2 &bold
18 &gotopage &mkformnotable &mkform3);
19 %EXPORT_TAGS = ( ); # eg: TAG => [ qw!name1 name2! ],
21 # your exported package globals go here,
22 # as well as any optionally exported functions
24 @EXPORT_OK = qw($Var1 %Hashit);
27 # non-exported package globals go here
28 use vars qw(@more $stuff);
30 # initalize package globals, first exported ones
36 # then the others (which are still accessible as $Some::Module::stuff)
40 # all file-scoped lexicals must be created before
41 # the functions below that use them.
44 # Change this value to reflect where you will store your includes
47 open (KC, "/etc/koha.conf");
51 if (/(.*)\s*=\s*(.*)/) {
54 # Clean up white space at beginning and end
59 $configfile{$variable}=$value;
62 my $path=$configfile{'includes'};
63 ($path) || ($path="/usr/local/www/hdl/htdocs/includes");
66 # here's a file-private function as a closure,
67 # callable as &$priv_func; it cannot be prototyped.
72 # make all your functions, whether exported or not;
75 my $string="<html>\n";
81 print "<br>goto target = $target<br>";
82 my $string = "<META HTTP-EQUIV=Refresh CONTENT=\"0;URL=http:$target\">";
88 # edit the paths in here
90 if ($type eq 'issue') {
91 open (FILE,"$path/issues-top.inc") || die;
92 } elsif ($type eq 'opac') {
93 open (FILE,"$path/opac-top.inc") || die;
94 } elsif ($type eq 'member') {
95 open (FILE,"$path/members-top.inc") || die;
96 } elsif ($type eq 'acquisitions'){
97 open (FILE,"$path/aquisitions-top.inc")|| die;
98 } elsif ($type eq 'report'){
99 open (FILE,"$path/reports-top.inc") || die;
100 } elsif ($type eq 'circulation') {
101 open (FILE,"$path/circulation-top.inc") || die;
103 open (FILE,"$path/cat-top.inc") || die;
108 # $string[$count]="<BLOCKQUOTE>";
115 if ($type eq 'issue'){
116 open (FILE,"$path/issues-bottom.inc") || die;
117 } elsif ($type eq 'opac') {
118 open (FILE,"$path/opac-bottom.inc") || die;
119 } elsif ($type eq 'member') {
120 open (FILE,"$path/members-bottom.inc") || die;
121 } elsif ($type eq 'acquisitions') {
122 open (FILE,"$path/aquisitions-bottom.inc") || die;
123 } elsif ($type eq 'report') {
124 open (FILE,"$path/reports-bottom.inc") || die;
125 } elsif ($type eq 'circulation') {
126 open (FILE,"$path/circulation-bottom.inc") || die;
128 open (FILE,"$path/cat-bottom.inc") || die;
136 my $string="<table border=0 cellspacing=0 cellpadding=5>\n";
142 #the last item in data may be a backgroundimage
143 my ($cols,$colour,@data)=@_;
145 my $string="<tr valign=top bgcolor=$colour>";
147 if ($data[$cols] ne ''){
148 #check for backgroundimage
149 $string.="<td background=\"$data[$cols]\">";
153 if ($data[$i] eq "") {
154 $string.=" </td>";
156 $string.="$data[$i]</td>";
160 $string=$string."</tr>\n";
165 my $string="</table>\n";
170 my ($action,%inputs)=@_;
171 my $string="<form action=$action method=post>\n";
172 $string=$string.mktablehdr();
174 my @keys=sort keys %inputs;
178 while ( $i2<$count) {
179 my $value=$inputs{$keys[$i2]};
180 my @data=split('\t',$value);
181 #my $posn = shift(@data);
182 if ($data[0] eq 'hidden'){
183 $string=$string."<input type=hidden name=$keys[$i2] value=\"$data[1]\">\n";
186 if ($data[0] eq 'radio') {
187 $text="<input type=radio name=$keys[$i2] value=$data[1]>$data[1]
188 <input type=radio name=$keys[$i2] value=$data[2]>$data[2]";
190 if ($data[0] eq 'text') {
191 $text="<input type=$data[0] name=$keys[$i2] value=\"$data[1]\">";
193 if ($data[0] eq 'textarea') {
194 $text="<textarea name=$keys[$i2] wrap=physical cols=40 rows=4>$data[1]</textarea>";
196 if ($data[0] eq 'select') {
197 $text="<select name=$keys[$i2]>";
199 while ($data[$i] ne "") {
200 my $val = $data[$i+1];
201 $text = $text."<option value=$data[$i]>$val";
204 $text=$text."</select>";
206 $string=$string.mktablerow(2,'white',$keys[$i2],$text);
207 #@order[$posn] =mktablerow(2,'white',$keys[$i2],$text);
211 #$string=$string.join("\n",@order);
212 $string=$string.mktablerow(2,'white','<input type=submit>','<input type=reset>');
213 $string=$string.mktableft;
214 $string=$string."</form>";
218 my ($action,%inputs)=@_;
219 my $string="<form action=$action method=post>\n";
220 $string=$string.mktablehdr();
222 my @keys=sort keys %inputs;
226 while ( $i2<$count) {
227 my $value=$inputs{$keys[$i2]};
228 my @data=split('\t',$value);
230 if ($data[0] eq 'hidden'){
231 $order[$posn]="<input type=hidden name=$keys[$i2] value=\"$data[1]\">\n";
234 if ($data[0] eq 'radio') {
235 $text="<input type=radio name=$keys[$i2] value=$data[1]>$data[1]
236 <input type=radio name=$keys[$i2] value=$data[2]>$data[2]";
238 if ($data[0] eq 'text') {
239 $text="<input type=$data[0] name=$keys[$i2] value=\"$data[1]\" size=40>";
241 if ($data[0] eq 'textarea') {
242 $text="<textarea name=$keys[$i2] cols=40 rows=4>$data[1]</textarea>";
244 if ($data[0] eq 'select') {
245 $text="<select name=$keys[$i2]>";
247 while ($data[$i] ne "") {
248 my $val = $data[$i+1];
249 $text = $text."<option value=$data[$i]>$val";
252 $text=$text."</select>";
254 # $string=$string.mktablerow(2,'white',$keys[$i2],$text);
255 $order[$posn]=mktablerow(2,'white',$keys[$i2],$text);
259 my $temp=join("\n",@order);
260 $string=$string.$temp;
261 $string=$string.mktablerow(1,'white','<input type=submit>');
262 $string=$string.mktableft;
263 $string=$string."</form>";
267 my ($action,@inputs)=@_;
268 my $string="<form action=$action method=post>\n";
270 for (my $i=0; $i<$count; $i++){
271 if ($inputs[$i][0] eq 'hidden'){
272 $string=$string."<input type=hidden name=$inputs[$i][1] value=\"$inputs[$i][2]\">\n";
274 if ($inputs[$i][0] eq 'radio') {
275 $string.="<input type=radio name=$inputs[1] value=$inputs[$i][2]>$inputs[$i][2]";
277 if ($inputs[$i][0] eq 'text') {
278 $string.="<input type=$inputs[$i][0] name=$inputs[$i][1] value=\"$inputs[$i][2]\">";
280 if ($inputs[$i][0] eq 'textarea') {
281 $string.="<textarea name=$inputs[$i][1] wrap=physical cols=40 rows=4>$inputs[$i][2]</textarea>";
283 if ($inputs[$i][0] eq 'reset'){
284 $string.="<input type=reset name=$inputs[$i][1] value=\"$inputs[$i][2]\">";
286 if ($inputs[$i][0] eq 'submit'){
287 $string.="<input type=submit name=$inputs[$i][1] value=\"$inputs[$i][2]\">";
290 $string=$string."</form>";
294 my ($action,%inputs)=@_;
295 my $string="<form action=$action method=post>\n";
296 $string=$string.mktablehdr();
299 while ( my ($key, $value) = each %inputs) {
300 my @data=split('\t',$value);
301 my $posn = shift(@data);
302 my $reqd = shift(@data);
303 my $ltext = shift(@data);
304 if ($data[0] eq 'hidden'){
305 $string=$string."<input type=hidden name=$key value=\"$data[1]\">\n";
308 if ($data[0] eq 'radio') {
309 $text="<input type=radio name=$key value=$data[1]>$data[1]
310 <input type=radio name=$key value=$data[2]>$data[2]";
311 } elsif ($data[0] eq 'text') {
316 $text="<input type=$data[0] name=$key size=$size value=\"$data[2]\">";
317 } elsif ($data[0] eq 'textarea') {
318 my @size=split("x",$data[1]);
319 if ($data[1] eq "") {
323 $text="<textarea name=$key wrap=physical cols=$size[0] rows=$size[1]>$data[2]</textarea>";
324 } elsif ($data[0] eq 'select') {
325 $text="<select name=$key>";
328 while ($data[$i] ne "") {
329 my $val = $data[$i+1];
330 $text = $text."<option value=\"$data[$i]\"";
331 if ($data[$i] eq $sel) {
332 $text = $text." selected";
334 $text = $text.">$val";
337 $text=$text."</select>";
340 $ltext = $ltext." (Req)";
342 @order[$posn] =mktablerow(2,'white',$ltext,$text);
345 $string=$string.join("\n",@order);
346 $string=$string.mktablerow(2,'white','<input type=submit>','<input type=reset>');
347 $string=$string.mktableft;
348 $string=$string."</form>";
353 my $string="</body></html>\n";
359 my $string="<a href=\"$url\">$text</a>";
367 $string="<FONT SIZE=6><em>$text</em></FONT><br>";
370 $string="<FONT SIZE=6><em>$text</em></FONT>";
373 $string="<FONT SIZE=6><em>$text</em></FONT><p>";
380 my $string="<CENTER>\n";
386 my $string="</CENTER>\n";
392 my $string="<b>$text</b>";
396 END { } # module clean-up code here (global destructor)