+Changes since version 0.2.0
+===========================
+
+- Fixed problem where changing the width and height of the large text
+ boxes in the settings where they wouldn't take effect.
+- Removed CGI.pm from installer and replaced it with CGI::Lite.
+- Added ability to change the amount of pages, templates and filters
+ that can be shown.
+
Changes since version 0.1.0
===========================
\r
<div class="code">\r
$kiriwrite_dbmodule->connectfilter(1);\r
- $kiriwrite_dbmodule->addfilter({ FindFilter => “This is the find filter.”, ReplaceFilter => “This is the replace filter.”, Priority => 1, Notes => “Some notes about the filter.” });\r
+ $kiriwrite_dbmodule->addfilter({ FindFilter => “This is the find filter.”, ReplaceFilter => “This is the replace filter.”, Priority => 1, Enabled => 1, Notes => “Some notes about the filter.” });\r
</div>\r
\r
<br>\r
<td class="tabledata">Priority</td>\r
<td class="tabledata">Specifies the priority setting of the new filter.</td>\r
</tr>\r
+ <tr>\r
+ <td class="tabledata">Enabled</td>\r
+ <td class="tabledata">Specifies if the filter should be used when compiling.</td>\r
+ </tr>\r
<tr>\r
<td class="tabledata">Notes</td>\r
<td class="tabledata">Specifies the notes for the new filter.</td>\r
\r
<div class="code">\r
$kiriwrite_dbmodule->connectfilter();<br>\r
- $kiriwrite_dbmodule->editfilter({ FilterID => 1, NewFindFilter => “The new find filter setting.”, NewReplaceFilter => “The new replace filter setting.”, NewFilterPriority => 2, NewFilterNotes => “The new notes of the filter.” });\r
+ $kiriwrite_dbmodule->editfilter({ FilterID => 1, NewFindFilter => “The new find filter setting.”, NewReplaceFilter => “The new replace filter setting.”, NewFilterPriority => 2, NewEnabled => 1, NewFilterNotes => “The new notes of the filter.” });\r
</div>\r
\r
options<br>\r
<td class="tabledata">NewFilterPriority</td>\r
<td class="tabledata">Specifies the new filter priority setting.</td>\r
</tr>\r
+ <tr>\r
+ <td class="tabledata">NewEnabled</td>\r
+ <td class="tabledata">Specifies if the filter should be used when compiling.</td>\r
+ </tr>\r
<tr>\r
<td class="tabledata">NewFilterNotes</td>\r
<td class="tabledata">Specifies the new filter notes.</td>\r
</tr>\r
<tr>\r
<td class="tabledata">Reduced</td>\r
- <td class="tabledata">Gets a reduced version of the filter information (filter identification number, priority, filter find setting and filter replace setting).</td>\r
+ <td class="tabledata">Gets a reduced version of the filter information (filter identification number, priority, filter find setting, filter replace setting and filter enabled setting).</td>\r
</tr>\r
</table>\r
\r
<body>\r
<div class="menubarback">\r
<div class="menubar">\r
- <span class="apptitle">Kiriwrite</span>
+ <span class="apptitle">Kiriwrite</span>\r
\r
</div>\r
</div>\r
<span class="pagetitle">User Documentation</span><br>\r
\r
The User Documentation contains information on how to install Kiriwrite, operate Kiriwrite, solutions to common problems that occur while using Kiriwrite and tips on using Kiriwrite.\r
-\r\r
+\r
+<br><br>\r
+\r
+<span class="heading">Contents</span><br>\r
+\r
+<a href="user-preface.html">Preface</a><br>\r
+<a href="user-introduction.html">Introduction</a><br>\r
+<a href="user-chapter1.html">Chapter 1: Installation</a><br>\r
+ <a href="user-chapter1-obtainingkiriwrite.html">1.1: Obtaining Kiriwrite</a><br>\r
+ <a href="user-chapter1-installingkiriwrite.html">1.2: Installing Kiriwrite</a><br>\r
+ <a href="user-chapter1-installerscript.html">1.3: Kiriwrite Installer Script</a><br>\r
+<a href="user-chapter2.html">Chapter 2: Operation</a><br>\r
+ <a href="user-chapter2-databases.html">2.1: Databases</a><br>\r
+ <a href="user-chapter2-pages.html">2.2: Pages</a><br>\r
+ <a href="user-chapter2-filters.html">2.3: Filters</a><br>\r
+ <a href="user-chapter2-templates.html">2.4: Templates</a><br>\r
+ <a href="user-chapter2-compiling.html">2.5: Compiling</a><br>\r
+<a href="user-chapter3.html">Chapter 3: Kiriwrite Settings</a><br>\r
+<a href="user-chapter4.html">Chapter 4: Usage Tips</a><br>\r
+ <a href="user-chapter4-securing.html">4.1: Securing your Kiriwrite installation</a><br>\r
+ <a href="user-chapter4-renaming.html">4.2: Renaming the Kiriwrite script (kiriwrite.cgi)</a><br>\r
+ <a href="user-chapter4-removing.html">4.3: Removing unneeded modules and language files</a><br>\r
+<a href="user-chapter5.html">Chapter 5: Troubleshooting</a><br>\r
+<a href="user-chapter6.html">Chapter 6: Contributing to Kiriwrite</a>\r
<hr>\r
<span class="pagetitle">Preface</span><br><br>\r
Kiriwrite originally came into existence in 2003 when I was designing a new layout for my personal website (Kirinji's Pad) and found that I had so many pages to edit, I had to find an easier way of editing the website layout as I needed to and apply those changes to all of the pages on the website very quickly.<br><br>\r
\r
To view the next (or previous list) of filters, click on the relevant link at the top of the page and to view a specific list of filters, select the list page number in the drop down menu box at the top of the page and click on the Show button.<br><br>\r
\r
+Filters that have a grey background are filters that have been disabled and won't be used when the pages are compiled.<br><br>\r
+\r
<span class="heading">2.3.1 Add a filter</span><br><br>\r
\r
To add a filter click on the 'Add Filter' link on the View Filters sub-menu, a form then appears allowing to enter the information about the new filter.<br><br>\r
<td class="tabledata">Notes</td>\r
<td class="tabledata">Specifies the notes for this filter.</td>\r
</tr>\r
+ <tr>\r
+ <td class="tabledata">Enable this filter</td>\r
+ <td class="tabledata">Specifies if the filter should be used when the pages are compiled.</td>\r
+ </tr>\r
</table>\r
\r
<br>\r
<td class="tabledata">Notes</td>\r
<td class="tabledata">Specifies the new notes for this filter.</td>\r
</tr>\r
+ <tr>\r
+ <td class="tabledata">Enable this filter</td>\r
+ <td class="tabledata">Specifies if the filter should be used when the pages are compiled.</td>\r
+ </tr>\r
</table>\r
\r
<br>\r
<td class="tabledata">Text Area Rows</td>\r
<td class="tabledata">Specifies the height of the text area when editing notes, pages and templates.</td>\r
</tr>\r
+ <tr>\r
+ <td class="tabledata">Pages on browse</td>\r
+ <td class="tabledata">Specifies the amount of pages that should be viewed when getting the list of pages in the database.</td>\r
+ </tr>\r
+ <tr>\r
+ <td class="tabledata">Filters on browse</td>\r
+ <td class="tabledata">Specifies the amount of filters that should be viewed when getting the list of filters in the database.</td>\r
+ </tr>\r
+ <tr>\r
+ <td class="tabledata">Templates on browse</td>\r
+ <td class="tabledata">Specifies the amount of templates that should be viewed when getting the list of templates in the database.</td>\r
+ </tr>\r
<tr>\r
<td class="tabledata">Date Format</td>\r
<td class="tabledata">Specifies the date format to use when list the pages from the database. A selection of date formats are available from the drop down box or a custom one can be entered into the text box next to the drop down box.</td>\r
TODO
====
+Changes implemented in 0.3.0
+============================
+
- Add the ability to switch off and on a filter.
+- Removed CGI.pm from the installer script.
+- Added ability to change the amount of pages, templates and filters that
+ can be viewed.
Changes implemented in 0.2.0
============================
if ($reduced && $reduced eq 1){
- $statement_handle = $database_handle->prepare('SELECT id, priority, findsetting, replacesetting FROM ' . $class->convert($options{"TablePrefix"}) . '_filters where id = \'' . $class->convert($filter_id) . '\'') or ( $error = "FilterDatabaseError", $errorext = $database_handle->errstr, return );
+ $statement_handle = $database_handle->prepare('SELECT id, priority, findsetting, replacesetting, enabled FROM ' . $class->convert($options{"TablePrefix"}) . '_filters where id = \'' . $class->convert($filter_id) . '\'') or ( $error = "FilterDatabaseError", $errorext = $database_handle->errstr, return );
$statement_handle->execute();
} else {
- $statement_handle = $database_handle->prepare('SELECT id, priority, findsetting, replacesetting, notes FROM ' . $class->convert($options{"TablePrefix"}) . '_filters where id = \'' . $class->convert($filter_id) . '\'') or ( $error = "FilterDatabaseError", $errorext = $database_handle->errstr, return );
+ $statement_handle = $database_handle->prepare('SELECT id, priority, findsetting, replacesetting, enabled, notes FROM ' . $class->convert($options{"TablePrefix"}) . '_filters where id = \'' . $class->convert($filter_id) . '\'') or ( $error = "FilterDatabaseError", $errorext = $database_handle->errstr, return );
$statement_handle->execute();
}
$filter_info{"FilterPriority"} = decode_utf8($filter_data[1]);
$filter_info{"FilterFind"} = decode_utf8($filter_data[2]);
$filter_info{"FilterReplace"} = decode_utf8($filter_data[3]);
- $filter_info{"FilterNotes"} = decode_utf8($filter_data[4]);
+ $filter_info{"FilterEnabled"} = decode_utf8($filter_data[4]);
+ $filter_info{"FilterNotes"} = decode_utf8($filter_data[5]);
$filter_exists = 1;
# FindFilter Specifies the find filter to add. #
# ReplaceFilter Specifies the replace filter to add. #
# Priority Specifies the filter priority to use. #
+# Enabled Specifies if the filter should be enabled. #
# Notes Specifies the notes to use. #
#################################################################################
my $filter_find = $passedoptions->{"FindFilter"};
my $filter_replace = $passedoptions->{"ReplaceFilter"};
my $filter_priority = $passedoptions->{"Priority"};
+ my $filter_enabled = $passedoptions->{"Enabled"};
my $filter_notes = $passedoptions->{"Notes"};
# Check if the template database exists.
}
+ if (!$filter_enabled){
+
+ $filter_enabled = "";
+
+ }
+
# Check if there is really no filter table.
if (!$filterdb_exists){
# NewFindFilter Specifies the new find filter setting. #
# NewReplaceFilter Specifies the new replace filter setting. #
# NewFilterPriority Specifies the new filter priority setting. #
+# NewEnabled Specifies if the filter is enabled. #
# NewFilterNotes Specifies the new notes for the filter. #
#################################################################################
my $filter_newfind = $passedoptions->{"NewFindFilter"};
my $filter_newreplace = $passedoptions->{"NewReplaceFilter"};
my $filter_newpriority = $passedoptions->{"NewFilterPriority"};
+ my $filter_enabled = $passedoptions->{"NewEnabled"};
my $filter_newnotes = $passedoptions->{"NewFilterNotes"};
# Check if the filter exists before editing it.
findsetting = \'' . $class->convert($filter_newfind) . '\',
replacesetting = \'' . $class->convert($filter_newreplace) . '\',
priority = \'' . $class->convert($filter_newpriority) . '\',
+ enabled = \'' . $class->convert($filter_enabled) . '\',
notes = \'' . $class->convert($filter_newnotes) . '\'
WHERE id = \'' . $class->convert($filter_id) . '\'') or ( $error = "FilterDatabaseError", $errorext = $database_handle->errstr, return );
$statement_handle->execute();
if ($reduced && $reduced eq 1){
- $filterdb_statement_handle = $filterdb_database_handle->prepare('SELECT id, priority, findsetting, replacesetting FROM kiriwrite_filters where id = \'' . $class->convert($filter_id) . '\'') or ( $error = "FilterDatabaseError", $errorext = $filterdb_database_handle->errstr, return );
+ $filterdb_statement_handle = $filterdb_database_handle->prepare('SELECT id, priority, findsetting, replacesetting, enabled FROM kiriwrite_filters where id = \'' . $class->convert($filter_id) . '\'') or ( $error = "FilterDatabaseError", $errorext = $filterdb_database_handle->errstr, return );
$filterdb_statement_handle->execute();
} else {
- $filterdb_statement_handle = $filterdb_database_handle->prepare('SELECT id, priority, findsetting, replacesetting, notes FROM kiriwrite_filters where id = \'' . $class->convert($filter_id) . '\'') or ( $error = "FilterDatabaseError", $errorext = $filterdb_database_handle->errstr, return );
+ $filterdb_statement_handle = $filterdb_database_handle->prepare('SELECT id, priority, findsetting, replacesetting, enabled, notes FROM kiriwrite_filters where id = \'' . $class->convert($filter_id) . '\'') or ( $error = "FilterDatabaseError", $errorext = $filterdb_database_handle->errstr, return );
$filterdb_statement_handle->execute();
}
$filter_info{"FilterPriority"} = $filter_data[1];
$filter_info{"FilterFind"} = $filter_data[2];
$filter_info{"FilterReplace"} = $filter_data[3];
- $filter_info{"FilterNotes"} = $filter_data[4];
+ $filter_info{"FilterEnabled"} = $filter_data[4];
+ $filter_info{"FilterNotes"} = $filter_data[5];
$filter_exists = 1;
my $filter_find = $passedoptions->{"FindFilter"};
my $filter_replace = $passedoptions->{"ReplaceFilter"};
my $filter_priority = $passedoptions->{"Priority"};
+ my $filter_enabled = $passedoptions->{"Enabled"};
my $filter_notes = $passedoptions->{"Notes"};
# Check if the filter database permissions are valid.
}
+ if (!$filter_enabled){
+
+ $filter_enabled = "";
+
+ }
+
my $directory_permissions = main::kiriwrite_filepermissions(".", 1, 1, 0);
if ($directory_permissions eq 1 && $filterdb_exists){
priority int(5),
findsetting varchar(1024),
replacesetting varchar(1024),
+ enabled boolean,
notes text
)') or ( $error = "FilterDatabaseError", $errorext = $filterdb_database_handle->errstr, return );
$filterdb_statement_handle->execute();
# Add the filter to the filter database.
- $filterdb_statement_handle = $filterdb_database_handle->prepare('INSERT INTO kiriwrite_filters (id, priority, findsetting, replacesetting, notes) VALUES (
+ $filterdb_statement_handle = $filterdb_database_handle->prepare('INSERT INTO kiriwrite_filters (id, priority, findsetting, replacesetting, enabled, notes) VALUES (
\'' . $class->convert($new_id) . '\',
\'' . $class->convert($filter_priority) . '\',
\'' . $class->convert($filter_find) . '\',
\'' . $class->convert($filter_replace) .'\',
+ \'' . $class->convert($filter_enabled) . '\',
\'' . $class->convert($filter_notes) . '\'
)') or ( $error = "FilterDatabaseError", $errorext = $filterdb_database_handle->errstr, return );
$filterdb_statement_handle->execute();
# NewFindFilter Specifies the new find filter setting. #
# NewReplaceFilter Specifies the new replace filter setting. #
# NewFilterPriority Specifies the new filter priority setting. #
+# NewEnabled Specifies if the filter should be enabled. #
# NewFilterNotes Specifies the new notes for the filter. #
#################################################################################
my $filter_newfind = $passedoptions->{"NewFindFilter"};
my $filter_newreplace = $passedoptions->{"NewReplaceFilter"};
my $filter_newpriority = $passedoptions->{"NewFilterPriority"};
+ my $filter_enabled = $passedoptions->{"NewEnabled"};
my $filter_newnotes = $passedoptions->{"NewFilterNotes"};
# Check if the filter database permissions are valid.
findsetting = \'' . $class->convert($filter_newfind) . '\',
replacesetting = \'' . $class->convert($filter_newreplace) . '\',
priority = \'' . $class->convert($filter_newpriority) . '\',
+ enabled = \'' . $class->convert($filter_enabled) . '\',
notes = \'' . $class->convert($filter_newnotes) . '\'
WHERE id = \'' . $class->convert($filter_id) . '\'') or ( $error = "FilterDatabaseError", $errorext = $filterdb_database_handle->errstr, return );
$filterdb_statement_handle->execute();
use warnings; # Write warnings to the HTTP Server Log file.
use utf8;
-use CGI qw(:standard *table *Tr *td);
+#use CGI qw(:standard *table *Tr *td);
+use CGI::Lite;
#use CGI::Carp('fatalsToBrowser'); # Output errors to the browser.
# Setup strings in specific languages. Style should be no spacing for
$kiriwrite_lang{"en-GB"}{"usekiriwritetext"} = "To use Kiriwrite click or select the link below (will not work if the Kiriwrite script is not called kiriwrite.cgi):";
$kiriwrite_lang{"en-GB"}{"usekiriwritelink"} = "Start using Kiriwrite.";
-my $query = new CGI;
+my $query_lite = new CGI::Lite;
+my $form_data = $query_lite->parse_form_data;
my $language_selected = "";
-my $http_query_confirm = $query->param('confirm');
-my $http_query_installlanguage = $query->param('installlanguage');
+my $http_query_confirm = $form_data->{'confirm'};
+my $http_query_installlanguage = $form_data->{'installlanguage'};
if (!$http_query_installlanguage){
$error_type = "generic";
}
- print header();
+ print "Content-type: text/html;\r\n\r\n";
- print start_html({ -title => $kiriwrite_lang{$language_selected}{error}, -style => { -code => $cssstyle }});
+ print "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\n";
+ print "<head>\n<title>$kiriwrite_lang{$language_selected}{installertitle}</title>\n<style type=\"text/css\" media=\"screen\">$cssstyle</style>\n</head>\n<body>\n";
- print h2($kiriwrite_lang{$language_selected}{error});
+ print "<h2>$kiriwrite_lang{$language_selected}{error}</h2>";
print $kiriwrite_error{$error_type};
- print br();
+ print "<br />\n";
print $kiriwrite_lang{$language_selected}{errormessagetext};
- print end_html();
+ print "</body>\n</html>";
exit;
display_textareacols = $passedsettings->{TextAreaCols}
display_textarearows = $passedsettings->{TextAreaRows}
+ display_pagecount = 50
+ display_filtercount = 50
+ display_templatecount = 50
database_server = $passedsettings->{DatabaseServer}
database_port = $passedsettings->{DatabasePort}
}
+sub kiriwrite_addtablerow{
+#################################################################################
+# kiriwrite_addtablerow: Adds a table row. #
+# #
+# Usage: #
+# #
+# kiriwrite_addtablerow(name, data); #
+# #
+# name Specifies the name of the table row. #
+# namestyle Specifies the style for the name of the table row. #
+# data Specifies the data to be used in the table row. #
+# datastyle Specifies the style for the data of the table row. #
+#################################################################################
+
+ my ($name, $namestyle, $data, $datastyle) = @_;
+
+ if (!$data){
+
+ $data = "";
+
+ }
+
+ print "<tr>\n";
+ print "<td class=\"$namestyle\">$name</td>\n";
+ print "<td class=\"$datastyle\">$data</td>\n";
+ print "</tr>\n";
+
+}
+
#################################################################################
# End list of subroutines. #
#################################################################################
# The confirm value has been given so get the data from the query.
- my $http_query_dbdirectory = $query->param('dbdirectory');
- my $http_query_outputdirectory = $query->param('outputdirectory');
- my $http_query_imagesuripath = $query->param('imagesuripath');
+ my $http_query_dbdirectory = $form_data->{'dbdirectory'};
+ my $http_query_outputdirectory = $form_data->{'outputdirectory'};
+ my $http_query_imagesuripath = $form_data->{'imagesuripath'};
- my $http_query_textarearows = $query->param('textarearows');
- my $http_query_textareacols = $query->param('textareacols');
+ my $http_query_textarearows = $form_data->{'textarearows'};
+ my $http_query_textareacols = $form_data->{'textareacols'};
- my $http_query_dateformat = $query->param('dateformat');
- my $http_query_customdateformat = $query->param('customdateformat');
+ my $http_query_dateformat = $form_data->{'dateformat'};
+ my $http_query_customdateformat = $form_data->{'customdateformat'};
- my $http_query_language = $query->param('language');
+ my $http_query_language = $form_data->{'language'};
- my $http_query_presmodule = $query->param('presmodule');
- my $http_query_dbmodule = $query->param('dbmodule');
+ my $http_query_presmodule = $form_data->{'presmodule'};
+ my $http_query_dbmodule = $form_data->{'dbmodule'};
- my $http_query_databaseserver = $query->param('databaseserver');
- my $http_query_databaseport = $query->param('databaseport');
- my $http_query_databaseprotocol = $query->param('databaseprotocol');
- my $http_query_databasename = $query->param('databasename');
- my $http_query_databaseusername = $query->param('databaseusername');
- my $http_query_databasepassword = $query->param('databasepassword');
- my $http_query_databasetableprefix = $query->param('databasetableprefix');
- my $http_query_removeinstallscript = $query->param('removeinstallscript');
+ my $http_query_databaseserver = $form_data->{'databaseserver'};
+ my $http_query_databaseport = $form_data->{'databaseport'};
+ my $http_query_databaseprotocol = $form_data->{'databaseprotocol'};
+ my $http_query_databasename = $form_data->{'databasename'};
+ my $http_query_databaseusername = $form_data->{'databaseusername'};
+ my $http_query_databasepassword = $form_data->{'databasepassword'};
+ my $http_query_databasetableprefix = $form_data->{'databasetableprefix'};
+ my $http_query_removeinstallscript = $form_data->{'removeinstallscript'};
# Check if the text area rows and column values are blank.
}
- print header();
+ print "Content-type: text/html\r\n\r\n";
- print start_html({ -title => $kiriwrite_lang{$language_selected}{installertitle}, -style => { -code => $cssstyle }});
- print h2($kiriwrite_lang{$language_selected}{installertitle});
+ #print start_html({ -title => $kiriwrite_lang{$language_selected}{installertitle}, -style => { -code => $cssstyle }});
+ print "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\n";
+ print "<head>\n<title>$kiriwrite_lang{$language_selected}{installertitle}</title>\n<style type=\"text/css\" media=\"screen\">$cssstyle</style>\n</head>\n<body>\n";
+ print "<h2>$kiriwrite_lang{$language_selected}{installertitle}</h2>";
print $kiriwrite_lang{$language_selected}{installedmessage};
if ($installscriptmessage){
- print br();
- print br();
+ print "<br /><br />\n";
print $installscriptmessage;
}
- print br();
- print br();
+ print "<br /><br />\n";
print $kiriwrite_lang{$language_selected}{usekiriwritetext};
- print br();
- print br();
- print a({-href=>'kiriwrite.cgi'}, $kiriwrite_lang{$language_selected}{usekiriwritelink});
+ print "<br /><br />\n";
+ print "<a href=\"kiriwrite.cgi\">$kiriwrite_lang{$language_selected}{usekiriwritelink}</a>";
+ print "</body>\n</html>";
exit;
# Create a list of common date and time formats.
-my @datetime_formats = [
+my @datetime_formats = (
'DD/MM/YY (hh:mm:ss)', 'DD/MM/YY hh:mm:ss', 'D/M/Y (hh:mm:ss)',
'D/M/Y hh:mm:ss', 'D/M/YY (hh:mm:ss)', 'D/M/YY hh:mm:ss',
'DD/MM (hh:mm:ss)', 'D/M (hh:mm:ss)', 'DD/MM hh:mm:ss',
'YY-MM-DD (hh:mm:ss)', 'YY-MM-DD hh:mm:ss', 'Y-M-D (hh:mm:ss)',
'Y-M-D hh:mm:ss', 'M-D (hh:mm:ss)', 'M-D hh:mm:ss',
'YY-MM-DD', 'MM-DD'
-];
+);
# Create the list of tests to do.
# Print the header.
-print header();
+print "Content-Type: text/html;\r\n\r\n";
# Print the page for installing Kiriwrite.
-print start_html( -title=> $kiriwrite_lang{$language_selected}{installertitle}, -style => { -code => $cssstyle });
-
-print start_table( { -width=> "100%" } );
-print start_Tr();
-print start_td({ -class => "languagebar" });
-print $kiriwrite_lang{$language_selected}{installertitle};
-print end_td();
-print start_td({ -class => "languagebarselect" });
-print start_form("POST", "install.cgi");
-
-# This is a bodge for the language list.
+print "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\n";
+print "<head>\n<title>$kiriwrite_lang{$language_selected}{installertitle}</title>\n";
+print "<style type=\"text/css\" media=\"screen\">$cssstyle</style>\n</head>\n<body>";
+print "<table width=\"100%\">";
my $language_name_short;
my $language_list_seek = 0;
+my $installlanguage_out = "";
-print "<select name=\"installlanguage\">";
+$installlanguage_out = "<select name=\"installlanguage\">\n";
foreach $language_name_short (@language_list_short){
- print "<option value=\"" . $language_name_short . "\">" . $language_list_long[$language_list_seek] . "</option>";
+ $installlanguage_out = $installlanguage_out . "<option value=\"" . $language_name_short . "\">" . $language_list_long[$language_list_seek] . "</option>\n";
$language_list_seek++;
}
-print "</select> ";
-print submit($kiriwrite_lang{$language_selected}{switch});
-
-print end_form;
-print end_td();
-print end_Tr();
-print end_table();
+$installlanguage_out = $installlanguage_out . "</select>\n";
-print h2($kiriwrite_lang{$language_selected}{installertitle});
+kiriwrite_addtablerow($kiriwrite_lang{$language_selected}{installertitle}, "languagebar", "<form action=\"install.cgi\" method=\"POST\">\n$installlanguage_out\n<input type=\"submit\" value=\"$kiriwrite_lang{$language_selected}{switch}\">\n</form>\n", "languagebarselect");
+print "</table>";
+print "<h2>$kiriwrite_lang{$language_selected}{installertitle}</h2>\n";
print $kiriwrite_lang{$language_selected}{installertext};
-
-print h3($kiriwrite_lang{$language_selected}{dependencytitle});
-print h4($kiriwrite_lang{$language_selected}{requiredmodules});
+print "<h3>$kiriwrite_lang{$language_selected}{dependencytitle}</h3>\n";
+print "<h4>$kiriwrite_lang{$language_selected}{requiredmodules}</h4>\n";
print $kiriwrite_lang{$language_selected}{perlmodules};
-print br();;
-print br();;
+print "<br /><br />\n";
if ($dependency_error eq 1){
print $kiriwrite_lang{$language_selected}{errormessage};
print $kiriwrite_lang{$language_selected}{dependencyperlmodulesmissing};
- print br();
- print br();
+ print "<br /><br />\n";
}
-print start_table();
-print start_Tr();
-print start_td({ -class => "tablecellheader" });
-print $kiriwrite_lang{$language_selected}{module};
-print end_td();
-print start_td({ -class => "tablecellheader" });
-print $kiriwrite_lang{$language_selected}{result};
-print end_td();
-print end_Tr();
+print "<table>\n";
+
+kiriwrite_addtablerow($kiriwrite_lang{$language_selected}{module}, "tablecellheader", $kiriwrite_lang{$language_selected}{result}, "tablecellheader");
foreach $test (keys %dependency_results) {
- print start_Tr();
- print start_td({ -class => "tablename" });
- print $test;
- print end_td();
- print start_td({ -class => "tabledata" });
- print $dependency_results{$test}{result};
- print end_td();
- print end_Tr();
+ kiriwrite_addtablerow($test, "tablename", $dependency_results{$test}{result}, "tabledata");
}
-print end_table();
+print "</table>";
-print h4($kiriwrite_lang{$language_selected}{databasemodules});
+print "<h4>$kiriwrite_lang{$language_selected}{databasemodules}</h4>\n";
print $kiriwrite_lang{$language_selected}{databasemodulestext};
-print br();
-print br();
+print "<br /><br />\n";
if ($database_error eq 1){
print $kiriwrite_lang{$language_selected}{warningmessage};
print $kiriwrite_lang{$language_selected}{databaseperlmodulesmissing};
- print br();
- print br();
+ print "<br /><br />\n";
}
-print start_table();
-print start_Tr();
-print start_td({ -class => "tablecellheader" });
-print $kiriwrite_lang{$language_selected}{module};
-print end_td();
-print start_td({ -class => "tablecellheader" });
-print $kiriwrite_lang{$language_selected}{result};
-print end_td();
-print end_Tr();
+kiriwrite_addtablerow($kiriwrite_lang{$language_selected}{module}, "tablecellheader", $kiriwrite_lang{$language_selected}{result}, "tablecellheader");
foreach $test (keys %database_results) {
- print start_Tr();
- print start_td({ -class => "tablename" });
- print $test;
- print end_td();
- print start_td({ -class => "tabledata" });
- print $database_results{$test}{result};
- print end_td();
- print end_Tr();
+ kiriwrite_addtablerow($test, "tablename", $database_results{$test}{result}, "tabledata");
}
-print end_table();
+print "</table>";
-print h4($kiriwrite_lang{$language_selected}{filepermissions});
+print "<h4>$kiriwrite_lang{$language_selected}{filepermissions}</h4>\n";
print $kiriwrite_lang{$language_selected}{filepermissionstext};
-print br();
-print br();
+print "<br /><br />\n";
if ($file_error eq 1){
print $kiriwrite_lang{$language_selected}{errormessage};
print $kiriwrite_lang{$language_selected}{filepermissionsinvalid};
- print br();
- print br();
+ print "<br /><br />\n";
}
-print start_table();
-print start_Tr();
-print start_td({ -class => "tablecellheader" });
-print "Filename";
-print end_td();
-print start_td({ -class => "tablecellheader" });
-print "Result";
-print end_td();
-print end_Tr();
+print "<table>";
+
+kiriwrite_addtablerow("Filename", "tablecellheader", "Result", "tablecellheader");
foreach $test (keys %file_results) {
- print start_Tr();
- print start_td({ -class => "tablename" });
- print $test;
- print end_td();
- print start_td({ -class => "tabledata" });
- print $file_results{$test}{result};
- print end_td();
- print end_Tr();
+ kiriwrite_addtablerow($test, "tablename", $file_results{$test}{result}, "tabledata");
}
-print end_table();
+print "</table>";
if ($dependency_error eq 1){
- print hr();
- print h4($kiriwrite_lang{$language_selected}{criticalerror});
- print $kiriwrite_lang{$language_selected}{dependencymodulesnotinstalled};
- print end_html;
+ print "<hr />\n";
+ print "<h4>$kiriwrite_lang{$language_selected}{criticalerror}</h4>\n";
+ print $kiriwrite_lang{$language_selected}{dependencymodulesnotinstalled} . "\n";
+ print "</body>\n</html>";
exit;
}
if ($database_onemodule eq 0){
- print hr();
- print h4($kiriwrite_lang{$language_selected}{criticalerror});
- print $kiriwrite_lang{$language_selected}{databasemodulesnotinstalled};
- print end_html;
+ print "<hr />\n";
+ print "<h4>$kiriwrite_lang{$language_selected}{criticalerror}</h4>\n";
+ print $kiriwrite_lang{$language_selected}{databasemodulesnotinstalled} . "\n";
+ print "</body>\n</html>";
exit;
}
if ($file_error eq 1){
- print hr();
- print h4($kiriwrite_lang{$language_selected}{criticalerror});
- print $kiriwrite_lang{$language_selected}{filepermissionerrors};
- print end_html;
+ print "<hr />\n";
+ print "<h4>$kiriwrite_lang{$language_selected}{criticalerror}</h4>\n";
+ print $kiriwrite_lang{$language_selected}{filepermissionerrors} . "\n";
+ print "</body>\n</html>";
exit;
}
my (%available_languages, $available_languages);
my @presentation_modules;
my @database_modules;
-
-my $presentation_modules_ref = \@presentation_modules;
-my $database_modules_ref = \@database_modules;
+my $select_data = "";
+my $language_data;
+my $language_out = "";
+my ($presmodule_name, $presmodule_out) = "";
+my ($dbmodule_name, $dbmodule_out) = "";
# Get the list of available languages.
my @language_directory = grep /m*\.lang$/, readdir(LANGUAGEDIR);
closedir(LANGUAGEDIR);
-my $language_data;
-
foreach my $language_file (@language_directory){
# Load the language file.
# Get the friendly name for the database module.
$presmodule_file =~ s/.pm$//g;
-
push(@presentation_modules, $presmodule_file);
}
# Get the friendly name for the database module.
$dbmodule_file =~ s/.pm$//g;
-
push(@database_modules, $dbmodule_file);
}
-print h3($kiriwrite_lang{$language_selected}{settingstitle});
-
+print "<h3>$kiriwrite_lang{$language_selected}{settingstitle}</h3>";
print $kiriwrite_lang{$language_selected}{settingstext};
-print br();
-print br();
-
-print start_form("POST", "install.cgi");
-print hidden( -name => 'confirm', -default => '1');
-print hidden( -name => 'installlanguage', -default => $language_selected);
-
-print start_table({ -width => "100%" });
-
-print start_Tr();
-print start_td({ -class => "tablecellheader" });
-print $kiriwrite_lang{$language_selected}{setting};
-print end_td();
-print start_td({ -class => "tablecellheader" });
-print $kiriwrite_lang{$language_selected}{value};
-print end_td();
-print end_Tr();
-
-print start_Tr();
-print start_td({ -class => "tablecellheader" });
-print $kiriwrite_lang{$language_selected}{directories};
-print end_td();
-print start_td({ -class => "tablecellheader" });
-print end_td();
-print end_Tr();
-
-print start_Tr();
-print start_td({ -class => "tablename" });
-print $kiriwrite_lang{$language_selected}{databasedirectory};
-print end_td();
-print start_td({ -class => "tabledata" });
-print textfield({ -name => "dbdirectory", -size => 32, -maxlength => 64, -value => $default_dbdirectory });
-print end_td();
-print end_Tr();
-
-print start_Tr();
-print start_td({ -class => "tablename" });
-print $kiriwrite_lang{$language_selected}{outputdirectory};
-print end_td();
-print start_td({ -class => "tabledata" });
-print textfield({ -name => "outputdirectory", -size => 32, -maxlength => 64, -value => $default_outputdirectory });
-print end_td();
-print end_Tr();
-
-print start_Tr();
-print start_td({ -class => "tablename" });
-print $kiriwrite_lang{$language_selected}{imagesuripath};
-print end_td();
-print start_td({ -class => "tabledata" });
-print textfield({ -name => "imagesuripath", -size => 32, -maxlength => 64, -value => $default_imagesuri });
-print end_td();
-print end_Tr();
-
-print start_Tr();
-print start_td({ -class => "tablecellheader" });
-print $kiriwrite_lang{$language_selected}{display};
-print end_td();
-print start_td({ -class => "tablecellheader" });
-print end_td();
-print end_Tr();
-
-print start_Tr();
-print start_td({ -class => "tablename" });
-print $kiriwrite_lang{$language_selected}{textarearows};
-print end_td();
-print start_td({ -class => "tabledata" });
-print textfield({ -name => "textarearows", -size => 3, -maxlength => 3, -value => $default_textarearows });
-print end_td();
-print end_Tr();
-
-print start_Tr();
-print start_td({ -class => "tablename" });
-print $kiriwrite_lang{$language_selected}{textareacols};
-print end_td();
-print start_td({ -class => "tabledata" });
-print textfield({ -name => "textareacols", -size => 3, -maxlength => 3, -value => $default_textareacols });
-print end_td();
-print end_Tr();
-
-print start_Tr();
-print start_td({ -class => "tablecellheader" });
-print $kiriwrite_lang{$language_selected}{date};
-print end_td();
-print start_td({ -class => "tablecellheader" });
-print "";
-print end_td();
-print end_Tr();
-
-print start_Tr();
-print start_td({ -class => "tablename" });
-print $kiriwrite_lang{$language_selected}{dateformat};
-print end_td();
-print start_td({ -class => "tabledata" });
-
-print popup_menu( -name => "dateformat", -values => @datetime_formats );
-print textfield({ -name => "customdateformat", -size => 32, -maxlength => 64, });
-
-print end_td();
-print end_Tr();
-
-print start_Tr();
-print start_td({ -class => "tablecellheader" });
-print $kiriwrite_lang{$language_selected}{language};
-print end_td();
-print start_td({ -class => "tablecellheader" });
-print end_td();
-print end_Tr();
-
-print start_Tr();
-print start_td({ -class => "tablename" });
-print $kiriwrite_lang{$language_selected}{systemlanguage};
-print end_td();
-print start_td({ -class => "tabledata" });
-
-# Note: This the following code is bodge. If anyone can fix it so that it all works
-# with popup_menu properly it will be appriciated.
-
-print "<select name=\"language\">";
+print "<br /><br />\n";
+
+print "<form action=\"install.cgi\" method=\"POST\">";
+print "<input type=\"hidden\" name=\"confirm\" value=\"1\">\n<input type=\"hidden\" name=\"installlanguage\" value=\"$language_selected\">\n";
+
+print "<table width=\"100%\">";
+kiriwrite_addtablerow($kiriwrite_lang{$language_selected}{setting}, "tablecellheader", $kiriwrite_lang{$language_selected}{value}, "tablecellheader");
+kiriwrite_addtablerow($kiriwrite_lang{$language_selected}{directories}, "tablecellheader", "", "tablecellheader");
+kiriwrite_addtablerow($kiriwrite_lang{$language_selected}{databasedirectory}, "tablname", "<input type=\"text\" name=\"dbdirectory\" size=\"32\" maxlength=\"64\" value=\"$default_dbdirectory\">", "tabledata");
+kiriwrite_addtablerow($kiriwrite_lang{$language_selected}{outputdirectory}, "tablename", "<input type=\"text\" name=\"outputdirectory\" size=\"32\" maxlength=\"64\" value=\"$default_outputdirectory\">", "tabledata");
+kiriwrite_addtablerow($kiriwrite_lang{$language_selected}{imagesuripath}, "tablename", "<input type=\"text\" name=\"imagesuripath\" size=\"32\" maxlength=\"64\" value=\"$default_imagesuri\">", "tabledata");
+kiriwrite_addtablerow($kiriwrite_lang{$language_selected}{display}, "tablecellheader", "", "tablecellheader");
+kiriwrite_addtablerow($kiriwrite_lang{$language_selected}{textarearows}, "tablename", "<input type=\"text\" name=\"textarearows\" size=\"3\" maxlength=\"3\" value=\"$default_textarearows\">", "tabledata");
+kiriwrite_addtablerow($kiriwrite_lang{$language_selected}{textareacols}, "tablename", "<input type=\"text\" name=\"textareacols\" size=\"3\" maxlength=\"3\" value=\"$default_textareacols\">", "tabledata");
+kiriwrite_addtablerow($kiriwrite_lang{$language_selected}{date}, "tablecellheader", "", "tablecellheader");
+
+foreach my $select_name (@datetime_formats){
+ $select_data = $select_data . "<option value=\"$select_name\">" . $select_name . "</option>\n";
+}
-foreach my $language (keys %available_languages){
+kiriwrite_addtablerow($kiriwrite_lang{$language_selected}{dateformat}, "tablename", "<select>$select_data</select>\n<input type=\"text\" size=\"32\" maxlength=\"64\" name=\"customdateformat\">", "tabledata");
+kiriwrite_addtablerow($kiriwrite_lang{$language_selected}{language}, "tablecellheader", "", "tablecellheader");
+foreach my $language (keys %available_languages){
if ($language eq $language_selected){
-
- print "<option value=\"" . $language . "\" selected=selected>" . $available_languages{$language} . "</option>";
-
+ $language_out = $language_out . "<option value=\"" . $language . "\" selected=selected>" . $available_languages{$language} . "</option>\n";
} else {
-
- print "<option value=\"" . $language . "\">" . $available_languages{$language} . "</option>";
-
+ $language_out = $language_out . "<option value=\"" . $language . "\">" . $available_languages{$language} . "</option>\n";
}
+}
+kiriwrite_addtablerow($kiriwrite_lang{$language_selected}{systemlanguage}, "tablename", $language_out, "tabledata");
+kiriwrite_addtablerow($kiriwrite_lang{$language_selected}{modules}, "tablecellheader", "", "tablecellheader");
+foreach $presmodule_name (@presentation_modules){
+ $presmodule_out = $presmodule_out . "<option value=\"$presmodule_name\">$presmodule_name</option>";
+}
+kiriwrite_addtablerow($kiriwrite_lang{$language_selected}{presentationmodule}, "tablename", "<select name=\"presmodule\">$presmodule_out</select>", "tabledata");
+foreach $dbmodule_name (@database_modules){
+ $dbmodule_out = $dbmodule_out . "<option value=\"$dbmodule_name\">$dbmodule_name</option>";
}
-print "</select>";
-
-print end_td();
-print end_Tr();
-
-print start_Tr();
-print start_td({ -class => "tablecellheader" });
-print $kiriwrite_lang{$language_selected}{modules};
-print end_td();
-print start_td({ -class => "tablecellheader" });
-print "";
-print end_td();
-print end_Tr();
-
-print start_Tr();
-print start_td({ -class => "tablename" });
-print $kiriwrite_lang{$language_selected}{presentationmodule};
-print end_td();
-print start_td({ -class => "tabledata" });
-print popup_menu({ -name => 'presmodule', -values => $presentation_modules_ref, -default => "HTML4S" });
-print end_td();
-print end_Tr();
-
-print start_Tr();
-print start_td({ -class => "tablename" });
-print $kiriwrite_lang{$language_selected}{databasemodule};
-print end_td();
-print start_td({ -class => "tabledata" });
-print popup_menu({ -name => 'dbmodule', -values => $database_modules_ref, -default => "SQLite" });
-print end_td();
-print end_Tr();
-
-print start_Tr();
-print start_td({ -class => "tablename" });
-print $kiriwrite_lang{$language_selected}{databaseserver};
-print end_td();
-print start_td({ -class => "tabledata" });
-print textfield({ -name => "databaseserver", -size => 32, -maxlength => 128, -value => $default_server });
-print end_td();
-print end_Tr();
-
-print start_Tr();
-print start_td({ -class => "tablename" });
-print $kiriwrite_lang{$language_selected}{databaseport};
-print end_td();
-print start_td({ -class => "tabledata" });
-print textfield({ -name => "databaseport", -maxlength => 5, -size => 5, -value => $default_port });
-print end_td();
-print end_Tr();
-
-print start_Tr();
-print start_td({ -class => "tablename" });
-print $kiriwrite_lang{$language_selected}{databaseprotocol};
-print end_td();
-print start_td({ -class => "tabledata" });
-print popup_menu( -name => "databaseprotocol", -values => [ 'tcp', 'udp' ], -default => $default_protocol);
-print end_td();
-print end_Tr();
-
-print start_Tr();
-print start_td({ -class => "tablename" });
-print $kiriwrite_lang{$language_selected}{databasename};
-print end_td();
-print start_td({ -class => "tabledata" });
-print textfield({ -name => "databasename", -size => 32, -maxlength => 32, -default => $default_name });
-print end_td();
-print end_Tr();
-
-print start_Tr();
-print start_td({ -class => "tablename" });
-print $kiriwrite_lang{$language_selected}{databaseusername};
-print end_td();
-print start_td({ -class => "tabledata" });
-print textfield({ -name => "databaseusername", -size => 16, -maxlength => 16, -default => $default_username });
-print end_td();
-print end_Tr();
-
-print start_Tr();
-print start_td({ -class => "tablename" });
-print $kiriwrite_lang{$language_selected}{databasepassword};
-print end_td();
-print start_td({ -class => "tabledata" });
-print password_field({ -name => "databasepassword", -size => 32, -maxlength => 64 });
-print end_td();
-print end_Tr();
-
-print start_Tr();
-print start_td({ -class => "tablename" });
-print $kiriwrite_lang{$language_selected}{databasetableprefix};
-print end_td();
-print start_td({ -class => "tabledata" });
-print textfield({ -name => "databasetableprefix", -size => 32, -maxlength => 32, -default => $default_prefix });
-print end_td();
-print end_Tr();
-
-print start_Tr();
-print start_td({ -class => "tablecellheader" });
-print $kiriwrite_lang{$language_selected}{installationoptions};
-print end_td();
-print start_td({ -class => "tablecellheader" });
-print "";
-print end_td();
-print end_Tr();
-
-print start_Tr();
-print start_td({ -class => "tablename" });
-print $kiriwrite_lang{$language_selected}{installoptions};
-print end_td();
-print start_td({ -class => "tabledata" });
-print checkbox( -name => 'removeinstallscript', -checked => 1, -label => " " . $kiriwrite_lang{$language_selected}{removeinstallscript});
-print end_td();
-print end_Tr();
-
-print end_table();
-
-print br();
-print submit($kiriwrite_lang{$language_selected}{savesettingsbutton});
-print " | ";
-print reset($kiriwrite_lang{$language_selected}{resetsettingsbutton});
-
-print end_form();
-
-print end_html;
+kiriwrite_addtablerow($kiriwrite_lang{$language_selected}{databasemodule}, "tablename", "<select name=\"dbmodule\">$dbmodule_out</select>", "tabledata");
+kiriwrite_addtablerow($kiriwrite_lang{$language_selected}{databaseserver}, "tablename", "<input type=\"text\" name=\"databaseserver\" size=\"32\" maxlength=\"128\" value=\"$default_server\">\n", "tabledata");
+kiriwrite_addtablerow($kiriwrite_lang{$language_selected}{databaseport}, "tablename", "<input type=\"text\" name=\"databaseport\" maxlength=\"5\" size=\"5\" value=\"$default_port\">\n", "tabledata");
+kiriwrite_addtablerow($kiriwrite_lang{$language_selected}{databaseprotocol}, "tablename", "<select name=\"databaseprotocol\">\n<option value=\"tcp\">tcp</option>\n<option value=\"udp\">udp</option>\n</select>\n", "tabledata");
+kiriwrite_addtablerow($kiriwrite_lang{$language_selected}{databasename}, "tablename", "<input type=\"text\" name=\"databasename\" size=\"32\" maxlength=\"32\" value=\"$default_name\">\n", "tabledata");
+kiriwrite_addtablerow($kiriwrite_lang{$language_selected}{databaseusername}, "tablename", "<input type=\"text\" name=\"databaseusername\" size=\"16\" maxlength=\"16\" value=\"$default_username\">\n", "tabledata");
+kiriwrite_addtablerow($kiriwrite_lang{$language_selected}{databasepassword}, "tablename", "<input type=\"password\" name=\"databasepassword\" size=\"32\" maxlength=\"64\">\n", "tabledata");
+kiriwrite_addtablerow($kiriwrite_lang{$language_selected}{databasetableprefix}, "tablename", "<input type=\"text\" name=\"databasetableprefix\" size=\"32\" maxlength=\"32\" value=\"$default_prefix\">\n", "tabledata");
+kiriwrite_addtablerow($kiriwrite_lang{$language_selected}{installationoptions}, "tablecellheader", "", "tablecellheader");
+kiriwrite_addtablerow($kiriwrite_lang{$language_selected}{installoptions}, "tablename", "<input type=\"checkbox\" name=\"removeinstallscript\" checked=checked value=\"on\"> $kiriwrite_lang{$language_selected}{removeinstallscript}\n", "tabledata");
+
+print "</table>\n";
+
+print "<br />\n<input type=\"submit\" value=\"$kiriwrite_lang{$language_selected}{savesettingsbutton}\"> | <input type=\"reset\" value=\"$kiriwrite_lang{$language_selected}{resetsettingsbutton}\">\n";
+
+print "</form>\n</body>\n</html>";
exit;
__END__
\ No newline at end of file
use CGI::Lite;
use Tie::IxHash;
+binmode STDOUT, ':utf8';
+
# This is commented out because it uses a fair bit of CPU usage.
#use CGI::Carp('fatalsToBrowser'); # Output errors to the browser.
"display_textarearows" => $config->{config}{display_textarearows},
"display_textareacols" => $config->{config}{display_textareacols},
+ "display_pagecount" => $config->{config}{display_pagecount},
+ "display_templatecount" => $config->{config}{display_templatecount},
+ "display_filtercount" => $config->{config}{display_filtercount},
"database_server" => $config->{config}{database_server},
"database_port" => $config->{config}{database_port},
my $kiriwrite_config_textarearows_number = kiriwrite_variablecheck($kiriwrite_config{"display_textareacols"}, "numbers", 0, 1);
my $kiriwrite_config_textareacols_maxlength = kiriwrite_variablecheck($kiriwrite_config{"display_textareacols"}, "maxlength", 3, 1);
my $kiriwrite_config_textareacols_number = kiriwrite_variablecheck($kiriwrite_config{"display_textareacols"}, "numbers", 0, 1);
+ my $kiriwrite_config_pagecount_maxlength = kiriwrite_variablecheck($kiriwrite_config{"display_pagecount"}, "maxlength", 4, 1);
+ my $kiriwrite_config_pagecount_number = kiriwrite_variablecheck($kiriwrite_config{"display_pagecount"}, "numbers", 0, 1);
+ my $kiriwrite_config_templatecount_maxlength = kiriwrite_variablecheck($kiriwrite_config{"display_templatecount"}, "maxlength", 4, 1);
+ my $kiriwrite_config_templatecount_number = kiriwrite_variablecheck($kiriwrite_config{"display_templatecount"}, "numbers", 0, 1);
+ my $kiriwrite_config_filtercount_maxlength = kiriwrite_variablecheck($kiriwrite_config{"display_filtercount"}, "maxlength", 4, 1);
+ my $kiriwrite_config_filtercount_number = kiriwrite_variablecheck($kiriwrite_config{"display_filtercount"}, "numbers", 0, 1);
# Check if the language filename is valid and return an critical error if
# they aren't.
}
+ # Check if the amount of items per view settings are blank and return a critical
+ # error if they are.
+
+ if (!$kiriwrite_config{"display_pagecount"}){
+
+ # The display page count is blank so return a
+ # critical error.
+
+ kiriwrite_critical("pagecountblank");
+
+ }
+
+ if (!$kiriwrite_config{"display_templatecount"}){
+
+ # The display template count is blank so return
+ # a critical error.
+
+ kiriwrite_critical("templatecountblank");
+
+ }
+
+ if (!$kiriwrite_config{"display_filtercount"}){
+
+ # The display filter count is blank so return a
+ # critical error.
+
+ kiriwrite_critical("filtercountblank");
+
+ }
+
+ # Check if the amount of items per view settings are valid and return a critical
+ # error message if they aren't.
+
+ if ($kiriwrite_config_pagecount_maxlength eq 1){
+
+ # The length of the page count value is too long
+ # so return a critical error.
+
+ kiriwrite_critical("pagecounttoolong");
+
+ }
+
+ if ($kiriwrite_config_pagecount_number eq 1){
+
+ # The page count value is invalid so return
+ # a critical error.
+
+ kiriwrite_critical("pagecountinvalid");
+
+ }
+
+ if ($kiriwrite_config_templatecount_maxlength eq 1){
+
+ # The length of the template count value is too
+ # long so return a critical error.
+
+ kiriwrite_critical("filtercounttoolong");
+
+ }
+
+ if ($kiriwrite_config_templatecount_number eq 1){
+
+ # The template count value is invalid so return
+ # a critical error.
+
+ kiriwrite_critical("filtercountinvalid");
+
+ }
+
+ if ($kiriwrite_config_filtercount_maxlength eq 1){
+
+ # The length of the filter count value is too
+ # long so return a critical error.
+
+ kiriwrite_critical("templatecounttoolong");
+
+ }
+
+ if ($kiriwrite_config_filtercount_number eq 1){
+
+ # The filter count value is invalid so return
+ # a critical error.
+
+ kiriwrite_critical("templatecountinvalid");
+
+ }
+
# Check if the language file does exist before loading it and return an critical error
# if it does not exist.
"blankfilename", "blankvariable", "fileexists", "internalerror", "invalidoption", "invalidaction", "invalidfilename", "invalidmode", "invalidutf8", "invalidvariable", "variabletoolong",
# Specific error messages.
- "blankcompiletype", "blankdatabasepageadd", "blankdirectory", "blankfindfilter", "blankdatetimeformat", "browsenumbertoolong", "browsenumberinvalid", "databaseconnectionerror", "databasecategoriestoolong", "databasecopysame", "databasealreadyexists", "datadirectorymissing", "datadirectoryinvalidpermissions", "databasedescriptiontoolong", "databasefilenameinvalid", "databasefilenametoolong", "databaseerror", "databaseinvalidpermissions", "databasenameinvalid", "databasenametoolong", "databasenameblank", "databasemissingfile", "databasemovemissingfile", "databasenorename", "databasemovesame", "dbmoduleblank", "dbmoduleinvalid", "dbdirectoryblank", "dbdirectoryinvalid", "dbmodulemissing", "filtersdatabasenotcreated", "filtersdbdatabaseerror", "filtersdbpermissions", "filtersdbmissing", "filteridblank", "filterdoesnotexist", "filteridinvalid", "filteridtoolong", "findfiltertoolong", "filterpriorityinvalid", "filterpriorityinvalidchars", "filterprioritytoolong", "invalidcompiletype", "invalidpagenumber", "nopagesselected", "invaliddirectory", "invaliddatetimeformat", "invalidlanguagefilename", "languagefilenamemissing", "moduleblank", "moduleinvalid", "newcopydatabasedatabaseerror", "newcopydatabasedoesnotexist", "newcopydatabasefileinvalidpermissions", "newmovedatabasedatabaseerror", "newmovedatabasedoesnotexist", "newmovedatabasefileinvalidpermissions", "nodatabasesavailable", "nodatabaseselected", "noeditvaluesselected", "oldcopydatabasedatabaseerror", "oldcopydatabasedoesnotexist", "oldcopydatabasefileinvalidpermissions", "oldmovedatabasedatabaseerror", "oldmovedatabasedoesnotexist", "oldmovedatabasefileinvalidpermissions", "outputdirectoryblank", "outputdirectoryinvalid", "outputdirectorymissing", "outputdirectoryinvalidpermissions", "overridetemplatevalueinvalid", "overridetemplatetoolong", "overridetemplateinvalid", "presmoduleblank", "presmoduleinvalid", "presmodulemissing", "pagefilenamedoesnotexist", "pagefilenameexists", "pagefilenameinvalid", "pagefilenametoolong", "pagefilenameblank", "pagetitletoolong", "pagedescriptiontoolong", "pagesectiontoolong", "pagedatabasefilenametoolong", "pagesettingstoolong", "pagesettingsinvalid", "pagetemplatefilenametoolong", "replacefiltertoolong", "servernameinvalid", "servernametoolong", "serverdatabasenameinvalid", "serverdatabasenametoolong", "serverdatabaseusernameinvalid", "serverdatabaseusernametoolong", "serverdatabasepasswordtoolong", "serverdatabasetableprefixinvalid", "serverdatabasetableprefixtoolong", "serverportnumberinvalid", "serverportnumberinvalidcharacters", "serverportnumbertoolong", "serverprotocolnametoolong", "serverprotocolinvalid", "templatenameblank", "templatefilenameexists", "templatefilenameinvalid", "templatedatabaseerror", "templatedatabaseinvalidpermissions", "templatedatabaseinvalidformat", "templatedirectoryblank", "templatedirectoryinvalid", "templatedatabasenotcreated", "templatefilenametoolong", "templatenametoolong", "templatedescriptiontoolong", "templatedatabasemissing", "templatedoesnotexist", "templatefilenameblank", "textarearowblank", "textarearowtoolong", "textarearowinvalid", "textareacolblank", "textareacoltoolong", "textareacolinvalid"
+ "blankcompiletype", "blankdatabasepageadd", "blankdirectory", "blankfindfilter", "blankdatetimeformat", "browsenumbertoolong", "browsenumberinvalid", "databaseconnectionerror", "databasecategoriestoolong", "databasecopysame", "databasealreadyexists", "datadirectorymissing", "datadirectoryinvalidpermissions", "databasedescriptiontoolong", "databasefilenameinvalid", "databasefilenametoolong", "databaseerror", "databaseinvalidpermissions", "databasenameinvalid", "databasenametoolong", "databasenameblank", "databasemissingfile", "databasemovemissingfile", "databasenorename", "databasemovesame", "dbmoduleblank", "dbmoduleinvalid", "dbdirectoryblank", "dbdirectoryinvalid", "dbmodulemissing", "filtercountinvalid", "filtercounttoolong", "filtersdatabasenotcreated", "filtersdbdatabaseerror", "filtersdbpermissions", "filtersdbmissing", "filteridblank", "filterdoesnotexist", "filteridinvalid", "filteridtoolong", "findfiltertoolong", "filterpriorityinvalid", "filterpriorityinvalidchars", "filterprioritytoolong", "invalidcompiletype", "invalidpagenumber", "nopagesselected", "invaliddirectory", "invaliddatetimeformat", "invalidlanguagefilename", "languagefilenamemissing", "moduleblank", "moduleinvalid", "newcopydatabasedatabaseerror", "newcopydatabasedoesnotexist", "newcopydatabasefileinvalidpermissions", "newmovedatabasedatabaseerror", "newmovedatabasedoesnotexist", "newmovedatabasefileinvalidpermissions", "nodatabasesavailable", "nodatabaseselected", "noeditvaluesselected", "oldcopydatabasedatabaseerror", "oldcopydatabasedoesnotexist", "oldcopydatabasefileinvalidpermissions", "oldmovedatabasedatabaseerror", "oldmovedatabasedoesnotexist", "oldmovedatabasefileinvalidpermissions", "outputdirectoryblank", "outputdirectoryinvalid", "outputdirectorymissing", "outputdirectoryinvalidpermissions", "overridetemplatevalueinvalid", "overridetemplatetoolong", "overridetemplateinvalid", "presmoduleblank", "presmoduleinvalid", "presmodulemissing", "pagecountinvalid", "pagecounttoolong", "pagefilenamedoesnotexist", "pagefilenameexists", "pagefilenameinvalid", "pagefilenametoolong", "pagefilenameblank", "pagetitletoolong", "pagedescriptiontoolong", "pagesectiontoolong", "pagedatabasefilenametoolong", "pagesettingstoolong", "pagesettingsinvalid", "pagetemplatefilenametoolong", "replacefiltertoolong", "servernameinvalid", "servernametoolong", "serverdatabasenameinvalid", "serverdatabasenametoolong", "serverdatabaseusernameinvalid", "serverdatabaseusernametoolong", "serverdatabasepasswordtoolong", "serverdatabasetableprefixinvalid", "serverdatabasetableprefixtoolong", "serverportnumberinvalid", "serverportnumberinvalidcharacters", "serverportnumbertoolong", "serverprotocolnametoolong", "serverprotocolinvalid", "templatecountinvalid", "templatecounttoolong", "templatenameblank", "templatefilenameexists", "templatefilenameinvalid", "templatedatabaseerror", "templatedatabaseinvalidpermissions", "templatedatabaseinvalidformat", "templatedirectoryblank", "templatedirectoryinvalid", "templatedatabasenotcreated", "templatefilenametoolong", "templatenametoolong", "templatedescriptiontoolong", "templatedatabasemissing", "templatedoesnotexist", "templatefilenameblank", "textarearowblank", "textarearowtoolong", "textarearowinvalid", "textareacolblank", "textareacoltoolong", "textareacolinvalid"
);
my $finalutf8 = Encode::decode_utf8( $utfstring );
return $finalutf8;
+ #return $utfstring;
}
"presmodulemissing" => "The presentation module is missing! Running the installer script for Kiriwrite is recommended.",
"presmoduleinvalidpermissions" => "The presentation module cannot be used as it has invalid permission settings set! Please set the valid permission settings for the presentation module.",
"presmoduleinvalid" => "The presentation module name given is invalid. Running the installer script for Kiriwrite is recommended.",
- "textarearowblank" => "The text area row value given is blank.",
+ "textarearowblank" => "The text area row value given is blank. Running the installer script for Kiriwrite is recommended.",
"textarearowtoolong" => "The text area row value is too long. Running the installer script for Kiriwrite is recommended.",
"textarearowinvalid" => "The text area row value is invalid. Running the installer script for Kiriwrite is recommended.",
- "textareacolblank" => "The text area row value given is blank.",
+ "textareacolblank" => "The text area row value given is blank. Running the installer script for Kiriwrite is recommended.",
"textareacoltoolong" => "The text area column value is too long. Running the installer script for Kiriwrite is recommended.",
"textareacolinvalid" => "The text area column value is invalid. Running the installer script for Kiriwrite is recommended.",
+ "pagecountblank" => "The page count value is blank. Running the installer script for Kiriwrite is recommended.",
+ "templatecountblank" => "The template count value is blank. Running the installer script for Kiriwrite is recommended.",
+ "filtercountblank" => "The filter count value is blank. Running the installer script for Kiriwrite is recommended.",
+ "pagecounttoolong" => "The page count value is too long. Running the installer script for Kiriwrite is recommended.",
+ "templatecounttoolong" => "The template count value is too long. Running the installer script for Kiriwrite is recommended.",
+ "filtercounttoolong" => "The filter count value is too long. Running the installer script for Kiriwrite is recommended.",
+ "pagecountinvalid" => "The page count value is invalid. Running the installer script for Kiriwrite is recommended.",
+ "templatecountinvalid" => "The template count value is invalid. Running the installer script for Kiriwrite is recommended.",
+ "filtercountinvalid" => "The filter count is invalid. Running the installer script for Kiriwrite is recommended."
);
}
- binmode STDOUT, ':utf8';
-
print $pageoutput;
return;
findfilter = Find...
replacefilter = Replace with...
notes = Notes
+enabled = Enable this filter.
addfilterbutton = Add Filter
filteradded = Filter Added
filteraddedmessage = The filter was added successfully to the filters list.
display = Display
textareacols = Text Area Columns
textarearows = Text Area Rows
+pagecount = Pages on browse
+templatecount = Templates on browse
+filtercount = Filters on browse
date = Date
dateformat = Date Format
language = Language
# is "on" or blank and if it is something else then
# return an error.
+ if (!$override){
+
+ $override = "off";
+
+ }
+
if ($override eq "on"){
- } elsif (!$override){
+ } elsif (!$override || $override eq "off"){
} else {
# The override value is invalid so return an error.
%filter_info = $kiriwrite_dbmodule->getfilterinfo({ FilterID => $filter, Reduced => 1 });
+ # Check if the filter is enabled and if it isn't then process
+ # the next filter.
+
+ if (!$filter_info{"FilterEnabled"}){
+
+ # The filter is not enabled so process the next filter.
+
+ next;
+
+ }
+
# Check if any errors occured while getting the filter information.
if ($kiriwrite_dbmodule->geterror eq "FilterDatabaseError"){
$kiriwrite_presmodule->addtext($kiriwrite_lang->{database}->{databasenotes});
$kiriwrite_presmodule->endcell();
$kiriwrite_presmodule->addcell("tablecell2");
- $kiriwrite_presmodule->addtextbox("databasenotes", { Columns => 50, Rows => 10, WordWrap => 0 });
+ $kiriwrite_presmodule->addtextbox("databasenotes", { Columns => $kiriwrite_config{"display_textareacols"}, Rows => $kiriwrite_config{"display_textarearows"}, WordWrap => 0 });
$kiriwrite_presmodule->endcell();
$kiriwrite_presmodule->endrow();
$kiriwrite_presmodule->addtext($kiriwrite_lang->{database}->{databasenotes});
$kiriwrite_presmodule->endcell();
$kiriwrite_presmodule->addcell("tablecell2");
- $kiriwrite_presmodule->addtextbox("databasenotes", { Columns => 50, Rows => 10, Value => $database_notes } );
+ $kiriwrite_presmodule->addtextbox("databasenotes", { Columns => $kiriwrite_config{"display_textareacols"}, Rows => $kiriwrite_config{"display_textarearows"}, Value => $database_notes } );
$kiriwrite_presmodule->endcell();
$kiriwrite_presmodule->endrow();
my $http_query_findwords = $form_data->{'findword'};
my $http_query_replacewords = $form_data->{'replaceword'};
my $http_query_priority = $form_data->{'priority'};
+ my $http_query_enabled = $form_data->{'enabled'};
my $http_query_notes = $form_data->{'notes'};
- my $pagedata = kiriwrite_filter_add($http_query_findwords, $http_query_replacewords, $http_query_priority, $http_query_notes, $http_query_confirm);
+ my $pagedata = kiriwrite_filter_add({ FindFilter => $http_query_findwords, ReplaceFilter => $http_query_replacewords, Priority => $http_query_priority, Enabled => $http_query_enabled, Notes => $http_query_notes, Confirm => $http_query_confirm });
+ #my $pagedata = kiriwrite_filter_add($http_query_findwords, $http_query_replacewords, $http_query_priority, $http_query_notes, $http_query_confirm);
kiriwrite_output_header; # Output the header to browser/console/stdout.
kiriwrite_output_page($kiriwrite_lang->{filter}->{addfilter}, $pagedata, "filter"); # Output the page to browser/console/stdout.
my $http_query_replacewords = $form_data->{'filterreplace'};
my $http_query_priority = $form_data->{'priority'};
my $http_query_notes = $form_data->{'notes'};
+ my $http_query_enabled = $form_data->{'enabled'};
- my $pagedata = kiriwrite_filter_edit($http_query_number, $http_query_findwords, $http_query_replacewords, $http_query_priority, $http_query_notes, $http_query_confirm);
+ my $pagedata = kiriwrite_filter_edit({ FilterID => $http_query_number, NewFindFilter => $http_query_findwords, NewReplaceFilter => $http_query_replacewords, NewPriority => $http_query_priority, NewEnabled => $http_query_enabled, NewFilterNotes => $http_query_notes, Confirm => $http_query_confirm });
kiriwrite_output_header; # Output the header to browser/console/stdout.
kiriwrite_output_page($kiriwrite_lang->{filter}->{editfilter}, $pagedata, "filter"); # Output the page to browser/console/stdout.
}
- my $pagedata = kiriwrite_filter_edit($http_query_number);
+ my $pagedata = kiriwrite_filter_edit({ FilterID => $http_query_number });
kiriwrite_output_header; # Output the header to browser/console/stdout.
kiriwrite_output_page($kiriwrite_lang->{filter}->{editfilter}, $pagedata, "filter"); # Output the page to browser/console/stdout.
my $blankfindfilter = 0;
my $filterswarning = "";
my $filter;
- my $filter_split = 50;
+ my $filter_split = $kiriwrite_config{"display_filtercount"};
my $filter_list = 0;
my $filter_count = 0;
my $filter_style = 0;
if ($filter_total_count eq $filter_split){
- $filter_list = substr(($filter_total_count / $filter_split), 0, 1);
+ $filter_list = int(($filter_total_count / $filter_split));
} else {
- $filter_list = substr(($filter_total_count / $filter_split), 0, 1) + 1;
+ $filter_list = int(($filter_total_count / $filter_split) + 1);
}
$filter_list{$filter_count}{Priority} = $filter_info{"FilterPriority"};
$filter_list{$filter_count}{Find} = $filter_info{"FilterFind"};
$filter_list{$filter_count}{Replace} = $filter_info{"FilterReplace"};
+ $filter_list{$filter_count}{Enabled} = $filter_info{"FilterEnabled"};
$filter_list{$filter_count}{Notes} = $filter_info{"FilterNotes"};
$filter_count++;
}
+ # Check if the filter is disabled.
+
+ if (!$filter_list{$filter}{Enabled}){
+
+ $filter_style_name = "tablecelldisabled";
+
+ }
+
$kiriwrite_presmodule->startrow();
$kiriwrite_presmodule->addcell($filter_style_name);
$kiriwrite_presmodule->addtext($filter_list{$filter}{Priority});
}
- if (!@database_filters && $filter_browsenumber > 1){
+ if (!$filter_total_count){
+
+ $filter_total_count = "";
+
+ }
+
+ if ($filter_browsenumber > 1 && !@database_filters){
# There were no values given for the page browse
# number given so write a message saying that
# given.
$kiriwrite_presmodule->clear();
- $kiriwrite_presmodule->addtext(kiriwrite_language($kiriwrite_lang->{filter}->{viewfilters}, $db_name), { Style => "pageheader" });
+ $kiriwrite_presmodule->addtext($kiriwrite_lang->{filter}->{viewfilters}, { Style => "pageheader" });
$kiriwrite_presmodule->addlinebreak();
$kiriwrite_presmodule->addlinebreak();
$kiriwrite_presmodule->startbox("errorbox");
# There are no filters in the filter database.
$kiriwrite_presmodule->clear();
- $kiriwrite_presmodule->addtext(kiriwrite_language($kiriwrite_lang->{filter}->{viewfilters}, $db_name), { Style => "pageheader" });
+ $kiriwrite_presmodule->addtext(kiriwrite_language($kiriwrite_lang->{filter}->{viewfilters}), { Style => "pageheader" });
$kiriwrite_presmodule->addlinebreak();
$kiriwrite_presmodule->addlinebreak();
$kiriwrite_presmodule->startbox("errorbox");
# #
# Usage: #
# #
-# kiriwrite_filter_add(filterfind, filterreplace, filterpriority, #
-# filternotes, [confirm]); #
+# kiriwrite_filter_add(options); #
# #
-# filterfind Specifies the new word(s) to find. #
-# filterreplace Specifies the new word(s) to replace. #
-# filterpriority Specifies the new priority to use. #
-# filternotes Specifies the new notes to use. #
-# confirm Confirms the action to add a filter. #
+# options Specifies the following options as a hash (in any order). #
+# #
+# FindFilter Specifies the find filter setting. #
+# ReplaceFilter Specifies the replace filter setting. #
+# Priority Specifies the priority of the filter. #
+# Enabled Specifies if the filter should be enabled. #
+# Notes Specifies some notes about the filter. #
+# Confirm Specifies if the filter should be added. #
#################################################################################
# Get the values that have been passed to the subroutine.
- my ($filter_new_find, $filter_new_replace, $filter_new_priority, $filter_new_notes, $confirm) = @_;
+ my ($options) = @_;
+
+ $confirm = $options->{"Confirm"};
# Check the confirm value to make sure it is no more than
# one character long.
# The confirm integer is '1', so add the word
# to the filter list.
+ # Get the values from the hashref.
+
+ my $filter_new_find = $options->{"FindFilter"};
+ my $filter_new_replace = $options->{"ReplaceFilter"};
+ my $filter_new_priority = $options->{"Priority"};
+ my $filter_new_enabled = $options->{"Enabled"};
+ my $filter_new_notes = $options->{"Notes"};
+
# First, check the variables recieved are UTF8
# copliant.
}
+ # Check if the enabled value is either "on" or
+ # blank and return an error if it is something
+ # else.
+
+ if (!$filter_new_enabled || $filter_new_enabled ne "off"){
+
+ } else {
+
+ # FINISH THIS.
+
+ }
+
+ # Check if the new filter should be enabled.
+
+ my $filter_enable = 0;
+
+ if (!$filter_new_enabled){
+
+ $filter_new_enabled = "off";
+
+ }
+
+ if ($filter_new_enabled eq "on"){
+
+ # The filter is enabled.
+
+ $filter_enable = 1;
+
+ }
+
# Check the length and contents of the values given
# to make sure they are valid.
# Add the filter to the filter database.
- $kiriwrite_dbmodule->addfilter({ FindFilter => $filter_new_find, ReplaceFilter => $filter_new_replace, Priority => $filter_new_priority, Notes => $filter_new_notes});
+ $kiriwrite_dbmodule->addfilter({ FindFilter => $filter_new_find, ReplaceFilter => $filter_new_replace, Priority => $filter_new_priority, Enabled => $filter_enable, Notes => $filter_new_notes});
# Check if any errors have occured while adding the filter.
$kiriwrite_presmodule->addtext($kiriwrite_lang->{filter}->{notes});
$kiriwrite_presmodule->endcell();
$kiriwrite_presmodule->addcell("tablecell2");
- $kiriwrite_presmodule->addtextbox("notes", { Columns => 50, Rows => 10 });
+ $kiriwrite_presmodule->addtextbox("notes", { Columns => $kiriwrite_config{"display_textareacols"}, Rows => $kiriwrite_config{"display_textarearows"} });
+ $kiriwrite_presmodule->endcell();
+ $kiriwrite_presmodule->endrow();
+
+ $kiriwrite_presmodule->startrow();
+ $kiriwrite_presmodule->addcell("tablecell1");
+ $kiriwrite_presmodule->endcell();
+ $kiriwrite_presmodule->addcell("tablecell2");
+ $kiriwrite_presmodule->addcheckbox("enabled", { OptionDescription => $kiriwrite_lang->{filter}->{enabled}, Checked => 1 });
$kiriwrite_presmodule->endcell();
$kiriwrite_presmodule->endrow();
# #
# Usage: #
# #
-# kiriwrite_filter_edit(filternumber, newfilterfind, newfilterreplace, #
-# newfilterpriority, newfilternotes, confirm); #
+# kiriwrite_filter_edit(options); #
+# #
+# options Specifies the following options as hash (in any order). #
# #
-# filterid Specifies the filter number (line number) in the #
-# filter database. #
-# newfilterfind Specifies the new word to find. #
-# newfilterreplace Specifies the new word to replace. #
-# newfilterpriority Specifies the new filter priority. #
-# newfilternotes Specifies the new filter notes. #
-# confirm Confirms the action to edit a filter. #
+# FilterID Specifies the filter number in the filter database. #
+# NewFindFilter Specifies the new find filter. #
+# NewReplaceFilter Specifies the new replace filter. #
+# NewPriority Specifies the new priority. #
+# NewEnabled Specifies the new enable setting. #
+# NewFilterNotes Specifies the new filter notes. #
+# Confirm Confirms the action to edit a filter. #
#################################################################################
# Get the values that have been passed to the subroutine.
- my ($filter_id, $filter_new_find, $filter_new_replace, $filter_new_priority, $filter_new_notes, $confirm) = @_;
+ my ($options) = @_;
+ #my ($filter_id, $filter_new_find, $filter_new_replace, $filter_new_priority, $filter_new_notes, $confirm) = @_;
+
+ my $filter_id = $options->{"FilterID"};
+ my $confirm = $options->{"Confirm"};
# Check the confirm value to make sure it is no more than
# one character long.
# The action to edit a filter has been confirmed so
# edit the selected filter.
+ # Get the values from the hashref.
+
+ my $filter_new_find = $options->{"NewFindFilter"};
+ my $filter_new_replace = $options->{"NewReplaceFilter"};
+ my $filter_new_priority = $options->{"NewPriority"};
+ my $filter_new_notes = $options->{"NewFilterNotes"};
+ my $filter_new_enabled = $options->{"NewEnabled"};
+
# First, check the variables recieved are UTF8
# copliant.
}
+ # Check to see if the filter should be enabled.
+
+ my $filter_enable = 0;
+
+ if (!$filter_new_enabled){
+
+ $filter_new_enabled = "off";
+
+ }
+
+ if ($filter_new_enabled eq "on"){
+
+ # The filter is enabled.
+
+ $filter_enable = 1;
+
+ }
+
# Connect to the database server.
$kiriwrite_dbmodule->connect();
# Edit the selected filter in the filter database.
- $kiriwrite_dbmodule->editfilter({ FilterID => $filter_id, NewFindFilter => $filter_new_find, NewReplaceFilter => $filter_new_replace, NewFilterPriority => $filter_new_priority, NewFilterNotes => $filter_new_notes });
+ $kiriwrite_dbmodule->editfilter({ FilterID => $filter_id, NewFindFilter => $filter_new_find, NewReplaceFilter => $filter_new_replace, NewFilterPriority => $filter_new_priority, NewEnabled => $filter_enable, NewFilterNotes => $filter_new_notes });
# Check if any errors occured while editing the filter.
$filter_priority = $filter_info{"FilterPriority"};
$filter_find = $filter_info{"FilterFind"};
$filter_replace = $filter_info{"FilterReplace"};
+ $filter_enabled = $filter_info{"FilterEnabled"};
$filter_notes = $filter_info{"FilterNotes"};
# Disconnect from the filter database.
$kiriwrite_presmodule->addtext($kiriwrite_lang->{filter}->{notes});
$kiriwrite_presmodule->endcell();
$kiriwrite_presmodule->addcell("tablecell2");
- $kiriwrite_presmodule->addtextbox("notes", { Columns => 50, Rows => 10});
+ $kiriwrite_presmodule->addtextbox("notes", { Columns => $kiriwrite_config{"display_textareacols"}, Rows => $kiriwrite_config{"display_textarearows"}, Value => $filter_notes});
+ $kiriwrite_presmodule->endcell();
+ $kiriwrite_presmodule->endrow();
+
+ $kiriwrite_presmodule->startrow();
+ $kiriwrite_presmodule->addcell("tablecell1");
+ $kiriwrite_presmodule->endcell();
+ $kiriwrite_presmodule->addcell("tablecell2");
+
+ if ($filter_enabled eq 1){
+
+ $kiriwrite_presmodule->addcheckbox("enabled", { OptionDescription => $kiriwrite_lang->{filter}->{enabled}, Checked => 1 });
+
+ } else {
+
+ $kiriwrite_presmodule->addcheckbox("enabled", { OptionDescription => $kiriwrite_lang->{filter}->{enabled} });
+
+ }
$kiriwrite_presmodule->endcell();
$kiriwrite_presmodule->endrow();
my $tablestyletype = 0;
my $page_count = 0;
my $db_file_notblank = 0;
- my $page_split = 50;
+ my $page_split = $kiriwrite_config{"display_pagecount"};
my $page_list = 0;
my $page_list_count = 0;
if ($page_total_count eq $page_split){
- $page_list = substr(($page_total_count / $page_split), 0, 1);
+ $page_list = int(($page_total_count / $page_split));
} else {
- $page_list = substr(($page_total_count / $page_split), 0, 1) + 1;
+ $page_list = int(($page_total_count / $page_split) + 1);
}
$kiriwrite_presmodule->addtext($kiriwrite_lang->{pages}->{pagecontent});
$kiriwrite_presmodule->endcell();
$kiriwrite_presmodule->addcell("tablecell2");
- $kiriwrite_presmodule->addtextbox("pagecontent", { Columns => 50, Rows => 10 });
+ $kiriwrite_presmodule->addtextbox("pagecontent", { Columns => $kiriwrite_config{"display_textareacols"}, Rows => $kiriwrite_config{"display_textarearows"} });
$kiriwrite_presmodule->addlinebreak();
$kiriwrite_presmodule->addlinebreak();
$kiriwrite_presmodule->startbox("datalist");
$kiriwrite_presmodule->addtext($kiriwrite_lang->{pages}->{pagecontent});
$kiriwrite_presmodule->endcell();
$kiriwrite_presmodule->addcell("tablecell2");
- $kiriwrite_presmodule->addtextbox("pagecontent", { Columns => 50, Rows => 10, Value => $data_content });
+ $kiriwrite_presmodule->addtextbox("pagecontent", { Columns => $kiriwrite_config{"display_textareacols"}, Rows => $kiriwrite_config{"display_textarearows"}, Value => $data_content });
$kiriwrite_presmodule->addlinebreak();
$kiriwrite_presmodule->addlinebreak();
$kiriwrite_presmodule->startbox("datalist");
my $http_query_dbmodule = $form_data->{'dbmodule'};
my $http_query_textareacols = $form_data->{'textareacols'};
my $http_query_textarearows = $form_data->{'textarearows'};
+ my $http_query_pagecount = $form_data->{'pagecount'};
+ my $http_query_filtercount = $form_data->{'filtercount'};
+ my $http_query_templatecount = $form_data->{'templatecount'};
my $http_query_database_server = $form_data->{'database_server'};
my $http_query_database_port = $form_data->{'database_port'};
my $http_query_database_password = $form_data->{'database_password'};
my $http_query_database_tableprefix = $form_data->{'database_tableprefix'};
- my $pagedata = kiriwrite_settings_edit({ DatabaseDirectory => $http_query_database, OutputDirectory => $http_query_output, ImagesURIPath => $http_query_imagesuri, DateTimeFormat => $http_query_datetimeformat, SystemLanguage => $http_query_systemlanguage, PresentationModule => $http_query_presmodule, TextAreaCols => $http_query_textareacols, TextAreaRows => $http_query_textarearows, DatabaseModule => $http_query_dbmodule, DatabaseServer => $http_query_database_server, DatabasePort => $http_query_database_port, DatabaseProtocol => $http_query_database_protocol, DatabaseSQLDatabase => $http_query_database_sqldatabase, DatabaseUsername => $http_query_database_username, DatabasePasswordKeep => $http_query_database_passwordkeep, DatabasePassword => $http_query_database_password, DatabaseTablePrefix => $http_query_database_tableprefix, Confirm => 1 });
+ my $pagedata = kiriwrite_settings_edit({ DatabaseDirectory => $http_query_database, OutputDirectory => $http_query_output, ImagesURIPath => $http_query_imagesuri, DateTimeFormat => $http_query_datetimeformat, SystemLanguage => $http_query_systemlanguage, PresentationModule => $http_query_presmodule, TextAreaCols => $http_query_textareacols, TextAreaRows => $http_query_textarearows, PageCount => $http_query_pagecount, FilterCount => $http_query_filtercount, TemplateCount => $http_query_templatecount, DatabaseModule => $http_query_dbmodule, DatabaseServer => $http_query_database_server, DatabasePort => $http_query_database_port, DatabaseProtocol => $http_query_database_protocol, DatabaseSQLDatabase => $http_query_database_sqldatabase, DatabaseUsername => $http_query_database_username, DatabasePasswordKeep => $http_query_database_passwordkeep, DatabasePassword => $http_query_database_password, DatabaseTablePrefix => $http_query_database_tableprefix, Confirm => 1 });
kiriwrite_output_header; # Output the header to browser/console/stdout.
kiriwrite_output_page($kiriwrite_lang->{setting}->{editsettings}, $pagedata, "settings"); # Output the page to browser/console/stdout.
my $settings_noncgi_images = $kiriwrite_config{"directory_noncgi_images"};
my $settings_display_textareacols = $kiriwrite_config{"display_textareacols"};
my $settings_display_textarearows = $kiriwrite_config{"display_textarearows"};
+ my $settings_display_pagecount = $kiriwrite_config{"display_pagecount"};
+ my $settings_display_templatecount = $kiriwrite_config{"display_templatecount"};
+ my $settings_display_filtercount = $kiriwrite_config{"display_filtercount"};
my $settings_system_datetime = $kiriwrite_config{"system_datetime"};
my $settings_system_language = $kiriwrite_config{"system_language"};
my $settings_system_presentation = $kiriwrite_config{"system_presmodule"};
$kiriwrite_presmodule->endcell();
$kiriwrite_presmodule->endrow();
+ $kiriwrite_presmodule->startrow();
+ $kiriwrite_presmodule->addcell("tablecell1");
+ $kiriwrite_presmodule->addtext($kiriwrite_lang->{setting}->{pagecount});
+ $kiriwrite_presmodule->endcell();
+ $kiriwrite_presmodule->addcell("tablecell2");
+ $kiriwrite_presmodule->addtext($settings_display_pagecount);
+ $kiriwrite_presmodule->endcell();
+ $kiriwrite_presmodule->endrow();
+
+ $kiriwrite_presmodule->startrow();
+ $kiriwrite_presmodule->addcell("tablecell1");
+ $kiriwrite_presmodule->addtext($kiriwrite_lang->{setting}->{templatecount});
+ $kiriwrite_presmodule->endcell();
+ $kiriwrite_presmodule->addcell("tablecell2");
+ $kiriwrite_presmodule->addtext($settings_display_templatecount);
+ $kiriwrite_presmodule->endcell();
+ $kiriwrite_presmodule->endrow();
+
+ $kiriwrite_presmodule->startrow();
+ $kiriwrite_presmodule->addcell("tablecell1");
+ $kiriwrite_presmodule->addtext($kiriwrite_lang->{setting}->{filtercount});
+ $kiriwrite_presmodule->endcell();
+ $kiriwrite_presmodule->addcell("tablecell2");
+ $kiriwrite_presmodule->addtext($settings_display_filtercount);
+ $kiriwrite_presmodule->endcell();
+ $kiriwrite_presmodule->endrow();
+
$kiriwrite_presmodule->startrow();
$kiriwrite_presmodule->addcell("tablecellheader");
$kiriwrite_presmodule->addtext($kiriwrite_lang->{setting}->{date});
# DatabaseModule Specifies the new database module to use for Kiriwrite. #
# TextAreaCols Specifies the width of the text area. #
# TextAreaRows Specifies the height of the text area. #
+# PageCount Specifies the amount of pages that should be viewed. #
+# FilterCount Specifies the amount of filters that should be viewed. #
+# TemplateCount Specifies the amount of templates that should be viewed.#
# #
# Options for server-based database modules. #
# #
my $settings_dbmodule = $passedoptions->{"DatabaseModule"};
my $settings_textareacols = $passedoptions->{"TextAreaCols"};
my $settings_textarearows = $passedoptions->{"TextAreaRows"};
+ my $settings_pagecount = $passedoptions->{"PageCount"};
+ my $settings_filtercount = $passedoptions->{"FilterCount"};
+ my $settings_templatecount = $passedoptions->{"TemplateCount"};
my $settings_database_server = $passedoptions->{"DatabaseServer"};
my $settings_database_port = $passedoptions->{"DatabasePort"};
my $kiriwrite_textareacols_maxlength = kiriwrite_variablecheck($settings_textareacols, "maxlength", 3, 1);
my $kiriwrite_textareacols_number = kiriwrite_variablecheck($settings_textareacols, "numbers", 0, 1);
+ my $kiriwrite_pagecount_maxlength = kiriwrite_variablecheck($settings_pagecount, "maxlength", 4, 1);
+ my $kiriwrite_pagecount_number = kiriwrite_variablecheck($settings_pagecount, "numbers", 0, 1);
+ my $kiriwrite_filtercount_maxlength = kiriwrite_variablecheck($settings_filtercount, "maxlength", 4, 1);
+ my $kiriwrite_filtercount_number = kiriwrite_variablecheck($settings_filtercount, "numbers", 0, 1);
+ my $kiriwrite_templatecount_maxlength = kiriwrite_variablecheck($settings_templatecount, "maxlength", 4, 1);
+ my $kiriwrite_templatecount_number = kiriwrite_variablecheck($settings_templatecount, "numbers", 0, 1);
+
if ($kiriwrite_dbdirectory_check eq 1){
# The database directory name is blank, so return
}
+ if ($kiriwrite_pagecount_maxlength eq 1){
+
+ # The page count value is too long, so return
+ # an error.
+
+ kiriwrite_error("pagecounttoolong");
+
+ }
+
+ if ($kiriwrite_pagecount_number eq 1){
+
+ # The page count value is invalid, so return
+ # an error.
+
+ kiriwrite_error("pagecountinvalid");
+
+ }
+
+ if ($kiriwrite_filtercount_maxlength eq 1){
+
+ # The filter count value is too long, so return
+ # an error.
+
+ kiriwrite_error("filtercounttoolong");
+
+ }
+
+ if ($kiriwrite_filtercount_number eq 1){
+
+ # The filter count value is invalid, so return
+ # an error.
+
+ kiriwrite_error("filtercountinvalid");
+
+ }
+
+ if ($kiriwrite_templatecount_maxlength eq 1){
+
+ # The template count value is too long, so return
+ # an error.
+
+ kiriwrite_error("templatecounttoolong");
+
+ }
+
+ if ($kiriwrite_templatecount_number eq 1){
+
+ # The template count value is invalid, so return
+ # an error.
+
+ kiriwrite_error("templatecountinvalid");
+
+ }
+
# Check if the presentation module with the filename given exists.
my $presmodule_exists = kiriwrite_fileexists("Modules/Presentation/" . $settings_presmodule . ".pm");
# Write the new settings to the configuration file.
- kiriwrite_output_config({ DatabaseDirectory => $settings_dbdirectory, OutputDirectory => $settings_outputdirectory, ImagesURIPath => $settings_imagesuri, DateTimeFormat => $settings_datetimeformat, SystemLanguage => $settings_languagesystem, PresentationModule => $settings_presmodule, TextAreaCols => $settings_textareacols, TextAreaRows => $settings_textarearows, DatabaseModule => $settings_dbmodule, DatabaseServer => $settings_database_server, DatabasePort => $settings_database_port, DatabaseProtocol => $settings_database_protocol, DatabaseSQLDatabase => $settings_database_sqldatabase, DatabaseUsername => $settings_database_username, DatabasePassword => $settings_database_password, DatabaseTablePrefix => $settings_database_tableprefix });
+ kiriwrite_output_config({ DatabaseDirectory => $settings_dbdirectory, OutputDirectory => $settings_outputdirectory, ImagesURIPath => $settings_imagesuri, DateTimeFormat => $settings_datetimeformat, SystemLanguage => $settings_languagesystem, PresentationModule => $settings_presmodule, TextAreaCols => $settings_textareacols, TextAreaRows => $settings_textarearows, PageCount => $settings_pagecount, FilterCount => $settings_filtercount, TemplateCount => $settings_templatecount, DatabaseModule => $settings_dbmodule, DatabaseServer => $settings_database_server, DatabasePort => $settings_database_port, DatabaseProtocol => $settings_database_protocol, DatabaseSQLDatabase => $settings_database_sqldatabase, DatabaseUsername => $settings_database_username, DatabasePassword => $settings_database_password, DatabaseTablePrefix => $settings_database_tableprefix });
# Write a confirmation message.
my $display_textareacols = $kiriwrite_config{"display_textareacols"};
my $display_textarearows = $kiriwrite_config{"display_textarearows"};
+ my $display_pagecount = $kiriwrite_config{"display_pagecount"};
+ my $display_templatecount = $kiriwrite_config{"display_templatecount"};
+ my $display_filtercount = $kiriwrite_config{"display_filtercount"};
my $database_server = $kiriwrite_config{"database_server"};
my $database_port = $kiriwrite_config{"database_port"};
$kiriwrite_presmodule->addinputbox("textarearows", { Size => 3, MaxLength => 3, Value => $display_textarearows });
$kiriwrite_presmodule->endrow();
+ $kiriwrite_presmodule->startrow();
+ $kiriwrite_presmodule->addcell("tablecell1");
+ $kiriwrite_presmodule->addtext($kiriwrite_lang->{setting}->{pagecount});
+ $kiriwrite_presmodule->endcell();
+ $kiriwrite_presmodule->addcell("tablecell2");
+ $kiriwrite_presmodule->addinputbox("pagecount", { Size => 4, MaxLength => 4, Value => $display_pagecount });
+ $kiriwrite_presmodule->endrow();
+
+ $kiriwrite_presmodule->startrow();
+ $kiriwrite_presmodule->addcell("tablecell1");
+ $kiriwrite_presmodule->addtext($kiriwrite_lang->{setting}->{filtercount});
+ $kiriwrite_presmodule->endcell();
+ $kiriwrite_presmodule->addcell("tablecell2");
+ $kiriwrite_presmodule->addinputbox("filtercount", { Size => 4, MaxLength => 4, Value => $display_filtercount });
+ $kiriwrite_presmodule->endrow();
+
+ $kiriwrite_presmodule->startrow();
+ $kiriwrite_presmodule->addcell("tablecell1");
+ $kiriwrite_presmodule->addtext($kiriwrite_lang->{setting}->{templatecount});
+ $kiriwrite_presmodule->endcell();
+ $kiriwrite_presmodule->addcell("tablecell2");
+ $kiriwrite_presmodule->addinputbox("templatecount", { Size => 4, MaxLength => 4, Value => $display_templatecount });
+ $kiriwrite_presmodule->endrow();
+
$kiriwrite_presmodule->startrow();
$kiriwrite_presmodule->addcell("tablecellheader");
$kiriwrite_presmodule->addtext($kiriwrite_lang->{setting}->{date});
# Kiriwrite. #
# TextAreaCols Specifies the width of the text area. #
# TextAreaRows Specifies the height of the text area. #
+# PageCount Specifies the amount of pages to view. #
+# FilterCount Specifies the amount of filters to view. #
+# TemplateCount Specifies the amount of templates to view. #
# DatabaseModule Specifies the new database module to use for Kiriwrite. #
# DatabaseServer Specifies the database server to use. #
# DaravasePort Specifies the port the database server is running on. #
my $settings_textareacols = $passedsettings->{"TextAreaCols"};
my $settings_textarearows = $passedsettings->{"TextAreaRows"};
+ my $settings_pagecount = $passedsettings->{"PageCount"};
+ my $settings_filtercount = $passedsettings->{"FilterCount"};
+ my $settings_templatecount = $passedsettings->{"TemplateCount"};
my $settings_database_server = $passedsettings->{"DatabaseServer"};
my $settings_database_port = $passedsettings->{"DatabasePort"};
$configdata = $configdata . "system_datetime = " . $settings_datetime . "\r\n\r\n";
$configdata = $configdata . "display_textareacols = " . $settings_textareacols . "\r\n";
- $configdata = $configdata . "display_textarearows = " . $settings_textarearows . "\r\n\r\n";
+ $configdata = $configdata . "display_textarearows = " . $settings_textarearows . "\r\n";
+ $configdata = $configdata . "display_pagecount = " . $settings_pagecount . "\r\n";
+ $configdata = $configdata . "display_filtercount = " . $settings_filtercount . "\r\n";
+ $configdata = $configdata . "display_templatecount = " . $settings_templatecount . "\r\n\r\n";
$configdata = $configdata . "database_server = " . $settings_database_server . "\r\n";
$configdata = $configdata . "database_port = " . $settings_database_port . "\r\n";
$kiriwrite_presmodule->addtext($kiriwrite_lang->{template}->{templatelayout});
$kiriwrite_presmodule->endcell();
$kiriwrite_presmodule->addcell("tablecell2");
- $kiriwrite_presmodule->addtextbox("templatelayout", { Columns => 50, Rows => 10 });
+ $kiriwrite_presmodule->addtextbox("templatelayout", { Columns => $kiriwrite_config{"display_textareacols"}, Rows => $kiriwrite_config{"display_textarearows"} });
$kiriwrite_presmodule->addlinebreak();
$kiriwrite_presmodule->addlinebreak();
$kiriwrite_presmodule->startbox("datalist");
$kiriwrite_presmodule->addtext($kiriwrite_lang->{template}->{templatelayout});
$kiriwrite_presmodule->endcell();
$kiriwrite_presmodule->addcell("tablecell2");
- $kiriwrite_presmodule->addtextbox("newlayout", { Rows => 10, Columns => 50, Value => $template_layout});
+ $kiriwrite_presmodule->addtextbox("newlayout", { Columns => $kiriwrite_config{"display_textareacols"}, Rows => $kiriwrite_config{"display_textarearows"}, Value => $template_layout});
$kiriwrite_presmodule->addlinebreak();
$kiriwrite_presmodule->addlinebreak();
$kiriwrite_presmodule->startbox("datalist");
my $template_description = "";
my $template_data = "";
- my $template_split = 50;
+ my $template_split = $kiriwrite_config{"display_templatecount"};
my $template_list = 0;
my $template_count = 0;
if ($template_total_count eq $template_split){
- $template_list = substr(($template_total_count / $template_split), 0, 1);
+ $template_list = int(($template_total_count / $template_split));
} else {
- $template_list = substr(($template_total_count / $template_split), 0, 1) + 1;
+ $template_list = int(($template_total_count / $template_split) + 1);
}
# then write a message saying that there are no templates in the
# database.
- if (!@database_pages && $template_browsenumber > 1){
-
- # There were no values given for the page browse
- # number given so write a message saying that
- # there were no pages for the page browse number
- # given.
-
- $kiriwrite_presmodule->clear();
- $kiriwrite_presmodule->addtext(kiriwrite_language($kiriwrite_lang->{template}->{viewtemplates}, $db_name), { Style => "pageheader" });
- $kiriwrite_presmodule->addlinebreak();
- $kiriwrite_presmodule->addlinebreak();
- $kiriwrite_presmodule->startbox("errorbox");
- $kiriwrite_presmodule->enterdata($kiriwrite_lang->{template}->{notemplatesinpagebrowse});
- $kiriwrite_presmodule->addlinebreak();
- $kiriwrite_presmodule->addlinebreak();
- $kiriwrite_presmodule->addlink($kiriwrite_env{"script_filename"} . "?mode=template" . $database_file, { Text => $kiriwrite_lang->{template}->{returntofirstpagebrowse} });
- $kiriwrite_presmodule->endbox();
-
- return $kiriwrite_presmodule->grab();
+ if (!@templates_list && $template_browsenumber > 1){
+
+ # There were no values given for the page browse
+ # number given so write a message saying that
+ # there were no pages for the page browse number
+ # given.
+
+ $kiriwrite_presmodule->clear();
+ $kiriwrite_presmodule->addtext(kiriwrite_language($kiriwrite_lang->{template}->{viewtemplates}, $db_name), { Style => "pageheader" });
+ $kiriwrite_presmodule->addlinebreak();
+ $kiriwrite_presmodule->addlinebreak();
+ $kiriwrite_presmodule->startbox("errorbox");
+ $kiriwrite_presmodule->enterdata($kiriwrite_lang->{template}->{notemplatesinpagebrowse});
+ $kiriwrite_presmodule->addlinebreak();
+ $kiriwrite_presmodule->addlinebreak();
+ $kiriwrite_presmodule->addlink($kiriwrite_env{"script_filename"} . "?mode=template", { Text => $kiriwrite_lang->{template}->{returntofirstpagebrowse} });
+ $kiriwrite_presmodule->endbox();
+
+ # Disconnect from the database server.
+
+ $kiriwrite_dbmodule->disconnect();
+ $kiriwrite_dbmodule->disconnecttemplate();
+
+ return $kiriwrite_presmodule->grab();
} elsif (!@templates_list && !$templatewarning){
$templatewarning = $kiriwrite_lang->{template}->{notemplatesavailable};
font-size: 12px;
}
+ .tablecelldisabled {
+ background-color: #808080;
+ font-size: 12px;
+ }
+
.copyrightbar {
background-color: #30AAAA;
padding: 7px;
font-weight: bold;
}
</style>
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8;">
+ <meta http-equiv="Content-Type" content="text/html; charset=utf8;">
</head>
<body>
<div class="page">