Home | News | Projects | Releases
Bugs | RFE | Repositories | Help
Commit of recent work in preperation for Kiriwrite 0.5.0
[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 Modules::Presentation::HTML4S;
26 # Enable strict and use warnings.
28 use strict;
29 use warnings;
31 # Set the following values.
33 our $VERSION = "0.5.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 = Kiriwrite::Presentation::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 # Password      Specifies the input box is a password box.                      #
1039 #################################################################################
1041         # Get the options recieved.
1043         my $class       = shift;
1044         my ($inputboxname, $options) = @_;
1046         my $tagdata     = "";
1047         my $tabcount    = $tablevel;
1049         # Get certain values from the hash.
1051         my $size        = $options->{'Size'};
1052         my $maxlength   = $options->{'MaxLength'};
1053         my $style       = $options->{'Style'};
1054         my $value       = $options->{'Value'};
1055         my $password    = $options->{'Password'};
1057         # Check if certain values are undefined and if they
1058         # are then set them blank or to a default value.
1060         if (!$inputboxname){
1061                 die("The input box name given is blank.");
1062         }
1064         if (!$size){
1065                 $size = 0;
1066         }
1068         if (!$maxlength){
1069                 $maxlength = 0;
1070         }
1072         if (!$style){
1073                 $style = "";
1074         }
1076         if (!$value){
1077                 $value = "";
1078         }
1080         if (!$password){
1081                 $password = 0;
1082         }
1084         # Check if certain values are valid and return
1085         # an error if they aren't.
1087         my $size_validated = $size;
1088         my $maxlength_validated = $maxlength;
1090         $size_validated         =~ tr/0-9//d;
1091         $maxlength_validated    =~ tr/0-9//d;
1093         if ($size_validated ne ""){
1094                 die("The size given is invalid.");
1095         }
1097         if ($maxlength_validated ne ""){
1098                 die("The maximum length given is invalid.");
1099         }
1101         while ($tabcount > 0){
1102                 $tagdata = $tagdata . "\t";
1103                 $tabcount = $tabcount - 1;
1104         }
1106         # Add an input text box.
1108         $tagdata = "<input "; 
1110         # Check if it should be a password field.
1112         if ($password eq 1){
1114                 # The field should be a password field.
1116                 $tagdata = $tagdata . "type=\"password\" ";
1118         } else {
1120                 # The field should be a text field.
1122                 $tagdata = $tagdata . "type=\"text\" ";
1124         }
1126         $tagdata = $tagdata . "name=\"" . $class->convert($inputboxname, "content") . "\"";
1127         
1128         if ($size > 0){
1129                 $tagdata = $tagdata . " size=\"" . $class->convert($size, "content") . "\"";
1130         }
1132         if ($maxlength > 0){
1133                 $tagdata = $tagdata . " maxlength=\"" . $class->convert($maxlength, "content") . "\"";
1134         }
1136         if ($style ne ""){
1137                 $tagdata = $tagdata . " class=\"" . $class->convert($style, "content") . "\"";
1138         }
1140         if ($value ne ""){
1141                 $tagdata = $tagdata . " value=\"" . $class->convert($value, "content") . "\"";
1142         }
1144         $tagdata = $tagdata . ">" . "\r\n";
1146         # Append the tag data to the page data.
1148         $pagedata = $pagedata . $tagdata;
1152 sub addtextbox{
1153 #################################################################################
1154 # addtextbox: Add a multiple line text box.                                     #
1155 #                                                                               #
1156 # Usage:                                                                        #
1157 #                                                                               #
1158 # $presmodule->addtextbox(textboxname, options);                                #
1159 #                                                                               #
1160 # textboxname   Specifies the name of the multiple line text box.               #
1161 # options       Specifies the following options (in any order).                 #
1162 #                                                                               #
1163 # Columns       Specifies the width of the multiple line text box.              #
1164 # Rows          Specifies the height of the multiple line text box.             #
1165 # Style         Specifies the CSS style to use.                                 #
1166 # Value         Specifies a value for the multiple line text box.               #
1167 #################################################################################
1169         # Get the options recieved.
1171         my $class       = shift;
1172         my ($textboxname, $options) = @_;
1174         my $tagdata     = "";
1175         my $tabcount    = $tablevel;
1177         # Get certain values from the hash.
1179         my $columns     = $options->{'Columns'};
1180         my $rows        = $options->{'Rows'};
1181         my $style       = $options->{'Style'};
1182         my $value       = $options->{'Value'};
1184         # Check if certain values are undefined and if they
1185         # are then set them blank or to a default value.
1187         if (!$textboxname){
1188                 die("The multiple line text box name is blank.");
1189         }
1190         
1191         if (!$columns){
1192                 $columns = 0;
1193         }
1195         if (!$rows){
1196                 $rows = 0;
1197         }
1199         if (!$style){
1200                 $style = "";
1201         }
1203         if (!$value){
1204                 $value = "";
1205         }
1207         # Check if certain values are valid and return
1208         # an error if they aren't.
1210         my $columns_validated   = $columns;
1211         my $rows_validated      = $rows;
1213         $columns_validated      =~ tr/0-9//d;
1214         $rows_validated         =~ tr/0-9//d;
1216         if ($columns_validated ne ""){
1217                 die("The columns value given is invalid.");
1218         }
1220         if ($rows_validated ne ""){
1221                 die("The rows value given is invalid.");
1222         }
1224         while ($tabcount > 0){
1225                 $tagdata = $tagdata . "\t";
1226                 $tabcount = $tabcount - 1;
1227         }
1229         # Add a multiple line text box.
1231         $tagdata = $tagdata . "<textarea name=\"" . $class->convert($textboxname, "content") . "\"";
1233         if ($columns > 0){
1234                 $tagdata = $tagdata . " cols=\"" . $class->convert($columns, "content") . "\"";
1235         }       
1237         if ($rows > 0){
1238                 $tagdata = $tagdata . " rows=\"" . $class->convert($rows, "content") . "\"";
1239         }
1241         if ($style ne ""){
1242                 $tagdata = $tagdata . " class=\"" . $class->convert($style, "content") . "\"";
1243         }       
1245         $tagdata = $tagdata . ">";
1246         $tagdata = $tagdata . $class->convert($value, "content");
1247         $tagdata = $tagdata . "</textarea>" . "\r\n";
1249         # Append the tag data to the page data.
1251         $pagedata = $pagedata . $tagdata;
1255 sub addsubmit{
1256 #################################################################################
1257 # addsubmit: Add a submit button.                                               #
1258 #                                                                               #
1259 # Usage:                                                                        #
1260 #                                                                               #
1261 # $pagemodule->addsubmit(submitname, options);                                  #
1262 #                                                                               #
1263 # submitname    Specifies the name (label) of the submit button.                #
1264 # options       Specifies the following options (in any order).                 #
1265 #                                                                               #
1266 # Style         Specifies the CSS style to use.                                 #
1267 #################################################################################
1269         # Get the options recieved.
1271         my $class       = shift;
1272         my ($submitname, $options) = @_;
1274         my $tagdata     = "";
1275         my $tabcount    = $tablevel;
1276         
1277         # Get certain values from the hash.
1279         my $style       = $options->{'Style'};
1281         # Check if certain values are undefined and if they
1282         # are then set them blank or to a default value.
1284         if (!$submitname){
1285                 die("The submit name is blank.");
1286         }
1288         if (!$style){
1289                 $style = "";
1290         }
1292         while ($tabcount > 0){
1293                 $tagdata = $tagdata . "\t";
1294                 $tabcount = $tabcount - 1;
1295         }
1297         # Add a submit button.
1299         $tagdata = $tagdata . "<input type=\"submit\" value=\"" . $class->convert($submitname, "content") . "\"";
1301         if ($style ne ""){
1302                 $tagdata = $tagdata . " class=\"" . $class->convert($style, "content") . "\"";
1303         }
1305         $tagdata = $tagdata . ">" . "\r\n";
1307         # Append the tag data to the page data.
1309         $pagedata = $pagedata . $tagdata;
1313 sub addreset{
1314 #################################################################################
1315 # addreset: Add a reset button.                                                 #
1316 #                                                                               #
1317 # Usage:                                                                        #
1318 #                                                                               #
1319 # $pagemodule->addreset(resetname, options);                                    #
1320 #                                                                               #
1321 # resetname     Specifies the name (label) of the reset button.                 #
1322 # options       Specifies the following options (in any order).                 #
1323 #                                                                               #
1324 # Style         Specifies the CSS style to use.                                 #
1325 #################################################################################
1327         # Get the options recieved.
1329         my $class       = shift;
1330         my ($resetname, $options) = @_;
1332         my $tagdata     = "";
1333         my $tabcount    = $tablevel;
1334         
1335         # Get certain values from the hash.
1337         my $style       = $options->{'Style'};
1339         # Check if certain values are undefined and if they
1340         # are then set them blank or to a default value.
1342         if (!$resetname){
1343                 die("The reset name is blank.");
1344         }
1346         if (!$style){
1347                 $style = "";
1348         }
1350         while ($tabcount > 0){
1351                 $tagdata = $tagdata . "\t";
1352                 $tabcount = $tabcount - 1;
1353         }
1355         # Add a reset button.
1357         $tagdata = $tagdata . "<input type=\"reset\" value=\"" . $class->convert($resetname, "content") . "\"";
1359         if ($style ne ""){
1360                 $tagdata = $tagdata . " class=\"" . $class->convert($style, "content") . "\"";
1361         }
1363         $tagdata = $tagdata . ">" . "\r\n";
1365         # Append the tag data to the page data.
1367         $pagedata = $pagedata . $tagdata;
1371 sub addhiddendata{
1372 #################################################################################
1373 # addhiddendata: Adds hidden data to the form.                                  #
1374 #                                                                               #
1375 # Usage:                                                                        #
1376 #                                                                               #
1377 # $presmodule->addhiddendata(name, value);                                      #
1378 #                                                                               #
1379 # name          Specifies the name of the hidden data.                          #
1380 # value         Specifies the value of the hidden data.                         #
1381 #################################################################################
1383         # Get the name and value.
1385         my $class       = shift;
1386         my ($name, $value) = @_;
1388         my $tagdata     = "";
1389         my $tabcount    = $tablevel;
1391         # Check if certain values are undefined and if they
1392         # are then set them blank or to a default value.
1394         if (!$name){
1395                 die("The name for the hidden data is blank.");
1396         }
1398         if (!$value){
1399                 $value = "";
1400         }
1402         while ($tabcount > 0){
1403                 $tagdata = $tagdata . "\t";
1404                 $tabcount = $tabcount - 1;
1405         }
1407         # Add hidden data.
1409         $tagdata = $tagdata . "<input type=\"hidden\" name=\"" . $class->convert($name, "content") . "\"";
1411         if ($value ne ""){
1412                 $tagdata = $tagdata . " value=\"" . $class->convert($value, "content") . "\"";
1413         }
1415         $tagdata = $tagdata . ">" . "\r\n";
1417         # Add the tag data to the page data.
1419         $pagedata = $pagedata . $tagdata;
1423 sub addbutton{
1424 #################################################################################
1425 # addbutton: Add a button.                                                      #
1426 #                                                                               #
1427 # Usage:                                                                        #
1428 #                                                                               #
1429 # $presmodule->addbutton(buttonname, options);                                  #
1430 #                                                                               #
1431 # buttonname    Specifies the name of button.                                   #
1432 # options       Specifies the following options below (in any order).           #
1433 #                                                                               #
1434 # Value         Specifies the value of the button.                              #
1435 # Description   Specifies the description (label) of the button.                #
1436 # Style         Specifies the CSS style to use.                                 #
1437 #################################################################################
1439         # Get the options recieved.
1441         my $class       = shift;
1442         my ($buttonname, $options) = @_;
1444         my $tagdata     = "";
1445         my $tabcount    = $tablevel;
1447         # Get certain values from the hash.
1449         my $value       = $options->{'Value'};
1450         my $description = $options->{'Description'};
1451         my $style       = $options->{'Style'};
1453         # Check if certain values are undefined and if they
1454         # are then set them blank or to a default value.
1456         if (!$buttonname){
1457                 die("The name for button is blank.");
1458         }
1460         if (!$value){
1461                 $value = "";
1462         }
1464         if (!$description){
1465                 die("The description for the button is blank.");
1466         }
1468         if (!$style){
1469                 $style = "";
1470         }
1472         while ($tabcount > 0){
1473                 $tagdata = $tagdata . "\t";
1474                 $tabcount = $tabcount - 1;
1475         }
1477         # Add a button.
1479         $tagdata = $tagdata . "<button name=\"" . $class->convert($buttonname, "content") . "\"";       
1481         if ($value ne ""){
1482                 $tagdata = $tagdata . " value=\"" . $class->convert($value, "content") . "\"";
1483         }
1485         if ($style ne ""){
1486                 $tagdata = $tagdata . " class=\"" . $class->convert($style, "content") . "\"";
1487         }
1489         $tagdata = $tagdata . ">" . $class->convert($description, "content") . "</button>\r\n";
1491         # Add the tag data to the page data.
1493         $pagedata = $pagedata . $tagdata;
1497 sub endform{
1498 #################################################################################
1499 # endform: Ends a form.                                                         #
1500 #                                                                               #
1501 # Usage:                                                                        #
1502 #                                                                               #
1503 # $presmodule->endform();                                                       #
1504 #################################################################################
1506         # End a form.
1508         my $tagdata = "";
1509         $tablevel = ($tablevel - 1);
1510         my $tabcount = $tablevel;
1512         while ($tabcount > 0){
1513                 $tagdata = $tagdata . "\t";
1514                 $tabcount = $tabcount - 1;
1515         }
1517         $tagdata = $tagdata . "</form>" . "\r\n";
1519         # Append the tag data to the page data.
1521         $pagedata = $pagedata . $tagdata;
1525 #################################################################################
1526 # Page Link.                                                                    #
1527 #################################################################################
1529 sub addlink{
1530 #################################################################################
1531 # addlink: Adds a link.                                                         #
1532 #                                                                               #
1533 # Usage:                                                                        #
1534 #                                                                               #
1535 # $presmodule->addlink(link, options);                                          #
1536 #                                                                               #
1537 # Link          Specifies the location of the link.                             #
1538 # options       Specifies the following options below (in any order).           #
1539 #                                                                               #
1540 # Target        Specifies the target window for the link.                       #
1541 # Text          Specifies the text to use.                                      #
1542 #################################################################################
1544         # Get the options recieved.
1546         my $class       = shift;
1547         my ($link, $options) = @_;
1549         my $tagdata     = "";
1550         my $tabcount    = $tablevel;
1552         # Get certain values from the hash.
1554         my $target      = $options->{'Target'}; 
1555         my $name        = $options->{'Text'};
1556         my $embed       = $options->{'Embed'};
1558         # Check if certain values are undefined and if they
1559         # are then set them blank or to a default value.
1561         if (!$link){
1562                 die("The link specified was blank.");
1563         }
1565         if (!$target){
1566                 $target = "";
1567         }
1569         if (!$embed){
1570                 $embed = 0;
1571         }
1573         while ($tabcount > 0){
1574                 $tagdata = $tagdata . "\t";
1575                 $tabcount = $tabcount - 1;
1576         }
1578         # Add a link.
1580         $tagdata = "<a href=\"" . $class->convert($link, "link") . "\"";        
1582         if ($target ne ""){
1583                 $tagdata = $tagdata . " target=\"" . $class->convert($target, "content") . "\"";
1584         }
1586         $tagdata = $tagdata . ">" . $class->convert($name, "content")  . "</a>" . "\r\n";
1588         # Append the tag data to the page data.
1590         $pagedata = $pagedata . $tagdata;
1594 #################################################################################
1595 # Image.                                                                        #
1596 #################################################################################
1598 sub addimage{
1599 #################################################################################
1600 # addimage: Adds an image.                                                      #
1601 #                                                                               #
1602 # Usage:                                                                        #
1603 #                                                                               #
1604 # $presmodule->addimage(image, options);                                        #
1605 #                                                                               #
1606 # image         Specifies the location of the image.                            #
1607 # options       Specifies the following options below (in any order).           #
1608 #                                                                               #
1609 # Style         Specifies the CSS style to use.                                 #
1610 # Description   Specifies the description of the image.                         #
1611 # Width         Specifies the width of the image.                               #
1612 # Height        Specifies the height of the image.                              #
1613 #################################################################################
1615         # Get the options recieved.
1617         my $class       = shift;
1618         my ($image, $options) = @_;
1620         my $tagdata     = "";
1621         my $tabcount    = $tablevel;
1623         # Get certain values from the hash.
1625         my $style       = $options->{'Style'};
1626         my $width       = $options->{'Width'};
1627         my $height      = $options->{'Height'};
1629         # Check if certain values are undefined and if they
1630         # are then set them blank or to a default value.
1632         if (!$image){
1633                 die("The link to the image given is blank");
1634         }
1636         if (!$style){
1637                 $style = "";
1638         }
1640         if (!$width){
1641                 $width = 0;
1642         }
1644         if (!$height){
1645                 $height = 0;
1646         }
1648         # Check if certain values are valid and return
1649         # an error if they aren't.
1651         my $width_validated     = $width;
1652         my $height_validated    = $height;
1654         $width_validated        =~ tr/0-9//d;
1655         $height_validated       =~ tr/0-9//d;
1657         if (!$width_validated){
1658                 die("The width value given is invalid.");
1659         }
1661         if (!$height_validated){
1662                 die("The height value given is invalid.");
1663         }
1665         while ($tabcount > 0){
1666                 $tagdata = $tagdata . "\t";
1667                 $tabcount = $tabcount - 1;
1668         }
1670         # Add an image.
1672         $tagdata = $tagdata . "<img src=\"" . $class->convert($image, "content") . "\"";
1674         if ($style ne ""){
1675                 $tagdata = $tagdata . " class=\"" . $class->convert($style, "content") . "\"";
1676         }
1678         if ($width ne 0){
1679                 $tagdata = $tagdata . " width=\"" . $class->convert($width, "content") . "\"";
1680         }
1682         if ($height ne 0){
1683                 $tagdata = $tagdata . " height=\"" . $class->convert($height, "content") . "\"";
1684         }
1686         $tagdata = $tagdata . ">" . "\r\n";
1688         # Append the tag data to the page data.
1690         $pagedata = $pagedata . $tagdata;
1694 #################################################################################
1695 # Text.                                                                         #
1696 #################################################################################
1698 sub addtext{
1699 #################################################################################
1700 # addtext: Adds some text.                                                      #
1701 #                                                                               #
1702 # Usage:                                                                        #
1703 #                                                                               #
1704 # $presmodule->addtext(text, options);                                          #
1705 #                                                                               #
1706 # text          Specifies the text to add.                                      #
1707 # options       Specifies the following options below (in any order).           #
1708 #                                                                               #
1709 # Style         Specifies the CSS style to use.                                 #
1710 #################################################################################
1712         # Get the options recieved.
1714         my $class       = shift;
1715         my ($text, $options) = @_;
1717         my $tagdata     = "";
1718         my $tabcount    = $tablevel;
1720         # Get certain values from the hash.
1722         my $style       = $options->{'Style'};
1724         # Check if certain values are undefined and if they
1725         # are then set them blank or to a default value.
1727         if (!$style){
1728                 $style = "";
1729         }
1731         if (!$text){
1732                 $text = "";
1733         }
1735         # Add some text.
1737         if ($style ne ""){
1738                 $tagdata = $tagdata . "<span class=\"" . $class->convert($style, "content") . "\">" . $class->convert($text, "content") . "</span>";
1739         } else {
1740                 $tagdata = $tagdata . $class->convert($text, "content");
1741         }       
1743         # Append the tagdata to the pagedata.
1745         $pagedata = $pagedata . $tagdata;
1749 sub addboldtext{
1750 #################################################################################
1751 # addboldtext: Adds some bold text.                                             #
1752 #                                                                               #
1753 # Usage:                                                                        #
1754 #                                                                               #
1755 # $presmodule->addboldtext(text, options);                                      #
1756 #                                                                               #
1757 # text          Specifies the text to add.                                      #
1758 # options       Specifies the following options below (in any order).           #
1759 #                                                                               #
1760 # Style         Specifies the CSS style to use.                                 #
1761 #################################################################################
1763         # Get the options recieved.
1765         my $class       = shift;
1766         my ($text, $options) = @_;
1768         my $tagdata     = "";
1769         my $tabcount    = $tablevel;
1771         # Get certain values from the hash.
1773         my $style       = $options->{'Style'};
1775         # Check if certain values are undefined and if they
1776         # are then set them blank or to a default value.
1778         if (!$text){
1779                 die("The text given was blank.");
1780         }       
1782         if (!$style){
1783                 $style = "";
1784         }
1786         # Add some bold text.
1788         if ($style ne ""){
1789                 $tagdata = $tagdata . "<span class=\"" . $style . "\">" . $class->convert($text, "content") . "</span>";
1790         } else {
1791                 $tagdata = $tagdata . "<b>" . $class->convert($text, "content") . "</b>";
1792         }
1794         # Append the tagdata to the pagedata.
1796         $pagedata = $pagedata . $tagdata;
1800 sub additalictext{
1801 #################################################################################
1802 # addboldtext: Adds some italic text.                                           #
1803 #                                                                               #
1804 # Usage:                                                                        #
1805 #                                                                               #
1806 # $presmodule->additalictext(text, options);                                    #
1807 #                                                                               #
1808 # text          Specifies the text to add.                                      #
1809 # options       Specifies the following options below (in any order).           #
1810 #                                                                               #
1811 # Style         Specifies the CSS style to use.                                 #
1812 #################################################################################
1814         # Get the options recieved.
1816         my $class       = shift;
1817         my ($text, $options) = @_;
1819         my $tagdata     = "";
1820         my $tabcount    = $tablevel;
1822         # Get certain values from the hash.
1824         my $style       = $options->{'Style'};
1826         # Check if certain values are undefined and if they
1827         # are then set them blank or to a default value.
1829         if (!$text){
1830                 die("The text given was blank.");
1831         }       
1833         if (!$style){
1834                 $style = "";
1835         }
1837         # Add some italic text.
1839         if ($style ne ""){
1840                 $tagdata = $tagdata . "<span class=\"\">" . $class->convert($text, "content") . "</span>";              
1841         } else {
1842                 $tagdata = $tagdata . "<i>" . $class->convert($text, "content") . "</i>";
1843         }
1845         # Append the tagdata to the pagedata.
1847         $pagedata = $pagedata . $tagdata;
1851 sub addlinebreak{
1852 #################################################################################
1853 # addlinebreak: Adds a line break specific to the output format.                #
1854 #                                                                               #
1855 # Usage:                                                                        #
1856 #                                                                               #
1857 # $presmodule->addlinebreak();                                                  #
1858 #################################################################################
1860         # Add a line break.
1862         my $tagdata = "";
1864         $tagdata = "<br>" . "\r\n";
1866         # Append the tagdata to the pagedata.
1868         $pagedata = $pagedata . $tagdata;
1872 sub addhorizontalline{
1873 #################################################################################
1874 # addhorizontalline: Adds a horizontal line.                                    #
1875 #                                                                               #
1876 # Usage:                                                                        #
1877 #                                                                               #
1878 # $presmodule->addhorizontalline();                                             #
1879 #################################################################################
1881         # Add a horizontal line.
1883         my $tagdata = "";
1884         
1885         $tagdata = "<hr>" . "\r\n";
1887         # Append the tagdata to the pagedata.
1889         $pagedata = $pagedata . $tagdata;
1893 #################################################################################
1894 # Other.                                                                        #
1895 #################################################################################
1897 sub startlist{
1898 #################################################################################
1899 # startlist: Start a list.                                                      #
1900 #                                                                               #
1901 # Usage:                                                                        #
1902 #                                                                               #
1903 # $presmodule->startlist();                                                     #
1904 #################################################################################
1906         # Start a list.
1908         my $tagdata = "";
1909         my $tabcount = $tablevel;
1911         while ($tabcount > 0){
1912                 $tagdata = $tagdata . "\t";
1913                 $tabcount = $tabcount - 1;
1914         }
1916         $tagdata = $tagdata . "<ul>" . "\r\n";
1918         # Append the tag data to the page data.
1920         $pagedata = $pagedata . $tagdata;
1921         $tablevel++;
1925 sub additem{
1926 #################################################################################
1927 # additem: Adds an item to the list.                                            #
1928 #                                                                               #
1929 # Usage:                                                                        #
1930 #                                                                               #
1931 # $presmodule->additem(text, options);                                          #
1932 #                                                                               #
1933 # text          Specifies the text to use for the item.                         #
1934 # options       Specifies the following options (in any order).                 #
1935 #                                                                               #
1936 # Style         Specifies the CSS style to use.                                 #
1937 #################################################################################
1939          # Get the options recieved.
1941         my $class       = shift;
1942         my ($text, $options) = @_;
1944         my $tagdata     = "";
1945         my $tabcount    = $tablevel;
1947         # Get certain values from the hash.
1949         my $style       = $options->{'Style'};
1951         # Check if certain values are undefined and if they
1952         # are then set them blank or to a default value.
1954         if (!$text){
1955                 die("The text given was blank.");
1956         }
1958         if (!$style){
1959                 $style = "";
1960         }
1962         # Add an item to the list.
1964         $tagdata = $tagdata . "<li ";
1966         if ($style ne ""){
1967                 $tagdata = $tagdata . " class=\"" . $class->convert($style, "content") . "\"";
1968         }
1970         $tagdata = $tagdata . ">" . $class->convert($text, "content");
1972         # Append the tag data to the page data.
1974         $pagedata = $pagedata . $tagdata;
1978 sub endlist{
1979 #################################################################################
1980 # endlist: End a list.                                                          #
1981 #                                                                               #
1982 # Usage:                                                                        #
1983 #                                                                               #
1984 # $presmodule-endlist();                                                        #
1985 #################################################################################
1987         # End a list.
1989         my $tagdata = "";
1990         $tablevel = ($tablevel - 1);
1991         my $tabcount = $tablevel;
1993         while ($tabcount > 0){
1994                 $tagdata = $tagdata . "\t";
1995                 $tabcount = $tabcount - 1;
1996         }
1998         $tagdata = $tagdata . "</ul>" . "\r\n";
2000         # Append the tag data to the page data.
2002         $pagedata = $pagedata . $tagdata;
2006 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