1 #################################################################################
2 # Xestia Scanner Server Presentation Module - HTML 4.0 Strict (HTML4S.pm) #
3 # Output Module for writing pages to the HTML 4.0 Strict Standard #
5 # Copyright (C) 2007-2011 Steve Brokenshire <sbrokenshire@xestia.co.uk> #
7 # This module is licensed under the same license as Xestia Scanner Server which #
8 # is licensed under the GPL version 3. #
10 # This program is free software: you can redistribute it and/or modify #
11 # it under the terms of the GNU General Public License as published by #
12 # the Free Software Foundation, version 3 of the License. #
14 # This program is distributed in the hope that it will be useful, #
15 # but WITHOUT ANY WARRANTY; without even the implied warranty of #
16 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
17 # GNU General Public License for more details. #
19 # You should have received a copy of the GNU General Public License #
20 # along with this program. If not, see <http://www.gnu.org/licenses/>. #
21 #################################################################################
23 # Define the package (perl module) name.
25 package Modules::Presentation::HTML4S;
27 # Enable strict and use warnings.
32 # Set the following values.
34 our $VERSION = "0.1.0";
38 #################################################################################
39 # Generic Subroutines. #
40 #################################################################################
43 #################################################################################
44 # new: Create an instance of HTML4S #
48 # $presmodule = Modules::Presentation::HTML4S->new(); #
49 #################################################################################
51 # Get the perl module name.
56 return bless($self, $class);
61 #################################################################################
62 # clear: Clear the current layout created by this module. #
66 # $presmodule->clear(); #
67 #################################################################################
75 #################################################################################
76 # grab: Grab the current layout created by this module. #
80 # $presmodule->grab(); #
81 #################################################################################
88 #################################################################################
89 # convert: Converts the data passed into data that is compliant with the output #
94 # $presmodule->convert(data, type); #
96 # data Specifies the data to be converted. #
97 # type Specifies the type the data should be converted to. #
98 #################################################################################
100 # Get the data and type passed.
103 my ($data, $type) = @_;
105 # Check if certain values are undefined and if they are
106 # then set them blank or return an error.
113 die("No type was specified");
116 # Check what type is being used and process the data
117 # according the type being used.
119 if ($type eq "content"){
121 $data =~ s/&/&/g;
122 $data =~ s/#/#/g;
123 $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;
133 $data =~ s/'/'/g;
137 } elsif ($type eq "link"){
139 $data =~ s/&/&/g;
140 $data =~ s/\+/\%2B/g;
141 $data =~ s/\?/\%3F/g;
145 $data =~ s/\@/\%40/g;
155 die("An invalid type was specified.");
163 #################################################################################
164 # Tags for creating tables. #
165 #################################################################################
168 #################################################################################
169 # starttable: Start a table. #
173 # $presmodule->starttable(cssstyle, {options}); #
175 # cssstyle Specifies the CSS style name to use. #
176 # options Specifies the following options (in any order): #
178 # CellPadding The cell padding to be used for each table. #
179 # CellSpacing The cell spacing to be used for each table. #
180 #################################################################################
182 # Get the CSS style and options.
185 my ($cssstyle, $options) = @_;
188 my $tabcount = $tablevel;
190 my $cellpadding = $options->{'CellPadding'};
191 my $cellspacing = $options->{'CellSpacing'};
193 # Check if the cell padding and cell spacing and
194 # CSS style values are blank and if they are then
209 # Check if the cell padding and cell spacing values
210 # are valid and die if it isn't.
212 my $cellpadding_validated = $cellpadding;
213 my $cellspacing_validated = $cellspacing;
215 $cellpadding_validated =~ tr/0-9//d;
216 $cellspacing_validated =~ tr/0-9//d;
218 if ($cellpadding_validated ne ""){
219 die("Cell padding value given is invalid.");
222 if ($cellspacing_validated ne ""){
223 die("Cell spacing value given is invalid.");
226 while ($tabcount > 0){
227 $tagdata = $tagdata . "\t";
228 $tabcount = $tabcount - 1;
233 $tagdata = $tagdata . "<table";
235 # Check if the cell spacing and cell padding has values
238 if ($cellspacing >= 0){
239 $tagdata = $tagdata . " cellspacing=\"" . $cellspacing . "\"";
242 if ($cellpadding > 0){
243 $tagdata = $tagdata . " cellpadding=\"" . $cellpadding . "\"";
246 if ($cssstyle ne ""){
247 $tagdata = $tagdata . " class=\"" . $class->convert($cssstyle, "content") . "\"";
250 $tagdata = $tagdata . ">" . "\r\n";
252 # Append the tag data to the page data.
254 $pagedata = $pagedata . $tagdata;
260 #################################################################################
261 # startheader: Start a table header. #
265 # $presmodule->startheader(); #
266 #################################################################################
268 # Start a table header row.
271 my $tabcount = $tablevel;
273 while ($tabcount > 0){
274 $tagdata = $tagdata . "\t";
275 $tabcount = $tabcount - 1;
278 $tagdata = $tagdata . "<tr>" . "\r\n";
280 # Append the tag data to the page data.
282 $pagedata = $pagedata . $tagdata;
288 #################################################################################
289 # addheader: Add a table header. #
293 # $presmodule->addheader(headername, {options}); #
295 # headername Specifies the name of the table header to use. #
296 # options Specifies the following options below (in any order): #
298 # Style Specifies the CSS Style to use for the table header. #
299 #################################################################################
301 # Get the header name and options.
304 my ($headername, $options) = @_;
306 my $cssstyle = $options->{'Style'};
308 # Check if the CSS Style or header name is undefined and
309 # if they are then set them blank.
320 my $tabcount = $tablevel;
322 while ($tabcount > 0){
323 $tagdata = $tagdata . "\t";
324 $tabcount = $tabcount - 1;
327 $tagdata = $tagdata . "<th";
329 if ($cssstyle ne ""){
330 $tagdata = $tagdata . " class=\"" . $class->convert($cssstyle, "content") . "\"";
333 $tagdata = $tagdata . ">" . $class->convert($headername, "content") . "</th>" . "\r\n";
335 # Append the tag data to the page data.
337 $pagedata = $pagedata . $tagdata;
342 #################################################################################
343 # endheader: End a table header row #
347 # $presmodule->endheader(); #
348 #################################################################################
350 # End a table header row.
353 $tablevel = ($tablevel - 1);
354 my $tabcount = $tablevel;
356 while ($tabcount > 0){
357 $tagdata = $tagdata . "\t";
358 $tabcount = $tabcount - 1;
361 $tagdata = $tagdata . "</tr>" . "\r\n";
363 # Append the tag data to the page data.
365 $pagedata = $pagedata . $tagdata;
370 #################################################################################
371 # startrow: Start a table row. #
375 # $presmodule->startrow(); #
376 #################################################################################
381 my $tabcount = $tablevel;
383 while ($tabcount > 0){
384 $tagdata = $tagdata . "\t";
385 $tabcount = $tabcount - 1;
388 $tagdata = $tagdata . "<tr>" . "\r\n";
390 # Append the tag data to the page data.
392 $pagedata = $pagedata . $tagdata;
398 #################################################################################
399 # addcell: Add a table cell. #
403 # $presmodule->addcell(style); #
405 # style Specifies which CSS Style to use. #
406 #################################################################################
408 # Get the cell information and options.
412 my $tabcount = $tablevel;
415 # Check if the cell data and CSS style are undefined
416 # and if they are then set them blank.
422 while ($tabcount > 0){
423 $tagdata = $tagdata . "\t";
424 $tabcount = $tabcount - 1;
427 $tagdata = $tagdata . "<td";
429 if ($cssstyle ne ""){
430 $tagdata = $tagdata . " class=\"" . $class->convert($cssstyle, "content") . "\"";
433 $tagdata = $tagdata . ">";
435 # Append the tag data to the page data.
437 $pagedata = $pagedata . $tagdata;
442 #################################################################################
443 # endcell: End a table cell. #
447 # $presmodule->endcell(); #
448 #################################################################################
454 $tagdata = $tagdata . "</td>" . "\r\n";
456 # Append the tag data to the page data.
458 $pagedata = $pagedata . $tagdata;
463 #################################################################################
464 # endrow: Ends a table row. #
468 # $presmodule->endrow(); #
469 #################################################################################
474 $tablevel = ($tablevel - 1);
475 my $tabcount = $tablevel;
477 while ($tabcount > 0){
478 $tagdata = $tagdata . "\t";
479 $tabcount = $tabcount - 1;
482 $tagdata = $tagdata . "</tr>" . "\r\n";
484 # Append the tag data to the page data.
486 $pagedata = $pagedata . $tagdata;
491 #################################################################################
492 # endtable: Ends a table. #
496 # $presmodule->endtable(); #
497 #################################################################################
502 $tablevel = ($tablevel - 1);
503 my $tabcount = $tablevel;
505 while ($tabcount > 0){
506 $tagdata = $tagdata . "\t";
507 $tabcount = $tabcount - 1;
510 $tagdata = $tagdata . "</table>" . "\r\n";
512 # Append the tag data to the page data.
514 $pagedata = $pagedata . $tagdata;
518 #################################################################################
520 #################################################################################
523 #################################################################################
524 # startbox: Start an information box. #
528 # $presmodule->startbox(cssstyle); #
530 # cssstyle Specifies the CSS Style to use. #
531 #################################################################################
533 # Get the CSS Style name.
536 my $cssstyle = shift;
538 # Check if the CSS style given is undefined and
539 # if it is then set it blank.
546 my $tabcount = $tablevel;
548 while ($tabcount > 0){
549 $tagdata = $tagdata . "\t";
550 $tabcount = $tabcount - 1;
553 # Start an information box.
555 $tagdata = $tagdata . "<div";
557 if ($cssstyle ne ""){
558 $tagdata = $tagdata . " class=\"" . $class->convert($cssstyle, "content") . "\"";
561 $tagdata = $tagdata . ">";
563 # Append the tag data to the page data.
565 $pagedata = $pagedata . $tagdata;
570 #################################################################################
571 # enterdata: Enter data into a information box. #
575 # $presmodule->enterdata(data); #
577 # data Specifies what data should be entered into the information box. #
578 #################################################################################
580 # Get the data for the information box.
585 # Append the data to the page data.
587 $pagedata = $pagedata . $class->convert($data, "content");
592 #################################################################################
593 # endbox: End an information box. #
597 # $presmodule->endbox(); #
598 #################################################################################
600 # End an information box.
603 $tagdata = $tagdata . "</div>" . "\r\n";
605 # Append the tag data to the page data.
607 $pagedata = $pagedata . $tagdata;
611 #################################################################################
613 #################################################################################
616 #################################################################################
617 # startform: Start a form. #
621 # $presmodule->startform(action, method); #
623 # action Specifies the action (address) the data should be sent to. #
624 # method Specifies the method to use (POST, GET) #
625 #################################################################################
632 my $tabcount = $tablevel;
634 # Check if the action and method values given
635 # are undefined and if they are set default
643 # The method is blank so set it to POST.
647 while ($tabcount > 0){
648 $tagdata = $tagdata . "\t";
649 $tabcount = $tabcount - 1;
652 $tagdata = $tagdata . "<form action=\"" . $class->convert($action, "content") . "\" method=\"" . $class->convert($method, "content") . "\">" . "\r\n";
654 # Append the tag data to the page data.
656 $pagedata = $pagedata . $tagdata;
662 #################################################################################
663 # addcheckbox: Add a check box. #
667 # $presmodule->addcheckbox(checkboxname, {options}); #
669 # checkboxname Specifies the check box name. #
670 # options Specifies the following options below (in any order). #
672 # OptionDescription Specifies a description for the checkbox value. #
673 # Style Specifies the CSS style to use. #
674 # Checked Specifies if the checkbox is checked. #
675 # LineBreak Specifies if a line break should be added. #
676 # ReadOnly Specifies the check box is read only. #
677 #################################################################################
679 # Get the options recieved.
682 my ($checkboxname, $options) = @_;
685 my $tabcount = $tablevel;
687 # Get certain values from the hash.
689 my $optiondescription = $options->{'OptionDescription'};
690 my $style = $options->{'Style'};
691 my $checked = $options->{'Checked'};
692 my $linebreak = $options->{'LineBreak'};
693 my $readonly = $options->{'ReadOnly'};
695 # Check if certain values are undefined and if they
696 # are then set them blank or to a default value.
699 die("The checkbox name is blank.");
702 if (!$optiondescription){
703 $optiondescription = "";
722 while ($tabcount > 0){
723 $tagdata = $tagdata . "\t";
724 $tabcount = $tabcount - 1;
729 $tagdata = $tagdata . "<input type=\"checkbox\" name=\"" . $class->convert($checkboxname, "content") . "\"";
732 $tagdata = $tagdata . " class=\"" . $class->convert($style, "content") . "\"";
736 $tagdata = $tagdata . " checked";
740 $tagdata = $tagdata . " disabled";
743 $tagdata = $tagdata . ">";
745 if ($optiondescription ne ""){
746 $tagdata = $tagdata . " " . $class->convert($optiondescription, "content");
749 if ($linebreak eq 1){
750 $tagdata = $tagdata . "<br>";
753 $tagdata = $tagdata . "\r\n";
755 # Append the tag data to the page data.
757 $pagedata = $pagedata . $tagdata;
762 #################################################################################
763 # addradiobox: Add a radio box. #
767 # $presmodule->addradiobox(radioboxname, {options}); #
769 # radioboxname The name of the radio box. #
770 # options Specifies the following options below (in any order). #
772 # Description Specifies a description for the checkbox value. #
773 # Style Specifies the CSS style to use. #
774 # Selected Specifies if the radio box is selected. #
775 # LineBreak Specifies if a line break should be used. #
776 # Value Specifies the value of the radio box. #
777 # ReadOnly Specifies the radio box is read only. #
778 #################################################################################
780 # Get the options recieved.
783 my ($radioboxname, $options) = @_;
786 my $tabcount = $tablevel;
788 # Get certain values from the hash.
790 my $optiondescription = $options->{'Description'};
791 my $style = $options->{'Style'};
792 my $selected = $options->{'Selected'};
793 my $linebreak = $options->{'LineBreak'};
794 my $value = $options->{'Value'};
795 my $readonly = $options->{'ReadOnly'};
797 # Check if certain values are undefined and if they
798 # are then set them blank or to a default value.
801 die("The radio box name is blank.");
808 if (!$optiondescription){
809 $optiondescription = "";
828 while ($tabcount > 0){
829 $tagdata = $tagdata . "\t";
830 $tabcount = $tabcount - 1;
835 $tagdata = $tagdata . "<input type=\"radio\" name=\"" . $class->convert($radioboxname, "content") . "\"";
838 $tagdata = $tagdata . " class=\"" . $class->convert($style, "content") . "\"";
842 $tagdata = $tagdata . " checked";
846 $tagdata = $tagdata . " disabled";
850 $tagdata = $tagdata . " value=\"" . $class->convert($value, "content") . "\"";
852 $tagdata = $tagdata . " value=\"0\"";
855 $tagdata = $tagdata . ">";
857 if ($optiondescription ne ""){
858 $tagdata = $tagdata . " " . $class->convert($optiondescription, "content");
861 if ($linebreak eq 1){
862 $tagdata = $tagdata . "<br>";
865 $tagdata = $tagdata . "\r\n";
867 # Append the tag data to the page data.
869 $pagedata = $pagedata . $tagdata;
873 #################################################################################
874 # addselectbox: Add a select box. #
878 # $presmodule->addselectbox(selectname, {options}); #
880 # selectboxname Specifies the name of the select box. #
881 # options Specifies the following options (in any order). #
883 # Style Specifies the CSS style to use. #
884 # ReadOnly Specifies the select box is read only. #
885 #################################################################################
887 # Get the options recieved.
890 my ($selectboxname, $options) = @_;
893 my $tabcount = $tablevel;
895 # Get certain values from the hash.
897 my $style = $options->{'Style'};
898 my $readonly = $options->{'ReadOnly'};
900 # Check if certain values are undefined and if they
901 # are then set them blank or to a default value.
903 if (!$selectboxname){
904 die("The select box name is blank.")
915 while ($tabcount > 0){
916 $tagdata = $tagdata . "\t";
917 $tabcount = $tabcount - 1;
922 $tagdata = $tagdata . "<select name=\"" . $class->convert($selectboxname, "content") . "\"";
925 $tagdata = $tagdata = " class=\"" . $class->convert($style, "content") . "\"";
929 $tagdata = $tagdata . " disabled";
932 $tagdata = $tagdata . ">";
934 # Append the tag data to the page data.
936 $pagedata = $pagedata . $tagdata;
942 #################################################################################
943 # addoption: Add an option for a select box. #
947 # $presmodule->addoption(optionname, options); #
949 # optionname Specifies the name (description) of the option. #
950 # options Specifies the following options (in any order). #
952 # Style Specifies the CSS style to be used. #
953 # Value Specifies the value of the option. #
954 # Selected This option is selected as default when the page is displayed. #
955 #################################################################################
957 # Get the options recieved.
960 my ($optionname, $options) = @_;
963 my $tabcount = $tablevel;
965 # Get certain values from the hash.
967 my $style = $options->{'Style'};
968 my $value = $options->{'Value'};
969 my $selected = $options->{'Selected'};
971 # Check if certain values are undefined and if they
972 # are then set them blank or to a default value.
975 die("The option name given is blank.");
979 die("No value for the option was given.");
990 # Check if certain values are valid and return
991 # an error if they aren't.
993 my $selected_validated = $selected;
995 $selected_validated =~ tr/0-9//d;
997 if ($selected_validated ne ""){
998 die("The selection option is invalid.");
1001 while ($tabcount > 0){
1002 $tagdata = $tagdata . "\t";
1003 $tabcount = $tabcount - 1;
1006 # Add an option for a select box.
1008 $tagdata = $tagdata . "<option value=\"" . $class->convert($value, "content") . "\"";
1011 $tagdata = $tagdata . " class=\"" . $class->convert($style, "content") . "\"";
1014 if ($selected eq 1){
1015 $tagdata = $tagdata . " selected";
1018 $tagdata = $tagdata . ">" . $class->convert($optionname, "content") . "</option>\r\n";
1020 # Append the tag data to the page data.
1022 $pagedata = $pagedata . $tagdata;
1027 #################################################################################
1028 # endselectbox: Ends a select box. #
1032 # $presmodule->endselectbox(); #
1033 #################################################################################
1038 $tablevel = ($tablevel - 1);
1039 my $tabcount = $tablevel;
1041 while ($tabcount > 0){
1042 $tagdata = $tagdata . "\t";
1043 $tabcount = $tabcount - 1;
1046 $tagdata = $tagdata . "</select>" . "\r\n";
1048 # Append the tag data to the page data.
1050 $pagedata = $pagedata . $tagdata;
1055 #################################################################################
1056 # addinputbox: Add a input text box. #
1060 # $presmodule->addinputbox(inputboxname, options); #
1062 # inputboxname Specifies the name of the input text box. #
1063 # options Specifies the following options (in any order). #
1065 # Size Specifies the size of the input text box. #
1066 # MaxLength Specifies the maximum length of the input text box. #
1067 # Style Specifies the CSS style to use. #
1068 # Value Specifies a value for the input box. #
1069 # Password Specifies the input box is a password box. #
1070 # ReadOnly Specifies the input box is read only. #
1071 #################################################################################
1073 # Get the options recieved.
1076 my ($inputboxname, $options) = @_;
1079 my $tabcount = $tablevel;
1081 # Get certain values from the hash.
1083 my $size = $options->{'Size'};
1084 my $maxlength = $options->{'MaxLength'};
1085 my $style = $options->{'Style'};
1086 my $value = $options->{'Value'};
1087 my $password = $options->{'Password'};
1088 my $readonly = $options->{'ReadOnly'};
1089 my $zerointeger = $options->{'ZeroInteger'};
1093 # Check if certain values are undefined and if they
1094 # are then set them blank or to a default value.
1096 if (!$inputboxname){
1097 die("The input box name given is blank.");
1128 # Check if certain values are valid and return
1129 # an error if they aren't.
1131 my $size_validated = $size;
1132 my $maxlength_validated = $maxlength;
1134 $size_validated =~ tr/0-9//d;
1135 $maxlength_validated =~ tr/0-9//d;
1137 if ($size_validated ne ""){
1138 die("The size given is invalid.");
1141 if ($maxlength_validated ne ""){
1142 die("The maximum length given is invalid.");
1145 while ($tabcount > 0){
1146 $tagdata = $tagdata . "\t";
1147 $tabcount = $tabcount - 1;
1150 # Add an input text box.
1152 $tagdata = "<input ";
1154 # Check if it should be a password field.
1156 if ($password eq 1){
1158 # The field should be a password field.
1160 $tagdata = $tagdata . "type=\"password\" ";
1164 # The field should be a text field.
1166 $tagdata = $tagdata . "type=\"text\" ";
1170 $tagdata = $tagdata . "name=\"" . $class->convert($inputboxname, "content") . "\"";
1173 $tagdata = $tagdata . " size=\"" . $class->convert($size, "content") . "\"";
1176 if ($maxlength > 0){
1177 $tagdata = $tagdata . " maxlength=\"" . $class->convert($maxlength, "content") . "\"";
1181 $tagdata = $tagdata . " class=\"" . $class->convert($style, "content") . "\"";
1185 $tagdata = $tagdata . " value=\"" . $class->convert($value, "content") . "\"";
1188 if ($value eq "" && $zerointeger eq 1){
1189 $tagdata = $tagdata . " value=\"0\"";
1192 if ($readonly eq 1){
1193 $tagdata = $tagdata . " disabled";
1196 $tagdata = $tagdata . ">" . "\r\n";
1198 # Append the tag data to the page data.
1200 $pagedata = $pagedata . $tagdata;
1205 #################################################################################
1206 # addtextbox: Add a multiple line text box. #
1210 # $presmodule->addtextbox(textboxname, options); #
1212 # textboxname Specifies the name of the multiple line text box. #
1213 # options Specifies the following options (in any order). #
1215 # Columns Specifies the width of the multiple line text box. #
1216 # Rows Specifies the height of the multiple line text box. #
1217 # Style Specifies the CSS style to use. #
1218 # Value Specifies a value for the multiple line text box. #
1219 # ReadOnly Specifies if the text box is read only. #
1220 #################################################################################
1222 # Get the options recieved.
1225 my ($textboxname, $options) = @_;
1228 my $tabcount = $tablevel;
1230 # Get certain values from the hash.
1232 my $columns = $options->{'Columns'};
1233 my $rows = $options->{'Rows'};
1234 my $style = $options->{'Style'};
1235 my $value = $options->{'Value'};
1236 my $readonly = $options->{'ReadOnly'};
1238 # Check if certain values are undefined and if they
1239 # are then set them blank or to a default value.
1242 die("The multiple line text box name is blank.");
1265 # Check if certain values are valid and return
1266 # an error if they aren't.
1268 my $columns_validated = $columns;
1269 my $rows_validated = $rows;
1271 $columns_validated =~ tr/0-9//d;
1272 $rows_validated =~ tr/0-9//d;
1274 if ($columns_validated ne ""){
1275 die("The columns value given is invalid.");
1278 if ($rows_validated ne ""){
1279 die("The rows value given is invalid.");
1282 while ($tabcount > 0){
1283 $tagdata = $tagdata . "\t";
1284 $tabcount = $tabcount - 1;
1287 # Add a multiple line text box.
1289 $tagdata = $tagdata . "<textarea name=\"" . $class->convert($textboxname, "content") . "\"";
1292 $tagdata = $tagdata . " cols=\"" . $class->convert($columns, "content") . "\"";
1296 $tagdata = $tagdata . " rows=\"" . $class->convert($rows, "content") . "\"";
1300 $tagdata = $tagdata . " class=\"" . $class->convert($style, "content") . "\"";
1303 if ($readonly eq 1){
1304 $tagdata = $tagdata . " disabled";
1307 $tagdata = $tagdata . ">";
1308 $tagdata = $tagdata . $class->convert($value, "content");
1309 $tagdata = $tagdata . "</textarea>" . "\r\n";
1311 # Append the tag data to the page data.
1313 $pagedata = $pagedata . $tagdata;
1318 #################################################################################
1319 # addsubmit: Add a submit button. #
1323 # $pagemodule->addsubmit(submitname, options); #
1325 # submitname Specifies the name (label) of the submit button. #
1326 # options Specifies the following options (in any order). #
1328 # Style Specifies the CSS style to use. #
1329 #################################################################################
1331 # Get the options recieved.
1334 my ($submitname, $options) = @_;
1337 my $tabcount = $tablevel;
1339 # Get certain values from the hash.
1341 my $style = $options->{'Style'};
1343 # Check if certain values are undefined and if they
1344 # are then set them blank or to a default value.
1347 die("The submit name is blank.");
1354 while ($tabcount > 0){
1355 $tagdata = $tagdata . "\t";
1356 $tabcount = $tabcount - 1;
1359 # Add a submit button.
1361 $tagdata = $tagdata . "<input type=\"submit\" value=\"" . $class->convert($submitname, "content") . "\"";
1364 $tagdata = $tagdata . " class=\"" . $class->convert($style, "content") . "\"";
1367 $tagdata = $tagdata . ">" . "\r\n";
1369 # Append the tag data to the page data.
1371 $pagedata = $pagedata . $tagdata;
1376 #################################################################################
1377 # addreset: Add a reset button. #
1381 # $pagemodule->addreset(resetname, options); #
1383 # resetname Specifies the name (label) of the reset button. #
1384 # options Specifies the following options (in any order). #
1386 # Style Specifies the CSS style to use. #
1387 #################################################################################
1389 # Get the options recieved.
1392 my ($resetname, $options) = @_;
1395 my $tabcount = $tablevel;
1397 # Get certain values from the hash.
1399 my $style = $options->{'Style'};
1401 # Check if certain values are undefined and if they
1402 # are then set them blank or to a default value.
1405 die("The reset name is blank.");
1412 while ($tabcount > 0){
1413 $tagdata = $tagdata . "\t";
1414 $tabcount = $tabcount - 1;
1417 # Add a reset button.
1419 $tagdata = $tagdata . "<input type=\"reset\" value=\"" . $class->convert($resetname, "content") . "\"";
1422 $tagdata = $tagdata . " class=\"" . $class->convert($style, "content") . "\"";
1425 $tagdata = $tagdata . ">" . "\r\n";
1427 # Append the tag data to the page data.
1429 $pagedata = $pagedata . $tagdata;
1434 #################################################################################
1435 # addhiddendata: Adds hidden data to the form. #
1439 # $presmodule->addhiddendata(name, value); #
1441 # name Specifies the name of the hidden data. #
1442 # value Specifies the value of the hidden data. #
1443 #################################################################################
1445 # Get the name and value.
1448 my ($name, $value) = @_;
1451 my $tabcount = $tablevel;
1453 # Check if certain values are undefined and if they
1454 # are then set them blank or to a default value.
1457 die("The name for the hidden data is blank.");
1464 while ($tabcount > 0){
1465 $tagdata = $tagdata . "\t";
1466 $tabcount = $tabcount - 1;
1471 $tagdata = $tagdata . "<input type=\"hidden\" name=\"" . $class->convert($name, "content") . "\"";
1474 $tagdata = $tagdata . " value=\"" . $class->convert($value, "content") . "\"";
1477 $tagdata = $tagdata . ">" . "\r\n";
1479 # Add the tag data to the page data.
1481 $pagedata = $pagedata . $tagdata;
1486 #################################################################################
1487 # addbutton: Add a button. #
1491 # $presmodule->addbutton(buttonname, options); #
1493 # buttonname Specifies the name of button. #
1494 # options Specifies the following options below (in any order). #
1496 # Value Specifies the value of the button. #
1497 # Description Specifies the description (label) of the button. #
1498 # Style Specifies the CSS style to use. #
1499 #################################################################################
1501 # Get the options recieved.
1504 my ($buttonname, $options) = @_;
1507 my $tabcount = $tablevel;
1509 # Get certain values from the hash.
1511 my $value = $options->{'Value'};
1512 my $description = $options->{'Description'};
1513 my $style = $options->{'Style'};
1515 # Check if certain values are undefined and if they
1516 # are then set them blank or to a default value.
1519 die("The name for button is blank.");
1527 die("The description for the button is blank.");
1534 while ($tabcount > 0){
1535 $tagdata = $tagdata . "\t";
1536 $tabcount = $tabcount - 1;
1541 $tagdata = $tagdata . "<button name=\"" . $class->convert($buttonname, "content") . "\"";
1544 $tagdata = $tagdata . " value=\"" . $class->convert($value, "content") . "\"";
1548 $tagdata = $tagdata . " class=\"" . $class->convert($style, "content") . "\"";
1551 $tagdata = $tagdata . ">" . $class->convert($description, "content") . "</button>\r\n";
1553 # Add the tag data to the page data.
1555 $pagedata = $pagedata . $tagdata;
1560 #################################################################################
1561 # endform: Ends a form. #
1565 # $presmodule->endform(); #
1566 #################################################################################
1571 $tablevel = ($tablevel - 1);
1572 my $tabcount = $tablevel;
1574 while ($tabcount > 0){
1575 $tagdata = $tagdata . "\t";
1576 $tabcount = $tabcount - 1;
1579 $tagdata = $tagdata . "</form>" . "\r\n";
1581 # Append the tag data to the page data.
1583 $pagedata = $pagedata . $tagdata;
1587 #################################################################################
1589 #################################################################################
1592 #################################################################################
1593 # addlink: Adds a link. #
1597 # $presmodule->addlink(link, options); #
1599 # Link Specifies the location of the link. #
1600 # options Specifies the following options below (in any order). #
1602 # Target Specifies the target window for the link. #
1603 # Text Specifies the text to use. #
1604 #################################################################################
1606 # Get the options recieved.
1609 my ($link, $options) = @_;
1612 my $tabcount = $tablevel;
1614 # Get certain values from the hash.
1616 my $target = $options->{'Target'};
1617 my $name = $options->{'Text'};
1618 my $embed = $options->{'Embed'};
1620 # Check if certain values are undefined and if they
1621 # are then set them blank or to a default value.
1624 die("The link specified was blank.");
1635 while ($tabcount > 0){
1636 $tagdata = $tagdata . "\t";
1637 $tabcount = $tabcount - 1;
1642 $tagdata = "<a href=\"" . $class->convert($link, "link") . "\"";
1645 $tagdata = $tagdata . " target=\"" . $class->convert($target, "content") . "\"";
1648 $tagdata = $tagdata . ">" . $class->convert($name, "content") . "</a>" . "\r\n";
1650 # Append the tag data to the page data.
1652 $pagedata = $pagedata . $tagdata;
1656 #################################################################################
1658 #################################################################################
1661 #################################################################################
1662 # addimage: Adds an image. #
1666 # $presmodule->addimage(image, options); #
1668 # image Specifies the location of the image. #
1669 # options Specifies the following options below (in any order). #
1671 # Style Specifies the CSS style to use. #
1672 # Description Specifies the description of the image. #
1673 # Width Specifies the width of the image. #
1674 # Height Specifies the height of the image. #
1675 #################################################################################
1677 # Get the options recieved.
1680 my ($image, $options) = @_;
1683 my $tabcount = $tablevel;
1685 # Get certain values from the hash.
1687 my $style = $options->{'Style'};
1688 my $width = $options->{'Width'};
1689 my $height = $options->{'Height'};
1691 # Check if certain values are undefined and if they
1692 # are then set them blank or to a default value.
1695 die("The link to the image given is blank");
1710 # Check if certain values are valid and return
1711 # an error if they aren't.
1713 my $width_validated = $width;
1714 my $height_validated = $height;
1716 $width_validated =~ tr/0-9//d;
1717 $height_validated =~ tr/0-9//d;
1719 #if (!$width_validated){
1720 # die("The width value given is invalid.");
1723 #if (!$height_validated){
1724 # die("The height value given is invalid.");
1727 while ($tabcount > 0){
1728 $tagdata = $tagdata . "\t";
1729 $tabcount = $tabcount - 1;
1734 $tagdata = $tagdata . "<img src=\"" . $class->convert($image, "content") . "\"";
1737 $tagdata = $tagdata . " class=\"" . $class->convert($style, "content") . "\"";
1741 $tagdata = $tagdata . " width=\"" . $class->convert($width, "content") . "\"";
1745 $tagdata = $tagdata . " height=\"" . $class->convert($height, "content") . "\"";
1748 $tagdata = $tagdata . ">" . "\r\n";
1750 # Append the tag data to the page data.
1752 $pagedata = $pagedata . $tagdata;
1756 #################################################################################
1758 #################################################################################
1761 #################################################################################
1762 # addtext: Adds some text. #
1766 # $presmodule->addtext(text, options); #
1768 # text Specifies the text to add. #
1769 # options Specifies the following options below (in any order). #
1771 # Style Specifies the CSS style to use. #
1772 #################################################################################
1774 # Get the options recieved.
1777 my ($text, $options) = @_;
1780 my $tabcount = $tablevel;
1782 # Get certain values from the hash.
1784 my $style = $options->{'Style'};
1786 # Check if certain values are undefined and if they
1787 # are then set them blank or to a default value.
1800 $tagdata = $tagdata . "<span class=\"" . $class->convert($style, "content") . "\">" . $class->convert($text, "content") . "</span>";
1802 $tagdata = $tagdata . $class->convert($text, "content");
1805 # Append the tagdata to the pagedata.
1807 $pagedata = $pagedata . $tagdata;
1812 #################################################################################
1813 # addboldtext: Adds some bold text. #
1817 # $presmodule->addboldtext(text, options); #
1819 # text Specifies the text to add. #
1820 # options Specifies the following options below (in any order). #
1822 # Style Specifies the CSS style to use. #
1823 #################################################################################
1825 # Get the options recieved.
1828 my ($text, $options) = @_;
1831 my $tabcount = $tablevel;
1833 # Get certain values from the hash.
1835 my $style = $options->{'Style'};
1837 # Check if certain values are undefined and if they
1838 # are then set them blank or to a default value.
1841 die("The text given was blank.");
1848 # Add some bold text.
1851 $tagdata = $tagdata . "<span class=\"" . $style . "\">" . $class->convert($text, "content") . "</span>";
1853 $tagdata = $tagdata . "<b>" . $class->convert($text, "content") . "</b>";
1856 # Append the tagdata to the pagedata.
1858 $pagedata = $pagedata . $tagdata;
1863 #################################################################################
1864 # addboldtext: Adds some italic text. #
1868 # $presmodule->additalictext(text, options); #
1870 # text Specifies the text to add. #
1871 # options Specifies the following options below (in any order). #
1873 # Style Specifies the CSS style to use. #
1874 #################################################################################
1876 # Get the options recieved.
1879 my ($text, $options) = @_;
1882 my $tabcount = $tablevel;
1884 # Get certain values from the hash.
1886 my $style = $options->{'Style'};
1888 # Check if certain values are undefined and if they
1889 # are then set them blank or to a default value.
1892 die("The text given was blank.");
1899 # Add some italic text.
1902 $tagdata = $tagdata . "<span class=\"\">" . $class->convert($text, "content") . "</span>";
1904 $tagdata = $tagdata . "<i>" . $class->convert($text, "content") . "</i>";
1907 # Append the tagdata to the pagedata.
1909 $pagedata = $pagedata . $tagdata;
1914 #################################################################################
1915 # addlinebreak: Adds a line break specific to the output format. #
1919 # $presmodule->addlinebreak(); #
1920 #################################################################################
1926 $tagdata = "<br>" . "\r\n";
1928 # Append the tagdata to the pagedata.
1930 $pagedata = $pagedata . $tagdata;
1934 sub addhorizontalline{
1935 #################################################################################
1936 # addhorizontalline: Adds a horizontal line. #
1940 # $presmodule->addhorizontalline(); #
1941 #################################################################################
1943 # Add a horizontal line.
1947 $tagdata = "<hr>" . "\r\n";
1949 # Append the tagdata to the pagedata.
1951 $pagedata = $pagedata . $tagdata;
1955 #################################################################################
1957 #################################################################################
1960 #################################################################################
1961 # startlist: Start a list. #
1965 # $presmodule->startlist(); #
1966 #################################################################################
1971 my $tabcount = $tablevel;
1973 while ($tabcount > 0){
1974 $tagdata = $tagdata . "\t";
1975 $tabcount = $tabcount - 1;
1978 $tagdata = $tagdata . "<ul>" . "\r\n";
1980 # Append the tag data to the page data.
1982 $pagedata = $pagedata . $tagdata;
1988 #################################################################################
1989 # additem: Adds an item to the list. #
1993 # $presmodule->additem(text, options); #
1995 # text Specifies the text to use for the item. #
1996 # options Specifies the following options (in any order). #
1998 # Style Specifies the CSS style to use. #
1999 #################################################################################
2001 # Get the options recieved.
2004 my ($text, $options) = @_;
2007 my $tabcount = $tablevel;
2009 # Get certain values from the hash.
2011 my $style = $options->{'Style'};
2013 # Check if certain values are undefined and if they
2014 # are then set them blank or to a default value.
2017 die("The text given was blank.");
2024 # Add an item to the list.
2026 $tagdata = $tagdata . "<li ";
2029 $tagdata = $tagdata . " class=\"" . $class->convert($style, "content") . "\"";
2032 $tagdata = $tagdata . ">" . $class->convert($text, "content");
2034 # Append the tag data to the page data.
2036 $pagedata = $pagedata . $tagdata;
2041 #################################################################################
2042 # endlist: End a list. #
2046 # $presmodule-endlist(); #
2047 #################################################################################
2052 $tablevel = ($tablevel - 1);
2053 my $tabcount = $tablevel;
2055 while ($tabcount > 0){
2056 $tagdata = $tagdata . "\t";
2057 $tabcount = $tabcount - 1;
2060 $tagdata = $tagdata . "</ul>" . "\r\n";
2062 # Append the tag data to the page data.
2064 $pagedata = $pagedata . $tagdata;