Home | News | Projects | Releases
Bugs | RFE | Repositories | Help
Some additional changes that were missed.
[kiriwrite/.git] / cgi-files / Modules / Presentation / HTML4S.pm
1 #################################################################################
2 # Kiriwrite 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 Steve Brokenshire <sbrokenshire@xestia.co.uk>              #
6 #                                                                               #
7 # This module is licensed under the same license as Kiriwrite which is the GPL. #
8 #                                                                               #
9 # This program is free software; you can redistribute it and/or modify it under #
10 # the terms of the GNU General Public License as published by the Free          #
11 # Software Foundation; as version 2 of the License.                             #
12 #                                                                               #
13 # This program is distributed in the hope that it will be useful, but WITHOUT   #
14 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS #
15 # FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.#
16 #                                                                               #
17 # You should have received a copy of the GNU General Public License along with  #
18 # this program; if not, write to the Free Software Foundation, Inc., 51         #
19 # Franklin St, Fifth Floor, Boston, MA 02110-1301 USA                           #
20 #################################################################################
22 # Define the package (perl module) name.
24 package Kiriwrite::Presentation::HTML4S;
26 # Enable strict and use warnings.
28 use strict;
29 use warnings;
31 # Set the following values.
33 our $VERSION = "0.1.0";
34 my $pagedata = "";
35 my $tablevel = 0;
37 #################################################################################
38 # Generic Subroutines.                                                          #
39 #################################################################################
41 sub new{
42 #################################################################################
43 # new: Create an instance of Kiriwrite::Presentation::HTML4S                    #
44 #                                                                               #
45 # Usage:                                                                        #
46 #                                                                               #
47 # $presmodule = Modules::Output::HTML4S->new();                                 #
48 #################################################################################
49         
50         # Get the perl module name.
52         my $class = shift;
53         my $self = {};
55         return bless($self, $class);
57 }
59 sub clear{
60 #################################################################################
61 # clear: Clear the current layout created by this module.                       #
62 #                                                                               #
63 # Usage:                                                                        #
64 #                                                                               #
65 # $presmodule->clear();                                                         #
66 #################################################################################
68         $pagedata = "";
69         return;
71 }
73 sub grab{
74 #################################################################################
75 # grab: Grab the current layout created by this module.                         #
76 #                                                                               #
77 # Usage:                                                                        #
78 #                                                                               #
79 # $presmodule->grab();                                                          #
80 #################################################################################
82         return $pagedata;
84 }
86 sub convert{
87 #################################################################################
88 # convert: Converts the data passed into data that is compliant with the output #
89 # format.                                                                       #
90 #                                                                               #
91 # Usage:                                                                        #
92 #                                                                               #
93 # $presmodule->convert(data, type);                                             #
94 #                                                                               #
95 # data          Specifies the data to be converted.                             #
96 # type          Specifies the type the data should be converted to.             #
97 #################################################################################
99         # Get the data and type passed.
101         my $class = shift;
102         my ($data, $type) = @_;
104         # Check if certain values are undefined and if they are
105         # then set them blank or return an error.
107         if (!$data){
108                 $data = "";
109         }
111         if (!$type){
112                 die("No type was specified");
113         }
115         # Check what type is being used and process the data
116         # according the type being used.
118         if ($type eq "content"){
120                 $data =~ s/&/&amp;/g;
121                 $data =~ s/#/&#35;/g;
122                 $data =~ s/\"/&#34;/g;
123                 $data =~ s/'/'/g;
124                 $data =~ s/>/&gt;/g;
125                 $data =~ s/</&lt;/g;
126                 $data =~ s/\+/&#43;/g;
127                 $data =~ s/-/&#45;/g;
128                 $data =~ s/_/&#95;/g;
129                 $data =~ s/\@/&#64;/g;
130                 $data =~ s/~/&#126;/g;
131                 $data =~ s/\?/&#63;/g;
132                 $data =~ s/'/&#39;/g;
133                 $data =~ s/\0//g;
134                 $data =~ s/\b//g;
136         } elsif ($type eq "link"){
138                 $data =~ s/&/&amp;/g;
139                 $data =~ s/\+/\%2B/g;
140                 $data =~ s/\?/\%3F/g;
141                 $data =~ s/%3F/\?/;
142                 $data =~ s/-/\%2D/g;
143                 $data =~ s/_/\%5F/g;
144                 $data =~ s/\@/\%40/g;
145                 $data =~ s/#/\%23/g;
146                 $data =~ s/>/\%3E/g;
147                 $data =~ s/</\%3C/g;
148                 $data =~ s/~/\%7E/g;
149                 $data =~ s/'/\%27/;
150                 $data =~ s/!/\%21/g;
152         } else {
154                 die("An invalid type was specified.");
156         }
158         return $data;
162 #################################################################################
163 # Tags for creating tables.                                                     #
164 #################################################################################
166 sub starttable{
167 #################################################################################
168 # starttable: Start a table.                                                    #
169 #                                                                               #
170 # Usage:                                                                        #
171 #                                                                               #
172 # $presmodule->starttable(cssstyle, {options});                                 #
173 #                                                                               #
174 # cssstyle      Specifies the CSS style name to use.                            #
175 # options       Specifies the following options (in any order):                 #
176 #                                                                               #
177 # CellPadding   The cell padding to be used for each table.                     #
178 # CellSpacing   The cell spacing to be used for each table.                     #
179 #################################################################################
181         # Get the CSS style and options.
183         my $class = shift;
184         my ($cssstyle, $options) = @_;
186         my $tagdata = "";
187         my $tabcount = $tablevel;
189         my $cellpadding = $options->{'CellPadding'};
190         my $cellspacing = $options->{'CellSpacing'};
192         # Check if the cell padding and cell spacing and 
193         # CSS style values are blank and if they are then 
194         # set them blank.
196         if (!$cellpadding){
197                 $cellpadding = 0;
198         }
200         if (!$cellspacing){
201                 $cellspacing = 0;
202         }
204         if (!$cssstyle){
205                 $cssstyle = "";
206         }
208         # Check if the cell padding and cell spacing values
209         # are valid and die if it isn't.
211         my $cellpadding_validated = $cellpadding;
212         my $cellspacing_validated = $cellspacing;
214         $cellpadding_validated =~ tr/0-9//d;
215         $cellspacing_validated =~ tr/0-9//d;
217         if ($cellpadding_validated ne ""){
218                 die("Cell padding value given is invalid.");
219         }
221         if ($cellspacing_validated ne ""){
222                 die("Cell spacing value given is invalid.");
223         }
225         while ($tabcount > 0){
226                 $tagdata = $tagdata . "\t";
227                 $tabcount = $tabcount - 1;
228         }
230         # Start a table.
232         $tagdata = $tagdata . "<table";
234         # Check if the cell spacing and cell padding has values
235         # more than 0.
237         if ($cellspacing >= 0){
238                 $tagdata = $tagdata . " cellspacing=\"" . $cellspacing . "\"";
239         }
241         if ($cellpadding > 0){
242                 $tagdata = $tagdata . " cellpadding=\"" . $cellpadding . "\"";
243         }
245         if ($cssstyle ne ""){
246                 $tagdata = $tagdata . " class=\"" . $class->convert($cssstyle, "content") . "\"";
247         }
249         $tagdata = $tagdata . ">" . "\r\n";
251         # Append the tag data to the page data.
253         $pagedata = $pagedata . $tagdata;
254         $tablevel++;
258 sub startheader{
259 #################################################################################
260 # startheader: Start a table header.                                            #
261 #                                                                               #
262 # Usage:                                                                        #
263 #                                                                               #
264 # $presmodule->startheader();                                                   #
265 #################################################################################
267         # Start a table header row.
269         my $tagdata = "";
270         my $tabcount = $tablevel;
272         while ($tabcount > 0){
273                 $tagdata = $tagdata . "\t";
274                 $tabcount = $tabcount - 1;
275         }
277         $tagdata = $tagdata . "<tr>" . "\r\n";
279         # Append the tag data to the page data.
281         $pagedata = $pagedata . $tagdata;
282         $tablevel++;
286 sub addheader{
287 #################################################################################
288 # addheader: Add a table header.                                                #
289 #                                                                               #
290 # Usage:                                                                        #
291 #                                                                               #
292 # $presmodule->addheader(headername, {options});                                #
293 #                                                                               #
294 # headername    Specifies the name of the table header to use.                  #
295 # options       Specifies the following options below (in any order):           #
296 #                                                                               #
297 # Style         Specifies the CSS Style to use for the table header.            #
298 #################################################################################
300         # Get the header name and options.
302         my $class       = shift;
303         my ($headername, $options)      = @_;
305         my $cssstyle    = $options->{'Style'};
307         # Check if the CSS Style or header name is undefined and
308         # if they are then set them blank.
310         if (!$headername){
311                 $headername = "";
312         }
314         if (!$cssstyle){
315                 $cssstyle = "";
316         }
318         my $tagdata = "";
319         my $tabcount = $tablevel;
321         while ($tabcount > 0){
322                 $tagdata = $tagdata . "\t";
323                 $tabcount = $tabcount - 1;
324         }
326         $tagdata = $tagdata . "<th";
327         
328         if ($cssstyle ne ""){
329                 $tagdata = $tagdata . " class=\"" . $class->convert($cssstyle, "content") . "\"";
330         }
332         $tagdata = $tagdata . ">" . $class->convert($headername, "content") . "</th>" . "\r\n";
334         # Append the tag data to the page data.
336         $pagedata = $pagedata . $tagdata;
340 sub endheader{
341 #################################################################################
342 # endheader: End a table header row                                             #
343 #                                                                               #
344 # Usage:                                                                        #
345 #                                                                               #
346 # $presmodule->endheader();                                                     #
347 #################################################################################
349         # End a table header row.
351         my $tagdata = "";
352         $tablevel = ($tablevel - 1);
353         my $tabcount = $tablevel;
355         while ($tabcount > 0){
356                 $tagdata = $tagdata . "\t";
357                 $tabcount = $tabcount - 1;
358         }
360         $tagdata = $tagdata . "</tr>" . "\r\n";
362         # Append the tag data to the page data.
364         $pagedata = $pagedata . $tagdata;
368 sub startrow{
369 #################################################################################
370 # startrow: Start a table row.                                                  #
371 #                                                                               #
372 # Usage:                                                                        #
373 #                                                                               #
374 # $presmodule->startrow();                                                      #
375 #################################################################################
377         # Start a table row.
379         my $tagdata = "";
380         my $tabcount = $tablevel;
382         while ($tabcount > 0){
383                 $tagdata = $tagdata . "\t";
384                 $tabcount = $tabcount - 1;
385         }
387         $tagdata = $tagdata . "<tr>" . "\r\n";
389         # Append the tag data to the page data.
391         $pagedata = $pagedata . $tagdata;
392         $tablevel++;
396 sub addcell{
397 #################################################################################
398 # addcell: Add a table cell.                                                    #
399 #                                                                               #
400 # Usage:                                                                        #
401 #                                                                               #
402 # $presmodule->addcell(style);                                                  #
403 #                                                                               #
404 # style         Specifies which CSS Style to use.                               #
405 #################################################################################
407         # Get the cell information and options.
409         my $class       = shift;
410         my ($cssstyle)  = @_;
411         my $tabcount    = $tablevel;
412         my $tagdata     = "";
414         # Check if the cell data and CSS style are undefined
415         # and if they are then set them blank.
417         if (!$cssstyle){
418                 $cssstyle = "";
419         }
421         while ($tabcount > 0){
422                 $tagdata = $tagdata . "\t";
423                 $tabcount = $tabcount - 1;
424         }
426         $tagdata = $tagdata . "<td";
428         if ($cssstyle ne ""){
429                 $tagdata = $tagdata . " class=\"" . $class->convert($cssstyle, "content") . "\"";
430         }
432         $tagdata = $tagdata . ">";
434         # Append the tag data to the page data.
436         $pagedata = $pagedata . $tagdata;
440 sub endcell{
441 #################################################################################
442 # endcell: End a table cell.                                                    #
443 #                                                                               #
444 # Usage:                                                                        #
445 #                                                                               #
446 # $presmodule->endcell();                                                       #
447 ################################################################################# 
449         # End a table cell.
451         my $tagdata = "";
453         $tagdata = $tagdata . "</td>" . "\r\n";
455         # Append the tag data to the page data.
457         $pagedata = $pagedata . $tagdata;
461 sub endrow{
462 #################################################################################
463 # endrow: Ends a table row.                                                     #
464 #                                                                               #
465 # Usage:                                                                        #
466 #                                                                               #
467 # $presmodule->endrow();                                                        #
468 #################################################################################
470         # End a table row.
472         my $tagdata = "";
473         $tablevel = ($tablevel - 1);
474         my $tabcount = $tablevel;
476         while ($tabcount > 0){
477                 $tagdata = $tagdata . "\t";
478                 $tabcount = $tabcount - 1;
479         }
481         $tagdata = $tagdata . "</tr>" . "\r\n";
483         # Append the tag data to the page data.
485         $pagedata = $pagedata . $tagdata;
489 sub endtable{
490 #################################################################################
491 # endtable: Ends a table.                                                       #
492 #                                                                               #
493 # Usage:                                                                        #
494 #                                                                               #
495 # $presmodule->endtable();                                                      #
496 #################################################################################
498         # End a table.
500         my $tagdata = "";
501         $tablevel = ($tablevel - 1);
502         my $tabcount = $tablevel;
504         while ($tabcount > 0){
505                 $tagdata = $tagdata . "\t";
506                 $tabcount = $tabcount - 1;
507         }
509         $tagdata = $tagdata . "</table>" . "\r\n";
511         # Append the tag data to the page data.
513         $pagedata = $pagedata . $tagdata;
517 #################################################################################
518 # Information box.                                                              #
519 #################################################################################
521 sub startbox{
522 #################################################################################
523 # startbox: Start an information box.                                           #
524 #                                                                               #
525 # Usage:                                                                        #
526 #                                                                               #
527 # $presmodule->startbox(cssstyle);                                              #
528 #                                                                               #
529 # cssstyle      Specifies the CSS Style to use.                                 #
530 #################################################################################
532         # Get the CSS Style name.
534         my $class       = shift;
535         my $cssstyle    = shift;
537         # Check if the CSS style given is undefined and
538         # if it is then set it blank.
540         if (!$cssstyle){
541                 $cssstyle = "";
542         }
544         my $tagdata = "";
545         my $tabcount = $tablevel;
547         while ($tabcount > 0){
548                 $tagdata = $tagdata . "\t";
549                 $tabcount = $tabcount - 1;
550         }
552         # Start an information box.
554         $tagdata = $tagdata . "<div";
555         
556         if ($cssstyle ne ""){
557                 $tagdata = $tagdata . " class=\"" . $class->convert($cssstyle, "content") . "\"";
558         }
560         $tagdata = $tagdata . ">";
562         # Append the tag data to the page data.
564         $pagedata = $pagedata . $tagdata;
568 sub enterdata{
569 #################################################################################
570 # enterdata: Enter data into a information box.                                 #
571 #                                                                               #
572 # Usage:                                                                        #
573 #                                                                               #
574 # $presmodule->enterdata(data);                                                 #
575 #                                                                               #
576 # data          Specifies what data should be entered into the information box. #
577 #################################################################################
579         # Get the data for the information box.
581         my $class       = shift;
582         my $data        = shift;
584         # Append the data to the page data.
586         $pagedata = $pagedata . $class->convert($data, "content");
590 sub endbox{
591 #################################################################################
592 # endbox: End an information box.                                               #
593 #                                                                               #
594 # Usage:                                                                        #
595 #                                                                               #
596 # $presmodule->endbox();                                                        #
597 #################################################################################
599         # End an information box.
601         my $tagdata = "";
602         $tagdata = $tagdata . "</div>" . "\r\n";
604         # Append the tag data to the page data.
606         $pagedata = $pagedata . $tagdata;
610 #################################################################################
611 # Form boxes.                                                                   #
612 #################################################################################
614 sub startform{
615 #################################################################################
616 # startform: Start a form.                                                      #
617 #                                                                               #
618 # Usage:                                                                        #
619 #                                                                               #
620 # $presmodule->startform(action, method);                                       #
621 #                                                                               #
622 # action        Specifies the action (address) the data should be sent to.      #
623 # method        Specifies the method to use (POST, GET)                         #
624 #################################################################################
626         my $class       = shift;
627         my $action      = shift;
628         my $method      = shift;
630         my $tagdata     = "";
631         my $tabcount    = $tablevel;
633         # Check if the action and method values given
634         # are undefined and if they are set default
635         # values.
637         if (!$action){
638                 $action = "";
639         }
641         if (!$method){
642                 # The method is blank so set it to POST.
643                 $method = "POST";
644         }
646         while ($tabcount > 0){
647                 $tagdata = $tagdata . "\t";
648                 $tabcount = $tabcount - 1;
649         }
651         $tagdata = $tagdata . "<form action=\"" . $class->convert($action, "content") . "\" method=\"" . $class->convert($method, "content") . "\">" . "\r\n";
653         # Append the tag data to the page data.
655         $pagedata = $pagedata . $tagdata;
656         $tablevel++;
660 sub addcheckbox{
661 #################################################################################
662 # addcheckbox: Add a check box.                                                 #
663 #                                                                               #
664 # Usage:                                                                        #
665 #                                                                               #
666 # $presmodule->addcheckbox(checkboxname, {options});                            #
667 #                                                                               #
668 # checkboxname  Specifies the check box name.                                   #
669 # options       Specifies the following options below (in any order).           #
670 #                                                                               #
671 # OptionDescription     Specifies a description for the checkbox value.         #
672 # Style                 Specifies the CSS style to use.                         #
673 # Checked               Specifies if the checkbox is checked.                   #
674 # LineBreak             Specifies if a line break should be added.              #
675 #################################################################################
677         # Get the options recieved.
679         my $class       = shift;
680         my ($checkboxname, $options) = @_;
682         my $tagdata     = "";
683         my $tabcount    = $tablevel;
685         # Get certain values from the hash.
687         my $optiondescription   = $options->{'OptionDescription'};
688         my $style               = $options->{'Style'};
689         my $checked             = $options->{'Checked'};
690         my $linebreak           = $options->{'LineBreak'};
692         # Check if certain values are undefined and if they
693         # are then set them blank or to a default value.
695         if (!$checkboxname){
696                 die("The checkbox name is blank.");
697         }
699         if (!$optiondescription){
700                 $optiondescription = "";
701         }
703         if (!$style){
704                 $style = "";
705         }
707         if (!$checked){
708                 $checked = 0;
709         }
711         if (!$linebreak){
712                 $linebreak = 0;
713         }
715         while ($tabcount > 0){
716                 $tagdata = $tagdata . "\t";
717                 $tabcount = $tabcount - 1;
718         }
720         # Add a check box.
722         $tagdata = $tagdata . "<input type=\"checkbox\" name=\"" . $class->convert($checkboxname, "content") . "\"";
724         if ($style ne ""){
725                 $tagdata = $tagdata . " class=\"" . $class->convert($style, "content") . "\"";
726         }
728         if ($checked eq 1){
729                 $tagdata = $tagdata . " checked";
730         }
732         $tagdata = $tagdata . ">";
734         if ($optiondescription ne ""){
735                 $tagdata = $tagdata . "&nbsp;" . $class->convert($optiondescription, "content");
736         }
738         if ($linebreak eq 1){
739                 $tagdata = $tagdata . "<br>";
740         }
742         $tagdata = $tagdata . "\r\n";
744         # Append the tag data to the page data.
746         $pagedata = $pagedata . $tagdata;
750 sub addradiobox{
751 #################################################################################
752 # addradiobox: Add a radio box.                                                 #
753 #                                                                               #
754 # Usage:                                                                        #
755 #                                                                               #
756 # $presmodule->addradiobox(radioboxname, {options});                            #
757 #                                                                               #
758 # radioboxname  The name of the radio box.                                      #
759 # options       Specifies the following options below (in any order).           #
760 #                                                                               #
761 # Description           Specifies a description for the checkbox value.         #
762 # Style                 Specifies the CSS style to use.                         #
763 # Selected              Specifies if the radio box is selected.                 #
764 # LineBreak             Specifies if a line break should be used.               #
765 # Value                 Specifies the value of the radio box.                   #
766 #################################################################################
768         # Get the options recieved.
770         my $class       = shift;
771         my ($radioboxname, $options) = @_;
773         my $tagdata     = "";
774         my $tabcount    = $tablevel;
776         # Get certain values from the hash.
778         my $optiondescription   = $options->{'Description'};
779         my $style               = $options->{'Style'};
780         my $selected            = $options->{'Selected'};
781         my $linebreak           = $options->{'LineBreak'};
782         my $value               = $options->{'Value'};
784         # Check if certain values are undefined and if they
785         # are then set them blank or to a default value.        
787         if (!$radioboxname){
788                 die("The radio box name is blank.");
789         }
791         if (!$value){
792                 $value = "";
793         }
795         if (!$optiondescription){
796                 $optiondescription = "";
797         }
799         if (!$style){
800                 $style = "";
801         }
803         if (!$selected){
804                 $selected = 0;
805         }
807         if (!$linebreak){
808                 $linebreak = 0;
809         }
811         while ($tabcount > 0){
812                 $tagdata = $tagdata . "\t";
813                 $tabcount = $tabcount - 1;
814         }
816         # Add a radio box.
818         $tagdata = $tagdata . "<input type=\"radio\" name=\"" . $class->convert($radioboxname, "content") . "\"";
820         if ($style ne ""){
821                 $tagdata = $tagdata . " class=\"" . $class->convert($style, "content") . "\"";
822         }
824         if ($selected eq 1){
825                 $tagdata = $tagdata . " checked";
826         }
828         if ($value ne ""){
829                 $tagdata = $tagdata . " value=\"" . $class->convert($value, "content") . "\"";
830         } else {
831                 $tagdata = $tagdata . " value=\"0\"";
832         }
834         $tagdata = $tagdata . ">";
836         if ($optiondescription ne ""){
837                 $tagdata = $tagdata . "&nbsp;" . $class->convert($optiondescription, "content");
838         }
840         if ($linebreak eq 1){
841                 $tagdata = $tagdata . "<br>";
842         }
844         $tagdata = $tagdata . "\r\n";
846         # Append the tag data to the page data.
848         $pagedata = $pagedata . $tagdata;
851 sub addselectbox{
852 #################################################################################
853 # addselectbox: Add a select box.                                               #
854 #                                                                               #
855 # Usage:                                                                        #
856 #                                                                               #
857 # $presmodule->addselectbox(selectname, {options});                             #
858 #                                                                               #
859 # selectboxname Specifies the name of the select box.                           #
860 # options       Specifies the following options (in any order).                 #
861 #                                                                               #
862 # Style         Specifies the CSS style to use.                                 #
863 #################################################################################
865         # Get the options recieved.
867         my $class       = shift;
868         my ($selectboxname, $options) = @_;
870         my $tagdata     = "";
871         my $tabcount    = $tablevel;
873         # Get certain values from the hash.
875         my $style       = $options->{'Style'};
877         # Check if certain values are undefined and if they
878         # are then set them blank or to a default value.
880         if (!$selectboxname){
881                 die("The select box name is blank.")
882         }
884         if (!$style){
885                 $style = "";
886         }
888         while ($tabcount > 0){
889                 $tagdata = $tagdata . "\t";
890                 $tabcount = $tabcount - 1;
891         }
893         # Add a select box.
895         $tagdata = $tagdata . "<select name=\"" . $class->convert($selectboxname, "content") . "\"";
897         if ($style ne ""){
898                 $tagdata = $tagdata = " class=\"" . $class->convert($style, "content") . "\"";
899         }
901         $tagdata = $tagdata . ">";
903         # Append the tag data to the page data.
905         $pagedata = $pagedata . $tagdata;
906         $tablevel++;
910 sub addoption{
911 #################################################################################
912 # addoption: Add an option for a select box.                                    #
913 #                                                                               #
914 # Usage:                                                                        #
915 #                                                                               #
916 # $presmodule->addoption(optionname, options);                                  #
917 #                                                                               #
918 # optionname    Specifies the name (description) of the option.                 #
919 # options       Specifies the following options (in any order).                 #
920 #                                                                               #
921 # Style         Specifies the CSS style to be used.                             #
922 # Value         Specifies the value of the option.                              #
923 # Selected      This option is selected as default when the page is displayed.  #
924 #################################################################################
926         # Get the options recieved.
928         my $class       = shift;
929         my ($optionname, $options) = @_;
931         my $tagdata     = "";
932         my $tabcount    = $tablevel;
934         # Get certain values from the hash.
936         my $style       = $options->{'Style'};
937         my $value       = $options->{'Value'};
938         my $selected    = $options->{'Selected'};
940         # Check if certain values are undefined and if they
941         # are then set them blank or to a default value.
943         if (!$optionname){
944                 die("The option name given is blank.");
945         }
947         if (!$value){
948                 die("No value for the option was given.");
949         }
951         if (!$style){
952                 $style = "";
953         }
955         if (!$selected){
956                 $selected = 0;
957         }
959         # Check if certain values are valid and return
960         # an error if they aren't.
962         my $selected_validated = $selected;
964         $selected_validated =~ tr/0-9//d;
966         if ($selected_validated ne ""){
967                 die("The selection option is invalid.");
968         }
970         while ($tabcount > 0){
971                 $tagdata = $tagdata . "\t";
972                 $tabcount = $tabcount - 1;
973         }
975         # Add an option for a select box.
977         $tagdata = $tagdata . "<option value=\"" . $class->convert($value, "content") . "\"";
978         
979         if ($style ne ""){
980                 $tagdata = $tagdata . " class=\"" . $class->convert($style, "content") . "\"";
981         }
983         if ($selected eq 1){
984                 $tagdata = $tagdata . " selected";
985         }
986         
987         $tagdata = $tagdata . ">" . $class->convert($optionname, "content") .  "</option>\r\n";
989         # Append the tag data to the page data.
991         $pagedata = $pagedata . $tagdata;
995 sub endselectbox{
996 #################################################################################
997 # endselectbox: Ends a select box.                                              #
998 #                                                                               #
999 # Usage:                                                                        #
1000 #                                                                               #
1001 # $presmodule->endselectbox();                                                  #
1002 #################################################################################
1004         # End a select box.
1006         my $tagdata = "";
1007         $tablevel = ($tablevel - 1);
1008         my $tabcount = $tablevel;
1010         while ($tabcount > 0){
1011                 $tagdata = $tagdata . "\t";
1012                 $tabcount = $tabcount - 1;
1013         }
1015         $tagdata = $tagdata . "</select>" . "\r\n";
1017         # Append the tag data to the page data.
1019         $pagedata = $pagedata . $tagdata;
1023 sub addinputbox{
1024 #################################################################################
1025 # addinputbox: Add a input text box.                                            #
1026 #                                                                               #
1027 # Usage:                                                                        #
1028 #                                                                               #
1029 # $presmodule->addinputbox(inputboxname, options);                              #
1030 #                                                                               #
1031 # inputboxname  Specifies the name of the input text box.                       #
1032 # options       Specifies the following options (in any order).                 #
1033 #                                                                               #
1034 # Size          Specifies the size of the input text box.                       #
1035 # MaxLength     Specifies the maximum length of the input text box.             #
1036 # Style         Specifies the CSS style to use.                                 #
1037 # Value         Specifies a value for the input box.                            #
1038 #################################################################################
1040         # Get the options recieved.
1042         my $class       = shift;
1043         my ($inputboxname, $options) = @_;
1045         my $tagdata     = "";
1046         my $tabcount    = $tablevel;
1048         # Get certain values from the hash.
1050         my $size        = $options->{'Size'};
1051         my $maxlength   = $options->{'MaxLength'};
1052         my $style       = $options->{'Style'};
1053         my $value       = $options->{'Value'};
1054         my $password    = $options->{'Password'};
1056         # Check if certain values are undefined and if they
1057         # are then set them blank or to a default value.
1059         if (!$inputboxname){
1060                 die("The input box name given is blank.");
1061         }
1063         if (!$size){
1064                 $size = 0;
1065         }
1067         if (!$maxlength){
1068                 $maxlength = 0;
1069         }
1071         if (!$style){
1072                 $style = "";
1073         }
1075         if (!$value){
1076                 $value = "";
1077         }
1079         if (!$password){
1080                 $password = 0;
1081         }
1083         # Check if certain values are valid and return
1084         # an error if they aren't.
1086         my $size_validated = $size;
1087         my $maxlength_validated = $maxlength;
1089         $size_validated         =~ tr/0-9//d;
1090         $maxlength_validated    =~ tr/0-9//d;
1092         if ($size_validated ne ""){
1093                 die("The size given is invalid.");
1094         }
1096         if ($maxlength_validated ne ""){
1097                 die("The maximum length given is invalid.");
1098         }
1100         while ($tabcount > 0){
1101                 $tagdata = $tagdata . "\t";
1102                 $tabcount = $tabcount - 1;
1103         }
1105         # Add an input text box.
1107         $tagdata = "<input "; 
1109         # Check if it should be a password field.
1111         if ($password eq 1){
1113                 # The field should be a password field.
1115                 $tagdata = $tagdata . "type=\"password\" ";
1117         } else {
1119                 # The field should be a text field.
1121                 $tagdata = $tagdata . "type=\"text\" ";
1123         }
1125         $tagdata = $tagdata . "name=\"" . $class->convert($inputboxname, "content") . "\"";
1126         
1127         if ($size > 0){
1128                 $tagdata = $tagdata . " size=\"" . $class->convert($size, "content") . "\"";
1129         }
1131         if ($maxlength > 0){
1132                 $tagdata = $tagdata . " maxlength=\"" . $class->convert($maxlength, "content") . "\"";
1133         }
1135         if ($style ne ""){
1136                 $tagdata = $tagdata . " class=\"" . $class->convert($style, "content") . "\"";
1137         }
1139         if ($value ne ""){
1140                 $tagdata = $tagdata . " value=\"" . $class->convert($value, "content") . "\"";
1141         }
1143         $tagdata = $tagdata . ">" . "\r\n";
1145         # Append the tag data to the page data.
1147         $pagedata = $pagedata . $tagdata;
1151 sub addtextbox{
1152 #################################################################################
1153 # addtextbox: Add a multiple line text box.                                     #
1154 #                                                                               #
1155 # Usage:                                                                        #
1156 #                                                                               #
1157 # $presmodule->addtextbox(textboxname, options);                                #
1158 #                                                                               #
1159 # textboxname   Specifies the name of the multiple line text box.               #
1160 # options       Specifies the following options (in any order).                 #
1161 #                                                                               #
1162 # Columns       Specifies the width of the multiple line text box.              #
1163 # Rows          Specifies the height of the multiple line text box.             #
1164 # Style         Specifies the CSS style to use.                                 #
1165 # Value         Specifies a value for the multiple line text box.               #
1166 #################################################################################
1168         # Get the options recieved.
1170         my $class       = shift;
1171         my ($textboxname, $options) = @_;
1173         my $tagdata     = "";
1174         my $tabcount    = $tablevel;
1176         # Get certain values from the hash.
1178         my $columns     = $options->{'Columns'};
1179         my $rows        = $options->{'Rows'};
1180         my $style       = $options->{'Style'};
1181         my $value       = $options->{'Value'};
1183         # Check if certain values are undefined and if they
1184         # are then set them blank or to a default value.
1186         if (!$textboxname){
1187                 die("The multiple line text box name is blank.");
1188         }
1189         
1190         if (!$columns){
1191                 $columns = 0;
1192         }
1194         if (!$rows){
1195                 $rows = 0;
1196         }
1198         if (!$style){
1199                 $style = "";
1200         }
1202         if (!$value){
1203                 $value = "";
1204         }
1206         # Check if certain values are valid and return
1207         # an error if they aren't.
1209         my $columns_validated   = $columns;
1210         my $rows_validated      = $rows;
1212         $columns_validated      =~ tr/0-9//d;
1213         $rows_validated         =~ tr/0-9//d;
1215         if ($columns_validated ne ""){
1216                 die("The columns value given is invalid.");
1217         }
1219         if ($rows_validated ne ""){
1220                 die("The rows value given is invalid.");
1221         }
1223         while ($tabcount > 0){
1224                 $tagdata = $tagdata . "\t";
1225                 $tabcount = $tabcount - 1;
1226         }
1228         # Add a multiple line text box.
1230         $tagdata = $tagdata . "<textarea name=\"" . $class->convert($textboxname, "content") . "\"";
1232         if ($columns > 0){
1233                 $tagdata = $tagdata . " cols=\"" . $class->convert($columns, "content") . "\"";
1234         }       
1236         if ($rows > 0){
1237                 $tagdata = $tagdata . " rows=\"" . $class->convert($rows, "content") . "\"";
1238         }
1240         if ($style ne ""){
1241                 $tagdata = $tagdata . " class=\"" . $class->convert($style, "content") . "\"";
1242         }       
1244         $tagdata = $tagdata . ">";
1245         $tagdata = $tagdata . $value;
1246         $tagdata = $tagdata . "</textarea>" . "\r\n";
1248         # Append the tag data to the page data.
1250         $pagedata = $pagedata . $tagdata;
1254 sub addsubmit{
1255 #################################################################################
1256 # addsubmit: Add a submit button.                                               #
1257 #                                                                               #
1258 # Usage:                                                                        #
1259 #                                                                               #
1260 # $pagemodule->addsubmit(submitname, options);                                  #
1261 #                                                                               #
1262 # submitname    Specifies the name (label) of the submit button.                #
1263 # options       Specifies the following options (in any order).                 #
1264 #                                                                               #
1265 # Style         Specifies the CSS style to use.                                 #
1266 #################################################################################
1268         # Get the options recieved.
1270         my $class       = shift;
1271         my ($submitname, $options) = @_;
1273         my $tagdata     = "";
1274         my $tabcount    = $tablevel;
1275         
1276         # Get certain values from the hash.
1278         my $style       = $options->{'Style'};
1280         # Check if certain values are undefined and if they
1281         # are then set them blank or to a default value.
1283         if (!$submitname){
1284                 die("The submit name is blank.");
1285         }
1287         if (!$style){
1288                 $style = "";
1289         }
1291         while ($tabcount > 0){
1292                 $tagdata = $tagdata . "\t";
1293                 $tabcount = $tabcount - 1;
1294         }
1296         # Add a submit button.
1298         $tagdata = $tagdata . "<input type=\"submit\" value=\"" . $class->convert($submitname, "content") . "\"";
1300         if ($style ne ""){
1301                 $tagdata = $tagdata . " class=\"" . $class->convert($style, "content") . "\"";
1302         }
1304         $tagdata = $tagdata . ">" . "\r\n";
1306         # Append the tag data to the page data.
1308         $pagedata = $pagedata . $tagdata;
1312 sub addreset{
1313 #################################################################################
1314 # addreset: Add a reset button.                                                 #
1315 #                                                                               #
1316 # Usage:                                                                        #
1317 #                                                                               #
1318 # $pagemodule->addreset(resetname, options);                                    #
1319 #                                                                               #
1320 # resetname     Specifies the name (label) of the reset button.                 #
1321 # options       Specifies the following options (in any order).                 #
1322 #                                                                               #
1323 # Style         Specifies the CSS style to use.                                 #
1324 #################################################################################
1326         # Get the options recieved.
1328         my $class       = shift;
1329         my ($resetname, $options) = @_;
1331         my $tagdata     = "";
1332         my $tabcount    = $tablevel;
1333         
1334         # Get certain values from the hash.
1336         my $style       = $options->{'Style'};
1338         # Check if certain values are undefined and if they
1339         # are then set them blank or to a default value.
1341         if (!$resetname){
1342                 die("The reset name is blank.");
1343         }
1345         if (!$style){
1346                 $style = "";
1347         }
1349         while ($tabcount > 0){
1350                 $tagdata = $tagdata . "\t";
1351                 $tabcount = $tabcount - 1;
1352         }
1354         # Add a reset button.
1356         $tagdata = $tagdata . "<input type=\"reset\" value=\"" . $class->convert($resetname, "content") . "\"";
1358         if ($style ne ""){
1359                 $tagdata = $tagdata . " class=\"" . $class->convert($style, "content") . "\"";
1360         }
1362         $tagdata = $tagdata . ">" . "\r\n";
1364         # Append the tag data to the page data.
1366         $pagedata = $pagedata . $tagdata;
1370 sub addhiddendata{
1371 #################################################################################
1372 # addhiddendata: Adds hidden data to the form.                                  #
1373 #                                                                               #
1374 # Usage:                                                                        #
1375 #                                                                               #
1376 # $presmodule->addhiddendata(name, value);                                      #
1377 #                                                                               #
1378 # name          Specifies the name of the hidden data.                          #
1379 # value         Specifies the value of the hidden data.                         #
1380 #################################################################################
1382         # Get the name and value.
1384         my $class       = shift;
1385         my ($name, $value) = @_;
1387         my $tagdata     = "";
1388         my $tabcount    = $tablevel;
1390         # Check if certain values are undefined and if they
1391         # are then set them blank or to a default value.
1393         if (!$name){
1394                 die("The name for the hidden data is blank.");
1395         }
1397         if (!$value){
1398                 $value = "";
1399         }
1401         while ($tabcount > 0){
1402                 $tagdata = $tagdata . "\t";
1403                 $tabcount = $tabcount - 1;
1404         }
1406         # Add hidden data.
1408         $tagdata = $tagdata . "<input type=\"hidden\" name=\"" . $class->convert($name, "content") . "\"";
1410         if ($value ne ""){
1411                 $tagdata = $tagdata . " value=\"" . $class->convert($value, "content") . "\"";
1412         }
1414         $tagdata = $tagdata . ">" . "\r\n";
1416         # Add the tag data to the page data.
1418         $pagedata = $pagedata . $tagdata;
1422 sub addbutton{
1423 #################################################################################
1424 # addbutton: Add a button.                                                      #
1425 #                                                                               #
1426 # Usage:                                                                        #
1427 #                                                                               #
1428 # $presmodule->addbutton(buttonname, options);                                  #
1429 #                                                                               #
1430 # buttonname    Specifies the name of button.                                   #
1431 # options       Specifies the following options below (in any order).           #
1432 #                                                                               #
1433 # Value         Specifies the value of the button.                              #
1434 # Description   Specifies the description (label) of the button.                #
1435 # Style         Specifies the CSS style to use.                                 #
1436 #################################################################################
1438         # Get the options recieved.
1440         my $class       = shift;
1441         my ($buttonname, $options) = @_;
1443         my $tagdata     = "";
1444         my $tabcount    = $tablevel;
1446         # Get certain values from the hash.
1448         my $value       = $options->{'Value'};
1449         my $description = $options->{'Description'};
1450         my $style       = $options->{'Style'};
1452         # Check if certain values are undefined and if they
1453         # are then set them blank or to a default value.
1455         if (!$buttonname){
1456                 die("The name for button is blank.");
1457         }
1459         if (!$value){
1460                 $value = "";
1461         }
1463         if (!$description){
1464                 die("The description for the button is blank.");
1465         }
1467         if (!$style){
1468                 $style = "";
1469         }
1471         while ($tabcount > 0){
1472                 $tagdata = $tagdata . "\t";
1473                 $tabcount = $tabcount - 1;
1474         }
1476         # Add a button.
1478         $tagdata = $tagdata . "<button name=\"" . $class->convert($buttonname, "content") . "\"";       
1480         if ($value ne ""){
1481                 $tagdata = $tagdata . " value=\"" . $class->convert($value, "content") . "\"";
1482         }
1484         if ($style ne ""){
1485                 $tagdata = $tagdata . " class=\"" . $class->convert($style, "content") . "\"";
1486         }
1488         $tagdata = $tagdata . ">" . $class->convert($description, "content") . "</button>\r\n";
1490         # Add the tag data to the page data.
1492         $pagedata = $pagedata . $tagdata;
1496 sub endform{
1497 #################################################################################
1498 # endform: Ends a form.                                                         #
1499 #                                                                               #
1500 # Usage:                                                                        #
1501 #                                                                               #
1502 # $presmodule->endform();                                                       #
1503 #################################################################################
1505         # End a form.
1507         my $tagdata = "";
1508         $tablevel = ($tablevel - 1);
1509         my $tabcount = $tablevel;
1511         while ($tabcount > 0){
1512                 $tagdata = $tagdata . "\t";
1513                 $tabcount = $tabcount - 1;
1514         }
1516         $tagdata = $tagdata . "</form>" . "\r\n";
1518         # Append the tag data to the page data.
1520         $pagedata = $pagedata . $tagdata;
1524 #################################################################################
1525 # Page Link.                                                                    #
1526 #################################################################################
1528 sub addlink{
1529 #################################################################################
1530 # addlink: Adds a link.                                                         #
1531 #                                                                               #
1532 # Usage:                                                                        #
1533 #                                                                               #
1534 # $presmodule->addlink(link, options);                                          #
1535 #                                                                               #
1536 # Link          Specifies the location of the link.                             #
1537 # options       Specifies the following options below (in any order).           #
1538 #                                                                               #
1539 # Target        Specifies the target window for the link.                       #
1540 # Text          Specifies the text to use.                                      #
1541 #################################################################################
1543         # Get the options recieved.
1545         my $class       = shift;
1546         my ($link, $options) = @_;
1548         my $tagdata     = "";
1549         my $tabcount    = $tablevel;
1551         # Get certain values from the hash.
1553         my $target      = $options->{'Target'}; 
1554         my $name        = $options->{'Text'};
1555         my $embed       = $options->{'Embed'};
1557         # Check if certain values are undefined and if they
1558         # are then set them blank or to a default value.
1560         if (!$link){
1561                 die("The link specified was blank.");
1562         }
1564         if (!$target){
1565                 $target = "";
1566         }
1568         if (!$embed){
1569                 $embed = 0;
1570         }
1572         while ($tabcount > 0){
1573                 $tagdata = $tagdata . "\t";
1574                 $tabcount = $tabcount - 1;
1575         }
1577         # Add a link.
1579         $tagdata = "<a href=\"" . $class->convert($link, "link") . "\"";        
1581         if ($target ne ""){
1582                 $tagdata = $tagdata . " target=\"" . $class->convert($target, "content") . "\"";
1583         }
1585         $tagdata = $tagdata . ">" . $class->convert($name, "content")  . "</a>" . "\r\n";
1587         # Append the tag data to the page data.
1589         $pagedata = $pagedata . $tagdata;
1593 #################################################################################
1594 # Image.                                                                        #
1595 #################################################################################
1597 sub addimage{
1598 #################################################################################
1599 # addimage: Adds an image.                                                      #
1600 #                                                                               #
1601 # Usage:                                                                        #
1602 #                                                                               #
1603 # $presmodule->addimage(image, options);                                        #
1604 #                                                                               #
1605 # image         Specifies the location of the image.                            #
1606 # options       Specifies the following options below (in any order).           #
1607 #                                                                               #
1608 # Style         Specifies the CSS style to use.                                 #
1609 # Description   Specifies the description of the image.                         #
1610 # Width         Specifies the width of the image.                               #
1611 # Height        Specifies the height of the image.                              #
1612 #################################################################################
1614         # Get the options recieved.
1616         my $class       = shift;
1617         my ($image, $options) = @_;
1619         my $tagdata     = "";
1620         my $tabcount    = $tablevel;
1622         # Get certain values from the hash.
1624         my $style       = $options->{'Style'};
1625         my $width       = $options->{'Width'};
1626         my $height      = $options->{'Height'};
1628         # Check if certain values are undefined and if they
1629         # are then set them blank or to a default value.
1631         if (!$image){
1632                 die("The link to the image given is blank");
1633         }
1635         if (!$style){
1636                 $style = "";
1637         }
1639         if (!$width){
1640                 $width = 0;
1641         }
1643         if (!$height){
1644                 $height = 0;
1645         }
1647         # Check if certain values are valid and return
1648         # an error if they aren't.
1650         my $width_validated     = $width;
1651         my $height_validated    = $height;
1653         $width_validated        =~ tr/0-9//d;
1654         $height_validated       =~ tr/0-9//d;
1656         if (!$width_validated){
1657                 die("The width value given is invalid.");
1658         }
1660         if (!$height_validated){
1661                 die("The height value given is invalid.");
1662         }
1664         while ($tabcount > 0){
1665                 $tagdata = $tagdata . "\t";
1666                 $tabcount = $tabcount - 1;
1667         }
1669         # Add an image.
1671         $tagdata = $tagdata . "<img src=\"" . $class->convert($image, "content") . "\"";
1673         if ($style ne ""){
1674                 $tagdata = $tagdata . " class=\"" . $class->convert($style, "content") . "\"";
1675         }
1677         if ($width ne 0){
1678                 $tagdata = $tagdata . " width=\"" . $class->convert($width, "content") . "\"";
1679         }
1681         if ($height ne 0){
1682                 $tagdata = $tagdata . " height=\"" . $class->convert($height, "content") . "\"";
1683         }
1685         $tagdata = $tagdata . ">" . "\r\n";
1687         # Append the tag data to the page data.
1689         $pagedata = $pagedata . $tagdata;
1693 #################################################################################
1694 # Text.                                                                         #
1695 #################################################################################
1697 sub addtext{
1698 #################################################################################
1699 # addtext: Adds some text.                                                      #
1700 #                                                                               #
1701 # Usage:                                                                        #
1702 #                                                                               #
1703 # $presmodule->addtext(text, options);                                          #
1704 #                                                                               #
1705 # text          Specifies the text to add.                                      #
1706 # options       Specifies the following options below (in any order).           #
1707 #                                                                               #
1708 # Style         Specifies the CSS style to use.                                 #
1709 #################################################################################
1711         # Get the options recieved.
1713         my $class       = shift;
1714         my ($text, $options) = @_;
1716         my $tagdata     = "";
1717         my $tabcount    = $tablevel;
1719         # Get certain values from the hash.
1721         my $style       = $options->{'Style'};
1723         # Check if certain values are undefined and if they
1724         # are then set them blank or to a default value.
1726         if (!$style){
1727                 $style = "";
1728         }
1730         if (!$text){
1731                 $text = "";
1732         }
1734         # Add some text.
1736         if ($style ne ""){
1737                 $tagdata = $tagdata . "<span class=\"" . $class->convert($style, "content") . "\">" . $class->convert($text, "content") . "</span>";
1738         } else {
1739                 $tagdata = $tagdata . $class->convert($text, "content");
1740         }       
1742         # Append the tagdata to the pagedata.
1744         $pagedata = $pagedata . $tagdata;
1748 sub addboldtext{
1749 #################################################################################
1750 # addboldtext: Adds some bold text.                                             #
1751 #                                                                               #
1752 # Usage:                                                                        #
1753 #                                                                               #
1754 # $presmodule->addboldtext(text, options);                                      #
1755 #                                                                               #
1756 # text          Specifies the text to add.                                      #
1757 # options       Specifies the following options below (in any order).           #
1758 #                                                                               #
1759 # Style         Specifies the CSS style to use.                                 #
1760 #################################################################################
1762         # Get the options recieved.
1764         my $class       = shift;
1765         my ($text, $options) = @_;
1767         my $tagdata     = "";
1768         my $tabcount    = $tablevel;
1770         # Get certain values from the hash.
1772         my $style       = $options->{'Style'};
1774         # Check if certain values are undefined and if they
1775         # are then set them blank or to a default value.
1777         if (!$text){
1778                 die("The text given was blank.");
1779         }       
1781         if (!$style){
1782                 $style = "";
1783         }
1785         # Add some bold text.
1787         if ($style ne ""){
1788                 $tagdata = $tagdata . "<span class=\"\">" . $class->convert($text, "content") . "</span>";
1789         } else {
1790                 $tagdata = $tagdata . "<b>" . $class->convert($text, "content") . "</b>";
1791         }
1793         # Append the tagdata to the pagedata.
1795         $pagedata = $pagedata . $tagdata;
1799 sub additalictext{
1800 #################################################################################
1801 # addboldtext: Adds some italic text.                                           #
1802 #                                                                               #
1803 # Usage:                                                                        #
1804 #                                                                               #
1805 # $presmodule->additalictext(text, options);                                    #
1806 #                                                                               #
1807 # text          Specifies the text to add.                                      #
1808 # options       Specifies the following options below (in any order).           #
1809 #                                                                               #
1810 # Style         Specifies the CSS style to use.                                 #
1811 #################################################################################
1813         # Get the options recieved.
1815         my $class       = shift;
1816         my ($text, $options) = @_;
1818         my $tagdata     = "";
1819         my $tabcount    = $tablevel;
1821         # Get certain values from the hash.
1823         my $style       = $options->{'Style'};
1825         # Check if certain values are undefined and if they
1826         # are then set them blank or to a default value.
1828         if (!$text){
1829                 die("The text given was blank.");
1830         }       
1832         if (!$style){
1833                 $style = "";
1834         }
1836         # Add some italic text.
1838         if ($style ne ""){
1839                 $tagdata = $tagdata . "<span class=\"\">" . $class->convert($text, "content") . "</span>";              
1840         } else {
1841                 $tagdata = $tagdata . "<i>" . $class->convert($text, "content") . "</i>";
1842         }
1844         # Append the tagdata to the pagedata.
1846         $pagedata = $pagedata . $tagdata;
1850 sub addlinebreak{
1851 #################################################################################
1852 # addlinebreak: Adds a line break specific to the output format.                #
1853 #                                                                               #
1854 # Usage:                                                                        #
1855 #                                                                               #
1856 # $presmodule->addlinebreak();                                                  #
1857 #################################################################################
1859         # Add a line break.
1861         my $tagdata = "";
1863         $tagdata = "<br>" . "\r\n";
1865         # Append the tagdata to the pagedata.
1867         $pagedata = $pagedata . $tagdata;
1871 sub addhorizontalline{
1872 #################################################################################
1873 # addhorizontalline: Adds a horizontal line.                                    #
1874 #                                                                               #
1875 # Usage:                                                                        #
1876 #                                                                               #
1877 # $presmodule->addhorizontalline();                                             #
1878 #################################################################################
1880         # Add a horizontal line.
1882         my $tagdata = "";
1883         
1884         $tagdata = "<hr>" . "\r\n";
1886         # Append the tagdata to the pagedata.
1888         $pagedata = $pagedata . $tagdata;
1892 #################################################################################
1893 # Other.                                                                        #
1894 #################################################################################
1896 sub startlist{
1897 #################################################################################
1898 # startlist: Start a list.                                                      #
1899 #                                                                               #
1900 # Usage:                                                                        #
1901 #                                                                               #
1902 # $presmodule->startlist();                                                     #
1903 #################################################################################
1905         # Start a list.
1907         my $tagdata = "";
1908         my $tabcount = $tablevel;
1910         while ($tabcount > 0){
1911                 $tagdata = $tagdata . "\t";
1912                 $tabcount = $tabcount - 1;
1913         }
1915         $tagdata = $tagdata . "<ul>" . "\r\n";
1917         # Append the tag data to the page data.
1919         $pagedata = $pagedata . $tagdata;
1920         $tablevel++;
1924 sub additem{
1925 #################################################################################
1926 # additem: Adds an item to the list.                                            #
1927 #                                                                               #
1928 # Usage:                                                                        #
1929 #                                                                               #
1930 # $presmodule->additem(text, options);                                          #
1931 #                                                                               #
1932 # text          Specifies the text to use for the item.                         #
1933 # options       Specifies the following options (in any order).                 #
1934 #                                                                               #
1935 # Style         Specifies the CSS style to use.                                 #
1936 #################################################################################
1938          # Get the options recieved.
1940         my $class       = shift;
1941         my ($text, $options) = @_;
1943         my $tagdata     = "";
1944         my $tabcount    = $tablevel;
1946         # Get certain values from the hash.
1948         my $style       = $options->{'Style'};
1950         # Check if certain values are undefined and if they
1951         # are then set them blank or to a default value.
1953         if (!$text){
1954                 die("The text given was blank.");
1955         }
1957         if (!$style){
1958                 $style = "";
1959         }
1961         # Add an item to the list.
1963         $tagdata = $tagdata . "<li ";
1965         if ($style ne ""){
1966                 $tagdata = $tagdata . " class=\"" . $class->convert($style, "content") . "\"";
1967         }
1969         $tagdata = $tagdata . ">" . $class->convert($text, "content");
1971         # Append the tag data to the page data.
1973         $pagedata = $pagedata . $tagdata;
1977 sub endlist{
1978 #################################################################################
1979 # endlist: End a list.                                                          #
1980 #                                                                               #
1981 # Usage:                                                                        #
1982 #                                                                               #
1983 # $presmodule-endlist();                                                        #
1984 #################################################################################
1986         # End a list.
1988         my $tagdata = "";
1989         $tablevel = ($tablevel - 1);
1990         my $tabcount = $tablevel;
1992         while ($tabcount > 0){
1993                 $tagdata = $tagdata . "\t";
1994                 $tabcount = $tabcount - 1;
1995         }
1997         $tagdata = $tagdata . "</ul>" . "\r\n";
1999         # Append the tag data to the page data.
2001         $pagedata = $pagedata . $tagdata;
2005 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