1 #################################################################################
2 # Kiriwrite Presentation Module - HTML 4.0 Strict (HTML4S.pm) #
3 # Output Module for writing pages to the HTML 4.0 Strict Standard #
5 # Copyright (C) 2007 Steve Brokenshire <sbrokenshire@xestia.co.uk> #
7 # This module is licensed under the same license as Kiriwrite which is the GPL. #
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. #
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.#
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.
31 # Set the following values.
33 our $VERSION = "0.1.0";
37 #################################################################################
38 # Generic Subroutines. #
39 #################################################################################
42 #################################################################################
43 # new: Create an instance of Kiriwrite::Presentation::HTML4S #
47 # $presmodule = Kiriwrite::Presentation::HTML4S->new(); #
48 #################################################################################
50 # Get the perl module name.
55 return bless($self, $class);
60 #################################################################################
61 # clear: Clear the current layout created by this module. #
65 # $presmodule->clear(); #
66 #################################################################################
74 #################################################################################
75 # grab: Grab the current layout created by this module. #
79 # $presmodule->grab(); #
80 #################################################################################
87 #################################################################################
88 # convert: Converts the data passed into data that is compliant with the output #
93 # $presmodule->convert(data, type); #
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.
102 my ($data, $type) = @_;
104 # Check if certain values are undefined and if they are
105 # then set them blank or return an error.
112 die("No type was specified");
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/&/&/g;
121 $data =~ s/#/#/g;
122 $data =~ s/\"/"/g;
126 $data =~ s/\+/+/g;
127 $data =~ s/-/-/g;
128 $data =~ s/_/_/g;
129 $data =~ s/\@/@/g;
130 $data =~ s/~/~/g;
131 $data =~ s/\?/?/g;
132 $data =~ s/'/'/g;
136 } elsif ($type eq "link"){
138 $data =~ s/&/&/g;
139 $data =~ s/\+/\%2B/g;
140 $data =~ s/\?/\%3F/g;
144 $data =~ s/\@/\%40/g;
154 die("An invalid type was specified.");
162 #################################################################################
163 # Tags for creating tables. #
164 #################################################################################
167 #################################################################################
168 # starttable: Start a table. #
172 # $presmodule->starttable(cssstyle, {options}); #
174 # cssstyle Specifies the CSS style name to use. #
175 # options Specifies the following options (in any order): #
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.
184 my ($cssstyle, $options) = @_;
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
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.");
221 if ($cellspacing_validated ne ""){
222 die("Cell spacing value given is invalid.");
225 while ($tabcount > 0){
226 $tagdata = $tagdata . "\t";
227 $tabcount = $tabcount - 1;
232 $tagdata = $tagdata . "<table";
234 # Check if the cell spacing and cell padding has values
237 if ($cellspacing >= 0){
238 $tagdata = $tagdata . " cellspacing=\"" . $cellspacing . "\"";
241 if ($cellpadding > 0){
242 $tagdata = $tagdata . " cellpadding=\"" . $cellpadding . "\"";
245 if ($cssstyle ne ""){
246 $tagdata = $tagdata . " class=\"" . $class->convert($cssstyle, "content") . "\"";
249 $tagdata = $tagdata . ">" . "\r\n";
251 # Append the tag data to the page data.
253 $pagedata = $pagedata . $tagdata;
259 #################################################################################
260 # startheader: Start a table header. #
264 # $presmodule->startheader(); #
265 #################################################################################
267 # Start a table header row.
270 my $tabcount = $tablevel;
272 while ($tabcount > 0){
273 $tagdata = $tagdata . "\t";
274 $tabcount = $tabcount - 1;
277 $tagdata = $tagdata . "<tr>" . "\r\n";
279 # Append the tag data to the page data.
281 $pagedata = $pagedata . $tagdata;
287 #################################################################################
288 # addheader: Add a table header. #
292 # $presmodule->addheader(headername, {options}); #
294 # headername Specifies the name of the table header to use. #
295 # options Specifies the following options below (in any order): #
297 # Style Specifies the CSS Style to use for the table header. #
298 #################################################################################
300 # Get the header name and options.
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.
319 my $tabcount = $tablevel;
321 while ($tabcount > 0){
322 $tagdata = $tagdata . "\t";
323 $tabcount = $tabcount - 1;
326 $tagdata = $tagdata . "<th";
328 if ($cssstyle ne ""){
329 $tagdata = $tagdata . " class=\"" . $class->convert($cssstyle, "content") . "\"";
332 $tagdata = $tagdata . ">" . $class->convert($headername, "content") . "</th>" . "\r\n";
334 # Append the tag data to the page data.
336 $pagedata = $pagedata . $tagdata;
341 #################################################################################
342 # endheader: End a table header row #
346 # $presmodule->endheader(); #
347 #################################################################################
349 # End a table header row.
352 $tablevel = ($tablevel - 1);
353 my $tabcount = $tablevel;
355 while ($tabcount > 0){
356 $tagdata = $tagdata . "\t";
357 $tabcount = $tabcount - 1;
360 $tagdata = $tagdata . "</tr>" . "\r\n";
362 # Append the tag data to the page data.
364 $pagedata = $pagedata . $tagdata;
369 #################################################################################
370 # startrow: Start a table row. #
374 # $presmodule->startrow(); #
375 #################################################################################
380 my $tabcount = $tablevel;
382 while ($tabcount > 0){
383 $tagdata = $tagdata . "\t";
384 $tabcount = $tabcount - 1;
387 $tagdata = $tagdata . "<tr>" . "\r\n";
389 # Append the tag data to the page data.
391 $pagedata = $pagedata . $tagdata;
397 #################################################################################
398 # addcell: Add a table cell. #
402 # $presmodule->addcell(style); #
404 # style Specifies which CSS Style to use. #
405 #################################################################################
407 # Get the cell information and options.
411 my $tabcount = $tablevel;
414 # Check if the cell data and CSS style are undefined
415 # and if they are then set them blank.
421 while ($tabcount > 0){
422 $tagdata = $tagdata . "\t";
423 $tabcount = $tabcount - 1;
426 $tagdata = $tagdata . "<td";
428 if ($cssstyle ne ""){
429 $tagdata = $tagdata . " class=\"" . $class->convert($cssstyle, "content") . "\"";
432 $tagdata = $tagdata . ">";
434 # Append the tag data to the page data.
436 $pagedata = $pagedata . $tagdata;
441 #################################################################################
442 # endcell: End a table cell. #
446 # $presmodule->endcell(); #
447 #################################################################################
453 $tagdata = $tagdata . "</td>" . "\r\n";
455 # Append the tag data to the page data.
457 $pagedata = $pagedata . $tagdata;
462 #################################################################################
463 # endrow: Ends a table row. #
467 # $presmodule->endrow(); #
468 #################################################################################
473 $tablevel = ($tablevel - 1);
474 my $tabcount = $tablevel;
476 while ($tabcount > 0){
477 $tagdata = $tagdata . "\t";
478 $tabcount = $tabcount - 1;
481 $tagdata = $tagdata . "</tr>" . "\r\n";
483 # Append the tag data to the page data.
485 $pagedata = $pagedata . $tagdata;
490 #################################################################################
491 # endtable: Ends a table. #
495 # $presmodule->endtable(); #
496 #################################################################################
501 $tablevel = ($tablevel - 1);
502 my $tabcount = $tablevel;
504 while ($tabcount > 0){
505 $tagdata = $tagdata . "\t";
506 $tabcount = $tabcount - 1;
509 $tagdata = $tagdata . "</table>" . "\r\n";
511 # Append the tag data to the page data.
513 $pagedata = $pagedata . $tagdata;
517 #################################################################################
519 #################################################################################
522 #################################################################################
523 # startbox: Start an information box. #
527 # $presmodule->startbox(cssstyle); #
529 # cssstyle Specifies the CSS Style to use. #
530 #################################################################################
532 # Get the CSS Style name.
535 my $cssstyle = shift;
537 # Check if the CSS style given is undefined and
538 # if it is then set it blank.
545 my $tabcount = $tablevel;
547 while ($tabcount > 0){
548 $tagdata = $tagdata . "\t";
549 $tabcount = $tabcount - 1;
552 # Start an information box.
554 $tagdata = $tagdata . "<div";
556 if ($cssstyle ne ""){
557 $tagdata = $tagdata . " class=\"" . $class->convert($cssstyle, "content") . "\"";
560 $tagdata = $tagdata . ">";
562 # Append the tag data to the page data.
564 $pagedata = $pagedata . $tagdata;
569 #################################################################################
570 # enterdata: Enter data into a information box. #
574 # $presmodule->enterdata(data); #
576 # data Specifies what data should be entered into the information box. #
577 #################################################################################
579 # Get the data for the information box.
584 # Append the data to the page data.
586 $pagedata = $pagedata . $class->convert($data, "content");
591 #################################################################################
592 # endbox: End an information box. #
596 # $presmodule->endbox(); #
597 #################################################################################
599 # End an information box.
602 $tagdata = $tagdata . "</div>" . "\r\n";
604 # Append the tag data to the page data.
606 $pagedata = $pagedata . $tagdata;
610 #################################################################################
612 #################################################################################
615 #################################################################################
616 # startform: Start a form. #
620 # $presmodule->startform(action, method); #
622 # action Specifies the action (address) the data should be sent to. #
623 # method Specifies the method to use (POST, GET) #
624 #################################################################################
631 my $tabcount = $tablevel;
633 # Check if the action and method values given
634 # are undefined and if they are set default
642 # The method is blank so set it to POST.
646 while ($tabcount > 0){
647 $tagdata = $tagdata . "\t";
648 $tabcount = $tabcount - 1;
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;
661 #################################################################################
662 # addcheckbox: Add a check box. #
666 # $presmodule->addcheckbox(checkboxname, {options}); #
668 # checkboxname Specifies the check box name. #
669 # options Specifies the following options below (in any order). #
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.
680 my ($checkboxname, $options) = @_;
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.
696 die("The checkbox name is blank.");
699 if (!$optiondescription){
700 $optiondescription = "";
715 while ($tabcount > 0){
716 $tagdata = $tagdata . "\t";
717 $tabcount = $tabcount - 1;
722 $tagdata = $tagdata . "<input type=\"checkbox\" name=\"" . $class->convert($checkboxname, "content") . "\"";
725 $tagdata = $tagdata . " class=\"" . $class->convert($style, "content") . "\"";
729 $tagdata = $tagdata . " checked";
732 $tagdata = $tagdata . ">";
734 if ($optiondescription ne ""){
735 $tagdata = $tagdata . " " . $class->convert($optiondescription, "content");
738 if ($linebreak eq 1){
742 $tagdata = $tagdata . "\r\n";
744 # Append the tag data to the page data.
746 $pagedata = $pagedata . $tagdata;
751 #################################################################################
752 # addradiobox: Add a radio box. #
756 # $presmodule->addradiobox(radioboxname, {options}); #
758 # radioboxname The name of the radio box. #
759 # options Specifies the following options below (in any order). #
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.
771 my ($radioboxname, $options) = @_;
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.
788 die("The radio box name is blank.");
795 if (!$optiondescription){
796 $optiondescription = "";
811 while ($tabcount > 0){
812 $tagdata = $tagdata . "\t";
813 $tabcount = $tabcount - 1;
818 $tagdata = $tagdata . "<input type=\"radio\" name=\"" . $class->convert($radioboxname, "content") . "\"";
821 $tagdata = $tagdata . " class=\"" . $class->convert($style, "content") . "\"";
825 $tagdata = $tagdata . " checked";
829 $tagdata = $tagdata . " value=\"" . $class->convert($value, "content") . "\"";
831 $tagdata = $tagdata . " value=\"0\"";
834 $tagdata = $tagdata . ">";
836 if ($optiondescription ne ""){
837 $tagdata = $tagdata . " " . $class->convert($optiondescription, "content");
840 if ($linebreak eq 1){
841 $tagdata = $tagdata . "<br>";
844 $tagdata = $tagdata . "\r\n";
846 # Append the tag data to the page data.
848 $pagedata = $pagedata . $tagdata;
852 #################################################################################
853 # addselectbox: Add a select box. #
857 # $presmodule->addselectbox(selectname, {options}); #
859 # selectboxname Specifies the name of the select box. #
860 # options Specifies the following options (in any order). #
862 # Style Specifies the CSS style to use. #
863 #################################################################################
865 # Get the options recieved.
868 my ($selectboxname, $options) = @_;
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.")
888 while ($tabcount > 0){
889 $tagdata = $tagdata . "\t";
890 $tabcount = $tabcount - 1;
895 $tagdata = $tagdata . "<select name=\"" . $class->convert($selectboxname, "content") . "\"";
898 $tagdata = $tagdata = " class=\"" . $class->convert($style, "content") . "\"";
901 $tagdata = $tagdata . ">";
903 # Append the tag data to the page data.
905 $pagedata = $pagedata . $tagdata;
911 #################################################################################
912 # addoption: Add an option for a select box. #
916 # $presmodule->addoption(optionname, options); #
918 # optionname Specifies the name (description) of the option. #
919 # options Specifies the following options (in any order). #
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.
929 my ($optionname, $options) = @_;
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.
944 die("The option name given is blank.");
948 die("No value for the option was given.");
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.");
970 while ($tabcount > 0){
971 $tagdata = $tagdata . "\t";
972 $tabcount = $tabcount - 1;
975 # Add an option for a select box.
977 $tagdata = $tagdata . "<option value=\"" . $class->convert($value, "content") . "\"";
980 $tagdata = $tagdata . " class=\"" . $class->convert($style, "content") . "\"";
984 $tagdata = $tagdata . " selected";
987 $tagdata = $tagdata . ">" . $class->convert($optionname, "content") . "</option>\r\n";
989 # Append the tag data to the page data.
991 $pagedata = $pagedata . $tagdata;
996 #################################################################################
997 # endselectbox: Ends a select box. #
1001 # $presmodule->endselectbox(); #
1002 #################################################################################
1007 $tablevel = ($tablevel - 1);
1008 my $tabcount = $tablevel;
1010 while ($tabcount > 0){
1011 $tagdata = $tagdata . "\t";
1012 $tabcount = $tabcount - 1;
1015 $tagdata = $tagdata . "</select>" . "\r\n";
1017 # Append the tag data to the page data.
1019 $pagedata = $pagedata . $tagdata;
1024 #################################################################################
1025 # addinputbox: Add a input text box. #
1029 # $presmodule->addinputbox(inputboxname, options); #
1031 # inputboxname Specifies the name of the input text box. #
1032 # options Specifies the following options (in any order). #
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.
1043 my ($inputboxname, $options) = @_;
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.");
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.");
1096 if ($maxlength_validated ne ""){
1097 die("The maximum length given is invalid.");
1100 while ($tabcount > 0){
1101 $tagdata = $tagdata . "\t";
1102 $tabcount = $tabcount - 1;
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\" ";
1119 # The field should be a text field.
1121 $tagdata = $tagdata . "type=\"text\" ";
1125 $tagdata = $tagdata . "name=\"" . $class->convert($inputboxname, "content") . "\"";
1128 $tagdata = $tagdata . " size=\"" . $class->convert($size, "content") . "\"";
1131 if ($maxlength > 0){
1132 $tagdata = $tagdata . " maxlength=\"" . $class->convert($maxlength, "content") . "\"";
1136 $tagdata = $tagdata . " class=\"" . $class->convert($style, "content") . "\"";
1140 $tagdata = $tagdata . " value=\"" . $class->convert($value, "content") . "\"";
1143 $tagdata = $tagdata . ">" . "\r\n";
1145 # Append the tag data to the page data.
1147 $pagedata = $pagedata . $tagdata;
1152 #################################################################################
1153 # addtextbox: Add a multiple line text box. #
1157 # $presmodule->addtextbox(textboxname, options); #
1159 # textboxname Specifies the name of the multiple line text box. #
1160 # options Specifies the following options (in any order). #
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.
1171 my ($textboxname, $options) = @_;
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.
1187 die("The multiple line text box name is blank.");
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.");
1219 if ($rows_validated ne ""){
1220 die("The rows value given is invalid.");
1223 while ($tabcount > 0){
1224 $tagdata = $tagdata . "\t";
1225 $tabcount = $tabcount - 1;
1228 # Add a multiple line text box.
1230 $tagdata = $tagdata . "<textarea name=\"" . $class->convert($textboxname, "content") . "\"";
1233 $tagdata = $tagdata . " cols=\"" . $class->convert($columns, "content") . "\"";
1237 $tagdata = $tagdata . " rows=\"" . $class->convert($rows, "content") . "\"";
1241 $tagdata = $tagdata . " class=\"" . $class->convert($style, "content") . "\"";
1244 $tagdata = $tagdata . ">";
1245 $tagdata = $tagdata . $class->convert($value, "content");
1246 $tagdata = $tagdata . "</textarea>" . "\r\n";
1248 # Append the tag data to the page data.
1250 $pagedata = $pagedata . $tagdata;
1255 #################################################################################
1256 # addsubmit: Add a submit button. #
1260 # $pagemodule->addsubmit(submitname, options); #
1262 # submitname Specifies the name (label) of the submit button. #
1263 # options Specifies the following options (in any order). #
1265 # Style Specifies the CSS style to use. #
1266 #################################################################################
1268 # Get the options recieved.
1271 my ($submitname, $options) = @_;
1274 my $tabcount = $tablevel;
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.
1284 die("The submit name is blank.");
1291 while ($tabcount > 0){
1292 $tagdata = $tagdata . "\t";
1293 $tabcount = $tabcount - 1;
1296 # Add a submit button.
1298 $tagdata = $tagdata . "<input type=\"submit\" value=\"" . $class->convert($submitname, "content") . "\"";
1301 $tagdata = $tagdata . " class=\"" . $class->convert($style, "content") . "\"";
1304 $tagdata = $tagdata . ">" . "\r\n";
1306 # Append the tag data to the page data.
1308 $pagedata = $pagedata . $tagdata;
1313 #################################################################################
1314 # addreset: Add a reset button. #
1318 # $pagemodule->addreset(resetname, options); #
1320 # resetname Specifies the name (label) of the reset button. #
1321 # options Specifies the following options (in any order). #
1323 # Style Specifies the CSS style to use. #
1324 #################################################################################
1326 # Get the options recieved.
1329 my ($resetname, $options) = @_;
1332 my $tabcount = $tablevel;
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.
1342 die("The reset name is blank.");
1349 while ($tabcount > 0){
1350 $tagdata = $tagdata . "\t";
1351 $tabcount = $tabcount - 1;
1354 # Add a reset button.
1356 $tagdata = $tagdata . "<input type=\"reset\" value=\"" . $class->convert($resetname, "content") . "\"";
1359 $tagdata = $tagdata . " class=\"" . $class->convert($style, "content") . "\"";
1362 $tagdata = $tagdata . ">" . "\r\n";
1364 # Append the tag data to the page data.
1366 $pagedata = $pagedata . $tagdata;
1371 #################################################################################
1372 # addhiddendata: Adds hidden data to the form. #
1376 # $presmodule->addhiddendata(name, value); #
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.
1385 my ($name, $value) = @_;
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.
1394 die("The name for the hidden data is blank.");
1401 while ($tabcount > 0){
1402 $tagdata = $tagdata . "\t";
1403 $tabcount = $tabcount - 1;
1408 $tagdata = $tagdata . "<input type=\"hidden\" name=\"" . $class->convert($name, "content") . "\"";
1411 $tagdata = $tagdata . " value=\"" . $class->convert($value, "content") . "\"";
1414 $tagdata = $tagdata . ">" . "\r\n";
1416 # Add the tag data to the page data.
1418 $pagedata = $pagedata . $tagdata;
1423 #################################################################################
1424 # addbutton: Add a button. #
1428 # $presmodule->addbutton(buttonname, options); #
1430 # buttonname Specifies the name of button. #
1431 # options Specifies the following options below (in any order). #
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.
1441 my ($buttonname, $options) = @_;
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.
1456 die("The name for button is blank.");
1464 die("The description for the button is blank.");
1471 while ($tabcount > 0){
1472 $tagdata = $tagdata . "\t";
1473 $tabcount = $tabcount - 1;
1478 $tagdata = $tagdata . "<button name=\"" . $class->convert($buttonname, "content") . "\"";
1481 $tagdata = $tagdata . " value=\"" . $class->convert($value, "content") . "\"";
1485 $tagdata = $tagdata . " class=\"" . $class->convert($style, "content") . "\"";
1488 $tagdata = $tagdata . ">" . $class->convert($description, "content") . "</button>\r\n";
1490 # Add the tag data to the page data.
1492 $pagedata = $pagedata . $tagdata;
1497 #################################################################################
1498 # endform: Ends a form. #
1502 # $presmodule->endform(); #
1503 #################################################################################
1508 $tablevel = ($tablevel - 1);
1509 my $tabcount = $tablevel;
1511 while ($tabcount > 0){
1512 $tagdata = $tagdata . "\t";
1513 $tabcount = $tabcount - 1;
1516 $tagdata = $tagdata . "</form>" . "\r\n";
1518 # Append the tag data to the page data.
1520 $pagedata = $pagedata . $tagdata;
1524 #################################################################################
1526 #################################################################################
1529 #################################################################################
1530 # addlink: Adds a link. #
1534 # $presmodule->addlink(link, options); #
1536 # Link Specifies the location of the link. #
1537 # options Specifies the following options below (in any order). #
1539 # Target Specifies the target window for the link. #
1540 # Text Specifies the text to use. #
1541 #################################################################################
1543 # Get the options recieved.
1546 my ($link, $options) = @_;
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.
1561 die("The link specified was blank.");
1572 while ($tabcount > 0){
1573 $tagdata = $tagdata . "\t";
1574 $tabcount = $tabcount - 1;
1579 $tagdata = "<a href=\"" . $class->convert($link, "link") . "\"";
1582 $tagdata = $tagdata . " target=\"" . $class->convert($target, "content") . "\"";
1585 $tagdata = $tagdata . ">" . $class->convert($name, "content") . "</a>" . "\r\n";
1587 # Append the tag data to the page data.
1589 $pagedata = $pagedata . $tagdata;
1593 #################################################################################
1595 #################################################################################
1598 #################################################################################
1599 # addimage: Adds an image. #
1603 # $presmodule->addimage(image, options); #
1605 # image Specifies the location of the image. #
1606 # options Specifies the following options below (in any order). #
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.
1617 my ($image, $options) = @_;
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.
1632 die("The link to the image given is blank");
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.");
1660 if (!$height_validated){
1661 die("The height value given is invalid.");
1664 while ($tabcount > 0){
1665 $tagdata = $tagdata . "\t";
1666 $tabcount = $tabcount - 1;
1671 $tagdata = $tagdata . "<img src=\"" . $class->convert($image, "content") . "\"";
1674 $tagdata = $tagdata . " class=\"" . $class->convert($style, "content") . "\"";
1678 $tagdata = $tagdata . " width=\"" . $class->convert($width, "content") . "\"";
1682 $tagdata = $tagdata . " height=\"" . $class->convert($height, "content") . "\"";
1685 $tagdata = $tagdata . ">" . "\r\n";
1687 # Append the tag data to the page data.
1689 $pagedata = $pagedata . $tagdata;
1693 #################################################################################
1695 #################################################################################
1698 #################################################################################
1699 # addtext: Adds some text. #
1703 # $presmodule->addtext(text, options); #
1705 # text Specifies the text to add. #
1706 # options Specifies the following options below (in any order). #
1708 # Style Specifies the CSS style to use. #
1709 #################################################################################
1711 # Get the options recieved.
1714 my ($text, $options) = @_;
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.
1737 $tagdata = $tagdata . "<span class=\"" . $class->convert($style, "content") . "\">" . $class->convert($text, "content") . "</span>";
1739 $tagdata = $tagdata . $class->convert($text, "content");
1742 # Append the tagdata to the pagedata.
1744 $pagedata = $pagedata . $tagdata;
1749 #################################################################################
1750 # addboldtext: Adds some bold text. #
1754 # $presmodule->addboldtext(text, options); #
1756 # text Specifies the text to add. #
1757 # options Specifies the following options below (in any order). #
1759 # Style Specifies the CSS style to use. #
1760 #################################################################################
1762 # Get the options recieved.
1765 my ($text, $options) = @_;
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.
1778 die("The text given was blank.");
1785 # Add some bold text.
1788 $tagdata = $tagdata . "<span class=\"" . $style . "\">" . $class->convert($text, "content") . "</span>";
1790 $tagdata = $tagdata . "<b>" . $class->convert($text, "content") . "</b>";
1793 # Append the tagdata to the pagedata.
1795 $pagedata = $pagedata . $tagdata;
1800 #################################################################################
1801 # addboldtext: Adds some italic text. #
1805 # $presmodule->additalictext(text, options); #
1807 # text Specifies the text to add. #
1808 # options Specifies the following options below (in any order). #
1810 # Style Specifies the CSS style to use. #
1811 #################################################################################
1813 # Get the options recieved.
1816 my ($text, $options) = @_;
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.
1829 die("The text given was blank.");
1836 # Add some italic text.
1839 $tagdata = $tagdata . "<span class=\"\">" . $class->convert($text, "content") . "</span>";
1841 $tagdata = $tagdata . "<i>" . $class->convert($text, "content") . "</i>";
1844 # Append the tagdata to the pagedata.
1846 $pagedata = $pagedata . $tagdata;
1851 #################################################################################
1852 # addlinebreak: Adds a line break specific to the output format. #
1856 # $presmodule->addlinebreak(); #
1857 #################################################################################
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. #
1877 # $presmodule->addhorizontalline(); #
1878 #################################################################################
1880 # Add a horizontal line.
1884 $tagdata = "<hr>" . "\r\n";
1886 # Append the tagdata to the pagedata.
1888 $pagedata = $pagedata . $tagdata;
1892 #################################################################################
1894 #################################################################################
1897 #################################################################################
1898 # startlist: Start a list. #
1902 # $presmodule->startlist(); #
1903 #################################################################################
1908 my $tabcount = $tablevel;
1910 while ($tabcount > 0){
1911 $tagdata = $tagdata . "\t";
1912 $tabcount = $tabcount - 1;
1915 $tagdata = $tagdata . "<ul>" . "\r\n";
1917 # Append the tag data to the page data.
1919 $pagedata = $pagedata . $tagdata;
1925 #################################################################################
1926 # additem: Adds an item to the list. #
1930 # $presmodule->additem(text, options); #
1932 # text Specifies the text to use for the item. #
1933 # options Specifies the following options (in any order). #
1935 # Style Specifies the CSS style to use. #
1936 #################################################################################
1938 # Get the options recieved.
1941 my ($text, $options) = @_;
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.
1954 die("The text given was blank.");
1961 # Add an item to the list.
1963 $tagdata = $tagdata . "<li ";
1966 $tagdata = $tagdata . " class=\"" . $class->convert($style, "content") . "\"";
1969 $tagdata = $tagdata . ">" . $class->convert($text, "content");
1971 # Append the tag data to the page data.
1973 $pagedata = $pagedata . $tagdata;
1978 #################################################################################
1979 # endlist: End a list. #
1983 # $presmodule-endlist(); #
1984 #################################################################################
1989 $tablevel = ($tablevel - 1);
1990 my $tabcount = $tablevel;
1992 while ($tabcount > 0){
1993 $tagdata = $tagdata . "\t";
1994 $tabcount = $tabcount - 1;
1997 $tagdata = $tagdata . "</ul>" . "\r\n";
1999 # Append the tag data to the page data.
2001 $pagedata = $pagedata . $tagdata;