From 78f6c5e8ed54c22b470764e2b93c42ef1f6644e8 Mon Sep 17 00:00:00 2001 From: kirinji Date: Tue, 1 Apr 2008 20:08:56 +0000 Subject: [PATCH] Version 0.3.0 --- CHANGELOG | 9 + .../developer-chapter3-addfilter.html | 6 +- .../developer-chapter3-editfilter.html | 6 +- .../developer-chapter3-getfilterinfo.html | 2 +- Documentation/English (British)/user-all.html | 27 +- .../user-chapter2-filters.html | 10 + .../English (British)/user-chapter3.html | 12 + TODO | 6 + cgi-files/Modules/Database/MySQL5.pm | 18 +- cgi-files/Modules/Database/SQLite.pm | 21 +- cgi-files/install.cgi | 577 ++++++------------ cgi-files/kiriwrite.cgi | 116 +++- cgi-files/lang/en-GB.lang | 4 + cgi-files/lib/compile.lib | 19 +- cgi-files/lib/database.lib | 4 +- cgi-files/lib/filter.lib | 179 +++++- cgi-files/lib/page.lib | 10 +- cgi-files/lib/settings.lib | 142 ++++- cgi-files/lib/template.lib | 53 +- cgi-files/page.html | 7 +- 20 files changed, 743 insertions(+), 485 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index b9e9c5b..5754eb4 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,12 @@ +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 =========================== diff --git a/Documentation/English (British)/developer-chapter3-addfilter.html b/Documentation/English (British)/developer-chapter3-addfilter.html index 8d68579..51b58ad 100644 --- a/Documentation/English (British)/developer-chapter3-addfilter.html +++ b/Documentation/English (British)/developer-chapter3-addfilter.html @@ -29,7 +29,7 @@ Adds a filter to the filter database.

$kiriwrite_dbmodule->connectfilter(1); - $kiriwrite_dbmodule->addfilter({ FindFilter => “This is the find filter.”, ReplaceFilter => “This is the replace filter.”, Priority => 1, Notes => “Some notes about the filter.” }); + $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.” });

@@ -54,6 +54,10 @@ Specifies the following options as a hash in any order.

Priority Specifies the priority setting of the new filter. + + Enabled + Specifies if the filter should be used when compiling. + Notes Specifies the notes for the new filter. diff --git a/Documentation/English (British)/developer-chapter3-editfilter.html b/Documentation/English (British)/developer-chapter3-editfilter.html index 7c81d27..eb7373d 100644 --- a/Documentation/English (British)/developer-chapter3-editfilter.html +++ b/Documentation/English (British)/developer-chapter3-editfilter.html @@ -31,7 +31,7 @@ Edits a filter in the filter database.

$kiriwrite_dbmodule->connectfilter();
- $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.” }); + $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.” });
options
@@ -58,6 +58,10 @@ Specifies the following options as a hash in any order.

NewFilterPriority Specifies the new filter priority setting. + + NewEnabled + Specifies if the filter should be used when compiling. + NewFilterNotes Specifies the new filter notes. diff --git a/Documentation/English (British)/developer-chapter3-getfilterinfo.html b/Documentation/English (British)/developer-chapter3-getfilterinfo.html index c7b12c4..a4a4074 100644 --- a/Documentation/English (British)/developer-chapter3-getfilterinfo.html +++ b/Documentation/English (British)/developer-chapter3-getfilterinfo.html @@ -50,7 +50,7 @@ Specifies the following options as a hash in any order.

Reduced - Gets a reduced version of the filter information (filter identification number, priority, filter find setting and filter replace setting). + Gets a reduced version of the filter information (filter identification number, priority, filter find setting, filter replace setting and filter enabled setting). diff --git a/Documentation/English (British)/user-all.html b/Documentation/English (British)/user-all.html index 463e938..fd8083f 100644 --- a/Documentation/English (British)/user-all.html +++ b/Documentation/English (British)/user-all.html @@ -8,7 +8,7 @@ @@ -16,7 +16,30 @@ User Documentation
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. - + +

+ +Contents
+ +Preface
+Introduction
+Chapter 1: Installation
1.1: Obtaining Kiriwrite
1.2: Installing Kiriwrite
1.3: Kiriwrite Installer Script
+Chapter 2: Operation
2.1: Databases
2.2: Pages
2.3: Filters
2.4: Templates
2.5: Compiling
+Chapter 3: Kiriwrite Settings
+Chapter 4: Usage Tips
4.1: Securing your Kiriwrite installation
4.2: Renaming the Kiriwrite script (kiriwrite.cgi)
4.3: Removing unneeded modules and language files
+Chapter 5: Troubleshooting
+Chapter 6: Contributing to Kiriwrite
Preface

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.

