Home | News | Projects | Releases
Bugs | RFE | Repositories | Help
Forked Xestia Scanner Server!
[xestiascansrv/.git] / cgi-files / Modules / Presentation / HTML4S.pm
1 #################################################################################
2 # Xestia Scanner Server Presentation Module - HTML 4.0 Strict (HTML4S.pm)       #
3 # Output Module for writing pages to the HTML 4.0 Strict Standard               #
4 #                                                                               #
5 # Copyright (C) 2007-2011 Steve Brokenshire <sbrokenshire@xestia.co.uk>         #
6 #                                                                               #
7 # This module is licensed under the same license as Xestia Scanner Server which #
8 # is licensed under the GPL version 3.                                          #
9 #                                                                               #
10 # This program is free software: you can redistribute it and/or modify          #
11 # it under the terms of the GNU General Public License as published by          #
12 # the Free Software Foundation, version 3 of the License.                       #
13 #                                                                               #
14 # This program is distributed in the hope that it will be useful,               #
15 # but WITHOUT ANY WARRANTY; without even the implied warranty of                #
16 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the                 #
17 # GNU General Public License for more details.                                  #
18 #                                                                               #
19 # You should have received a copy of the GNU General Public License             #
20 # along with this program.  If not, see <http://www.gnu.org/licenses/>.         #
21 #################################################################################
23 # Define the package (perl module) name.
25 package Modules::Presentation::HTML4S;
27 # Enable strict and use warnings.
29 use strict;
30 use warnings;
32 # Set the following values.
34 our $VERSION = "0.1.0";
35 my $pagedata = "";
36 my $tablevel = 0;
38 #################################################################################
39 # Generic Subroutines.                                                          #
40 #################################################################################
42 sub new{
43 #################################################################################
44 # new: Create an instance of HTML4S                                             #
45 #                                                                               #
46 # Usage:                                                                        #
47 #                                                                               #
48 # $presmodule = Modules::Presentation::HTML4S->new();                           #
49 #################################################################################
50         
51         # Get the perl module name.
53         my $class = shift;
54         my $self = {};
56         return bless($self, $class);
58 }
60 sub clear{
61 #################################################################################
62 # clear: Clear the current layout created by this module.                       #
63 #                                                                               #
64 # Usage:                                                                        #
65 #                                                                               #
66 # $presmodule->clear();                                                         #
67 #################################################################################
69         $pagedata = "";
70         return;
72 }
74 sub grab{
75 #################################################################################
76 # grab: Grab the current layout created by this module.                         #
77 #                                                                               #
78 # Usage:                                                                        #
79 #                                                                               #
80 # $presmodule->grab();                                                          #
81 #################################################################################
83         return $pagedata;
85 }
87 sub convert{
88 #################################################################################
89 # convert: Converts the data passed into data that is compliant with the output #
90 # format.                                                                       #
91 #                                                                               #
92 # Usage:                                                                        #
93 #                                                                               #
94 # $presmodule->convert(data, type);                                             #
95 #                                                                               #
96 # data          Specifies the data to be converted.                             #
97 # type          Specifies the type the data should be converted to.             #
98 #################################################################################
100         # Get the data and type passed.
102         my $class = shift;
103         my ($data, $type) = @_;
105         # Check if certain values are undefined and if they are
106         # then set them blank or return an error.
108         if (!$data){
109                 $data = "";
110         }
112         if (!$type){
113                 die("No type was specified");
114         }
116         # Check what type is being used and process the data
117         # according the type being used.
119         if ($type eq "content"){
121                 $data =~ s/&/&amp;/g;
122                 $data =~ s/#/&#35;/g;
123                 $data =~ s/\"/&#34;/g;
124                 $data =~ s/'/'/g;
125                 $data =~ s/>/&gt;/g;
126                 $data =~ s/</&lt;/g;
127                 $data =~ s/\+/&#43;/g;
128                 $data =~ s/-/&#45;/g;
129                 $data =~ s/_/&#95;/g;
130                 $data =~ s/\@/&#64;/g;
131                 $data =~ s/~/&#126;/g;
132                 $data =~ s/\?/&#63;/g;
133                 $data =~ s/'/&#39;/g;
134                 $data =~ s/\0//g;
135                 $data =~ s/\b//g;
137         } elsif ($type eq "link"){
139                 $data =~ s/&/&amp;/g;
140                 $data =~ s/\+/\%2B/g;
141                 $data =~ s/\?/\%3F/g;
142                 $data =~ s/%3F/\?/;
143                 $data =~ s/-/\%2D/g;
144                 $data =~ s/_/\%5F/g;
145                 $data =~ s/\@/\%40/g;
146                 $data =~ s/#/\%23/g;
147                 $data =~ s/>/\%3E/g;
148                 $data =~ s/</\%3C/g;
149                 $data =~ s/~/\%7E/g;
150                 $data =~ s/'/\%27/;
151                 $data =~ s/!/\%21/g;
153         } else {
155                 die("An invalid type was specified.");
157         }
159         return $data;
163 #################################################################################
164 # Tags for creating tables.                                                     #
165 #################################################################################
167 sub starttable{
168 #################################################################################
169 # starttable: Start a table.                                                    #
170 #                                                                               #
171 # Usage:                                                                        #
172 #                                                                               #
173 # $presmodule->starttable(cssstyle, {options});                                 #
174 #                                                                               #
175 # cssstyle      Specifies the CSS style name to use.                            #
176 # options       Specifies the following options (in any order):                 #
177 #                                                                               #
178 # CellPadding   The cell padding to be used for each table.                     #
179 # CellSpacing   The cell spacing to be used for each table.                     #
180 #################################################################################
182         # Get the CSS style and options.
184         my $class = shift;
185         my ($cssstyle, $options) = @_;
187         my $tagdata = "";
188         my $tabcount = $tablevel;
190         my $cellpadding = $options->{'CellPadding'};
191         my $cellspacing = $options->{'CellSpacing'};
193         # Check if the cell padding and cell spacing and 
194         # CSS style values are blank and if they are then 
195         # set them blank.
197         if (!$cellpadding){
198                 $cellpadding = 0;
199         }
201         if (!$cellspacing){
202                 $cellspacing = 0;
203         }
205         if (!$cssstyle){
206                 $cssstyle = "";
207         }
209         # Check if the cell padding and cell spacing values
210         # are valid and die if it isn't.
212         my $cellpadding_validated = $cellpadding;
213         my $cellspacing_validated = $cellspacing;
215         $cellpadding_validated =~ tr/0-9//d;
216         $cellspacing_validated =~ tr/0-9//d;
218         if ($cellpadding_validated ne ""){
219                 die("Cell padding value given is invalid.");
220         }
222         if ($cellspacing_validated ne ""){
223                 die("Cell spacing value given is invalid.");
224         }
226         while ($tabcount > 0){
227                 $tagdata = $tagdata . "\t";
228                 $tabcount = $tabcount - 1;
229         }
231         # Start a table.
233         $tagdata = $tagdata . "<table";
235         # Check if the cell spacing and cell padding has values
236         # more than 0.
238         if ($cellspacing >= 0){
239                 $tagdata = $tagdata . " cellspacing=\"" . $cellspacing . "\"";
240         }
242         if ($cellpadding > 0){
243                 $tagdata = $tagdata . " cellpadding=\"" . $cellpadding . "\"";
244         }
246         if ($cssstyle ne ""){
247                 $tagdata = $tagdata . " class=\"" . $class->convert($cssstyle, "content") . "\"";
248         }
250         $tagdata = $tagdata . ">" . "\r\n";
252         # Append the tag data to the page data.
254         $pagedata = $pagedata . $tagdata;
255         $tablevel++;
259 sub startheader{
260 #################################################################################
261 # startheader: Start a table header.                                            #
262 #                                                                               #
263 # Usage:                                                                        #
264 #                                                                               #
265 # $presmodule->startheader();                                                   #
266 #################################################################################
268         # Start a table header row.
270         my $tagdata = "";
271         my $tabcount = $tablevel;
273         while ($tabcount > 0){
274                 $tagdata = $tagdata . "\t";
275                 $tabcount = $tabcount - 1;
276         }
278         $tagdata = $tagdata . "<tr>" . "\r\n";
280         # Append the tag data to the page data.
282         $pagedata = $pagedata . $tagdata;
283         $tablevel++;
287 sub addheader{
288 #################################################################################
289 # addheader: Add a table header.                                                #
290 #                                                                               #
291 # Usage:                                                                        #
292 #                                                                               #
293 # $presmodule->addheader(headername, {options});                                #
294 #                                                                               #
295 # headername    Specifies the name of the table header to use.                  #
296 # options       Specifies the following options below (in any order):           #
297 #                                                                               #
298 # Style         Specifies the CSS Style to use for the table header.            #
299 #################################################################################
301         # Get the header name and options.
303         my $class       = shift;
304         my ($headername, $options)      = @_;
306         my $cssstyle    = $options->{'Style'};
308         # Check if the CSS Style or header name is undefined and
309         # if they are then set them blank.
311         if (!$headername){
312                 $headername = "";
313         }
315         if (!$cssstyle){
316                 $cssstyle = "";
317         }
319         my $tagdata = "";
320         my $tabcount = $tablevel;
322         while ($tabcount > 0){
323                 $tagdata = $tagdata . "\t";
324                 $tabcount = $tabcount - 1;
325         }
327         $tagdata = $tagdata . "<th";
328         
329         if ($cssstyle ne ""){
330                 $tagdata = $tagdata . " class=\"" . $class->convert($cssstyle, "content") . "\"";
331         }
333         $tagdata = $tagdata . ">" . $class->convert($headername, "content") . "</th>" . "\r\n";
335         # Append the tag data to the page data.
337         $pagedata = $pagedata . $tagdata;
341 sub endheader{
342 #################################################################################
343 # endheader: End a table header row                                             #
344 #                                                                               #
345 # Usage:                                                                        #
346 #                                                                               #
347 # $presmodule->endheader();                                                     #
348 #################################################################################
350         # End a table header row.
352         my $tagdata = "";
353         $tablevel = ($tablevel - 1);
354         my $tabcount = $tablevel;
356         while ($tabcount > 0){
357                 $tagdata = $tagdata . "\t";
358                 $tabcount = $tabcount - 1;
359         }
361         $tagdata = $tagdata . "</tr>" . "\r\n";
363         # Append the tag data to the page data.
365         $pagedata = $pagedata . $tagdata;
369 sub startrow{
370 #################################################################################
371 # startrow: Start a table row.                                                  #
372 #                                                                               #
373 # Usage:                                                                        #
374 #                                                                               #
375 # $presmodule->startrow();                                                      #
376 #################################################################################
378         # Start a table row.
380         my $tagdata = "";
381         my $tabcount = $tablevel;
383         while ($tabcount > 0){
384                 $tagdata = $tagdata . "\t";
385                 $tabcount = $tabcount - 1;
386         }
388         $tagdata = $tagdata . "<tr>" . "\r\n";
390         # Append the tag data to the page data.
392         $pagedata = $pagedata . $tagdata;
393         $tablevel++;
397 sub addcell{
398 #################################################################################
399 # addcell: Add a table cell.                                                    #
400 #                                                                               #
401 # Usage:                                                                        #
402 #                                                                               #
403 # $presmodule->addcell(style);                                                  #
404 #                                                                               #
405 # style         Specifies which CSS Style to use.                               #
406 #################################################################################
408         # Get the cell information and options.
410         my $class       = shift;
411         my ($cssstyle)  = @_;
412         my $tabcount    = $tablevel;
413         my $tagdata     = "";
415         # Check if the cell data and CSS style are undefined
416         # and if they are then set them blank.
418         if (!$cssstyle){
419                 $cssstyle = "";
420         }
422         while ($tabcount > 0){
423                 $tagdata = $tagdata . "\t";
424                 $tabcount = $tabcount - 1;
425         }
427         $tagdata = $tagdata . "<td";
429         if ($cssstyle ne ""){
430                 $tagdata = $tagdata . " class=\"" . $class->convert($cssstyle, "content") . "\"";
431         }
433         $tagdata = $tagdata . ">";
435         # Append the tag data to the page data.
437         $pagedata = $pagedata . $tagdata;
441 sub endcell{
442 #################################################################################
443 # endcell: End a table cell.                                                    #
444 #                                                                               #
445 # Usage:                                                                        #
446 #                                                                               #
447 # $presmodule->endcell();                                                       #
448 ################################################################################# 
450         # End a table cell.
452         my $tagdata = "";
454         $tagdata = $tagdata . "</td>" . "\r\n";
456         # Append the tag data to the page data.
458         $pagedata = $pagedata . $tagdata;
462 sub endrow{
463 #################################################################################
464 # endrow: Ends a table row.                                                     #
465 #                                                                               #
466 # Usage:                                                                        #
467 #                                                                               #
468 # $presmodule->endrow();                                                        #
469 #################################################################################
471         # End a table row.
473         my $tagdata = "";
474         $tablevel = ($tablevel - 1);
475         my $tabcount = $tablevel;
477         while ($tabcount > 0){
478                 $tagdata = $tagdata . "\t";
479                 $tabcount = $tabcount - 1;
480         }
482         $tagdata = $tagdata . "</tr>" . "\r\n";
484         # Append the tag data to the page data.
486         $pagedata = $pagedata . $tagdata;
490 sub endtable{
491 #################################################################################
492 # endtable: Ends a table.                                                       #
493 #                                                                               #
494 # Usage:                                                                        #
495 #                                                                               #
496 # $presmodule->endtable();                                                      #
497 #################################################################################
499         # End a table.
501         my $tagdata = "";
502         $tablevel = ($tablevel - 1);
503         my $tabcount = $tablevel;
505         while ($tabcount > 0){
506                 $tagdata = $tagdata . "\t";
507                 $tabcount = $tabcount - 1;
508         }
510         $tagdata = $tagdata . "</table>" . "\r\n";
512         # Append the tag data to the page data.
514         $pagedata = $pagedata . $tagdata;
518 #################################################################################
519 # Information box.                                                              #
520 #################################################################################
522 sub startbox{
523 #################################################################################
524 # startbox: Start an information box.                                           #
525 #                                                                               #
526 # Usage:                                                                        #
527 #                                                                               #
528 # $presmodule->startbox(cssstyle);                                              #
529 #                                                                               #
530 # cssstyle      Specifies the CSS Style to use.                                 #
531 #################################################################################
533         # Get the CSS Style name.
535         my $class       = shift;
536         my $cssstyle    = shift;
538         # Check if the CSS style given is undefined and
539         # if it is then set it blank.
541         if (!$cssstyle){
542                 $cssstyle = "";
543         }
545         my $tagdata = "";
546         my $tabcount = $tablevel;
548         while ($tabcount > 0){
549                 $tagdata = $tagdata . "\t";
550                 $tabcount = $tabcount - 1;
551         }
553         # Start an information box.
555         $tagdata = $tagdata . "<div";
556         
557         if ($cssstyle ne ""){
558                 $tagdata = $tagdata . " class=\"" . $class->convert($cssstyle, "content") . "\"";
559         }
561         $tagdata = $tagdata . ">";
563         # Append the tag data to the page data.
565         $pagedata = $pagedata . $tagdata;
569 sub enterdata{
570 #################################################################################
571 # enterdata: Enter data into a information box.                                 #
572 #                                                                               #
573 # Usage:                                                                        #
574 #                                                                               #
575 # $presmodule->enterdata(data);                                                 #
576 #                                                                               #
577 # data          Specifies what data should be entered into the information box. #
578 #################################################################################
580         # Get the data for the information box.
582         my $class       = shift;
583         my $data        = shift;
585         # Append the data to the page data.
587         $pagedata = $pagedata . $class->convert($data, "content");
591 sub endbox{
592 #################################################################################
593 # endbox: End an information box.                                               #
594 #                                                                               #
595 # Usage:                                                                        #
596 #                                                                               #
597 # $presmodule->endbox();                                                        #
598 #################################################################################
600         # End an information box.
602         my $tagdata = "";
603         $tagdata = $tagdata . "</div>" . "\r\n";
605         # Append the tag data to the page data.
607         $pagedata = $pagedata . $tagdata;
611 #################################################################################
612 # Form boxes.                                                                   #
613 #################################################################################
615 sub startform{
616 #################################################################################
617 # startform: Start a form.                                                      #
618 #                                                                               #
619 # Usage:                                                                        #
620 #                                                                               #
621 # $presmodule->startform(action, method);                                       #
622 #                                                                               #
623 # action        Specifies the action (address) the data should be sent to.      #
624 # method        Specifies the method to use (POST, GET)                         #
625 #################################################################################
627         my $class       = shift;
628         my $action      = shift;
629         my $method      = shift;
631         my $tagdata     = "";
632         my $tabcount    = $tablevel;
634         # Check if the action and method values given
635         # are undefined and if they are set default
636         # values.
638         if (!$action){
639                 $action = "";
640         }
642         if (!$method){
643                 # The method is blank so set it to POST.
644                 $method = "POST";
645         }
647         while ($tabcount > 0){
648                 $tagdata = $tagdata . "\t";
649                 $tabcount = $tabcount - 1;
650         }
652         $tagdata = $tagdata . "<form action=\"" . $class->convert($action, "content") . "\" method=\"" . $class->convert($method, "content") . "\">" . "\r\n";
654         # Append the tag data to the page data.
656         $pagedata = $pagedata . $tagdata;
657         $tablevel++;
661 sub addcheckbox{
662 #################################################################################
663 # addcheckbox: Add a check box.                                                 #
664 #                                                                               #
665 # Usage:                                                                        #
666 #                                                                               #
667 # $presmodule->addcheckbox(checkboxname, {options});                            #
668 #                                                                               #
669 # checkboxname  Specifies the check box name.                                   #
670 # options       Specifies the following options below (in any order).           #
671 #                                                                               #
672 # OptionDescription     Specifies a description for the checkbox value.         #
673 # Style                 Specifies the CSS style to use.                         #
674 # Checked               Specifies if the checkbox is checked.                   #
675 # LineBreak             Specifies if a line break should be added.              #
676 # ReadOnly              Specifies the check box is read only.                   #
677 #################################################################################
679         # Get the options recieved.
681         my $class       = shift;
682         my ($checkboxname, $options) = @_;
684         my $tagdata     = "";
685         my $tabcount    = $tablevel;
687         # Get certain values from the hash.
689         my $optiondescription   = $options->{'OptionDescription'};
690         my $style               = $options->{'Style'};
691         my $checked             = $options->{'Checked'};
692         my $linebreak           = $options->{'LineBreak'};
693         my $readonly            = $options->{'ReadOnly'};
695         # Check if certain values are undefined and if they
696         # are then set them blank or to a default value.
698         if (!$checkboxname){
699                 die("The checkbox name is blank.");
700         }
702         if (!$optiondescription){
703                 $optiondescription = "";
704         }
706         if (!$style){
707                 $style = "";
708         }
710         if (!$checked){
711                 $checked = 0;
712         }
714         if (!$linebreak){
715                 $linebreak = 0;
716         }
717         
718         if (!$readonly){
719                 $readonly = 0;
720         }
722         while ($tabcount > 0){
723                 $tagdata = $tagdata . "\t";
724                 $tabcount = $tabcount - 1;
725         }
727         # Add a check box.
729         $tagdata = $tagdata . "<input type=\"checkbox\" name=\"" . $class->convert($checkboxname, "content") . "\"";
731         if ($style ne ""){
732                 $tagdata = $tagdata . " class=\"" . $class->convert($style, "content") . "\"";
733         }
735         if ($checked eq 1){
736                 $tagdata = $tagdata . " checked";
737         }
738         
739         if ($readonly eq 1){
740                 $tagdata = $tagdata . " disabled";
741         }
743         $tagdata = $tagdata . ">";
745         if ($optiondescription ne ""){
746                 $tagdata = $tagdata . "&nbsp;" . $class->convert($optiondescription, "content");
747         }
749         if ($linebreak eq 1){
750                 $tagdata = $tagdata . "<br>";
751         }
753         $tagdata = $tagdata . "\r\n";
755         # Append the tag data to the page data.
757         $pagedata = $pagedata . $tagdata;
761 sub addradiobox{
762 #################################################################################
763 # addradiobox: Add a radio box.                                                 #
764 #                                                                               #
765 # Usage:                                                                        #
766 #                                                                               #
767 # $presmodule->addradiobox(radioboxname, {options});                            #
768 #                                                                               #
769 # radioboxname  The name of the radio box.                                      #
770 # options       Specifies the following options below (in any order).           #
771 #                                                                               #
772 # Description           Specifies a description for the checkbox value.         #
773 # Style                 Specifies the CSS style to use.                         #
774 # Selected              Specifies if the radio box is selected.                 #
775 # LineBreak             Specifies if a line break should be used.               #
776 # Value                 Specifies the value of the radio box.                   #
777 # ReadOnly              Specifies the radio box is read only.                   #
778 #################################################################################
780         # Get the options recieved.
782         my $class       = shift;
783         my ($radioboxname, $options) = @_;
785         my $tagdata     = "";
786         my $tabcount    = $tablevel;
788         # Get certain values from the hash.
790         my $optiondescription   = $options->{'Description'};
791         my $style               = $options->{'Style'};
792         my $selected            = $options->{'Selected'};
793         my $linebreak           = $options->{'LineBreak'};
794         my $value               = $options->{'Value'};
795         my $readonly            = $options->{'ReadOnly'};
796         
797         # Check if certain values are undefined and if they
798         # are then set them blank or to a default value.        
800         if (!$radioboxname){
801                 die("The radio box name is blank.");
802         }
804         if (!$value){
805                 $value = "";
806         }
808         if (!$optiondescription){
809                 $optiondescription = "";
810         }
812         if (!$style){
813                 $style = "";
814         }
816         if (!$selected){
817                 $selected = 0;
818         }
820         if (!$linebreak){
821                 $linebreak = 0;
822         }
824         if (!$readonly){
825                 $readonly = 0;
826         }
827         
828         while ($tabcount > 0){
829                 $tagdata = $tagdata . "\t";
830                 $tabcount = $tabcount - 1;
831         }
833         # Add a radio box.
835         $tagdata = $tagdata . "<input type=\"radio\" name=\"" . $class->convert($radioboxname, "content") . "\"";
837         if ($style ne ""){
838                 $tagdata = $tagdata . " class=\"" . $class->convert($style, "content") . "\"";
839         }
841         if ($selected eq 1){
842                 $tagdata = $tagdata . " checked";
843         }
844         
845         if ($readonly eq 1){
846                 $tagdata = $tagdata . " disabled";
847         }
849         if ($value ne ""){
850                 $tagdata = $tagdata . " value=\"" . $class->convert($value, "content") . "\"";
851         } else {
852                 $tagdata = $tagdata . " value=\"0\"";
853         }
855         $tagdata = $tagdata . ">";
857         if ($optiondescription ne ""){
858                 $tagdata = $tagdata . "&nbsp;" . $class->convert($optiondescription, "content");
859         }
861         if ($linebreak eq 1){
862                 $tagdata = $tagdata . "<br>";
863         }
865         $tagdata = $tagdata . "\r\n";
867         # Append the tag data to the page data.
869         $pagedata = $pagedata . $tagdata;
872 sub addselectbox{
873 #################################################################################
874 # addselectbox: Add a select box.                                               #
875 #                                                                               #
876 # Usage:                                                                        #
877 #                                                                               #
878 # $presmodule->addselectbox(selectname, {options});                             #
879 #                                                                               #
880 # selectboxname Specifies the name of the select box.                           #
881 # options       Specifies the following options (in any order).                 #
882 #                                                                               #
883 # Style         Specifies the CSS style to use.                                 #
884 # ReadOnly      Specifies the select box is read only.                          #
885 #################################################################################
887         # Get the options recieved.
889         my $class       = shift;
890         my ($selectboxname, $options) = @_;
892         my $tagdata     = "";
893         my $tabcount    = $tablevel;
895         # Get certain values from the hash.
897         my $style       = $options->{'Style'};
898         my $readonly    = $options->{'ReadOnly'};
900         # Check if certain values are undefined and if they
901         # are then set them blank or to a default value.
903         if (!$selectboxname){
904                 die("The select box name is blank.")
905         }
907         if (!$style){
908                 $style = "";
909         }
910         
911         if (!$readonly){
912                 $readonly = 0;
913         }
915         while ($tabcount > 0){
916                 $tagdata = $tagdata . "\t";
917                 $tabcount = $tabcount - 1;
918         }
920         # Add a select box.
922         $tagdata = $tagdata . "<select name=\"" . $class->convert($selectboxname, "content") . "\"";
924         if ($style ne ""){
925                 $tagdata = $tagdata = " class=\"" . $class->convert($style, "content") . "\"";
926         }
928         if ($readonly eq 1){
929                 $tagdata = $tagdata . " disabled";
930         }
931         
932         $tagdata = $tagdata . ">";
934         # Append the tag data to the page data.
936         $pagedata = $pagedata . $tagdata;
937         $tablevel++;
941 sub addoption{
942 #################################################################################
943 # addoption: Add an option for a select box.                                    #
944 #                                                                               #
945 # Usage:                                                                        #
946 #                                                                               #
947 # $presmodule->addoption(optionname, options);                                  #
948 #                                                                               #
949 # optionname    Specifies the name (description) of the option.                 #
950 # options       Specifies the following options (in any order).                 #
951 #                                                                               #
952 # Style         Specifies the CSS style to be used.                             #
953 # Value         Specifies the value of the option.                              #
954 # Selected      This option is selected as default when the page is displayed.  #
955 #################################################################################
957         # Get the options recieved.
959         my $class       = shift;
960         my ($optionname, $options) = @_;
962         my $tagdata     = "";
963         my $tabcount    = $tablevel;
965         # Get certain values from the hash.
967         my $style       = $options->{'Style'};
968         my $value       = $options->{'Value'};
969         my $selected    = $options->{'Selected'};
971         # Check if certain values are undefined and if they
972         # are then set them blank or to a default value.
974         if (!$optionname){
975                 die("The option name given is blank.");
976         }
978         if (!$value){
979                 die("No value for the option was given.");
980         }
982         if (!$style){
983                 $style = "";
984         }
986         if (!$selected){
987                 $selected = 0;
988         }
990         # Check if certain values are valid and return
991         # an error if they aren't.
993         my $selected_validated = $selected;
995         $selected_validated =~ tr/0-9//d;
997         if ($selected_validated ne ""){
998                 die("The selection option is invalid.");
999         }
1001         while ($tabcount > 0){
1002                 $tagdata = $tagdata . "\t";
1003                 $tabcount = $tabcount - 1;
1004         }
1006         # Add an option for a select box.
1008         $tagdata = $tagdata . "<option value=\"" . $class->convert($value, "content") . "\"";
1009         
1010         if ($style ne ""){
1011                 $tagdata = $tagdata . " class=\"" . $class->convert($style, "content") . "\"";
1012         }
1014         if ($selected eq 1){
1015                 $tagdata = $tagdata . " selected";
1016         }
1017         
1018         $tagdata = $tagdata . ">" . $class->convert($optionname, "content") .  "</option>\r\n";
1020         # Append the tag data to the page data.
1022         $pagedata = $pagedata . $tagdata;
1026 sub endselectbox{
1027 #################################################################################
1028 # endselectbox: Ends a select box.                                              #
1029 #                                                                               #
1030 # Usage:                                                                        #
1031 #                                                                               #
1032 # $presmodule->endselectbox();                                                  #
1033 #################################################################################
1035         # End a select box.
1037         my $tagdata = "";
1038         $tablevel = ($tablevel - 1);
1039         my $tabcount = $tablevel;
1041         while ($tabcount > 0){
1042                 $tagdata = $tagdata . "\t";
1043                 $tabcount = $tabcount - 1;
1044         }
1046         $tagdata = $tagdata . "</select>" . "\r\n";
1048         # Append the tag data to the page data.
1050         $pagedata = $pagedata . $tagdata;
1054 sub addinputbox{
1055 #################################################################################
1056 # addinputbox: Add a input text box.                                            #
1057 #                                                                               #
1058 # Usage:                                                                        #
1059 #                                                                               #
1060 # $presmodule->addinputbox(inputboxname, options);                              #
1061 #                                                                               #
1062 # inputboxname  Specifies the name of the input text box.                       #
1063 # options       Specifies the following options (in any order).                 #
1064 #                                                                               #
1065 # Size          Specifies the size of the input text box.                       #
1066 # MaxLength     Specifies the maximum length of the input text box.             #
1067 # Style         Specifies the CSS style to use.                                 #
1068 # Value         Specifies a value for the input box.                            #
1069 # Password      Specifies the input box is a password box.                      #
1070 # ReadOnly      Specifies the input box is read only.                           #
1071 #################################################################################
1073         # Get the options recieved.
1075         my $class       = shift;
1076         my ($inputboxname, $options) = @_;
1078         my $tagdata     = "";
1079         my $tabcount    = $tablevel;
1081         # Get certain values from the hash.
1083         my $size        = $options->{'Size'};
1084         my $maxlength   = $options->{'MaxLength'};
1085         my $style       = $options->{'Style'};
1086         my $value       = $options->{'Value'};
1087         my $password    = $options->{'Password'};
1088         my $readonly    = $options->{'ReadOnly'};
1089         my $zerointeger = $options->{'ZeroInteger'};
1093         # Check if certain values are undefined and if they
1094         # are then set them blank or to a default value.
1096         if (!$inputboxname){
1097                 die("The input box name given is blank.");
1098         }
1100         if (!$size){
1101                 $size = 0;
1102         }
1104         if (!$maxlength){
1105                 $maxlength = 0;
1106         }
1108         if (!$style){
1109                 $style = "";
1110         }
1112         if (!$value){
1113                 $value = "";
1114         }
1116         if (!$zerointeger){
1117                 $zerointeger = 0;
1118         }
1120         if (!$password){
1121                 $password = 0;
1122         }
1124         if (!$readonly){
1125                 $readonly = 0;
1126         }
1127         
1128         # Check if certain values are valid and return
1129         # an error if they aren't.
1131         my $size_validated = $size;
1132         my $maxlength_validated = $maxlength;
1134         $size_validated         =~ tr/0-9//d;
1135         $maxlength_validated    =~ tr/0-9//d;
1137         if ($size_validated ne ""){
1138                 die("The size given is invalid.");
1139         }
1141         if ($maxlength_validated ne ""){
1142                 die("The maximum length given is invalid.");
1143         }
1145         while ($tabcount > 0){
1146                 $tagdata = $tagdata . "\t";
1147                 $tabcount = $tabcount - 1;
1148         }
1150         # Add an input text box.
1152         $tagdata = "<input "; 
1154         # Check if it should be a password field.
1156         if ($password eq 1){
1158                 # The field should be a password field.
1160                 $tagdata = $tagdata . "type=\"password\" ";
1162         } else {
1164                 # The field should be a text field.
1166                 $tagdata = $tagdata . "type=\"text\" ";
1168         }
1170         $tagdata = $tagdata . "name=\"" . $class->convert($inputboxname, "content") . "\"";
1171         
1172         if ($size > 0){
1173                 $tagdata = $tagdata . " size=\"" . $class->convert($size, "content") . "\"";
1174         }
1176         if ($maxlength > 0){
1177                 $tagdata = $tagdata . " maxlength=\"" . $class->convert($maxlength, "content") . "\"";
1178         }
1180         if ($style ne ""){
1181                 $tagdata = $tagdata . " class=\"" . $class->convert($style, "content") . "\"";
1182         }
1184         if ($value ne ""){
1185                 $tagdata = $tagdata . " value=\"" . $class->convert($value, "content") . "\"";
1186         }
1188         if ($value eq "" && $zerointeger eq 1){
1189                 $tagdata = $tagdata . " value=\"0\"";
1190         }
1192         if ($readonly eq 1){
1193                 $tagdata = $tagdata . " disabled";
1194         }
1196         $tagdata = $tagdata . ">" . "\r\n";
1198         # Append the tag data to the page data.
1200         $pagedata = $pagedata . $tagdata;
1204 sub addtextbox{
1205 #################################################################################
1206 # addtextbox: Add a multiple line text box.                                     #
1207 #                                                                               #
1208 # Usage:                                                                        #
1209 #                                                                               #
1210 # $presmodule->addtextbox(textboxname, options);                                #
1211 #                                                                               #
1212 # textboxname   Specifies the name of the multiple line text box.               #
1213 # options       Specifies the following options (in any order).                 #
1214 #                                                                               #
1215 # Columns       Specifies the width of the multiple line text box.              #
1216 # Rows          Specifies the height of the multiple line text box.             #
1217 # Style         Specifies the CSS style to use.                                 #
1218 # Value         Specifies a value for the multiple line text box.               #
1219 # ReadOnly      Specifies if the text box is read only.                         #
1220 #################################################################################
1222         # Get the options recieved.
1224         my $class       = shift;
1225         my ($textboxname, $options) = @_;
1227         my $tagdata     = "";
1228         my $tabcount    = $tablevel;
1230         # Get certain values from the hash.
1232         my $columns     = $options->{'Columns'};
1233         my $rows        = $options->{'Rows'};
1234         my $style       = $options->{'Style'};
1235         my $value       = $options->{'Value'};
1236         my $readonly    = $options->{'ReadOnly'};
1238         # Check if certain values are undefined and if they
1239         # are then set them blank or to a default value.
1241         if (!$textboxname){
1242                 die("The multiple line text box name is blank.");
1243         }
1244         
1245         if (!$columns){
1246                 $columns = 0;
1247         }
1249         if (!$rows){
1250                 $rows = 0;
1251         }
1253         if (!$style){
1254                 $style = "";
1255         }
1257         if (!$value){
1258                 $value = "";
1259         }
1260         
1261         if (!$readonly){
1262                 $readonly = 0;
1263         }
1265         # Check if certain values are valid and return
1266         # an error if they aren't.
1268         my $columns_validated   = $columns;
1269         my $rows_validated      = $rows;
1271         $columns_validated      =~ tr/0-9//d;
1272         $rows_validated         =~ tr/0-9//d;
1274         if ($columns_validated ne ""){
1275                 die("The columns value given is invalid.");
1276         }
1278         if ($rows_validated ne ""){
1279                 die("The rows value given is invalid.");
1280         }
1282         while ($tabcount > 0){
1283                 $tagdata = $tagdata . "\t";
1284                 $tabcount = $tabcount - 1;
1285         }
1287         # Add a multiple line text box.
1289         $tagdata = $tagdata . "<textarea name=\"" . $class->convert($textboxname, "content") . "\"";
1291         if ($columns > 0){
1292                 $tagdata = $tagdata . " cols=\"" . $class->convert($columns, "content") . "\"";
1293         }       
1295         if ($rows > 0){
1296                 $tagdata = $tagdata . " rows=\"" . $class->convert($rows, "content") . "\"";
1297         }
1299         if ($style ne ""){
1300                 $tagdata = $tagdata . " class=\"" . $class->convert($style, "content") . "\"";
1301         }       
1303         if ($readonly eq 1){
1304                 $tagdata = $tagdata . " disabled";
1305         }
1306         
1307         $tagdata = $tagdata . ">";
1308         $tagdata = $tagdata . $class->convert($value, "content");
1309         $tagdata = $tagdata . "</textarea>" . "\r\n";
1311         # Append the tag data to the page data.
1313         $pagedata = $pagedata . $tagdata;
1317 sub addsubmit{
1318 #################################################################################
1319 # addsubmit: Add a submit button.                                               #
1320 #                                                                               #
1321 # Usage:                                                                        #
1322 #                                                                               #
1323 # $pagemodule->addsubmit(submitname, options);                                  #
1324 #                                                                               #
1325 # submitname    Specifies the name (label) of the submit button.                #
1326 # options       Specifies the following options (in any order).                 #
1327 #                                                                               #
1328 # Style         Specifies the CSS style to use.                                 #
1329 #################################################################################
1331         # Get the options recieved.
1333         my $class       = shift;
1334         my ($submitname, $options) = @_;
1336         my $tagdata     = "";
1337         my $tabcount    = $tablevel;
1338         
1339         # Get certain values from the hash.
1341         my $style       = $options->{'Style'};
1343         # Check if certain values are undefined and if they
1344         # are then set them blank or to a default value.
1346         if (!$submitname){
1347                 die("The submit name is blank.");
1348         }
1350         if (!$style){
1351                 $style = "";
1352         }
1354         while ($tabcount > 0){
1355                 $tagdata = $tagdata . "\t";
1356                 $tabcount = $tabcount - 1;
1357         }
1359         # Add a submit button.
1361         $tagdata = $tagdata . "<input type=\"submit\" value=\"" . $class->convert($submitname, "content") . "\"";
1363         if ($style ne ""){
1364                 $tagdata = $tagdata . " class=\"" . $class->convert($style, "content") . "\"";
1365         }
1367         $tagdata = $tagdata . ">" . "\r\n";
1369         # Append the tag data to the page data.
1371         $pagedata = $pagedata . $tagdata;
1375 sub addreset{
1376 #################################################################################
1377 # addreset: Add a reset button.                                                 #
1378 #                                                                               #
1379 # Usage:                                                                        #
1380 #                                                                               #
1381 # $pagemodule->addreset(resetname, options);                                    #
1382 #                                                                               #
1383 # resetname     Specifies the name (label) of the reset button.                 #
1384 # options       Specifies the following options (in any order).                 #
1385 #                                                                               #
1386 # Style         Specifies the CSS style to use.                                 #
1387 #################################################################################
1389         # Get the options recieved.
1391         my $class       = shift;
1392         my ($resetname, $options) = @_;
1394         my $tagdata     = "";
1395         my $tabcount    = $tablevel;
1396         
1397         # Get certain values from the hash.
1399         my $style       = $options->{'Style'};
1401         # Check if certain values are undefined and if they
1402         # are then set them blank or to a default value.
1404         if (!$resetname){
1405                 die("The reset name is blank.");
1406         }
1408         if (!$style){
1409                 $style = "";
1410         }
1412         while ($tabcount > 0){
1413                 $tagdata = $tagdata . "\t";
1414                 $tabcount = $tabcount - 1;
1415         }
1417         # Add a reset button.
1419         $tagdata = $tagdata . "<input type=\"reset\" value=\"" . $class->convert($resetname, "content") . "\"";
1421         if ($style ne ""){
1422                 $tagdata = $tagdata . " class=\"" . $class->convert($style, "content") . "\"";
1423         }
1425         $tagdata = $tagdata . ">" . "\r\n";
1427         # Append the tag data to the page data.
1429         $pagedata = $pagedata . $tagdata;
1433 sub addhiddendata{
1434 #################################################################################
1435 # addhiddendata: Adds hidden data to the form.                                  #
1436 #                                                                               #
1437 # Usage:                                                                        #
1438 #                                                                               #
1439 # $presmodule->addhiddendata(name, value);                                      #
1440 #                                                                               #
1441 # name          Specifies the name of the hidden data.                          #
1442 # value         Specifies the value of the hidden data.                         #
1443 #################################################################################
1445         # Get the name and value.
1447         my $class       = shift;
1448         my ($name, $value) = @_;
1450         my $tagdata     = "";
1451         my $tabcount    = $tablevel;
1453         # Check if certain values are undefined and if they
1454         # are then set them blank or to a default value.
1456         if (!$name){
1457                 die("The name for the hidden data is blank.");
1458         }
1460         if (!$value){
1461                 $value = "";
1462         }
1464         while ($tabcount > 0){
1465                 $tagdata = $tagdata . "\t";
1466                 $tabcount = $tabcount - 1;
1467         }
1469         # Add hidden data.
1471         $tagdata = $tagdata . "<input type=\"hidden\" name=\"" . $class->convert($name, "content") . "\"";
1473         if ($value ne ""){
1474                 $tagdata = $tagdata . " value=\"" . $class->convert($value, "content") . "\"";
1475         }
1477         $tagdata = $tagdata . ">" . "\r\n";
1479         # Add the tag data to the page data.
1481         $pagedata = $pagedata . $tagdata;
1485 sub addbutton{
1486 #################################################################################
1487 # addbutton: Add a button.                                                      #
1488 #                                                                               #
1489 # Usage:                                                                        #
1490 #                                                                               #
1491 # $presmodule->addbutton(buttonname, options);                                  #
1492 #                                                                               #
1493 # buttonname    Specifies the name of button.                                   #
1494 # options       Specifies the following options below (in any order).           #
1495 #                                                                               #
1496 # Value         Specifies the value of the button.                              #
1497 # Description   Specifies the description (label) of the button.                #
1498 # Style         Specifies the CSS style to use.                                 #
1499 #################################################################################
1501         # Get the options recieved.
1503         my $class       = shift;
1504         my ($buttonname, $options) = @_;
1506         my $tagdata     = "";
1507         my $tabcount    = $tablevel;
1509         # Get certain values from the hash.
1511         my $value       = $options->{'Value'};
1512         my $description = $options->{'Description'};
1513         my $style       = $options->{'Style'};
1515         # Check if certain values are undefined and if they
1516         # are then set them blank or to a default value.
1518         if (!$buttonname){
1519                 die("The name for button is blank.");
1520         }
1522         if (!$value){
1523                 $value = "";
1524         }
1526         if (!$description){
1527                 die("The description for the button is blank.");
1528         }
1530         if (!$style){
1531                 $style = "";
1532         }
1534         while ($tabcount > 0){
1535                 $tagdata = $tagdata . "\t";
1536                 $tabcount = $tabcount - 1;
1537         }
1539         # Add a button.
1541         $tagdata = $tagdata . "<button name=\"" . $class->convert($buttonname, "content") . "\"";       
1543         if ($value ne ""){
1544                 $tagdata = $tagdata . " value=\"" . $class->convert($value, "content") . "\"";
1545         }
1547         if ($style ne ""){
1548                 $tagdata = $tagdata . " class=\"" . $class->convert($style, "content") . "\"";
1549         }
1551         $tagdata = $tagdata . ">" . $class->convert($description, "content") . "</button>\r\n";
1553         # Add the tag data to the page data.
1555         $pagedata = $pagedata . $tagdata;
1559 sub endform{
1560 #################################################################################
1561 # endform: Ends a form.                                                         #
1562 #                                                                               #
1563 # Usage:                                                                        #
1564 #                                                                               #
1565 # $presmodule->endform();                                                       #
1566 #################################################################################
1568         # End a form.
1570         my $tagdata = "";
1571         $tablevel = ($tablevel - 1);
1572         my $tabcount = $tablevel;
1574         while ($tabcount > 0){
1575                 $tagdata = $tagdata . "\t";
1576                 $tabcount = $tabcount - 1;
1577         }
1579         $tagdata = $tagdata . "</form>" . "\r\n";
1581         # Append the tag data to the page data.
1583         $pagedata = $pagedata . $tagdata;
1587 #################################################################################
1588 # Page Link.                                                                    #
1589 #################################################################################
1591 sub addlink{
1592 #################################################################################
1593 # addlink: Adds a link.                                                         #
1594 #                                                                               #
1595 # Usage:                                                                        #
1596 #                                                                               #
1597 # $presmodule->addlink(link, options);                                          #
1598 #                                                                               #
1599 # Link          Specifies the location of the link.                             #
1600 # options       Specifies the following options below (in any order).           #
1601 #                                                                               #
1602 # Target        Specifies the target window for the link.                       #
1603 # Text          Specifies the text to use.                                      #
1604 #################################################################################
1606         # Get the options recieved.
1608         my $class       = shift;
1609         my ($link, $options) = @_;
1611         my $tagdata     = "";
1612         my $tabcount    = $tablevel;
1614         # Get certain values from the hash.
1616         my $target      = $options->{'Target'}; 
1617         my $name        = $options->{'Text'};
1618         my $embed       = $options->{'Embed'};
1620         # Check if certain values are undefined and if they
1621         # are then set them blank or to a default value.
1623         if (!$link){
1624                 die("The link specified was blank.");
1625         }
1627         if (!$target){
1628                 $target = "";
1629         }
1631         if (!$embed){
1632                 $embed = 0;
1633         }
1635         while ($tabcount > 0){
1636                 $tagdata = $tagdata . "\t";
1637                 $tabcount = $tabcount - 1;
1638         }
1640         # Add a link.
1642         $tagdata = "<a href=\"" . $class->convert($link, "link") . "\"";        
1644         if ($target ne ""){
1645                 $tagdata = $tagdata . " target=\"" . $class->convert($target, "content") . "\"";
1646         }
1648         $tagdata = $tagdata . ">" . $class->convert($name, "content")  . "</a>" . "\r\n";
1650         # Append the tag data to the page data.
1652         $pagedata = $pagedata . $tagdata;
1656 #################################################################################
1657 # Image.                                                                        #
1658 #################################################################################
1660 sub addimage{
1661 #################################################################################
1662 # addimage: Adds an image.                                                      #
1663 #                                                                               #
1664 # Usage:                                                                        #
1665 #                                                                               #
1666 # $presmodule->addimage(image, options);                                        #
1667 #                                                                               #
1668 # image         Specifies the location of the image.                            #
1669 # options       Specifies the following options below (in any order).           #
1670 #                                                                               #
1671 # Style         Specifies the CSS style to use.                                 #
1672 # Description   Specifies the description of the image.                         #
1673 # Width         Specifies the width of the image.                               #
1674 # Height        Specifies the height of the image.                              #
1675 #################################################################################
1677         # Get the options recieved.
1679         my $class       = shift;
1680         my ($image, $options) = @_;
1682         my $tagdata     = "";
1683         my $tabcount    = $tablevel;
1685         # Get certain values from the hash.
1687         my $style       = $options->{'Style'};
1688         my $width       = $options->{'Width'};
1689         my $height      = $options->{'Height'};
1691         # Check if certain values are undefined and if they
1692         # are then set them blank or to a default value.
1694         if (!$image){
1695                 die("The link to the image given is blank");
1696         }
1698         if (!$style){
1699                 $style = "";
1700         }
1702         if (!$width){
1703                 $width = int(0);
1704         }
1706         if (!$height){
1707                 $height = int(0);
1708         }
1710         # Check if certain values are valid and return
1711         # an error if they aren't.
1713         my $width_validated     = $width;
1714         my $height_validated    = $height;
1716         $width_validated        =~ tr/0-9//d;
1717         $height_validated       =~ tr/0-9//d;
1719         #if (!$width_validated){
1720         #       die("The width value given is invalid.");
1721         #}
1723         #if (!$height_validated){
1724         #       die("The height value given is invalid.");
1725         #}
1727         while ($tabcount > 0){
1728                 $tagdata = $tagdata . "\t";
1729                 $tabcount = $tabcount - 1;
1730         }
1732         # Add an image.
1734         $tagdata = $tagdata . "<img src=\"" . $class->convert($image, "content") . "\"";
1736         if ($style ne ""){
1737                 $tagdata = $tagdata . " class=\"" . $class->convert($style, "content") . "\"";
1738         }
1740         if ($width ne 0){
1741                 $tagdata = $tagdata . " width=\"" . $class->convert($width, "content") . "\"";
1742         }
1744         if ($height ne 0){
1745                 $tagdata = $tagdata . " height=\"" . $class->convert($height, "content") . "\"";
1746         }
1748         $tagdata = $tagdata . ">" . "\r\n";
1750         # Append the tag data to the page data.
1752         $pagedata = $pagedata . $tagdata;
1756 #################################################################################
1757 # Text.                                                                         #
1758 #################################################################################
1760 sub addtext{
1761 #################################################################################
1762 # addtext: Adds some text.                                                      #
1763 #                                                                               #
1764 # Usage:                                                                        #
1765 #                                                                               #
1766 # $presmodule->addtext(text, options);                                          #
1767 #                                                                               #
1768 # text          Specifies the text to add.                                      #
1769 # options       Specifies the following options below (in any order).           #
1770 #                                                                               #
1771 # Style         Specifies the CSS style to use.                                 #
1772 #################################################################################
1774         # Get the options recieved.
1776         my $class       = shift;
1777         my ($text, $options) = @_;
1779         my $tagdata     = "";
1780         my $tabcount    = $tablevel;
1782         # Get certain values from the hash.
1784         my $style       = $options->{'Style'};
1786         # Check if certain values are undefined and if they
1787         # are then set them blank or to a default value.
1789         if (!$style){
1790                 $style = "";
1791         }
1793         if (!$text){
1794                 $text = "";
1795         }
1797         # Add some text.
1799         if ($style ne ""){
1800                 $tagdata = $tagdata . "<span class=\"" . $class->convert($style, "content") . "\">" . $class->convert($text, "content") . "</span>";
1801         } else {
1802                 $tagdata = $tagdata . $class->convert($text, "content");
1803         }       
1805         # Append the tagdata to the pagedata.
1807         $pagedata = $pagedata . $tagdata;
1811 sub addboldtext{
1812 #################################################################################
1813 # addboldtext: Adds some bold text.                                             #
1814 #                                                                               #
1815 # Usage:                                                                        #
1816 #                                                                               #
1817 # $presmodule->addboldtext(text, options);                                      #
1818 #                                                                               #
1819 # text          Specifies the text to add.                                      #
1820 # options       Specifies the following options below (in any order).           #
1821 #                                                                               #
1822 # Style         Specifies the CSS style to use.                                 #
1823 #################################################################################
1825         # Get the options recieved.
1827         my $class       = shift;
1828         my ($text, $options) = @_;
1830         my $tagdata     = "";
1831         my $tabcount    = $tablevel;
1833         # Get certain values from the hash.
1835         my $style       = $options->{'Style'};
1837         # Check if certain values are undefined and if they
1838         # are then set them blank or to a default value.
1840         if (!$text){
1841                 die("The text given was blank.");
1842         }       
1844         if (!$style){
1845                 $style = "";
1846         }
1848         # Add some bold text.
1850         if ($style ne ""){
1851                 $tagdata = $tagdata . "<span class=\"" . $style . "\">" . $class->convert($text, "content") . "</span>";
1852         } else {
1853                 $tagdata = $tagdata . "<b>" . $class->convert($text, "content") . "</b>";
1854         }
1856         # Append the tagdata to the pagedata.
1858         $pagedata = $pagedata . $tagdata;
1862 sub additalictext{
1863 #################################################################################
1864 # addboldtext: Adds some italic text.                                           #
1865 #                                                                               #
1866 # Usage:                                                                        #
1867 #                                                                               #
1868 # $presmodule->additalictext(text, options);                                    #
1869 #                                                                               #
1870 # text          Specifies the text to add.                                      #
1871 # options       Specifies the following options below (in any order).           #
1872 #                                                                               #
1873 # Style         Specifies the CSS style to use.                                 #
1874 #################################################################################
1876         # Get the options recieved.
1878         my $class       = shift;
1879         my ($text, $options) = @_;
1881         my $tagdata     = "";
1882         my $tabcount    = $tablevel;
1884         # Get certain values from the hash.
1886         my $style       = $options->{'Style'};
1888         # Check if certain values are undefined and if they
1889         # are then set them blank or to a default value.
1891         if (!$text){
1892                 die("The text given was blank.");
1893         }       
1895         if (!$style){
1896                 $style = "";
1897         }
1899         # Add some italic text.
1901         if ($style ne ""){
1902                 $tagdata = $tagdata . "<span class=\"\">" . $class->convert($text, "content") . "</span>";              
1903         } else {
1904                 $tagdata = $tagdata . "<i>" . $class->convert($text, "content") . "</i>";
1905         }
1907         # Append the tagdata to the pagedata.
1909         $pagedata = $pagedata . $tagdata;
1913 sub addlinebreak{
1914 #################################################################################
1915 # addlinebreak: Adds a line break specific to the output format.                #
1916 #                                                                               #
1917 # Usage:                                                                        #
1918 #                                                                               #
1919 # $presmodule->addlinebreak();                                                  #
1920 #################################################################################
1922         # Add a line break.
1924         my $tagdata = "";
1926         $tagdata = "<br>" . "\r\n";
1928         # Append the tagdata to the pagedata.
1930         $pagedata = $pagedata . $tagdata;
1934 sub addhorizontalline{
1935 #################################################################################
1936 # addhorizontalline: Adds a horizontal line.                                    #
1937 #                                                                               #
1938 # Usage:                                                                        #
1939 #                                                                               #
1940 # $presmodule->addhorizontalline();                                             #
1941 #################################################################################
1943         # Add a horizontal line.
1945         my $tagdata = "";
1946         
1947         $tagdata = "<hr>" . "\r\n";
1949         # Append the tagdata to the pagedata.
1951         $pagedata = $pagedata . $tagdata;
1955 #################################################################################
1956 # Other.                                                                        #
1957 #################################################################################
1959 sub startlist{
1960 #################################################################################
1961 # startlist: Start a list.                                                      #
1962 #                                                                               #
1963 # Usage:                                                                        #
1964 #                                                                               #
1965 # $presmodule->startlist();                                                     #
1966 #################################################################################
1968         # Start a list.
1970         my $tagdata = "";
1971         my $tabcount = $tablevel;
1973         while ($tabcount > 0){
1974                 $tagdata = $tagdata . "\t";
1975                 $tabcount = $tabcount - 1;
1976         }
1978         $tagdata = $tagdata . "<ul>" . "\r\n";
1980         # Append the tag data to the page data.
1982         $pagedata = $pagedata . $tagdata;
1983         $tablevel++;
1987 sub additem{
1988 #################################################################################
1989 # additem: Adds an item to the list.                                            #
1990 #                                                                               #
1991 # Usage:                                                                        #
1992 #                                                                               #
1993 # $presmodule->additem(text, options);                                          #
1994 #                                                                               #
1995 # text          Specifies the text to use for the item.                         #
1996 # options       Specifies the following options (in any order).                 #
1997 #                                                                               #
1998 # Style         Specifies the CSS style to use.                                 #
1999 #################################################################################
2001          # Get the options recieved.
2003         my $class       = shift;
2004         my ($text, $options) = @_;
2006         my $tagdata     = "";
2007         my $tabcount    = $tablevel;
2009         # Get certain values from the hash.
2011         my $style       = $options->{'Style'};
2013         # Check if certain values are undefined and if they
2014         # are then set them blank or to a default value.
2016         if (!$text){
2017                 die("The text given was blank.");
2018         }
2020         if (!$style){
2021                 $style = "";
2022         }
2024         # Add an item to the list.
2026         $tagdata = $tagdata . "<li ";
2028         if ($style ne ""){
2029                 $tagdata = $tagdata . " class=\"" . $class->convert($style, "content") . "\"";
2030         }
2032         $tagdata = $tagdata . ">" . $class->convert($text, "content");
2034         # Append the tag data to the page data.
2036         $pagedata = $pagedata . $tagdata;
2040 sub endlist{
2041 #################################################################################
2042 # endlist: End a list.                                                          #
2043 #                                                                               #
2044 # Usage:                                                                        #
2045 #                                                                               #
2046 # $presmodule-endlist();                                                        #
2047 #################################################################################
2049         # End a list.
2051         my $tagdata = "";
2052         $tablevel = ($tablevel - 1);
2053         my $tabcount = $tablevel;
2055         while ($tabcount > 0){
2056                 $tagdata = $tagdata . "\t";
2057                 $tabcount = $tabcount - 1;
2058         }
2060         $tagdata = $tagdata . "</ul>" . "\r\n";
2062         # Append the tag data to the page data.
2064         $pagedata = $pagedata . $tagdata;
2068 1;
Xestia Software Development
Yn Maystri
© 2006 - 2019 Xestia Software Development
Software

Xestia Address Book
Xestia Calendar
Development

Xestia Gelforn
Everything else

About
News
Privacy Policy