diff --git a/Documentation/English (British)/user-chapter2-filters.html b/Documentation/English (British)/user-chapter2-filters.html index a68b8da..f477a48 100644 --- a/Documentation/English (British)/user-chapter2-filters.html +++ b/Documentation/English (British)/user-chapter2-filters.html @@ -25,6 +25,8 @@ When compiling the pages, the order of the filters list is determined by the fil 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.

+Filters that have a grey background are filters that have been disabled and won't be used when the pages are compiled.

+ 2.3.1 Add a filter

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.

@@ -50,6 +52,10 @@ To add a filter click on the 'Add Filter' link on the View Filters sub-menu, a f Notes Specifies the notes for this filter. + + Enable this filter + Specifies if the filter should be used when the pages are compiled. +
@@ -80,6 +86,10 @@ To edit a filter click on the 'Edit' link opposite the filter you want to edit. Notes Specifies the new notes for this filter. + + Enable this filter + Specifies if the filter should be used when the pages are compiled. +
diff --git a/Documentation/English (British)/user-chapter3.html b/Documentation/English (British)/user-chapter3.html index f09761f..3866336 100644 --- a/Documentation/English (British)/user-chapter3.html +++ b/Documentation/English (British)/user-chapter3.html @@ -48,6 +48,18 @@ To edit the settings, click on the 'Edit Settings' link in the View Settings sub Text Area Rows Specifies the height of the text area when editing notes, pages and templates. + + Pages on browse + Specifies the amount of pages that should be viewed when getting the list of pages in the database. + + + Filters on browse + Specifies the amount of filters that should be viewed when getting the list of filters in the database. + + + Templates on browse + Specifies the amount of templates that should be viewed when getting the list of templates in the database. + Date Format 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. diff --git a/TODO b/TODO index 46cce3a..772851a 100644 --- a/TODO +++ b/TODO @@ -1,7 +1,13 @@ 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 ============================ diff --git a/cgi-files/Modules/Database/MySQL5.pm b/cgi-files/Modules/Database/MySQL5.pm index 6b4bcf3..62a8967 100644 --- a/cgi-files/Modules/Database/MySQL5.pm +++ b/cgi-files/Modules/Database/MySQL5.pm @@ -2389,12 +2389,12 @@ sub getfilterinfo{ 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(); } @@ -2407,7 +2407,8 @@ sub getfilterinfo{ $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; @@ -2444,6 +2445,7 @@ sub addfilter{ # 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. # ################################################################################# @@ -2473,6 +2475,7 @@ sub addfilter{ 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. @@ -2513,6 +2516,12 @@ sub addfilter{ } + if (!$filter_enabled){ + + $filter_enabled = ""; + + } + # Check if there is really no filter table. if (!$filterdb_exists){ @@ -2623,6 +2632,7 @@ sub editfilter{ # 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. # ################################################################################# @@ -2644,6 +2654,7 @@ sub editfilter{ 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. @@ -2677,6 +2688,7 @@ sub editfilter{ 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(); diff --git a/cgi-files/Modules/Database/SQLite.pm b/cgi-files/Modules/Database/SQLite.pm index 2fea5a0..a9bae05 100644 --- a/cgi-files/Modules/Database/SQLite.pm +++ b/cgi-files/Modules/Database/SQLite.pm @@ -2054,12 +2054,12 @@ sub getfilterinfo{ 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(); } @@ -2072,7 +2072,8 @@ sub getfilterinfo{ $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; @@ -2137,6 +2138,7 @@ sub addfilter{ 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. @@ -2180,6 +2182,12 @@ sub addfilter{ } + if (!$filter_enabled){ + + $filter_enabled = ""; + + } + my $directory_permissions = main::kiriwrite_filepermissions(".", 1, 1, 0); if ($directory_permissions eq 1 && $filterdb_exists){ @@ -2207,6 +2215,7 @@ sub addfilter{ 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(); @@ -2280,11 +2289,12 @@ sub addfilter{ # 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(); @@ -2305,6 +2315,7 @@ sub editfilter{ # 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. # ################################################################################# @@ -2326,6 +2337,7 @@ sub editfilter{ 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. @@ -2373,6 +2385,7 @@ sub editfilter{ 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(); diff --git a/cgi-files/install.cgi b/cgi-files/install.cgi index a782dc6..8da09f0 100755 --- a/cgi-files/install.cgi +++ b/cgi-files/install.cgi @@ -25,7 +25,8 @@ use strict; # Throw errors if there's something wrong. 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 @@ -187,11 +188,12 @@ $kiriwrite_lang{"en-GB"}{"languagename"} = "English (British)"; $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){ @@ -963,17 +965,18 @@ sub kiriwrite_error{ $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 "\n"; + print "\n$kiriwrite_lang{$language_selected}{installertitle}\n\n\n\n"; - print h2($kiriwrite_lang{$language_selected}{error}); + print "

$kiriwrite_lang{$language_selected}{error}

"; print $kiriwrite_error{$error_type}; - print br(); + print "
\n"; print $kiriwrite_lang{$language_selected}{errormessagetext}; - print end_html(); + print "\n"; exit; @@ -1006,6 +1009,9 @@ sub kiriwrite_writeconfig{ 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} @@ -1020,6 +1026,35 @@ sub kiriwrite_writeconfig{ } +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 "\n"; + print "$name\n"; + print "$data\n"; + print "\n"; + +} + ################################################################################# # End list of subroutines. # ################################################################################# @@ -1034,29 +1069,29 @@ if ($http_query_confirm eq 1){ # 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. @@ -1606,26 +1641,26 @@ if ($http_query_confirm eq 1){ } - 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 "\n"; + print "\n$kiriwrite_lang{$language_selected}{installertitle}\n\n\n\n"; + print "

$kiriwrite_lang{$language_selected}{installertitle}

"; print $kiriwrite_lang{$language_selected}{installedmessage}; if ($installscriptmessage){ - print br(); - print br(); + print "

\n"; print $installscriptmessage; } - print br(); - print br(); + print "

\n"; print $kiriwrite_lang{$language_selected}{usekiriwritetext}; - print br(); - print br(); - print a({-href=>'kiriwrite.cgi'}, $kiriwrite_lang{$language_selected}{usekiriwritelink}); + print "

\n"; + print "$kiriwrite_lang{$language_selected}{usekiriwritelink}"; + print "\n"; exit; @@ -1633,7 +1668,7 @@ if ($http_query_confirm eq 1){ # 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', @@ -1643,7 +1678,7 @@ my @datetime_formats = [ '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. @@ -1829,191 +1864,133 @@ foreach $test (keys %test_list){ # 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 "\n"; +print "\n$kiriwrite_lang{$language_selected}{installertitle}\n"; +print "\n\n"; +print ""; my $language_name_short; my $language_list_seek = 0; +my $installlanguage_out = ""; -print "\n"; foreach $language_name_short (@language_list_short){ - print ""; + $installlanguage_out = $installlanguage_out . "\n"; $language_list_seek++; } -print " "; -print submit($kiriwrite_lang{$language_selected}{switch}); - -print end_form; -print end_td(); -print end_Tr(); -print end_table(); +$installlanguage_out = $installlanguage_out . "\n"; -print h2($kiriwrite_lang{$language_selected}{installertitle}); +kiriwrite_addtablerow($kiriwrite_lang{$language_selected}{installertitle}, "languagebar", "\n$installlanguage_out\n\n\n", "languagebarselect"); +print "
"; +print "

$kiriwrite_lang{$language_selected}{installertitle}

\n"; print $kiriwrite_lang{$language_selected}{installertext}; - -print h3($kiriwrite_lang{$language_selected}{dependencytitle}); -print h4($kiriwrite_lang{$language_selected}{requiredmodules}); +print "

$kiriwrite_lang{$language_selected}{dependencytitle}

\n"; +print "

$kiriwrite_lang{$language_selected}{requiredmodules}

\n"; print $kiriwrite_lang{$language_selected}{perlmodules}; -print br();; -print br();; +print "

\n"; if ($dependency_error eq 1){ print $kiriwrite_lang{$language_selected}{errormessage}; print $kiriwrite_lang{$language_selected}{dependencyperlmodulesmissing}; - print br(); - print br(); + print "

\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 "\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 "
"; -print h4($kiriwrite_lang{$language_selected}{databasemodules}); +print "

$kiriwrite_lang{$language_selected}{databasemodules}

\n"; print $kiriwrite_lang{$language_selected}{databasemodulestext}; -print br(); -print br(); +print "

\n"; if ($database_error eq 1){ print $kiriwrite_lang{$language_selected}{warningmessage}; print $kiriwrite_lang{$language_selected}{databaseperlmodulesmissing}; - print br(); - print br(); + print "

\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 ""; -print h4($kiriwrite_lang{$language_selected}{filepermissions}); +print "

$kiriwrite_lang{$language_selected}{filepermissions}

\n"; print $kiriwrite_lang{$language_selected}{filepermissionstext}; -print br(); -print br(); +print "

\n"; if ($file_error eq 1){ print $kiriwrite_lang{$language_selected}{errormessage}; print $kiriwrite_lang{$language_selected}{filepermissionsinvalid}; - print br(); - print br(); + print "

\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 ""; + +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 "
"; if ($dependency_error eq 1){ - print hr(); - print h4($kiriwrite_lang{$language_selected}{criticalerror}); - print $kiriwrite_lang{$language_selected}{dependencymodulesnotinstalled}; - print end_html; + print "
\n"; + print "

$kiriwrite_lang{$language_selected}{criticalerror}

\n"; + print $kiriwrite_lang{$language_selected}{dependencymodulesnotinstalled} . "\n"; + print "\n"; 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 "
\n"; + print "

$kiriwrite_lang{$language_selected}{criticalerror}

\n"; + print $kiriwrite_lang{$language_selected}{databasemodulesnotinstalled} . "\n"; + print "\n"; 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 "
\n"; + print "

$kiriwrite_lang{$language_selected}{criticalerror}

\n"; + print $kiriwrite_lang{$language_selected}{filepermissionerrors} . "\n"; + print "\n"; exit; } @@ -2022,9 +1999,11 @@ my @language_short; 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. @@ -2034,8 +2013,6 @@ opendir(LANGUAGEDIR, "lang"); my @language_directory = grep /m*\.lang$/, readdir(LANGUAGEDIR); closedir(LANGUAGEDIR); -my $language_data; - foreach my $language_file (@language_directory){ # Load the language file. @@ -2067,7 +2044,6 @@ foreach my $presmodule_file (@presmodule_directory){ # Get the friendly name for the database module. $presmodule_file =~ s/.pm$//g; - push(@presentation_modules, $presmodule_file); } @@ -2083,270 +2059,69 @@ foreach my $dbmodule_file (@dbmodule_directory){ # 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 "

$kiriwrite_lang{$language_selected}{settingstitle}

"; 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 "\n\n"; + +print ""; +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", "", "tabledata"); +kiriwrite_addtablerow($kiriwrite_lang{$language_selected}{outputdirectory}, "tablename", "", "tabledata"); +kiriwrite_addtablerow($kiriwrite_lang{$language_selected}{imagesuripath}, "tablename", "", "tabledata"); +kiriwrite_addtablerow($kiriwrite_lang{$language_selected}{display}, "tablecellheader", "", "tablecellheader"); +kiriwrite_addtablerow($kiriwrite_lang{$language_selected}{textarearows}, "tablename", "", "tabledata"); +kiriwrite_addtablerow($kiriwrite_lang{$language_selected}{textareacols}, "tablename", "", "tabledata"); +kiriwrite_addtablerow($kiriwrite_lang{$language_selected}{date}, "tablecellheader", "", "tablecellheader"); + +foreach my $select_name (@datetime_formats){ + $select_data = $select_data . "\n"; +} -foreach my $language (keys %available_languages){ +kiriwrite_addtablerow($kiriwrite_lang{$language_selected}{dateformat}, "tablename", "\n", "tabledata"); +kiriwrite_addtablerow($kiriwrite_lang{$language_selected}{language}, "tablecellheader", "", "tablecellheader"); +foreach my $language (keys %available_languages){ if ($language eq $language_selected){ - - print ""; - + $language_out = $language_out . "\n"; } else { - - print ""; - + $language_out = $language_out . "\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 . ""; +} +kiriwrite_addtablerow($kiriwrite_lang{$language_selected}{presentationmodule}, "tablename", "", "tabledata"); +foreach $dbmodule_name (@database_modules){ + $dbmodule_out = $dbmodule_out . ""; } -print ""; - -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", "", "tabledata"); +kiriwrite_addtablerow($kiriwrite_lang{$language_selected}{databaseserver}, "tablename", "\n", "tabledata"); +kiriwrite_addtablerow($kiriwrite_lang{$language_selected}{databaseport}, "tablename", "\n", "tabledata"); +kiriwrite_addtablerow($kiriwrite_lang{$language_selected}{databaseprotocol}, "tablename", "\n", "tabledata"); +kiriwrite_addtablerow($kiriwrite_lang{$language_selected}{databasename}, "tablename", "\n", "tabledata"); +kiriwrite_addtablerow($kiriwrite_lang{$language_selected}{databaseusername}, "tablename", "\n", "tabledata"); +kiriwrite_addtablerow($kiriwrite_lang{$language_selected}{databasepassword}, "tablename", "\n", "tabledata"); +kiriwrite_addtablerow($kiriwrite_lang{$language_selected}{databasetableprefix}, "tablename", "\n", "tabledata"); +kiriwrite_addtablerow($kiriwrite_lang{$language_selected}{installationoptions}, "tablecellheader", "", "tablecellheader"); +kiriwrite_addtablerow($kiriwrite_lang{$language_selected}{installoptions}, "tablename", " $kiriwrite_lang{$language_selected}{removeinstallscript}\n", "tabledata"); + +print "
\n"; + +print "
\n | \n"; + +print "\n\n"; exit; __END__ \ No newline at end of file diff --git a/cgi-files/kiriwrite.cgi b/cgi-files/kiriwrite.cgi index 3b55b08..5ae1cfb 100755 --- a/cgi-files/kiriwrite.cgi +++ b/cgi-files/kiriwrite.cgi @@ -28,6 +28,8 @@ use utf8; 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. @@ -240,6 +242,9 @@ sub kiriwrite_settings_load{ "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}, @@ -266,6 +271,12 @@ sub kiriwrite_settings_load{ 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. @@ -383,6 +394,93 @@ sub kiriwrite_settings_load{ } + # 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. @@ -1824,7 +1922,7 @@ sub kiriwrite_error{ "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" ); @@ -2043,6 +2141,7 @@ sub kiriwrite_utf8convert{ my $finalutf8 = Encode::decode_utf8( $utfstring ); return $finalutf8; + #return $utfstring; } @@ -2085,12 +2184,21 @@ sub kiriwrite_critical{ "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." ); @@ -2248,8 +2356,6 @@ sub kiriwrite_output_page{ } - binmode STDOUT, ':utf8'; - print $pageoutput; return; diff --git a/cgi-files/lang/en-GB.lang b/cgi-files/lang/en-GB.lang index e68aac5..e7dc8bf 100644 --- a/cgi-files/lang/en-GB.lang +++ b/cgi-files/lang/en-GB.lang @@ -192,6 +192,7 @@ addfilter = Add Filter 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. @@ -330,6 +331,9 @@ imagesuripath = Images (URI path) 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 diff --git a/cgi-files/lib/compile.lib b/cgi-files/lib/compile.lib index acd7fbb..3b667dd 100644 --- a/cgi-files/lib/compile.lib +++ b/cgi-files/lib/compile.lib @@ -212,8 +212,14 @@ sub kiriwrite_compile_makepages{ # 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. @@ -462,6 +468,17 @@ sub kiriwrite_compile_makepages{ %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"){ diff --git a/cgi-files/lib/database.lib b/cgi-files/lib/database.lib index 308dea9..3fbf11e 100644 --- a/cgi-files/lib/database.lib +++ b/cgi-files/lib/database.lib @@ -388,7 +388,7 @@ sub kiriwrite_database_add{ $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(); @@ -740,7 +740,7 @@ sub kiriwrite_database_edit{ $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(); diff --git a/cgi-files/lib/filter.lib b/cgi-files/lib/filter.lib index a0053df..0b40c73 100644 --- a/cgi-files/lib/filter.lib +++ b/cgi-files/lib/filter.lib @@ -34,9 +34,11 @@ if ($form_data->{'action'}){ 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. @@ -68,8 +70,9 @@ if ($form_data->{'action'}){ 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. @@ -77,7 +80,7 @@ if ($form_data->{'action'}){ } - 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. @@ -212,7 +215,7 @@ sub kiriwrite_filter_list{ 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; @@ -279,11 +282,11 @@ sub kiriwrite_filter_list{ 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); } @@ -345,6 +348,7 @@ sub kiriwrite_filter_list{ $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++; @@ -495,6 +499,14 @@ sub kiriwrite_filter_list{ } + # 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}); @@ -550,7 +562,13 @@ sub kiriwrite_filter_list{ } - 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 @@ -558,7 +576,7 @@ sub kiriwrite_filter_list{ # 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"); @@ -573,7 +591,7 @@ sub kiriwrite_filter_list{ # 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"); @@ -600,19 +618,23 @@ sub kiriwrite_filter_add{ # # # 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. @@ -633,6 +655,14 @@ sub kiriwrite_filter_add{ # 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. @@ -670,6 +700,36 @@ sub kiriwrite_filter_add{ } + # 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. @@ -771,7 +831,7 @@ sub kiriwrite_filter_add{ # 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. @@ -880,7 +940,15 @@ sub kiriwrite_filter_add{ $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(); @@ -906,21 +974,26 @@ sub kiriwrite_filter_edit{ # # # 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. @@ -989,6 +1062,14 @@ sub kiriwrite_filter_edit{ # 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. @@ -1088,6 +1169,24 @@ sub kiriwrite_filter_edit{ } + # 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(); @@ -1133,7 +1232,7 @@ sub kiriwrite_filter_edit{ # 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. @@ -1268,6 +1367,7 @@ sub kiriwrite_filter_edit{ $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. @@ -1331,7 +1431,24 @@ sub kiriwrite_filter_edit{ $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(); diff --git a/cgi-files/lib/page.lib b/cgi-files/lib/page.lib index 80719f1..0848f9b 100644 --- a/cgi-files/lib/page.lib +++ b/cgi-files/lib/page.lib @@ -487,7 +487,7 @@ sub kiriwrite_page_list{ 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; @@ -609,11 +609,11 @@ sub kiriwrite_page_list{ 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); } @@ -1502,7 +1502,7 @@ sub kiriwrite_page_add{ $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"); @@ -2577,7 +2577,7 @@ sub kiriwrite_page_edit{ $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"); diff --git a/cgi-files/lib/settings.lib b/cgi-files/lib/settings.lib index bbcf4da..0129255 100644 --- a/cgi-files/lib/settings.lib +++ b/cgi-files/lib/settings.lib @@ -42,6 +42,9 @@ if ($form_data->{'action'}){ 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'}; @@ -52,7 +55,7 @@ if ($form_data->{'action'}){ 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. @@ -107,6 +110,9 @@ sub kiriwrite_settings_view{ 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"}; @@ -186,6 +192,33 @@ sub kiriwrite_settings_view{ $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}); @@ -275,6 +308,9 @@ sub kiriwrite_settings_edit{ # 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. # # # @@ -303,6 +339,9 @@ sub kiriwrite_settings_edit{ 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"}; @@ -396,6 +435,13 @@ sub kiriwrite_settings_edit{ 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 @@ -482,6 +528,60 @@ sub kiriwrite_settings_edit{ } + 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"); @@ -673,7 +773,7 @@ sub kiriwrite_settings_edit{ # 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. @@ -1010,6 +1110,9 @@ sub kiriwrite_settings_edit{ 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"}; @@ -1102,6 +1205,30 @@ sub kiriwrite_settings_edit{ $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}); @@ -1398,6 +1525,9 @@ sub kiriwrite_output_config{ # 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. # @@ -1424,6 +1554,9 @@ sub kiriwrite_output_config{ 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"}; @@ -1476,7 +1609,10 @@ sub kiriwrite_output_config{ $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"; diff --git a/cgi-files/lib/template.lib b/cgi-files/lib/template.lib index 6a19833..b8ec318 100644 --- a/cgi-files/lib/template.lib +++ b/cgi-files/lib/template.lib @@ -357,7 +357,7 @@ sub kiriwrite_template_add{ $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"); @@ -657,7 +657,7 @@ sub kiriwrite_template_edit{ $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"); @@ -964,7 +964,7 @@ sub kiriwrite_template_list{ 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; @@ -1071,11 +1071,11 @@ sub kiriwrite_template_list{ 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); } @@ -1103,25 +1103,30 @@ sub kiriwrite_template_list{ # 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}; diff --git a/cgi-files/page.html b/cgi-files/page.html index 314eecf..0e2b215 100644 --- a/cgi-files/page.html +++ b/cgi-files/page.html @@ -97,6 +97,11 @@ font-size: 12px; } + .tablecelldisabled { + background-color: #808080; + font-size: 12px; + } + .copyrightbar { background-color: #30AAAA; padding: 7px; @@ -157,7 +162,7 @@ font-weight: bold; } - +
-- 2.39.5