From: kirinji Date: Sun, 16 Aug 2009 22:13:02 +0000 (+0000) Subject: Commit of recent work in preperation for Kiriwrite 0.5.0 X-Git-Url: http://Server1/repobrowser/?a=commitdiff_plain;h=807fbc25c35ea3cdf16adcb2106fbb63b3511a68;p=kiriwrite%2F.git Commit of recent work in preperation for Kiriwrite 0.5.0 --- diff --git a/CHANGELOG b/CHANGELOG index f9e2937..a4beff9 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,17 @@ +Changes since version 0.4.0 +=========================== +- Added Output module system. You can now do whatever you need with the + pages once they have been compiled through the Output module system. + The original functionality of writing pages to the output directory is + in the Normal.pm file in the Modules/System directory. +- Fixed problem in installer script which wouldn't show a more helpful + error message when trying to load CGI::Lite. +- Fixed problem where pages that are compiled when there is no template + database are not written to the output directory even though a file + with the page filename given is created. +- Optimise the code using for getting the list of database, presentation + and output modules. + Changes since version 0.3.0 =========================== diff --git a/Documentation/English (British)/developer-chapter1-kiriwritecompileloadhash.html b/Documentation/English (British)/developer-chapter1-kiriwritecompileloadhash.html new file mode 100644 index 0000000..1c8e529 --- /dev/null +++ b/Documentation/English (British)/developer-chapter1-kiriwritecompileloadhash.html @@ -0,0 +1,40 @@ + + + + + + Kiriwrite Documentation - Developer Documentation - 1.43: kiriwrite_compile_loadhash + + + +
+ 1.43 kiriwrite_compile_loadhash

+ +kiriwrite_compile_loadhash loads the hash that is used for the output module. This is a temporary subroutine which should not reappear in the next release of Kiriwrite.

+ +Parameters:

+ +
+ kiriwrite_compile_loadhash(hash); +
+ +
+ +Usage:

+ +
+ kiriwrite_compile_loadhash(%hash); +
+ +
+ +hash
+Specifies the hash which contains the settings for the output module.

+
+ + diff --git a/Documentation/English (British)/developer-chapter2-addinputbox.html b/Documentation/English (British)/developer-chapter2-addinputbox.html index 3758924..fecd6dc 100644 --- a/Documentation/English (British)/developer-chapter2-addinputbox.html +++ b/Documentation/English (British)/developer-chapter2-addinputbox.html @@ -30,7 +30,7 @@ Adds an input box.

Usage:

- $kiriwrite_presmodule->addinputbox("inputbox", { Size => "64", MaxLength => "128", Style => "inputbox", Value => "Default" }); + $kiriwrite_presmodule->addinputbox("inputbox", { Size => "64", MaxLength => "128", Style => "inputbox", Value => "Default", Password => 0 });

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

Value Specifies the value of the input box. + + Password + Specifies if this input box is for a password. + diff --git a/Documentation/English (British)/developer-chapter3-guidance.html b/Documentation/English (British)/developer-chapter3-guidance.html index e4e8f24..6461438 100644 --- a/Documentation/English (British)/developer-chapter3-guidance.html +++ b/Documentation/English (British)/developer-chapter3-guidance.html @@ -17,7 +17,7 @@ Documentation | Tutorial Documentation |
3.1 Guidance

-When creating a new database module to be used in Kiriwrite, the following is required.

+When creating a new database module to be used in Kiriwrite, the following is required:

When creating a new database module, at the top of the page the following should be inserted:

@@ -39,7 +39,7 @@ When creating a new database module, at the top of the page the following should
-Replace (modulename) with the name of the module like MySQL5 (which means MySQL database server version 5.x). When specifying the module name it should be the name of the format (MySQL) and version (5 as in 6.x).

+Replace (modulename) with the name of the module like MySQL5 (which means MySQL database server version 5.x). When specifying the module name it should be the name of the format (MySQL) and version (5 as in 5.x).

'use strict' and 'use warnings' isn't required but it is generally accepted that Perl scripts and modules should have 'use strict' and 'use warnings' lines written.

diff --git a/Documentation/English (British)/developer-chapter3.html b/Documentation/English (British)/developer-chapter3.html index 6a38e8f..d33a13e 100644 --- a/Documentation/English (British)/developer-chapter3.html +++ b/Documentation/English (British)/developer-chapter3.html @@ -17,7 +17,7 @@ Documentation | Tutorial Documentation |
Chapter 3: Database Module

-The subroutines listed here in this chapter are used by the database module. The database module allows the data in the database to be easily manipulated. There are two types of database module with one being a server-based module and a file-based module. Both modules do not use all the subroutines but those subroutines which are not used.

+The subroutines listed here in this chapter are used by the database module. The database module allows the data in the database to be easily manipulated. There are two types of database module with one being a server-based module and a file-based module. Both module types do not use all the of subroutines available.

An example of a file-based database module is the SQLite module and an example of a server-based database module is the MySQL5 module (which is a database module for the MySQL 5.x database servers).

diff --git a/Documentation/English (British)/developer-chapter4-addpage.html b/Documentation/English (British)/developer-chapter4-addpage.html new file mode 100644 index 0000000..7a7b9f9 --- /dev/null +++ b/Documentation/English (British)/developer-chapter4-addpage.html @@ -0,0 +1,68 @@ + + + + + + Kiriwrite Documentation - Developer Documentation - 4.6: addpage + + + +
+ 4.6 addpage

+ +Adds a page for outputting later through the outputall subroutine.

+ +Parameters:

+ +
+ $kiriwrite_outputmodule->addpage(options); +
+ +
+ +Usage:

+ +
+ $kiriwrite_outputmodule->addpage({ Page => "index.html ", Data => "Page Data ", Title => "Page Title ", Section => "Page Section ", LastModified => $lastmodified, Database => "database "}); +
+ +
+ +options
+Specifies the options as a hash.

+ + + + + + + + + + + + + + + + + + + + + + + + + +
ValueDescription
PageSpecifies the filename of the page.
DataSpecifies the data for the page.
TitleSpecifies the title of the page.
SectionSpecifies the section name of the page.
LastModifiedSpecifies the date of when the page was last modified.
+
+ + diff --git a/Documentation/English (British)/developer-chapter4-clearflag.html b/Documentation/English (British)/developer-chapter4-clearflag.html new file mode 100644 index 0000000..0fb2d3a --- /dev/null +++ b/Documentation/English (British)/developer-chapter4-clearflag.html @@ -0,0 +1,37 @@ + + + + + + Kiriwrite Documentation - Developer Documentation - 4.12: clearflag + + + +
+ 4.12 clearflag

+ +Clears the error message flag and the error message itself.

+ +Parameters:

+ +
+ $kiriwrite_outputmodule->clearflag; +
+ +
+ +Usage:

+ +
+ $kiriwrite_outputmodule->clearflag; +
+
+ + diff --git a/Documentation/English (British)/developer-chapter4-clearpages.html b/Documentation/English (British)/developer-chapter4-clearpages.html new file mode 100644 index 0000000..4856fcc --- /dev/null +++ b/Documentation/English (British)/developer-chapter4-clearpages.html @@ -0,0 +1,37 @@ + + + + + + Kiriwrite Documentation - Developer Documentation - 4.9: clearpages + + + +
+ 4.9 clearpages

+ +Clears all of the pages.

+ +Parameters:

+ +
+ $kiriwrite_outputmodule->clearpages(); +
+ +
+ +Usage:

+ +
+ $kiriwrite_outputmodule->clearpages(); +
+
+ + diff --git a/Documentation/English (British)/developer-chapter4-errorflag.html b/Documentation/English (British)/developer-chapter4-errorflag.html new file mode 100644 index 0000000..706150b --- /dev/null +++ b/Documentation/English (British)/developer-chapter4-errorflag.html @@ -0,0 +1,37 @@ + + + + + + Kiriwrite Documentation - Developer Documentation - 4.10: errorflag + + + +
+ 4.10 errorflag

+ +Returns an error flag (if any).

+ +Parameters:

+ +
+ $kiriwrite_outputmodule->errorflag; +
+ +
+ +Usage:

+ +
+ $kiriwrite_outputmodule->errorflag; +
+
+ + diff --git a/Documentation/English (British)/developer-chapter4-errormessage.html b/Documentation/English (British)/developer-chapter4-errormessage.html new file mode 100644 index 0000000..1007a66 --- /dev/null +++ b/Documentation/English (British)/developer-chapter4-errormessage.html @@ -0,0 +1,37 @@ + + + + + + Kiriwrite Documentation - Developer Documentation - 4.11: errormessage + + + +
+ 4.11 errormessage

+ +Returns an error message (if any).

+ +Parameters:

+ +
+ $kiriwrite_outputmodule->errormessage; +
+ +
+ +Usage:

+ +
+ $kiriwrite_outputmodule->errormessage; +
+
+ + diff --git a/Documentation/English (British)/developer-chapter4-finish.html b/Documentation/English (British)/developer-chapter4-finish.html new file mode 100644 index 0000000..64c1487 --- /dev/null +++ b/Documentation/English (British)/developer-chapter4-finish.html @@ -0,0 +1,37 @@ + + + + + + Kiriwrite Documentation - Developer Documentation - 4.14: finish + + + +
+ 4.14 finish

+ +Close anything that was open (such as handles for database servers or files).

+ +Parameters:

+ +
+ $kiriwrite_outputmodule->finish; +
+ +
+ +Usage:

+ +
+ $kiriwrite_outputmodule->finish; +
+
+ + diff --git a/Documentation/English (British)/developer-chapter4-getoptions.html b/Documentation/English (British)/developer-chapter4-getoptions.html new file mode 100644 index 0000000..d7a2485 --- /dev/null +++ b/Documentation/English (British)/developer-chapter4-getoptions.html @@ -0,0 +1,140 @@ + + + + + + Kiriwrite Documentation - Developer Documentation - 4.5: getoptions + + + +
+ 4.5 getoptions

+ +Gets the options that will be used in the compile pages confirmation screen.

+ +Parameters:

+ +
+ $kiriwrite_outputmodule->getoptions(); +
+ +
+ +Usage:

+ +
+ %options = $kiriwrite_outputmodule->getoptions(); +
+ +
+ +In the getoptions subroutine, you build a hash up which is to be returned when the subroutine is finished.

+ +
+ $options{seperatedirdatabase}{type} = "checkbox";
+ $options{seperatedirdatabase}{string} = languagestrings("seperatedirdatabase"); +
+ +
+ +After the internal name of the option, you specify the type of option (and the options that go with that type of option):

+ +checkbox
+Specifies that a checkbox should be added.

+ + + + + + + + + + +
ValueDescription
stringSpecifies the description for the option.
+ +
+ +textbox
+Specifies that a text box should be added.

+ + + + + + + + + + + + + + + + + + + + + + + + + + +
ValueDescription
stringSpecifies the description for the text box.
valueSpecifies the default value of the text box.
sizeSpecifies the size of the text box.
maxlengthSpecifies the maximum size of the value.
passwordSpecifies the text box is a password box.
+ +
+ +combobox
+Specifies that a drop down box should be added.

+ + + + + + + + + + + + + + + + + + +
ValueDescription
optionnamesThe names for the options in the drop down box with each name separated by a pipe ( | )
optionvaluesThe values for the options in the drop down box with each value separated by a pipe. ( | )
stringSpecifies the string to provide a description of the drop down box.
+ +
+ +radio
+Specifies that a option button should be added.

+ + + + + + + + + + + + + + +
ValueDescription
StartFromSpecifies which filter entry to start from.
LimitSpecifies how many filters should be retrieved.
+
+ + diff --git a/Documentation/English (British)/developer-chapter4-guidance.html b/Documentation/English (British)/developer-chapter4-guidance.html new file mode 100644 index 0000000..57c7429 --- /dev/null +++ b/Documentation/English (British)/developer-chapter4-guidance.html @@ -0,0 +1,37 @@ + + + + + + Kiriwrite - Developer Documentation - 4.1: Guidance + + + +
+ When creating a new output module to be used in Kiriwrite, the following below is required.

+When creating a new output module, at the top of the page the following should be inserted at the very minimum using the Normal module as an example:

+ +
+package Modules::Output::Normal;

+use strict;
+use warnings;
+use Encode qw(decode_utf8);
+use Tie::IxHash;

+our $VERSION = "0.5.0";
+my ($pages, %pages);
+my $error_flag = 0;
+my $error_message = "";
+my $language_name = "";
+my %optionshash = ();

+tie(%pages, "Tie::IxHash"); +
+

+ +If a subroutine is not needed then create the subroutine which is not needed and insert the return command for that subroutine. +
+ + diff --git a/Documentation/English (British)/developer-chapter4-initialise.html b/Documentation/English (British)/developer-chapter4-initialise.html new file mode 100644 index 0000000..7fc2386 --- /dev/null +++ b/Documentation/English (British)/developer-chapter4-initialise.html @@ -0,0 +1,41 @@ + + + + + + Kiriwrite Documentation - Developer Documentation - 4.3: initialise + + + +
+
+
+ Kiriwrite is hosted by
+ BerliOS Developer Logo +
+

+ 4.3 initialise

+ +Initialise the output module.

+ +Parameters:

+ +
+ $kiriwrite_outputmodule->initialise(); +
+ +Usage:

+ +
+ $kiriwrite_outputmodule->initialise(); +
+
+ + diff --git a/Documentation/English (British)/developer-chapter4-languagestrings.html b/Documentation/English (British)/developer-chapter4-languagestrings.html new file mode 100644 index 0000000..0cfd8e4 --- /dev/null +++ b/Documentation/English (British)/developer-chapter4-languagestrings.html @@ -0,0 +1,42 @@ + + + + + + Kiriwrite Documentation - Developer Documentation - 4.13: languagestrings + + + +
+ 4.13 languagestrings

+ +Returns language strings that are used in this module.

+ +Parameters:

+ +
+ $kiriwrite_outputmodule->languagestrings(langstring); +
+ +
+ +Usage:

+ +
+ $kiriwrite_outputmodule->languagestrings("languagestring"); +
+ +
+ +langstring
+Specifies the name of the language string to use. +
+ + diff --git a/Documentation/English (British)/developer-chapter4-loadsettings.html b/Documentation/English (British)/developer-chapter4-loadsettings.html new file mode 100644 index 0000000..68d4dd4 --- /dev/null +++ b/Documentation/English (British)/developer-chapter4-loadsettings.html @@ -0,0 +1,46 @@ + + + + + + Kiriwrite Documentation - Developer Documentation - 4.4: loadsettings + + + +
+ 4.3 loadsettings

+ +Loads the settings for the output module and processes the options from the hash. Input validation of the options received from the hash should be done in this subroutine.

+ +
+
+Warning

+Any values passed to this subroutine should be input validated before they are used. +
+
+ +Parameters:

+ +
+ $kiriwrite_outputmodule->loadsettings(language, options); +
+ +Usage:

+ +
+ $kiriwrite_outputmodule->loadsettings("en-GB", %options); +
+language
+Specifies the language strings to be used.

+options
+Specifies the options for the output module as a hash. +
+ + diff --git a/Documentation/English (British)/developer-chapter4-new.html b/Documentation/English (British)/developer-chapter4-new.html new file mode 100644 index 0000000..551919c --- /dev/null +++ b/Documentation/English (British)/developer-chapter4-new.html @@ -0,0 +1,41 @@ + + + + + + Kiriwrite Documentation - Developer Documentation - 4.2: new + + + +
+
+
+ Kiriwrite is hosted by
+ BerliOS Developer Logo +
+

+ 4.2 new

+ +Create a new instance of the output module.

+ +Parameters:

+ +
+ Module::Output::Normal->new(); +
+ +Usage:

+ +
+$kiriwrite_outputmodule = Module::Output::Normal->new(); +
+
+ + diff --git a/Documentation/English (British)/developer-chapter4-outputall.html b/Documentation/English (British)/developer-chapter4-outputall.html new file mode 100644 index 0000000..1e0452f --- /dev/null +++ b/Documentation/English (British)/developer-chapter4-outputall.html @@ -0,0 +1,53 @@ + + + + + + Kiriwrite Documentation - Developer Documentation - 4.8: outputall + + + +
+ 4.8 outputall

+ +Outputs all of the pages.

+ +Parameters:

+ +
+ $kiriwrite_outputmodule->outputall(options); +
+ +
+ +Usage:

+ +
+ $kiriwrite_outputmodule->outputall(); +
+ +
+ +options
+Specifies the following options as a hash.

+ + + + + + + + + + +
ValueDescription
FinishedProcessingIndicate that this is the last time that outputall is going to be called.
+
+ + diff --git a/Documentation/English (British)/developer-chapter4-outputpage.html b/Documentation/English (British)/developer-chapter4-outputpage.html new file mode 100644 index 0000000..e098283 --- /dev/null +++ b/Documentation/English (British)/developer-chapter4-outputpage.html @@ -0,0 +1,73 @@ + + + + + + Kiriwrite Documentation - Developer Documentation - 4.7: outputpage + + + +
+ 4.7 outputpage

+ +Outputs a page.

+ +Parameters:

+ +
+ $kiriwrite_outputmodule->outputpage(options); +
+ +
+ +Usage:

+ +
+ $kiriwrite_outputmodule->outputpage({ Page => "Page Name", Data => "Lots of Page Data Here", Title => "Page Title", }); +
+ +
+ +options
+Specifies the following options as a hash in any order.

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
ValueDescription
PageSpecifies the filename of the page.
DataSpecifies the data for the page.
TitleSpecifies the title of the page.
SectionSpecifies the section name of the page.
LastModifiedSpecifies the date of when the page was last modified.
DatabaseSpecifies the name of the database for the page.
+
+ + diff --git a/Documentation/English (British)/developer-chapter4.html b/Documentation/English (British)/developer-chapter4.html index d301113..72eb1ca 100644 --- a/Documentation/English (British)/developer-chapter4.html +++ b/Documentation/English (British)/developer-chapter4.html @@ -3,7 +3,7 @@ - Kiriwrite Documentation - Developer Documentation - Chapter 4: Kiriwrite Page Format + Kiriwrite Documentation - Developer Documentation - Chapter 4: Output Modules
- Chapter 4: Kiriwrite Page Format

+ Chapter 4: Output Modules

-The Kiriwrite page format is the page format that is used internally for displaying the generated content from the presentation module.

+The subroutines listed here in this chapter are used by the output module. The output module allows control over the pages that have been compiled. Most output modules do not tend to use all the subroutines that are available to it.

-It is stored in the page.html file and can be changed to show the generated content from the presentation module in a different way. Typically the page format would be formatted as the style the presentation module would output.

+An example of a output module is the Normal module which duplicates the functionality of outputting the pages to the output directory which couldn't be altered before version 0.5.0 of Kiriwrite.

-The content generated from the presentation module and other information (such as page title) can be inserted into the page.html file by using the tags below:

- - - - - - - - - - - - - - - - - - - - - - -
TagDescription
<kiriwrite:menu>Writes the menu where this tag is specified.
<kiriwrite:imagespath>Writes the URI path the images directory.
<kiriwrite:title>Writes the title of the page.
<kiriwrite:pagedata>Writes the page data generated by the presentation module.
+When the output module is loaded the subroutines for it can be called from the $kiriwrite_outputmodule scalar only when the pages are being compiled.
diff --git a/Documentation/English (British)/developer-chapter5.html b/Documentation/English (British)/developer-chapter5.html index 32b3d35..8adb92c 100644 --- a/Documentation/English (British)/developer-chapter5.html +++ b/Documentation/English (British)/developer-chapter5.html @@ -3,7 +3,7 @@ - Kiriwrite Documentation - Developer Documentation - Chapter 5: Languages + Kiriwrite Documentation - Developer Documentation - Chapter 5: Kiriwrite Page Format
- Chapter 5: Languages

+ Chapter 5: Kiriwrite Page Format

-The language files that are used by Kiriwrite are stored in the 'lang' directory. The language filenames used are typically formatted as ISO 639-1 codes with the “local” dialect appened to it.

+The Kiriwrite page format is the page format that is used internally for displaying the generated content from the presentation module.

-An example of this is English (British), as it is the English language it begins with the ISO 639-1 code of en and is then appended with -GB for the “local” dialect making it en-GB. Typically if it's a language specific for a country the local dialect is in capitals, while variations of the language are typically in small letters.

+It is stored in the page.html file and can be changed to show the generated content from the presentation module in a different way. Typically the page format would be formatted as the style the presentation module would output.

-When translating Kiriwrite to another language, the default language of Kiriwrite is English (British). This is the en-GB.xml file in the 'lang' directory and will always contain the most recent language strings. However, if there are already completed and translated files in other languages, you can base the translation from that language if it is easier that way.

+The content generated from the presentation module and other information (such as page title) can be inserted into the page.html file by using the tags below:

-The settings in the 'about' tag provide information about the language file. 'name' specifies the name of the language, 'creator' specifies who created the language file while 'mailaddress' specifies an e-mail address (if desired).

- -The remaining tags contain all of the strings that are used within Kiriwrite. + + + + + + + + + + + + + + + + + + + + + +
TagDescription
<kiriwrite:menu>Writes the menu where this tag is specified.
<kiriwrite:imagespath>Writes the URI path the images directory.
<kiriwrite:title>Writes the title of the page.
<kiriwrite:pagedata>Writes the page data generated by the presentation module.
diff --git a/Documentation/English (British)/developer-chapter6.html b/Documentation/English (British)/developer-chapter6.html new file mode 100644 index 0000000..433b240 --- /dev/null +++ b/Documentation/English (British)/developer-chapter6.html @@ -0,0 +1,31 @@ + + + + + + Kiriwrite Documentation - Developer Documentation - Chapter 6: Languages + + + +
+ Chapter 6: Languages

+ +The language files that are used by Kiriwrite are stored in the 'lang' directory. The language filenames used are typically formatted as ISO 639-1 codes with the “local” dialect appened to it.

+ +An example of this is English (British), as it is the English language it begins with the ISO 639-1 code of en and is then appended with -GB for the “local” dialect making it en-GB. Typically if it's a language specific for a country the local dialect is in capitals, while variations of the language are typically in small letters.

+ +When translating Kiriwrite to another language, the default language of Kiriwrite is English (British). This is the en-GB.xml file in the 'lang' directory and will always contain the most recent language strings. However, if there are already completed and translated files in other languages, you can base the translation from that language if it is easier that way.

+ +The settings in the 'about' tag provide information about the language file. 'name' specifies the name of the language, 'creator' specifies who created the language file while 'mailaddress' specifies an e-mail address (if desired).

+ +The remaining tags contain all of the strings that are used within Kiriwrite. +
+ + diff --git a/Documentation/English (British)/developer-introduction.html b/Documentation/English (British)/developer-introduction.html index 4eb1a90..510257d 100644 --- a/Documentation/English (British)/developer-introduction.html +++ b/Documentation/English (British)/developer-introduction.html @@ -20,7 +20,7 @@ This documentation provides information about the following:
diff --git a/Documentation/English (British)/developer.html b/Documentation/English (British)/developer.html index 2b20c6a..f1dc783 100644 --- a/Documentation/English (British)/developer.html +++ b/Documentation/English (British)/developer.html @@ -65,6 +65,7 @@ The Developer Documentation contains information on how to create presentation m  1.40 kiriwrite_output_config
 1.41 kiriwrite_output_page
 1.42 kiriwrite_processconfig
1.43 kiriwrite_compile_loadhash
Chapter 2: Presentation Module
 2.1 Guidance
 2.2 new
diff --git a/Documentation/English (British)/style.css b/Documentation/English (British)/style.css index d35374c..4a4ca72 100644 --- a/Documentation/English (British)/style.css +++ b/Documentation/English (British)/style.css @@ -113,6 +113,8 @@ body { .code { background-image: url('images/messageback.png'); + background-repeat: repeat-x; + background-position: top; background-color: #307070; border-color: #70D0D0; border-style: solid; diff --git a/Documentation/English (British)/user-all.html b/Documentation/English (British)/user-all.html deleted file mode 100644 index fd8083f..0000000 --- a/Documentation/English (British)/user-all.html +++ /dev/null @@ -1,1321 +0,0 @@ - - - - - - Kiriwrite Documentation - - User Documentation - - - -
- 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.

-As I was designing my website using an advanced free ware text-editor (at it's time) which allowed me to create a template and create pages as I needed which was great, until I wanted to redesign the website. At that point I had around 50 pages which had to be changed and became somewhat time consuming.

-That was when I wrote the original Kiriwrite script which was coded pretty much to my own needs and wasn't really well organised and was coded in Perl (although not that brilliantly as strict and warnings weren't used since I was learning Perl at the time) and by the time I finished coding it, I was able to do what I needed to do with Kiriwrite.

-Around the end of 2005 (and after a two-year spell at St. Austell College which is now Cornwall College St. Austell) I decided to rewrite the Kiriwrite code because the original Kiriwrite did not do any input validation and so little of the code was commented which meant I forgot what everything did and I wanted to add some new features which would become useful in the future.

-The rewritten Kiriwrite version was pretty much done in October 2006, following a suggestion from a good friend I decided to replace the flat-file based system which I used since the original Kiriwrite with a file-based database system called SQLite. Once that was done pretty much around the end of January 2007, I then separated the database code, presentation code and language strings into separate modules and files which meant that a MySQL 5.x server-based database could be used instead of file-based SQLite. The presentation code used to render internal output from Kiriwrite was separated and placed in the HTML4S (HTML 4.01 Strict) presentation module. The language strings that was hard-coded were separated and placed in the English (British) language file.

-After some minor tweaks, the rewritten Kiriwrite code was pretty much ready and once the documentation was written Kiriwrite was ready for release. What I would like to see in the future for Kiriwrite is to make it work with mod_perl and add some extra customisable features as some settings are currently hard-coded when they could very well not be hard-coded.

-I leave you with some advice, if you are going to design a website which uses a white background don't assume everyone will use a white background by default if no colour is specified and actually declare it as white background in the Cascading Style Sheet markup. You'd be amazed at how many commercial websites and some personal websites (that expect you to have) assume you have a white background when really you have a teal coloured background.
-Introduction

-Kiriwrite is a web-based (browser-based) interface for creating pages for websites, intended for those who know how to create pages by hand and want to accelerate the process of (re)designing a static-only website.

-The documentation is split into three parts, the user documentation (which is this part), the developer documentation (for writing new modules or language files) and the tutorial documentation (the basics and how to use Kiriwrite).

-Although Kiriwrite isn't limited for creating pages for websites (as in you can create other types of text-based formats), Kiriwrite is primarily intended for creating pages for websites.


-Chapter 1: Installation

-Before Kiriwrite can be used, Kiriwrite needs to be installed properly and this involves obtaining the code from a source package or from a Subversion1 repository, copying the needed files into the correct place, setting the correct permissions on the files and running the installation script.

- -
-
- - Warning
- Please be aware (for this version), that Kiriwrite is intended to be used on a private web server and not on a public web server unless it is properly secured down because by default anyone can run Kiriwrite and manipulate the data already there. Suggested methods of securing down your Kiriwrite installation are available in Chapter 4: Usage Tips. -
-
-
- -
- -This chapter is split into two parts with the first part explaining on how to obtain Kiriwrite and the second part explaining on how to install Kiriwrite.

- -
-1 Subversion is a version control system which tracks changes to data stored in the repositories and allows easy updating of source code after the source code is checked out.
-1.1 Obtaining Kiriwrite

-Kiriwrite can be obtained either through the Subversion repository or extracted from a source archive that is available on Kiriwrite homepage.

-1.1.1: Archive Extraction

-The contents of the Kiriwrite archive can be extracted using gzip if it's a Gzip archive, bzip2 if it's a Bzip2'ed archive, 7za if it's a 7-Zip archive and unzip if it's a ZIP archive.

-Bear in mind the following is done from a command console. GUI interfaces can also do the same as preformed here and mainly involves opening the archive and clicking on the Extract/Extract All button or simply dragging the folder containing from out of the archive (usually making a copy of the contents in the archive).

- -
-
- Note
- The naming convention of the Kiriwrite archives go as the following:

-
- kiriwrite-x.y.z(-e).arc -
-
- Where x is the major version, y is the minor version and z is the revision with (-e) meaning a very tiny modification that had to be done that did not merit an increment to the revision number. -
-
- -
- -When downloading an archive, the archive can be checked (by downloading the file with the same name but with .sha256 or .md5 added to the end of it) using shasum1 or md5sum by doing the following to ensure it is downloaded correctly:

- -
- shasum -a 256 kiriwrite-x.y.z(-e).arc
- md5sum kiriwrite-x.y.z(-e).arc -
- -
- -shasum or md5sum should then generate the SHA-256 or MD5 checksum that should match the one that appears in the file with .sha256 or .md5 appended to it. If it does not match (and the file containing the sha256 or md5sum hash is the correct version) then the archive should be downloaded again and repeat the same process.

-To extract the gzip archive, the following command should be preformed when switched to the correct directory to extract from.

- -
- gzip -d -c (path)/kiriwrite-0.1.0.tar.gz | tar -xv -
- -
- -A list of files that have been extracted will then appear with the contents of the archive appearing in the directory that the archive was extracted to.

-To extract the bzip2 archive, the following command should be preformed when switched to the correct directory to extract from.

- -
- bzip2 -d -c (path)/kiriwrite-0.1.0.tar.bz2 | tar -xv -
- -
- -A list of files that have been extracted will then appear with the contents of the archive appearing in the directory that the archive was extracted to.

-To extract the ZIP archive, the following command should be preformed when switched to the correct directory to extract from.

- -
- unzip (path)/kiriwrite-0.1.0.zip -
- -
- -A list of files that have been extracted will then appear with the contents of the archive appearing in the directory that the archive was extracted to.

-To extract the 7Zip archive, the following command should be preformed when switched to the correct directory to extract from.

- -
- 7za e (path)/kiriwrite-0.1.0.7z -
- -
- -A list of files that have been extracted will then appear with the contents of the archive appearing in the directory that the archive was extracted to.

- -1.1.2: Subversion Access

-Kiriwrite can also be obtained through checking out the code from the Subversion repository.

- -
-
- Note
- Bear in mind that the code that is in the Kiriwrite Subversion repository is normally unstable and could very well cause unexpected problems (such as warnings that appear in the web server error log that can be easily fixed and alterations to the database structure which requires an upgrade script which hasn't been written yet for that particular version yet). -
-
- -
- -Kiriwrite can be obtained from the Subversion repository by doing the following in a command console after selecting the correct directory to put it in:

- -
- svn checkout svn://svn.berlios.de/kiriwrite/trunk -
- -
- -A list of files then appear as they are received from the Subversion repository and placed in the directory the command console is currently in. To update the code stored locally with code that is in the Kiriwrite Subversion repository this command should be done after changing to the directory where the local copy of the Kiriwrite Subversion code is:

- -
- svn update -
- -
- -A list of files will then appear showing which files has been updated. - -
-1 The version of shasum talked about here is the shasum script that is used by the Digest::SHA::PurePerl Perl module which can produce checksums in SHA-1, SHA-224, SHA-256, SHA-384 and SHA-512 which can be installed via CPAN.
-1.2.1 Copying files

-Before Kiriwrite can be used, the files need to be copied to the correct place. After extracting the archive, the structure of the extracted archive should be like this:

-Documentation – Documentation that is available in several languages.
-cgi-files – The main Kiriwrite script, associated modules, installer script and language files.
Modules – Modules for Kiriwrite are stored here.
-  Database – Database modules are stored here.
-  Presentation – Presentation modules are stored here.
db – Default database directory (for file based Database modules).
lang – The directory for language files in Kiriwrite.
lib - Library files that are used by Kiriwrite.
output – The output directory when pages are compiled.
-misc – Miscellaneous files (mainly for developers).
-non-cgi-files – Non CGI files that need to be placed outside of the cgi-bin folder.

-The files in the cgi-files folder should be copied to the cgi-bin1 folder2 and the files in the non-cgi-files folder should be copied to a folder which can be accessed from the web server.

-1.2.2 Setting Permissions

-The following permissions should be set for the files that have been copied to the cgi-files directory (the following file list should apply to those running *nix/BSD systems):

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
FilenameOwnerGroupOthers
(Top Directory)RWXRXNone
ModulesRXRXNone
Modules/DatabaseRXRXNone
Modules/Database/MySQL.pmRRNone
Modules/Database/SQLite.pmRRNone
Modules/PresentationRXRXNone
Modules/Presentation/HTML4S.pmRRNone
dbRWXRXNone
outputRWXRXNone
langRXRXNone
lang/*.langRRNone
libRRNone
lib\*.libRRNone
kiriwrite.cgiRWXRNone
install.cgiRWXRNone
page.htmlRRNone
- -

- -R = Read, W = Write, X = Execute/Allow directory listing

-For the non-cgi files folder, read only permissions should be set on all files (and read and allow directory listings for directories) as no writing should be needed.

-Once this is done, the installer script can be run by browsing to URI location of where the files in the cgi-files directory were in place and adding install.cgi to the end of it.

-
-1The cgi-bin folder is used for storing scripts that use the Common Gateway Interface (CGI). CGI scripts are typically associated with Perl scripts but can also be C++, C, Python, shell script and many others.
-2Some servers are configured so that CGI scripts can run from any directory so in this case Kiriwrite doesn't have to be placed in the cgi-bin directory.
-1.3 Kiriwrite Installer Script

-After pointing your browser to the installer script, a page appears which guides you through configuring the settings for Kiriwrite.

-At the top of the page a drop down box is available to change the language of the installer script to another language which is more easier to understand, simply select the language from the drop down box and click on the Switch button, the script will then switch to the selected language.

-The installer script will preform three tests, the first being to check if all the needed modules are there, the second test is to check if the modules needed for the database modules are there and finally a test to check if the directories have their correct permissions set.

-Before the settings can be configured, checks are made to make sure that all of the needed modules are installed properly. If any of the needed modules are missing an error message will appear saying that one or more of the required Perl modules is missing and will need to be installed which can be done from the CPAN interface.

-The installer script then checks to see if at least of the Perl modules for the database modules are installed. If none of the Perl modules needed for the database modules are found then an error message will appear saying that none of the Perl modules needed for the database modules are installed and will need to be installed which can be done from the CPAN interface.

-Finally, the installer script then checks to see if the directories have the minimum correct permissions set. If one or more of the directories has an error, then a message appears saying to make sure that the correct permissions are set.

- -
-
- Hint
- More information on solving problems that occur while installing Kiriwrite can be found in Chapter 5: Troubleshooting. -
-
- -
- -When the installer finds that everything is fine in regards to Perl modules and file permissions, a form appears allowing to configure the Kiriwrite installation to specific needs. Some default values are given which will work with the file-based database modules.

-The configuration settings in detail:

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
SettingDescription
Database DirectorySpecifies the database directory to use for storing databases that are created by the file-based database modules. This option is ignored by the server-based modules.
Output DirectorySpecifies the output directory to use to store the compiled pages.
Images (URI path)Specifies the Images (URI path) to use for displaying images when using the page template with Kiriwrite.
Text Area ColumnsSpecifies the width of the text area when editing notes, pages and templates.
Text Area RowsSpecifies the height of the text area when editing notes, pages and templates.
Date FormatSpecifies 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.
LanguageSpecifies the system language to use in Kiriwrite. If the language used in the installer script is available as language to use in Kiriwrite then that language will be selected by default.
Presentation ModuleSpecifies the presentation module to use in Kiriwrite.
Database ModuleSpecifies the database module to use in Kiriwrite. SQLite is a file-based database module which uses the database directory and the SQLite Perl module while MySQL5 is a server-based database module which uses a MySQL 5.x server from the MySQL Perl module.
- -
- -The following options are used only by the server-based database modules:

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
SettingDescription
Database ServerSpecifies the database server to use.
Database PortSpecifies the database port to use.
Database ProtocolSpecifies the database protocol to use.
Database NameSpecifies the database name to use.
Database UsernameSpecifies the database username to use.
Database PasswordSpecifies the database password to use.
Database Table PrefixSpecifies the table prefix to use. Multiple Kiriwrite installations can use the same server database so long as the table prefix is different.
- -
- -There is an option that is enabled by default to attempt to delete the installation script after the configuration file has been written since the installation script would no longer be needed after that. Unchecking the box for this option disables this.

-Click on the Save Settings button to write the configuration file or the Reset Settings button to restore the settings to their default values.

-After clicking on the Save Settings button, some checks are made to make sure that data passed is correct, the configuration file is written (and the installer script deleted if requested) and a message appears saying that Kiriwrite can now be used by clicking on the link at the bottom of the page. -
-Chapter 2: Operation

-Now that Kiriwrite is installed and working, this chapter is about operating Kiriwrite. This chapter is split into five parts:
- -
-2.1 Databases

-Databases are used for storing the pages that are created in Kiriwrite. Before pages can be stored in a database, a database has to be created.

-The default view when you run the Kiriwrite script is to show the list of databases. If there are no databases available, then a message appears saying that there are no databases than can be used.

-2.1.1 Add a database

-To add a database, from the View Databases sub-menu click on the 'Add Database' link, a form then appears allowing to enter the information about the new database.

- - - - - - - - - - - - - - - - - - - - - - - - - - -
SettingsDescription
Database NameSpecifies the database name of the new Kiriwrite database.
Database DescriptionSpecifies the description of the new Kiriwrite database.
Database CategoriesSpecifies the categories the database should belong to.
Database NotesThe notes that gives information about the database.
Database FilenameSpecifies the database filename to use. If nothing is entered for the filename than an attempt to automatically generate a filename will be done.
- -
- -To add the database with the settings given, click on the 'Add Database' button and a confirmation message should then appear saying that the database has been added and offering a link back to the list of databases. To clear the settings, click on the 'Clear values' button.

- -2.2 Edit a database

-To edit a database, click on the 'Edit' link opposite the name and description of the database you want to edit. A form then appears similar to the form for adding a database.

- - - - - - - - - - - - - - - - - - - - - - - - - - -
SettingsDescription
Database NameSpecifies the new database name of the Kiriwrite database.
Database DescriptionSpecifies the new description of the Kiriwrite database.
Database CategoriesSpecifies the new categories the database should belong to.
Database NotesThe notes that gives information about the database.
Database FilenameSpecifies the database filename to use.
- -
- -To edit a database with the new settings given click on the 'Edit Database' button and a confirmation message should appear saying that the database has been edited and offering a link back to the database list. Clicking on the 'Restore current settings' button will undo any changes and revert to the currently used settings.

- -2.3 Delete a database

-To delete a database, click on the 'Delete' link opposite. A message then appears asking if the selected database should be deleted. Clicking on the 'Yes, delete the database' button will delete the database and display a confirmation message saying that the selected database has been deleted offering a link to return to the database list. Clicking on 'No, return to the database list.' link will make it return to the database list.

- -
-
- - Warning
- When a database is deleted, the pages in the database are deleted as well. -
-
-

-2.2 Pages

- -Pages are used for storing information that is relevant to that page.

- -Pages can be access from the 'View Pages' menu link. As no database is selected, a drop down box will appear listing the databases that are available, select a database and then click on the View button. A list of pages for that database will then appear and if there are no pages in the database a message will appear saying that no pages exist in this database.

- -To view the next (or previous list) of pages, click on the relevant link at the top of the page and to view a specific list of pages, select the list page number in the drop down menu box at the top of the page and click on the Show button.

- -2.2.1: Creating a page

-A page can be created in the selected database by clicking on the 'Add Page' link in the View Pages sub-menu, a form then appears allowing to enter the information about the new page.

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
SettingDescription
DatabaseSpecifies the database that the page is being added to.
Page NameSpecifies the name of the new page.
Page DescriptionSpecifies the description of the new page.
Page SectionSpecifies the section name of the new page.
Page TemplateSpecifies the page template to use.
Page FilenameSpecifies the page filename to use.
Page ContentSpecifies the content of the page.
Page SettingsSpecifies if the page name and section should be used for the title.
- -
- -The following Kiriwrite tags can be used with the page content to automatically place information such as page name, description and section:

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
TagDescription
<kiriwrite:pagetitle>Places the page title here. The format of the page title can be changed using the Page Settings value.
<kiriwrite:pagename>Places the page name here.
<kiriwrite:pagedescription>Places the page description here.
<kiriwrite:pagesection>Places the page section here.
<kiriwrite:autosection>Places the automatic page section here.

-
-
- Note
- If there is a page section then the page section will appear bracketed. If Information was the page section then the automatic page section name would be '(Information)' and if the page section name is blank then no brackets will appear and will be blank. -
-
-
<kiriwrite:autotitle>Places the automatic page title here. This combines the section name and page name with brackets around them and a dash separating them with '(Section Name – Page Name)' being the example. The format can be changed by changing the Page Settings value.
- -
- -After entering the needed page information, the page can be added to the selected database by clicking on the 'Add Page' button and then a confirmation message would appear saying that the selected page has been added and offering a link to return to the page list for the selected database. The new page settings can be cleared by clicking on the 'Reset Settings' button.

- -2.2.2: Editing a page

- -To edit a page, click on the 'Edit' link opposite the page filename you want to edit. A form then appears that is similar for adding a page.

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
SettingDescription
DatabaseSpecifies the database that the page is being edited from.
Page NameSpecifies the new name of the page.
Page DescriptionSpecifies the new description of the page.
Page SectionSpecifies the new section name of the page.
Page TemplateSpecifies the new page template to use.
Page FilenameSpecifies the new page filename.
Page ContentSpecifies the new content of the page.
Page SettingsSpecifies if there should be a new page name and section setting.
- -
- -The following Kiriwrite tags are used for when adding a page can also be used when editing a page:

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
TagDescription
<kiriwrite:pagetitle>Places the page title here. The format of the page title can be changed using the Page Settings value.
<kiriwrite:pagename>Places the page name here.
<kiriwrite:pagedescription>Places the page description here.
<kiriwrite:pagesection>Places the page section here.
<kiriwrite:autosection>Places the automatic page section here.

-
-
- Note
- If there is a page section then the page section will appear bracketed. If Information was the page section then the automatic page section name would be '(Information)' and if the page section name is blank then no brackets will appear and will be blank. -
-
- -
<kiriwrite:autotitle>Places the automatic page title here. This combines the section name and page name with brackets around them and a dash separating them with '(Section Name – Page Name)' being the example. The format can be changed by changing the Page Settings value.
- -
- -After entering the new information, the page can be edited by clicking on the 'Edit Page' button and a confirmation message appears saying that the page has been edited and offering a link back to the list of pages for the currently selected database. Clicking on the 'Restore current settings' button will undo any changes and revert to the current page settings.

- -2.2.3: Deleting a page

- -To delete a page, click on the 'Delete' link opposite the page filename you want to delete, a message then appears asking to confirm that page will be deleted. Clicking on the 'Yes, delete the page' button will delete the page and offer a link back to the list of pages for the selected database. Clicking on the 'No, return to the page list for the (database name) database.' link will return to the list of pages for the selected database.

- -2.2.4: Delete multiple pages

- -To delete multiple pages from the selected database click on the check-box that is to the left of the page filenames you want to delete and then click on the 'Delete Selected' button at the top of the page, a form will then appear asking to confirm if the selected pages listed should be deleted.

- -Clicking on the 'Yes, delete the selected pages' button will display a confirmation message saying that the selected pages were deleted offering a link back to the list of pages for the selected database. Clicking on the 'No, return to the page list for the (database name) database.' will return to the list of pages for the selected database.

- -2.2.5: Move multiple pages

- -To move multiple pages from the selected database click on the check-box that is to the left of the page filenames you want to delete and then click on the 'Move Selected' button at the top of the page, a form will then appear asking to select which database the selected pages should go to and confirm that those pages are being moved to the new database.

- -Clicking on the 'Move selected pages' button will display a confirmation message saying that the selected pages were moved to the new database selected offering a link back to the selected database that the pages were moved from and a link to the selected database where the pages have moved to. Clicking on the 'Return to the page list for the (database name) database' will return to the list of pages in the selected database.

- -2.2.6: Copy multiple pages

- -To copy multiple pages from the selected database click on the check-box that is to the left of the page filenames you want to copy and then click on the 'Copy Selected' button at the top of the page, a form will then appear asking to select which database the selected pages should be copied to and confirm that those pages are being copied to the new database.

- -Clicking on the 'Copy selected pages' button will display a confirmation message saying that the selected pages were copied to the new database selected offering a link back to the selected pages that the pages were copied from and a link to the selected database where the pages have been copied to. Clicking on the 'Return to the page list for the (database name) database.' will return to the list of pages in the selected database.

- -2.2.7: Edit multiple pages

- -To edit multiple pages from the selected database click on the check-box that is to the left of the page filenames you want to edit and then click on the 'Edit Selected' button at the top of the page, a form will then appear that allows certain settings of each page to be edited as shown in the table below:

- - - - - - - - - - - - - - - - - - -
SettingDescription
Page SectionSpecifies the new page section to be used on the selected pages.
Page TemplateSpecifies the new page template to be used on the selected pages.
Page SettingsSpecifies the new page settings to be used on the selected pages.
- -
- -Each setting that needs to be changed needs to have the check-box on the left of the name needs to be checked otherwise the change will not take effect. This is done to make sure that only the selected page settings are changed.

-Clicking on the 'Edit selected pages' button will display a confirmation message saying that the selected pages were edited offering a link back to the list of pages in the selected database, clicking on the 'Clear values' button will clear the currently selected values and clicking on the 'Return to the page list for the '(database name)' database.' link will return to the page list for selected database.
-2.3 Filters

- -Filters allows text to be easily replaced by looking for certain words, tag or phrase and then replacing it with another set of words, tag or phrase.

- -The list of filters can be viewed by clicking on the 'View Filters' link. If the filter database doesn't exist than a message will appear saying that the filter database doesn't exist and will be created when a filter is added or if the filter database does exist but there are no filters then a message appears saying that there is no filters in the filter database.

- -When compiling the pages, the order of the filters list is determined by the filter priority number with the lower numbers being processed first and the filters with the higher filter priority numbers being processed last.

- -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.

- -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.

- - - - - - - - - - - - - - - - - - - - - - -
SettingDescription
Find...Specifies the find setting to search text for.
Replace With...Specifies the replace setting to replace the text with if the search text is found.
PrioritySpecifies the priority of the filter.
NotesSpecifies the notes for this filter.
- -
- -After entering the needed filter information, the filter can be added by clicking on the 'Add Filter' button which displays a confirmation message saying that the filter has been added to the filter database and offering a link back to the list of filters in the filter database. Clicking on the 'Clear values' button will clear any of the filter settings that have been entered and clicking on the 'Return to the filter list.' link will return to the list of filters in the filter database.

- -2.3.2 Edit a filter

-To edit a filter click on the 'Edit' link opposite the filter you want to edit. A form then appears that is similar to adding a filter.

- - - - - - - - - - - - - - - - - - - - - - -
SettingDescription
Find...Specifies the new find setting to search text for.
Replace With...Specifies the new replace setting to replace the text with if the search text is found.
PrioritySpecifies the new priority of the filter.
NotesSpecifies the new notes for this filter.
- -
- -To update the information about the filter, click on the 'Edit Filter' button and a confirmation message should appear saying that the selected filter was edited offering a link back to the list of filters in the filter database. Clicking on the 'Restore current settings' will undo any changes made and will revert the currently used filter settings and clicking on the 'Return to the filter list.' link will return to the list of filters in the filter database.

- -2.3.3 Delete a filter

- -To delete a filter click on the 'Delete' link opposite the filter you want to delete. A form then appears asking to confirm the deletion of the selected filter. Clicking on the 'Yes, delete the selected filter' button will display a confirmation message saying that the selected filter was deleted. Clicking on the 'No, return to the filter list.' link will return to the list of filters in the filter database.
-2.4 Templates

- -Templates allows pages to use a common layout which is used to keep a consistent layout on a website or keep the format of documentation pages the same. Templates also allow small tweaks to the page layout to be made without needing to edit each page so the change is reflected in all of the pages by simply changing the template layout and then recompile the pages.

- -The list of templates can be accessed by clicking on the 'View Templates' link. A list of templates from the template database should then appear. If the template database does not exist then a message will appear saying that the template database does not exist and will be created when a template is added. If no templates exist in the template database then a message appears saying that there are no templates in the template database.

- -To view the next (or previous list) of templates, click on the relevant link at the top of the page and to view a specific list of templates, select the list page number in the drop down menu box at the top of the page and click on the Show button.

- -2.4.1 Add a template

- -To add a template to the template database click on the 'Add Template' link from the View Templates sub-menu, a form then appears allowing to enter the new information about the template.

- - - - - - - - - - - - - - - - - - - - - - -
SettingDescription
Template NameSpecifies the template name to be used.
Template DescriptionSpecifies the template description to be used.
Template FilenameSpecifies the template filename to use.
Template LayoutSpecifies the content of the template layout.
- -
- -The following Kiriwrite tags can be used with the template layout to automatically place information such as page content, name, description and section: - -

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
TagDescription
<kiriwrite:pagecontent>Places the page content here.
<kiriwrite:pagetitle>Places the page title here. The format of the page title can be changed using the Page Settings value.
<kiriwrite:pagename>Places the page name here.
<kiriwrite:pagedescription>Places the page description here.
<kiriwrite:pagesection>Places the page section here.
<kiriwrite:autosection>Places the automatic page section here.

-
-
- Note
- If there is a page section then the page section will appear bracketed. If Information was the page section then the automatic page section name would be '(Information)' and if the page section name is blank then no brackets will appear and will be blank. -
-
-
<kiriwrite:autotitle>Places the automatic page title here. This combines the section name and page name with brackets around them and a dash separating them with '(Section Name – Page Name)' being the example. The format can be changed by changing the Page Settings value.
- -
- -After entering the needed template information, click on the 'Add Template' button to display a confirmation message saying that add the template to the list of templates in the template database and offering a link back to the list of templates in the template database. Clicking on the 'Clear values' button will clear all of the template settings entered. Clicking on the 'Return to the template list.' link will return to the list of templates in the template database.

- -2.4.2 Edit a template

-To edit a template click on the 'Edit' link opposite the template name you want to edit, a form then appears that is similar to adding a template.

- - - - - - - - - - - - - - - - - - - - - - -
SettingDescription
Template NameSpecifies the new template name to be used.
Template DescriptionSpecifies the new template description to be used.
Template FilenameSpecifies the new template filename to use.
Template LayoutSpecifies the new content of the template layout.
- -
- -The Kiriwrite tags used when adding a template can also be used when editing a template. - -

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
TagDescription
<kiriwrite:pagecontent>Places the page content here.
<kiriwrite:pagetitle>Places the page title here. The format of the page title can be changed using the Page Settings value.
<kiriwrite:pagename>Places the page name here.
<kiriwrite:pagedescription>Places the page description here.
<kiriwrite:pagesection>Places the page section here.
<kiriwrite:autosection>Places the automatic page section here.

-
-
- Note
- If there is a page section then the page section will appear bracketed. If Information was the page section then the automatic page section name would be '(Information)' and if the page section name is blank then no brackets will appear and will be blank. -
-
-
<kiriwrite:autotitle>Places the automatic page title here. This combines the section name and page name with brackets around them and a dash separating them with '(Section Name – Page Name)' being the example. The format can be changed by changing the Page Settings value.
- -
- -After editing the information about the template, the template can be edited by clicking on the 'Edit Template' button which will display a confirmation message saying that the template information was edited offering a link back to the list of templates in the template database. Clicking on the 'Restore current settings' button will undo any changes and revert to the currently used settings. Clicking on the 'Return to the template list.' will return to the list of templates in the template database.

- -2.4.3 Delete a template

- -To delete a template click on the 'Delete' link opposite the template name you want to delete, a message then appears asking to confirm the deletion of the selected template. Clicking on the 'Yes, delete the template' button will display a confirmation message saying that the selected template has been deleted offering a link back to the list of templates in the template database. Clicking on the 'No, return to the template list.' link will return to the list of templates in the template database.
-2.5 Compiling

- -Compiling combines the page data with the template layout and the filters that are in the filter database to create pages as if they were created manually.

- -To compile the pages from their databases, click on the 'Compile Pages' menu link. A list of databases will then appear which can be compiled. If no databases are available then a message will appear saying that no databases are available.

- -2.5.1 Compiling a database

- -To compile a database, click on the 'Compile' link opposite the database name you want to compile, a message then appears asking if the database should really be compiled. Clicking on the 'Compile Database' button will display a log of pages that have been compiled and any error messages that might appear with the link to return to the list of databases to compile at the end of the log.

- -When compiling a database, the template being used on the pages in the database selected can be overridden. To override the templates being used, click on the 'Override the template being used' box and select the template to override with.

- -Clicking on the 'Return to the compile database list.' will return to the list of databases to compile.

- -2.5.2 Compiling multiple databases

- -To compile multiple databases click on the check-box to the left of the database name for each database that should have its pages compiled and click on the 'Compile Selected' button which will display a message asking to confirm if the selected databases shown should be compiled. Clicking on the 'Compile Selected Databases' button will display a log of pages that have been compiled and any error messages that might appear with the link to return to the list of databases to compile at the end of the log.

- -When compiling a database, the templates being used on the pages in the databases selected can be overridden. To override the templates being used, click on the 'Override the template being used' box and select the template to override with.

- -Clicking on the 'Return to the compile database list.' will return to the list of databases to compile.

- -2.5.3 Compiling all databases

- -To compile all of the available databases click on the 'Compile All' link in the Compile Pages sub-menu which will display a message asking to confirm if all of the databases should have its pages compiled. Clicking on the 'Compile All Databases' button will display a log of pages that have been compiled and any error messages that might appear with the link to return to the list of databases to compile at the end of the log.

- -When compiling a database, the templates being used on the pages in all of the databases can be overridden. To override the templates being used, click on the 'Override the template being used' box and select the template to override with.

- -Clicking on the 'Return to the compile database list.' link will return to the list of databases to compile.

- -2.5.4 Cleaning the output directory

- -Cleaning the output directory removes all of the contents that is in the output directory. To clean the output directory click on the 'Clean Output Directory' link which will display a message asking to confirm that the output directory should be cleaned. Clicking on the 'Yes, clean output directory' will display a confirmation message saying that the output directory was cleaned. Clicking on the 'Return to the compile database list.' link will return to the list of databases to compile.
-Chapter 3: Kiriwrite Settings

- -The settings that are used in Kiriwrite can be viewed by clicking on the 'View Settings' link in the menu which will display a list of settings that are currently in use.

- -3.1 Editing the settings

- -To edit the settings, click on the 'Edit Settings' link in the View Settings sub-menu, a form then appears allowing the settings in Kiriwrite to be edited.

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
SettingDescription
Database DirectorySpecifies the database directory to use for storing databases that are created by the file-based database modules. This option is ignored by the server-based modules.
Output DirectorySpecifies the output directory to use to store the compiled pages.
Images (URI path)Specifies the Images (URI path) to use for displaying images when using the page template with Kiriwrite.
Text Area ColumnsSpecifies the width of the text area when editing notes, pages and templates.
Text Area RowsSpecifies the height of the text area when editing notes, pages and templates.
Date FormatSpecifies 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.
LanguageSpecifies the system language to use in Kiriwrite. If the language used in the installer script is available as language to use in Kiriwrite then that language will be selected by default.
Presentation ModuleSpecifies the presentation module to use in Kiriwrite.
Database ModuleSpecifies the database module to use in Kiriwrite. SQLite is a file-based database module which uses the database directory and the SQLite Perl module while MySQL5 is a server-based database module which uses a MySQL 5.x server from the MySQL Perl module.
- -
- -The following options are used only by the server-based database modules:

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
SettingDescription
Database ServerSpecifies the database server to use.
Database PortSpecifies the database port to use.
Database ProtocolSpecifies the database protocol to use.
Database NameSpecifies the database name to use.
Database UsernameSpecifies the database username to use.
Database PasswordSpecifies the database password to use.
Database Table PrefixSpecifies the table prefix to use. Multiple Kiriwrite installations can use the same server database so long as the table prefix is different.
- -
- -To save the new settings, click on the 'Change Settings' button which will display a confirmation message saying that the settings were changed and will take effect on the next page load of Kiriwrite offering a link back to the updated list of settings. Clicking on the 'Restore current settings' button will undo any changes made and will restore the current settings. Clicking on the 'Return to the list of settings.' link will return to the list of currently used settings.
-Chapter 4: Usage Tips

-This chapter mainly contains usage tips in securing your Kiriwrite installation and small features which may be useful for some users.

- -
- In this chapter, directory specific settings used in Apache is .htaccess. Typically, if the web server software is configured to check a file other than .htaccess then a different filename would be used (and would be blocked from being accessed from the web server). -
-
-4.1 Securing your Kiriwrite installation

- -This section is about securing your Kiriwrite installation.

- -4.1.1 HTTP Authentication

- -HTTP Authentication allows users who only know the correct username and password to access pages that are not available to the public. HTTP Authentication is done by the following if you're using Apache 1.3.x/2.x from a command console:

- -
- htpasswd -c .htpasswd username -
- -
- -The -c switch specifies that a password file should be created called .htpasswd (although can be called something else), while username is the username of the login (which can be something else other than username), after pressing enter a password prompt then appears asking for a password to be entered the same twice.

- -After the .htpasswd file is created, the file should be copied to a location that cannot be accessed from a URI resource (such as outside the htdocs/web documents directory) and then create a .htaccess file (if it doesn't exist) pointing to the password file with the following directives as an example.

- -
- AuthUserFile /home/www/website/private/.htpasswd
- AuthType Digest
- AuthName “Private Area” -
- -
- -The AuthUserFile directive should point to the htpasswd file that was created earlier on. The AuthType directive specifies the authentication type to use and AuthName specifies the name of the area to appear when entering the username and password.

- -4.1.2 IP Address Filtering

- -IP Address filtering allows certain IP addresses or hosts to be blocked from access and allowing everyone else access or blocking everyone from access and allowing certain IP addresses or hosts in. Typically when using Kiriwrite, the best method would be the white list method where everyone is blocked from access and only certain IP addresses or hosts can be allowed access.

- -To setup a white list, open the .htaccess file and insert the following (if it already exists) if you're using Apache 1.3/2.x:

- -
- Order Deny, Allow
- Deny from all
- Allow from 127.0.0.1 -
- -
- -This example denies everyone and then only allows 127.0.0.1 (which is the computer the web server is running from which tends to be the machine you're using on a personal installation). Multiple Allow commands can be entered which allows multiple hosts.

- -More information on using Allow and Deny can be found in the Apache 1.3/2.x Documentation.
-4.2 Renaming the main Kiriwrite script (kiriwrite.cgi)

- -While the Kiriwrite script can be used as kiriwrite.cgi, the script has been designed so that it can work if it's renamed to something else such as docmake.cgi, private.cgi or even flyingrhinos.cgi. This can simply be done by renaming the script to whatever name is needed.

- -
-
- - Warning
- Bear in mind that no matter what the script filename is called, it will always look for configuration file as kiriwrite.xml, the modules in the Modules directory and the language files in the lang directory. -
-
-
-
-4.3 Removing unneeded modules and language files

- -As Kiriwrite uses a modular system for manipulating the databases, outputting the pages internally by Kiriwrite and language files for each language used, space can be recovered by removing unneeded modules from the Modules directory and language files from the lang directory.

- -To make sure that the currently used database module, presentation module and language file are not deleted from their directories. Check which ones should be kept by clicking on the 'View Settings' menu link.
-Chapter 5: Troubleshooting

-5.1 Common Problems

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
ProblemSymptomSolution
When installing, some of the needed Perl modules have the word 'Error' next to them.The needed Perl modules are more than likely not installed.Install the needed Perl modules from the CPAN archive using the CPAN command interface.1
When installing, an error message appears saying that none of the needed Perl modules for the database modules are installed.The needed Perl module(s) (or the Perl module needed specifically for that certain database module) are more than likely not installed.Install the needed Perl modules from the CPAN archive using the CPAN command interface.
When installing, an error message appears saying that some of the directories and files have invalid permissions set.The directories and/or files have invalid permissions set.Change the permissions on the directories and/or files so that are the correct permissions needed.
When installing, no database or presentation modules appear in the list of available database or presentation modules.The modules weren't copied or were copied to the wrong directories.Copy or move the database modules to the correct directory.
When installing, no languages appears in the languages selection list.The language files weren't copied or were copied to the wrong location.Copy or move the language files to the correct directory.
When starting Kiriwrite, a critical error message appears saying that the configuration file does not exist.The configuration file has been deleted or the installation script wasn't run.Run the installer script (again).
When starting Kiriwrite, a critical error message appears saying that the configuration file has invalid permissions set.The configuration file has invalid permissions set.Change the permissions on the configuration file so that it can be read.
When starting Kiriwrite, a critical error message appears saying that the database module does not exist.The database module has been deleted or renamed.Run the installer script (again).
- Check if the Modules and Modules/Database directory have the correct permissions set so that they can be read. -
When starting Kiriwrite, a critical error message appears saying that the database module has invalid permissions set.The database module has invalid permissions set.Change the permissions on the database module so that they can be read (execute permissions not usually needed).
When starting Kiriwrite, a critical error message appears saying that the presentation module does not exist.The presentation module has been deleted or renamed.Run the installer script (again).
- Check if the Modules and Modules/Presentation directory have the correct permissions set so that they can be read. -
When starting Kiriwrite, a critical error message appears saying that the presentation module has invalid permissions set.The presentation module has invalid permissions set.Change the permissions on the presentation module so that they can be read (execute permissions not usually needed).
When starting Kiriwrite, a critical error message appears saying that the language file does not exist.The language file does not exist.Run the installer script (again).
- Check if the lang directory has the correct permissions set so that they can be read. -
When starting Kiriwrite, a critical error message appears saying that the language file has invalid permissions set.The language file has invalid permissions set.Change the permissions on the language file so that they can be read.
When viewing the list of databases, an error message appears saying that the permissions of the database directory is invalid.The database directory has incorrect permissions set.Set the correct permissions (read and write) on the database directory.
When viewing the template database, an error message appears saying the permissions of the template database is invalid.The template database has invalid permissions set.Set the correct permissions (read and write) on the template database.
When viewing the filter database, an error message appears saying that the permissions of the filter database is invalid.The filter database has invalid permissions set.Set the correct permissions (read and write) on the filter database.
When compiling the pages, an error message appears saying that the output directory has invalid permissions set.The output directory has invalid permissions set.Set the correct permissions (read and write) on the output directory.
When compiling the pages, certain pages do not change when the pages are edited.The pages have invalid permissions set.Set the correct permissions (read and write) on those pages which have invalid permissions set.
When compiling the pages, the template database has invalid permissions set.The template database has invalid permissions set.Set the correct permissions (read) on the template database.
When compiling the pages, the filter database has invalid permissions set.The filter database has invalid permissions set.Set the correct permissions (read) on the template database.
When saving the new settings, an error message appears saying that the configuration file has invalid permissions set.The configuration file has invalid permissions set.Set the correct permissions (read and write) on the configuration file and then change the permissions back to read-only after saving the new settings.
- -
- -
- -1The CPAN (Comprehensive Perl Archive Network) command interface is normally included with Perl installations and will normally require superuser (root) permissions.
-Chapter 6: Contributing to Kiriwrite

- -6.1: Contributing

- -You can contribute to Kiriwrite in many different ways like the following examples: - - -For more information on how to contribute to Kiriwrite visit http://xestia.co.uk/kiriwrite or visit the BerliOS project site at http://developer.berlios.de/projects/kiriwrite . A list of stuff that needs doing can be found in the TODO file in the Kiriwrite package (remember to check the latest Kiriwrite package's TODO file for the latest on what needs doing). -
- - diff --git a/Documentation/English (British)/user-chapter1-installerscript.html b/Documentation/English (British)/user-chapter1-installerscript.html index 3b1736b..4b8eda5 100644 --- a/Documentation/English (British)/user-chapter1-installerscript.html +++ b/Documentation/English (British)/user-chapter1-installerscript.html @@ -75,6 +75,10 @@ The configuration settings in detail:

Database Module Specifies the database module to use in Kiriwrite. SQLite is a file-based database module which uses the database directory and the SQLite Perl module while MySQL5 is a server-based database module which uses a MySQL 5.x server from the MySQL Perl module. + + Output Module + Specifies the output module to use in Kiriwrite. Normal is the only one available and replicates the hard coded functionality that was in Kiriwrite before version 0.5.0. +
diff --git a/Documentation/English (British)/user-chapter1-installingkiriwrite.html b/Documentation/English (British)/user-chapter1-installingkiriwrite.html index 22a4b65..c900d5b 100644 --- a/Documentation/English (British)/user-chapter1-installingkiriwrite.html +++ b/Documentation/English (British)/user-chapter1-installingkiriwrite.html @@ -22,6 +22,7 @@ Before Kiriwrite can be used, the files need to be copied to the correct place.  Modules – Modules for Kiriwrite are stored here.
  Database – Database modules are stored here.
  Presentation – Presentation modules are stored here.
+  Output – Output modules are stored here.
 db – Default database directory (for file based Database modules).
 lang – The directory for language files in Kiriwrite.
 lib - Library files that are used by Kiriwrite.
@@ -81,6 +82,18 @@ The following permissions should be set for the files that have been copied to t R None + + Modules/Output + RX + RX + None + + + Modules/Output/Normal.pm + R + R + None + db RWX diff --git a/Documentation/English (British)/user-chapter2-compiling.html b/Documentation/English (British)/user-chapter2-compiling.html index ca09dbb..94856a7 100644 --- a/Documentation/English (British)/user-chapter2-compiling.html +++ b/Documentation/English (British)/user-chapter2-compiling.html @@ -25,6 +25,8 @@ To compile the pages from their databases, click on the 'Compile Pages' menu lin To compile a database, click on the 'Compile' link opposite the database name you want to compile, a message then appears asking if the database should really be compiled. Clicking on the 'Compile Database' button will display a log of pages that have been compiled and any error messages that might appear with the link to return to the list of databases to compile at the end of the log.

+The output module selected is the default output module selected in the settings menu. To change the output module, select the output module from the drop down box and then click on the Select button that is next to it. The page will then refresh showing specific options for that output module.

+ When compiling a database, the template being used on the pages in the database selected can be overridden. To override the templates being used, click on the 'Override the template being used' box and select the template to override with.

Clicking on the 'Return to the compile database list.' will return to the list of databases to compile.

@@ -33,6 +35,8 @@ Clicking on the 'Return to the compile database list.' will return to the list o To compile multiple databases click on the check-box to the left of the database name for each database that should have its pages compiled and click on the 'Compile Selected' button which will display a message asking to confirm if the selected databases shown should be compiled. Clicking on the 'Compile Selected Databases' button will display a log of pages that have been compiled and any error messages that might appear with the link to return to the list of databases to compile at the end of the log.

+The output module selected is the default output module selected in the settings menu. To change the output module, select the output module from the drop down box and then click on the Select button that is next to it. The page will then refresh showing specific options for that output module.

+ When compiling a database, the templates being used on the pages in the databases selected can be overridden. To override the templates being used, click on the 'Override the template being used' box and select the template to override with.

Clicking on the 'Return to the compile database list.' will return to the list of databases to compile.

@@ -41,6 +45,8 @@ Clicking on the 'Return to the compile database list.' will return to the list o To compile all of the available databases click on the 'Compile All' link in the Compile Pages sub-menu which will display a message asking to confirm if all of the databases should have its pages compiled. Clicking on the 'Compile All Databases' button will display a log of pages that have been compiled and any error messages that might appear with the link to return to the list of databases to compile at the end of the log.

+The output module selected is the default output module selected in the settings menu. To change the output module, select the output module from the drop down box and then click on the Select button that is next to it. The page will then refresh showing specific options for that output module.

+ When compiling a database, the templates being used on the pages in all of the databases can be overridden. To override the templates being used, click on the 'Override the template being used' box and select the template to override with.

Clicking on the 'Return to the compile database list.' link will return to the list of databases to compile.

diff --git a/Documentation/English (British)/user-chapter3.html b/Documentation/English (British)/user-chapter3.html index 3866336..3477364 100644 --- a/Documentation/English (British)/user-chapter3.html +++ b/Documentation/English (British)/user-chapter3.html @@ -76,6 +76,10 @@ To edit the settings, click on the 'Edit Settings' link in the View Settings sub Database Module Specifies the database module to use in Kiriwrite. SQLite is a file-based database module which uses the database directory and the SQLite Perl module while MySQL5 is a server-based database module which uses a MySQL 5.x server from the MySQL Perl module. + + Output Module + Specifies the output module to use in Kiriwrite. Normal is the functionality that was hard-coded into Kiriwrite before version 0.5.0. +
diff --git a/Documentation/English (British)/user-chapter4-modperl.html b/Documentation/English (British)/user-chapter4-modperl.html index 3f555f9..e137130 100644 --- a/Documentation/English (British)/user-chapter4-modperl.html +++ b/Documentation/English (British)/user-chapter4-modperl.html @@ -20,7 +20,7 @@ Documentation | Tutorial Documentation | Kiriwrite under mod_perl 2.x can be made a little bit faster by pre-loading modules when the Apache Web Server starts up. After installing Kiriwrite and making sure that it runs properly, insert the following line into your httpd.conf file/VirtualHost section:

-PerlModule CGI::Lite DBI DBD::SQLite Tie::IxHash Encode +PerlModule CGI::Lite DBI DBD::SQLite Tie::IxHash Encode Hash::Search

diff --git a/INSTALL b/INSTALL index 7edbf9c..623db42 100644 --- a/INSTALL +++ b/INSTALL @@ -2,4 +2,7 @@ For information on installing Kiriwrite, see Chapter 1: Installation in the User Documentation in the Documentation directory. mod_perl 2.x users please pay attention to the specific information for -installing Kiriwrite under mod_perl 2.x in this Chapter. \ No newline at end of file +installing Kiriwrite under mod_perl 2.x in this Chapter. + +Mac OS X users should also read the section specific for Mac OS X users +in this Chapter as well. \ No newline at end of file diff --git a/TODO b/TODO index 605ece4..c2fafe2 100644 --- a/TODO +++ b/TODO @@ -6,16 +6,18 @@ Changes for future releases - Allow different encoding formats to be used when compiling instead of UTF-8 which will probably be implemented within the output modules. +- Code optimisation where the if statements are condensed into one line so + that less space is used among other improvements. -Changes for 0.5.0 -================= +Changes implemented in 0.5.0 +============================ -- Implement Output Module system. +- Implemented Output Module system. Changes implemented in 0.3.0 ============================ -- Add the ability to switch off and on a filter. +- Added 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. diff --git a/cgi-files/Modules/Database/MySQL5.pm b/cgi-files/Modules/Database/MySQL5.pm index 74a69a4..5c1e5d9 100644 --- a/cgi-files/Modules/Database/MySQL5.pm +++ b/cgi-files/Modules/Database/MySQL5.pm @@ -35,7 +35,7 @@ use DBI qw(:sql_types); # Set the following values. -our $VERSION = "0.1.0"; +our $VERSION = "0.5.0"; my ($options, %options); my $database_handle; my $statement_handle; @@ -1683,6 +1683,7 @@ sub getpageinfo{ "PageContent" => $pagedata, "PageSettings" => $pagesettings, "PageLastModified" => $class->dateconvert($pagelastmodified), + # ADD PageLastModifiedInternal ); $page_found = 1; diff --git a/cgi-files/Modules/Database/SQLite.pm b/cgi-files/Modules/Database/SQLite.pm index 0a88d27..6fc34b4 100644 --- a/cgi-files/Modules/Database/SQLite.pm +++ b/cgi-files/Modules/Database/SQLite.pm @@ -35,7 +35,7 @@ use DBI qw(:sql_types); # Set the following values. -our $VERSION = "0.2.0"; +our $VERSION = "0.5.0"; my ($options, %options); my $database_handle; my $statement_handle; @@ -1313,14 +1313,14 @@ sub getpageinfo{ # Put the values into the page hash. %database_page = ( - "PageFilename" => $pagefilename, - "PageName" => $pagename, - "PageDescription" => $pagedescription, - "PageSection" => $pagesection, - "PageTemplate" => $pagetemplate, - "PageContent" => $pagedata, - "PageSettings" => $pagesettings, - "PageLastModified" => $class->dateconvert($pagelastmodified), + "PageFilename" => $pagefilename, + "PageName" => $pagename, + "PageDescription" => $pagedescription, + "PageSection" => $pagesection, + "PageTemplate" => $pagetemplate, + "PageContent" => $pagedata, + "PageSettings" => $pagesettings, + "PageLastModified" => $class->dateconvert($pagelastmodified) ); $page_found = 1; diff --git a/cgi-files/Modules/Presentation/HTML4S.pm b/cgi-files/Modules/Presentation/HTML4S.pm index 44801ee..99fb0ea 100644 --- a/cgi-files/Modules/Presentation/HTML4S.pm +++ b/cgi-files/Modules/Presentation/HTML4S.pm @@ -30,7 +30,7 @@ use warnings; # Set the following values. -our $VERSION = "0.1.0"; +our $VERSION = "0.5.0"; my $pagedata = ""; my $tablevel = 0; @@ -1035,6 +1035,7 @@ sub addinputbox{ # MaxLength Specifies the maximum length of the input text box. # # Style Specifies the CSS style to use. # # Value Specifies a value for the input box. # +# Password Specifies the input box is a password box. # ################################################################################# # Get the options recieved. diff --git a/cgi-files/Modules/System/Common.pm b/cgi-files/Modules/System/Common.pm index 061d2e2..a7a7a8f 100644 --- a/cgi-files/Modules/System/Common.pm +++ b/cgi-files/Modules/System/Common.pm @@ -200,6 +200,7 @@ sub kiriwrite_settings_load{ "system_language" => $config{config}{system_language}, "system_presmodule" => $config{config}{system_presmodule}, "system_dbmodule" => $config{config}{system_dbmodule}, + "system_outputmodule" => $config{config}{system_outputmodule}, "system_datetime" => $config{config}{system_datetime}, "display_textarearows" => $config{config}{display_textarearows}, @@ -621,7 +622,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", "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" + "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", "outputmodulenametoolong", "outputmodulenameinvalid", "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" ); diff --git a/cgi-files/Modules/System/Compile.pm b/cgi-files/Modules/System/Compile.pm index a578401..bc8b4f2 100644 --- a/cgi-files/Modules/System/Compile.pm +++ b/cgi-files/Modules/System/Compile.pm @@ -6,7 +6,34 @@ use warnings; use Exporter; our @ISA = qw(Exporter); -our @EXPORT = qw(kiriwrite_compile_makepages kiriwrite_compile_all kiriwrite_compile_list kiriwrite_compile_clean kiriwrite_compile_clean_helper); +our @EXPORT = qw(kiriwrite_compile_getoutputmodules kiriwrite_compile_makepages kiriwrite_compile_all kiriwrite_compile_list kiriwrite_compile_clean kiriwrite_compile_clean_helper kiriwrite_compile_loadhash); + +my %formdata = (); + +sub kiriwrite_compile_getoutputmodules{ +################################################################################# +# kiriwrite_compile_getoutputmodules: Gets the list of available output modules.# +# # +# Usage: # +# # +# @outputmodules = kiriwrite_compile_getoutputmodules; # +################################################################################# + + my (@outputmoduleslist, @outputmoduleslist_final); + my $outputmodulefile; + + opendir(OUTPUTMODULEDIR, "Modules/Output"); + @outputmoduleslist = grep /m*\.pm$/, readdir(OUTPUTMODULEDIR); + closedir(OUTPUTMODULEDIR); + + foreach $outputmodulefile (@outputmoduleslist){ + $outputmodulefile =~ s/.pm$//; + push(@outputmoduleslist_final, $outputmodulefile); + } + + return @outputmoduleslist_final; + +} sub kiriwrite_compile_makepages{ ################################################################################# @@ -24,12 +51,20 @@ sub kiriwrite_compile_makepages{ # really be done. # # override Specifies if the template should be overriden. # # overridetemplate Specifies the name of the template to override with. # +# outputmodule Specifies the output module. # # selectedlist Specifies the databases to compile from as an array. # ################################################################################# # Get the values that have been passed to the subroutine. - my ($type, $confirm, $override, $override_template, @selectedlist) = @_; + my ($type, $confirm, $override, $override_template, $outputmodule, @selectedlist) = @_; + #my $type = shift; + #my $confirm = shift; + #my $override = shift; + #my $override_template = shift; + #my $outputmodule = shift; + #my @selectedlist = shift; + #my %formdata = shift; # Check if the confirm value is more than one # character long. @@ -120,12 +155,51 @@ sub kiriwrite_compile_makepages{ } + if (!$outputmodule){ + $outputmodule = $main::kiriwrite_config{'system_outputmodule'}; + } + + # Check if the output module name is valid. + + my $outputmodule_maxlength_check = kiriwrite_variablecheck($outputmodule, "maxlength", 64, 1); + + if ($outputmodule_maxlength_check eq 1){ + + # The length of the output module name is too + # long so return an error. + + kiriwrite_error("outputmodulenametoolong"); + + } + + my $outputmodule_filename_check = kiriwrite_variablecheck($outputmodule, "filename", "", 1); + + if ($outputmodule_maxlength_check eq 1){ + + # The length of the output module name is too + # long so return an error. + + kiriwrite_error("outputmodulenameinvalid"); + + } + + # Set up the output module. + + ($outputmodule) = $outputmodule =~ m/^(.*)$/g; + my $outputmodulename = "Modules::Output::" . $outputmodule; + eval "use " . $outputmodulename; + my $kiriwrite_outputmodule = $outputmodulename->new(); + my ($outputmodule_options, %outputmodule_options); + tie(%outputmodule_options, "Tie::IxHash"); + $kiriwrite_outputmodule->initialise(); + %outputmodule_options = $kiriwrite_outputmodule->getoptions(); + # Check if the action to compile the databases # has been confirmed. if ($confirm eq 1){ - # The action to compile the datavases has + # The action to compile the databases has # been confirmed. # Define some variables for later. @@ -142,11 +216,11 @@ sub kiriwrite_compile_makepages{ my @findfilter; my @replacefilter; my @templateslist; - my @pagedirectories; my @database_filters; my $warning_count = 0; my $error_count = 0; my $pages_count = 0; + my $page_compile_errorflag = 0; my $filter; my $filters_count = 0; my $filters_find_blank_warning = 0; @@ -156,15 +230,6 @@ sub kiriwrite_compile_makepages{ my $database_name; my $page_filename; my $page_filename_check; - my $page_filename_char = ""; - my $page_filename_directory; - my $page_filename_length = 0; - my $page_filename_seek = 0; - my $page_filename_dircount = 0; - my $page_filename_exists = 0; - my $page_filename_permissions = 0; - my $page_directory_name; - my $page_directory_path; my $page_name; my $page_description; my $page_section; @@ -189,7 +254,34 @@ sub kiriwrite_compile_makepages{ my $information_prefix = $main::kiriwrite_lang{compile}{informationprefix}; my $error_prefix = $main::kiriwrite_lang{compile}{errorprefix}; my $warning_prefix = $main::kiriwrite_lang{compile}{warningprefix}; - my $filehandle_page; + + # Get the settings for the output module and load them into the + # output module. + + use Hash::Search; + my $hs = new Hash::Search; + + $hs->hash_search("^outputmodule_", %formdata); + + my %outputmodulesettings = $hs->hash_search_resultdata; + my $language_name = $main::kiriwrite_config{'system_language'}; + + $kiriwrite_outputmodule->loadsettings($language_name, %outputmodulesettings); + + # Check if the settings for the output module were loaded correctly. + + if ($kiriwrite_outputmodule->errorflag eq 1){ + + # The settings for the output module were not loaded correctly + # so return an error. + + kiriwrite_error("outputmodulesettingerror", $kiriwrite_outputmodule->errormessage); + + } + + $kiriwrite_outputmodule->clearflag; + + # Write a page title and start the box for the data list. $main::kiriwrite_presmodule->addtext($main::kiriwrite_lang{compile}{compiledatabases}, { Style => "pageheader" }); $main::kiriwrite_presmodule->addlinebreak(); @@ -464,6 +556,10 @@ sub kiriwrite_compile_makepages{ foreach $database (@selectedlist){ + # Clear the error flag for the output module. + + $kiriwrite_outputmodule->clearflag; + # Check if the database filename and length # are valid. @@ -567,6 +663,15 @@ sub kiriwrite_compile_makepages{ foreach $page (@databasepages) { + # Clear the error flag for the output module.. + + $kiriwrite_outputmodule->clearflag; + + # Reset certain values. + + $page_autotitle = ""; + $page_autosection = ""; + # Get information about the page. %page_info = $main::kiriwrite_dbmodule->getpageinfo({ PageFilename => $page }); @@ -615,7 +720,7 @@ sub kiriwrite_compile_makepages{ $page_final = $page_content; - } elsif ($page_template eq "!none"){ + } elsif ($templates_skip eq 1 || $page_template eq "!none"){ $page_final = $page_content; @@ -702,130 +807,34 @@ sub kiriwrite_compile_makepages{ } - # Process the page filename and check what directories - # need to be created. - - $page_filename_length = int(length($page_filename)); - - do { - - $page_filename_char = substr($page_filename, $page_filename_seek, 1); - - # Check if a forward slash appears and add it to - # the list of directories array. - - if ($page_filename_char eq '/'){ + # Convert the date into a format that can be used by Kiriwrite. - # Append the directory name to the list of - # directories array. + # PUT SOME CODE HERE! XO - $pagedirectories[$page_filename_dircount] = $page_filename_directory; - $page_filename_directory = ""; - $page_filename_char = ""; - $page_filename_dircount++; + $kiriwrite_outputmodule->addpage({ Page => $page_filename, Data => $page_final, Title => $page_name, Section => $page_section, LastModified => $page_lastmodified, Database => $database }); - } else { - - # Append the character to the directory/filename. - - $page_filename_directory = $page_filename_directory . $page_filename_char; - - } - - $page_filename_seek++; + # Check if any errors occured while adding the page. - } until ($page_filename_length eq $page_filename_seek); - - foreach $page_directory_name (@pagedirectories){ - - # Check if the directory name is undefined and if it - # is then set it blank. - - if (!$page_directory_name){ - $page_directory_name = ""; - } - - if (!$page_directory_path){ - $page_directory_path = ""; - } + if ($kiriwrite_outputmodule->errorflag eq 1){ - # Check if the directory exists and create - # the directory if it doesn't exist. - - $page_directory_path = $page_directory_path . '/' . $page_directory_name; - - mkdir($main::kiriwrite_config{"directory_data_output"} . '/' . $page_directory_path); - - } - - # Check if the file already exists and if it does then check - # the permissions of the file and return an error if the - # permissions set are invalid. - - $page_filename_exists = kiriwrite_fileexists($main::kiriwrite_config{"directory_data_output"} . '/' . $page_filename); - - if ($page_filename_exists eq 0){ - - # The page filename exists, so check if the permissions given are - # valid. - - $page_filename_permissions = kiriwrite_filepermissions($main::kiriwrite_config{"directory_data_output"} . '/' . $page_filename, 1, 1); - - if ($page_filename_permissions eq 1){ - - # The file has invalid permissions set. - - $main::kiriwrite_presmodule->addtext($error_prefix . kiriwrite_language($main::kiriwrite_lang{compile}{pageinvalidpermissions}, $page_filename)); - $main::kiriwrite_presmodule->addlinebreak(); - $error_count++; - - # Reset certain values. - - $page_autotitle = ""; - $page_autosection = ""; - $page_filename_seek = 0; - $page_filename_dircount = 0; - - $page_filename_directory = ""; - $page_directory_path = ""; - $page_directory_name = ""; - @pagedirectories = (); - - next; - - } + $main::kiriwrite_presmodule->addtext($error_prefix . kiriwrite_language($main::kiriwrite_lang{compile}{pagenotwritten}, $page_filename, $kiriwrite_outputmodule->errormessage)); + $main::kiriwrite_presmodule->addlinebreak(); + $error_count++; + next; } - # Reset certain values. - - $page_autotitle = ""; - $page_autosection = ""; - $page_filename_seek = 0; - $page_filename_dircount = 0; - - $page_filename_directory = ""; - $page_directory_path = ""; - $page_directory_name = ""; - @pagedirectories = (); + $kiriwrite_outputmodule->outputpage({ Page => $page_filename, Data => $page_final, Title => $page_name, Section => $page_section, LastModified => $page_lastmodified, Database => $database }); - # Write the file to the output directory. + if ($kiriwrite_outputmodule->errorflag eq 1){ - ($page_filename) = $page_filename =~ m/^(.*)$/g; - ($main::kiriwrite_config{"directory_data_output"}) = $main::kiriwrite_config{"directory_data_output"} =~ m/^(.*)$/g; - - open($filehandle_page, "> ", $main::kiriwrite_config{"directory_data_output"} . '/' . $page_filename) or ($main::kiriwrite_presmodule->addtext($error_prefix . kiriwrite_language($main::kiriwrite_lang{compile}{pagenotwritten}, $page_filename, $!)), $main::kiriwrite_presmodule->addlinebreak(), $error_count++, next); - - if (!$page_final){ - - $page_final = ""; + $main::kiriwrite_presmodule->addtext($error_prefix . kiriwrite_language($main::kiriwrite_lang{compile}{pagenotwritten}, $page_filename, $kiriwrite_outputmodule->errormessage)); + $main::kiriwrite_presmodule->addlinebreak(); + $error_count++; + next; } - binmode $filehandle_page, ':utf8'; - print $filehandle_page $page_final; - close($filehandle_page); - # Write a message saying the page has been compiled. Check # to see if the page name is blank and write a message # saying there's no page name. @@ -844,6 +853,19 @@ sub kiriwrite_compile_makepages{ } + # Output all the pages (if required). + + $kiriwrite_outputmodule->outputall(); + + if ($kiriwrite_outputmodule->errorflag eq 1){ + + $main::kiriwrite_presmodule->addtext($error_prefix . kiriwrite_language($main::kiriwrite_lang{compile}{outputallerror}, $page_filename, $kiriwrite_outputmodule->errormessage)); + $main::kiriwrite_presmodule->addlinebreak(); + $error_count++; + next; + + } + # Write a message saying that the database has # been processed. @@ -852,9 +874,26 @@ sub kiriwrite_compile_makepages{ } + # This is the last time outputall is going to be called. + + $kiriwrite_outputmodule->outputall({ FinishedProcessing => 1 }); + + if ($kiriwrite_outputmodule->errorflag eq 1){ + + $main::kiriwrite_presmodule->addtext($error_prefix . kiriwrite_language($main::kiriwrite_lang{compile}{outputallerror}, $page_filename, $kiriwrite_outputmodule->errormessage)); + $main::kiriwrite_presmodule->addlinebreak(); + $error_count++; + next; + + } + # Disconnect from the database server. - $main::kiriwrite_dbmodule->disconnect(); + $main::kiriwrite_dbmodule->disconnect; + + # Run the finish subroutine for the output module. + + $kiriwrite_outputmodule->finish; $main::kiriwrite_presmodule->addhorizontalline(); $main::kiriwrite_presmodule->addtext(kiriwrite_language($main::kiriwrite_lang{compile}{compileresults}, $pages_count, $error_count, $warning_count)); @@ -878,6 +917,14 @@ sub kiriwrite_compile_makepages{ my @template_list; my $template_filename; my $template_file; + my @outputmodule_comboboxnames; + my @outputmodule_comboboxvalues; + my $outputmodule_comboboxname; + my $outputmodule_comboboxvalue; + my $outputmodule_selected = 0; + my $combobox_count = 0; + my $outputmoduleslist_name; + my $option_name; my %template_info; my %template_dblist; tie(%template_dblist, "Tie::IxHash"); @@ -1025,17 +1072,60 @@ sub kiriwrite_compile_makepages{ $main::kiriwrite_dbmodule->disconnecttemplate(); $main::kiriwrite_dbmodule->disconnect(); + # Get the list of output modules. + + my @outputmoduleslist = kiriwrite_compile_getoutputmodules; + # Write out a form asking the user to confirm if the # user wants to compile the selected database. $main::kiriwrite_presmodule->addtext($main::kiriwrite_lang{compile}{compiledatabase}, { Style => "pageheader" }); + + # Write out a form selecting the output module. + + $main::kiriwrite_presmodule->startform($main::kiriwrite_env{"script_filename"}, "POST"); + $main::kiriwrite_presmodule->addlinebreak(); + $main::kiriwrite_presmodule->addhiddendata("mode", "compile"); + $main::kiriwrite_presmodule->addhiddendata("action", "compile"); + $main::kiriwrite_presmodule->addhiddendata("type", "single"); + $main::kiriwrite_presmodule->addhiddendata("database", $databasefilename); + $main::kiriwrite_presmodule->addtext($main::kiriwrite_lang{compile}{selectoutputmodule}); + $main::kiriwrite_presmodule->addselectbox("outputmodule"); + + # Process the output modules found. + + foreach $outputmoduleslist_name (@outputmoduleslist){ + + # Print each option and check if the module name is the selected module. + + if ($outputmodule eq $outputmoduleslist_name){ + + $main::kiriwrite_presmodule->addoption($outputmoduleslist_name, { Value => $outputmoduleslist_name, Selected => 1 }); + + } else { + + $main::kiriwrite_presmodule->addoption($outputmoduleslist_name, { Value => $outputmoduleslist_name }); + + } + + } + + $main::kiriwrite_presmodule->endselectbox(); + $main::kiriwrite_presmodule->addtext(" | "); + $main::kiriwrite_presmodule->addsubmit($main::kiriwrite_lang{compile}{selectbutton}); + $main::kiriwrite_presmodule->endform(); + + # Write out another form for compiling the pages. + $main::kiriwrite_presmodule->startform($main::kiriwrite_env{"script_filename"}, "POST"); $main::kiriwrite_presmodule->startbox(); $main::kiriwrite_presmodule->addhiddendata("mode", "compile"); $main::kiriwrite_presmodule->addhiddendata("action", "compile"); $main::kiriwrite_presmodule->addhiddendata("type", "multiple"); + $main::kiriwrite_presmodule->addhiddendata("outputmodule", $outputmodule); $main::kiriwrite_presmodule->addhiddendata("id[1]", $databasefilename); $main::kiriwrite_presmodule->addhiddendata("name[1]", "on"); + $main::kiriwrite_presmodule->addhiddendata("count", 1); $main::kiriwrite_presmodule->addhiddendata("confirm", 1); $main::kiriwrite_presmodule->addlinebreak(); $main::kiriwrite_presmodule->addtext(kiriwrite_language($main::kiriwrite_lang{compile}{compiledatabasemessage}, $database_name)); @@ -1065,6 +1155,80 @@ sub kiriwrite_compile_makepages{ } + # Print out the list of options for the output module. + + $main::kiriwrite_presmodule->addlinebreak(); + $main::kiriwrite_presmodule->addlinebreak(); + $main::kiriwrite_presmodule->addtext($main::kiriwrite_lang{compile}{outputmodulesettings}, { Style => "smallpageheader" }); + $main::kiriwrite_presmodule->addlinebreak(); + + foreach $option_name (keys %outputmodule_options){ + + $main::kiriwrite_presmodule->addlinebreak(); + + # Check if the option is a checkbox option. + + if ($outputmodule_options{$option_name}{type} eq "checkbox"){ + + $main::kiriwrite_presmodule->addcheckbox("outputmodule_" . $option_name, { OptionDescription => $outputmodule_options{$option_name}{string} }); + + } + + # Check if the option is a string option. + + if ($outputmodule_options{$option_name}{type} eq "textbox"){ + + if (!$outputmodule_options{$option_name}{password}){ + $outputmodule_options{$option_name}{password} = 0; + } + + $main::kiriwrite_presmodule->addtext($outputmodule_options{$option_name}{string} . " "); + $main::kiriwrite_presmodule->addinputbox("outputmodule_" . $option_name, { Size => $outputmodule_options{$option_name}{size}, MaxLength => $outputmodule_options->{$option_name}{maxlength}, Value => $outputmodule_options{$option_name}{value}, Password => $outputmodule_options{$option_name}{password} }); + + } + + # Check if the option is a combobox option. + + if ($outputmodule_options{$option_name}{type} eq "combobox"){ + + $combobox_count = 0; + + @outputmodule_comboboxnames = split(/\|/, $outputmodule_options{$option_name}{optionnames}); + @outputmodule_comboboxvalues = split(/\|/, $outputmodule_options{$option_name}{optionvalues}); + + $main::kiriwrite_presmodule->addtext($outputmodule_options{$option_name}{string} . " "); + $main::kiriwrite_presmodule->addselectbox("outputmodule_" . $option_name); + + foreach $outputmodule_comboboxname (@outputmodule_comboboxnames){ + + $main::kiriwrite_presmodule->addoption($outputmodule_comboboxname, { Value => $outputmodule_comboboxvalues[$combobox_count] }); + $combobox_count++; + + } + + $main::kiriwrite_presmodule->endselectbox; + + } + + # Check if the option is a radio option. + + if ($outputmodule_options{$option_name}{type} eq "radio"){ + + # Check if the selected value is blank and if it is then + # set it to 0. + + if (!$outputmodule_options{$option_name}{selected}){ + $outputmodule_selected = 0; + } else { + $outputmodule_selected = 1; + } + + $main::kiriwrite_presmodule->addradiobox("outputmodule_" . $outputmodule_options{$option_name}{name}, { Description => $outputmodule_options{$option_name}{string}, Value => $outputmodule_options{$option_name}{value}, Selected => $outputmodule_selected }); + + } + + } + $main::kiriwrite_presmodule->addlinebreak(); $main::kiriwrite_presmodule->addlinebreak(); $main::kiriwrite_presmodule->addsubmit($main::kiriwrite_lang{compile}{compiledatabasebutton}); @@ -1176,11 +1340,64 @@ sub kiriwrite_compile_makepages{ } + # Get the list of output modules. + + my @outputmoduleslist = kiriwrite_compile_getoutputmodules; + # Write out the form for compiling the database. $main::kiriwrite_presmodule->addtext($main::kiriwrite_lang{compile}{compileselecteddatabases}, { Style => "pageheader" }); + + # Write out a form selecting the output module. + + $main::kiriwrite_presmodule->startform($main::kiriwrite_env{"script_filename"}, "POST"); $main::kiriwrite_presmodule->addlinebreak(); + $main::kiriwrite_presmodule->addhiddendata("mode", "compile"); + $main::kiriwrite_presmodule->addhiddendata("action", "compile"); + $main::kiriwrite_presmodule->addhiddendata("type", "multiple"); + + $database_count = 0; + + # Write out the list of databases to compile. + + foreach $database (keys %database_list){ + + $database_count++; + + $main::kiriwrite_presmodule->addhiddendata("id[" . $database_count . "]", $database_list{$database}{Filename}); + $main::kiriwrite_presmodule->addhiddendata("name[" . $database_count . "]", "on"); + + } + + $main::kiriwrite_presmodule->addhiddendata("count", $database_count); + $main::kiriwrite_presmodule->addtext($main::kiriwrite_lang{compile}{selectoutputmodule}); + $main::kiriwrite_presmodule->addselectbox("outputmodule"); + + # Process the output modules found. + + foreach $outputmoduleslist_name (@outputmoduleslist){ + + # Print each option and check if the module name is the selected module. + + if ($outputmodule eq $outputmoduleslist_name){ + + $main::kiriwrite_presmodule->addoption($outputmoduleslist_name, { Value => $outputmoduleslist_name, Selected => 1 }); + + } else { + + $main::kiriwrite_presmodule->addoption($outputmoduleslist_name, { Value => $outputmoduleslist_name }); + + } + + } + + $main::kiriwrite_presmodule->endselectbox(); + $main::kiriwrite_presmodule->addtext(" | "); + $main::kiriwrite_presmodule->addsubmit($main::kiriwrite_lang{compile}{selectbutton}); + $main::kiriwrite_presmodule->endform(); + $main::kiriwrite_presmodule->addlinebreak(); + $main::kiriwrite_presmodule->startform($main::kiriwrite_env{"script_filename"}, "POST"); $main::kiriwrite_presmodule->startbox(); $main::kiriwrite_presmodule->addhiddendata("mode", "compile"); @@ -1195,7 +1412,7 @@ sub kiriwrite_compile_makepages{ $database_count = 0; - # write out the list of databases to compile. + # Write out the list of databases to compile. foreach $database (keys %database_list){ @@ -1316,6 +1533,81 @@ sub kiriwrite_compile_makepages{ $main::kiriwrite_dbmodule->disconnecttemplate(); $main::kiriwrite_dbmodule->disconnect(); + # Print out the list of options for the output module. + + $main::kiriwrite_presmodule->addlinebreak(); + $main::kiriwrite_presmodule->addlinebreak(); + $main::kiriwrite_presmodule->addtext($main::kiriwrite_lang{compile}{outputmodulesettings}, { Style => "smallpageheader" }); + $main::kiriwrite_presmodule->addlinebreak(); + + foreach $option_name (keys %outputmodule_options){ + + $main::kiriwrite_presmodule->addlinebreak(); + + # Check if the option is a checkbox option. + + if ($outputmodule_options{$option_name}{type} eq "checkbox"){ + + $main::kiriwrite_presmodule->addcheckbox("outputmodule_" . $option_name, { OptionDescription => $outputmodule_options{$option_name}{string} }); + + } + + # Check if the option is a string option. + + if ($outputmodule_options{$option_name}{type} eq "string"){ + + if (!$outputmodule_options{$option_name}{password}){ + $outputmodule_options{$option_name}{password} = 0; + } + + $main::kiriwrite_presmodule->addtext($outputmodule_options{$option_name}{string} . " "); + $main::kiriwrite_presmodule->addinputbox("outputmodule_" . $option_name, { Size => $outputmodule_options{$option_name}{size}, MaxLength => $outputmodule_options->{$option_name}{maxlength}, Value => $outputmodule_options{$option_name}{value}, Password => $outputmodule_options{$option_name}{password} }); + + } + + # Check if the option is a combobox option. + + if ($outputmodule_options{$option_name}{type} eq "combobox"){ + + $combobox_count = 0; + + @outputmodule_comboboxnames = split(/\|/, $outputmodule_options{$option_name}{optionnames}); + @outputmodule_comboboxvalues = split(/\|/, $outputmodule_options{$option_name}{optionvalues}); + + $main::kiriwrite_presmodule->addtext($outputmodule_options{$option_name}{string} . " "); + $main::kiriwrite_presmodule->addselectbox("outputmodule_" . $option_name); + + foreach $outputmodule_comboboxname (@outputmodule_comboboxnames){ + + $main::kiriwrite_presmodule->addoption($outputmodule_comboboxname, { Value => $outputmodule_comboboxvalues[$combobox_count] }); + $combobox_count++; + + } + + $main::kiriwrite_presmodule->endselectbox; + + } + + # Check if the option is a radio option. + + if ($outputmodule_options{$option_name}{type} eq "radio"){ + + # Check if the selected value is blank and if it is then + # set it to 0. + + if (!$outputmodule_options{$option_name}{selected}){ + $outputmodule_selected = 0; + } else { + $outputmodule_selected = 1; + } + + $main::kiriwrite_presmodule->addradiobox("outputmodule_" . $outputmodule_options{$option_name}{name}, { Description => $outputmodule_options{$option_name}{string}, Value => $outputmodule_options{$option_name}{value}, Selected => $outputmodule_selected }); + + } + + } + + $main::kiriwrite_presmodule->addlinebreak(); $main::kiriwrite_presmodule->addlinebreak(); $main::kiriwrite_presmodule->addsubmit($main::kiriwrite_lang{compile}{compileselecteddatabasesbutton}); @@ -1353,9 +1645,62 @@ sub kiriwrite_compile_all{ # # # Usage: # # # -# kiriwrite_compile_all(); # +# kiriwrite_compile_all(outputmodule); # +# # +# outputmodule Specifies the output module to use. # ################################################################################# + # Get the parameters passed to this subroutine. + + my $outputmodule = shift; + + if (!$outputmodule){ + $outputmodule = $main::kiriwrite_config{'system_outputmodule'}; + } + + # Check if the output module name is valid. + + my $outputmodule_maxlength_check = kiriwrite_variablecheck($outputmodule, "maxlength", 64, 1); + + if ($outputmodule_maxlength_check eq 1){ + + # The length of the output module name is too + # long so return an error. + + kiriwrite_error("outputmodulenametoolong"); + + } + + my $outputmodule_filename_check = kiriwrite_variablecheck($outputmodule, "filename", "", 1); + + if ($outputmodule_maxlength_check eq 1){ + + # The length of the output module name is too + # long so return an error. + + kiriwrite_error("outputmodulenameinvalid"); + + } + + # Set up the output module. + + ($outputmodule) = $outputmodule =~ m/^(.*)$/g; + my $outputmodulename = "Modules::Output::" . $outputmodule; + eval "use " . $outputmodulename; + my $kiriwrite_outputmodule = $outputmodulename->new(); + my ($outputmodule_options, %outputmodule_options); + tie(%outputmodule_options, "Tie::IxHash"); + $kiriwrite_outputmodule->initialise(); + %outputmodule_options = $kiriwrite_outputmodule->getoptions(); + my @outputmodule_comboboxnames; + my @outputmodule_comboboxvalues; + my $outputmodule_comboboxname; + my $outputmodule_comboboxvalue; + my $outputmodule_selected = 0; + my $combobox_count = 0; + my $outputmoduleslist_name; + my $option_name; + # Connect to the database server. $main::kiriwrite_dbmodule->connect(); @@ -1371,6 +1716,8 @@ sub kiriwrite_compile_all{ } + my @outputmoduleslist = kiriwrite_compile_getoutputmodules; + # Get the list of available databases. my @database_list = $main::kiriwrite_dbmodule->getdblist(); @@ -1416,11 +1763,40 @@ sub kiriwrite_compile_all{ $main::kiriwrite_presmodule->addlinebreak(); $main::kiriwrite_presmodule->startform($main::kiriwrite_env{"script_filename"}, "POST"); - $main::kiriwrite_presmodule->startbox(); + $main::kiriwrite_presmodule->addhiddendata("mode", "compile"); + $main::kiriwrite_presmodule->addhiddendata("action", "all"); + $main::kiriwrite_presmodule->addtext($main::kiriwrite_lang{compile}{selectoutputmodule}); + $main::kiriwrite_presmodule->addselectbox("outputmodule"); + + # Process the output modules found. + + foreach $outputmoduleslist_name (@outputmoduleslist){ + + # Print each option and check if the module name is the selected module. + + if ($outputmodule eq $outputmoduleslist_name){ + + $main::kiriwrite_presmodule->addoption($outputmoduleslist_name, { Value => $outputmoduleslist_name, Selected => 1 }); + + } else { + + $main::kiriwrite_presmodule->addoption($outputmoduleslist_name, { Value => $outputmoduleslist_name }); + + } + + } + + $main::kiriwrite_presmodule->endselectbox(); + $main::kiriwrite_presmodule->addtext(" | "); + $main::kiriwrite_presmodule->addsubmit($main::kiriwrite_lang{compile}{selectbutton}); + $main::kiriwrite_presmodule->endform(); + + $main::kiriwrite_presmodule->addlinebreak(); + + $main::kiriwrite_presmodule->startform($main::kiriwrite_env{"script_filename"}, "POST"); $main::kiriwrite_presmodule->addhiddendata("mode", "compile"); $main::kiriwrite_presmodule->addhiddendata("action", "compile"); $main::kiriwrite_presmodule->addhiddendata("type", "multiple"); - $main::kiriwrite_presmodule->addtext($main::kiriwrite_lang{compile}{compilealldatabasesmessage}); $main::kiriwrite_presmodule->addlinebreak(); $main::kiriwrite_presmodule->addlinebreak(); @@ -1545,7 +1921,7 @@ sub kiriwrite_compile_all{ # Add overwrite template data. $main::kiriwrite_presmodule->addcheckbox("enableoverride", { OptionDescription => $main::kiriwrite_lang{compile}{overridetemplate}, LineBreak => 1 }); - $main::kiriwrite_presmodule->addtext($main::kiriwrite_lang{compile}{replacecurrenttemplate}); + $main::kiriwrite_presmodule->addtext($main::kiriwrite_lang{compile}{replacecurrenttemplate} . " "); $main::kiriwrite_presmodule->addselectbox("overridetemplate"); foreach $template_file (keys %template_dblist){ @@ -1564,14 +1940,87 @@ sub kiriwrite_compile_all{ $main::kiriwrite_dbmodule->disconnecttemplate(); $main::kiriwrite_dbmodule->disconnect(); + # Print out the list of options for the output module. + $main::kiriwrite_presmodule->addlinebreak(); $main::kiriwrite_presmodule->addlinebreak(); + $main::kiriwrite_presmodule->addtext($main::kiriwrite_lang{compile}{outputmodulesettings}, { Style => "smallpageheader" }); + $main::kiriwrite_presmodule->addlinebreak(); + + foreach $option_name (keys %outputmodule_options){ + + $main::kiriwrite_presmodule->addlinebreak(); + + # Check if the option is a checkbox option. + + if ($outputmodule_options{$option_name}{type} eq "checkbox"){ + + $main::kiriwrite_presmodule->addcheckbox("outputmodule_" . $option_name, { OptionDescription => $outputmodule_options{$option_name}{string} }); + + } + + # Check if the option is a string option. + + if ($outputmodule_options{$option_name}{type} eq "string"){ + + if (!$outputmodule_options{$option_name}{password}){ + $outputmodule_options{$option_name}{password} = 0; + } + + $main::kiriwrite_presmodule->addtext($outputmodule_options{$option_name}{string} . " "); + $main::kiriwrite_presmodule->addinputbox("outputmodule_" . $option_name, { Size => $outputmodule_options{$option_name}{size}, MaxLength => $outputmodule_options->{$option_name}{maxlength}, Value => $outputmodule_options{$option_name}{value}, Password => $outputmodule_options{$option_name}{password} }); + + } + + # Check if the option is a combobox option. + + if ($outputmodule_options{$option_name}{type} eq "combobox"){ + + $combobox_count = 0; + + @outputmodule_comboboxnames = split(/\|/, $outputmodule_options{$option_name}{optionnames}); + @outputmodule_comboboxvalues = split(/\|/, $outputmodule_options{$option_name}{optionvalues}); + + $main::kiriwrite_presmodule->addtext($outputmodule_options{$option_name}{string} . " "); + $main::kiriwrite_presmodule->addselectbox("outputmodule_" . $option_name); + + foreach $outputmodule_comboboxname (@outputmodule_comboboxnames){ + + $main::kiriwrite_presmodule->addoption($outputmodule_comboboxname, { Value => $outputmodule_comboboxvalues[$combobox_count] }); + $combobox_count++; + + } + + $main::kiriwrite_presmodule->endselectbox; + + } + + # Check if the option is a radio option. + + if ($outputmodule_options{$option_name}{type} eq "radio"){ + + # Check if the selected value is blank and if it is then + # set it to 0. + + if (!$outputmodule_options{$option_name}{selected}){ + $outputmodule_selected = 0; + } else { + $outputmodule_selected = 1; + } + + $main::kiriwrite_presmodule->addradiobox("outputmodule_" . $outputmodule_options{$option_name}{name}, { Description => $outputmodule_options{$option_name}{string}, Value => $outputmodule_options{$option_name}{value}, Selected => $outputmodule_selected }); + + } + + } + + $main::kiriwrite_presmodule->addlinebreak; + $main::kiriwrite_presmodule->addlinebreak; $main::kiriwrite_presmodule->addhiddendata("confirm", 1); $main::kiriwrite_presmodule->addsubmit($main::kiriwrite_lang{compile}{compilealldatabasesbutton}); $main::kiriwrite_presmodule->addtext(" | "); $main::kiriwrite_presmodule->addlink($main::kiriwrite_env{"script_filename"} . "?mode=compile", { Text => $main::kiriwrite_lang{compile}{returncompilelist} }); - $main::kiriwrite_presmodule->endbox(); $main::kiriwrite_presmodule->endform(); return $main::kiriwrite_presmodule->grab(); @@ -2115,4 +2564,23 @@ sub kiriwrite_compile_clean_helper{ return $permissions; -} \ No newline at end of file +} + +sub kiriwrite_compile_loadhash{ +################################################################################# +# kiriwrite_compile_loadhash: Loads the hash used for the Output Module. # +# # +# Usage: # +# # +# kiriwrite_compile_loadhash(hash); # +# # +# hash The hash to be passed on for the output moudle. # +################################################################################# + + my (%passedhash) = @_; + + %formdata = %passedhash; + +} + +1; \ No newline at end of file diff --git a/cgi-files/Modules/System/Settings.pm b/cgi-files/Modules/System/Settings.pm index 7785526..aa77cc0 100644 --- a/cgi-files/Modules/System/Settings.pm +++ b/cgi-files/Modules/System/Settings.pm @@ -31,6 +31,8 @@ sub kiriwrite_settings_view{ my $settings_system_language = $main::kiriwrite_config{"system_language"}; my $settings_system_presentation = $main::kiriwrite_config{"system_presmodule"}; my $settings_system_database = $main::kiriwrite_config{"system_dbmodule"}; + my $settings_system_output = $main::kiriwrite_config{"system_outputmodule"}; + $main::kiriwrite_presmodule->addtext($main::kiriwrite_lang{setting}{viewsettings}, { Style => "pageheader" }); $main::kiriwrite_presmodule->addlinebreak(); @@ -184,6 +186,15 @@ sub kiriwrite_settings_view{ $main::kiriwrite_presmodule->endcell(); $main::kiriwrite_presmodule->endrow(); + $main::kiriwrite_presmodule->startrow(); + $main::kiriwrite_presmodule->addcell("tablecell1"); + $main::kiriwrite_presmodule->addtext($main::kiriwrite_lang{setting}{outputmodule}); + $main::kiriwrite_presmodule->endcell(); + $main::kiriwrite_presmodule->addcell("tablecell2"); + $main::kiriwrite_presmodule->addtext($settings_system_output); + $main::kiriwrite_presmodule->endcell(); + $main::kiriwrite_presmodule->endrow(); + $main::kiriwrite_presmodule->startrow(); $main::kiriwrite_presmodule->addcell("tablecell1"); $main::kiriwrite_presmodule->addtext($main::kiriwrite_lang{setting}{databasemodule}); @@ -220,6 +231,7 @@ sub kiriwrite_settings_edit{ # PrsentationModule Specifies the new presentation module to use for # # Kiriwrite. # # DatabaseModule Specifies the new database module to use for Kiriwrite. # +# OutputModule Specifies the new output 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. # @@ -250,6 +262,7 @@ sub kiriwrite_settings_edit{ my $settings_datetimeformat = $passedoptions->{"DateTimeFormat"}; my $settings_languagesystem = $passedoptions->{"SystemLanguage"}; my $settings_presmodule = $passedoptions->{"PresentationModule"}; + my $settings_outputmodule = $passedoptions->{"OutputModule"}; my $settings_dbmodule = $passedoptions->{"DatabaseModule"}; my $settings_textareacols = $passedoptions->{"TextAreaCols"}; my $settings_textarearows = $passedoptions->{"TextAreaRows"}; @@ -300,6 +313,7 @@ sub kiriwrite_settings_edit{ my $kiriwrite_presmodule_modulename_check = kiriwrite_variablecheck($settings_presmodule, "module", 0, 1); my $kiriwrite_dbmodule_modulename_check = kiriwrite_variablecheck($settings_dbmodule, "module", 0, 1); + my $kiriwrite_outputmodule_modulename_check = kiriwrite_variablecheck($settings_outputmodule, "module", 0, 1); if ($kiriwrite_presmodule_modulename_check eq 1){ @@ -337,6 +351,24 @@ sub kiriwrite_settings_edit{ } + if ($kiriwrite_outputmodule_modulename_check eq 1){ + + # The output module name is blank, so return + # an error. + + kiriwrite_error("outputmoduleblank"); + + } + + if ($kiriwrite_outputmodule_modulename_check eq 2){ + + # The output module name is invalid, so return + # an error. + + kiriwrite_error("outputmoduleinvalid"); + + } + # Check if the directory names only contain letters and numbers and # return a specific error if they don't. @@ -687,7 +719,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, 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 }); + kiriwrite_output_config({ DatabaseDirectory => $settings_dbdirectory, OutputDirectory => $settings_outputdirectory, ImagesURIPath => $settings_imagesuri, DateTimeFormat => $settings_datetimeformat, SystemLanguage => $settings_languagesystem, PresentationModule => $settings_presmodule, OutputModule => $settings_outputmodule, 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. @@ -839,90 +871,22 @@ sub kiriwrite_settings_edit{ my @presmodule_directory; my $presmodule; my $presmodule_file = ""; - my $presmodule_char = ""; - my $presmodule_dot = 0; - my $presmodule_firstdot = 0; - my $presmodule_firstdotfound = ""; - my $presmodule_seek = 0; - my $presmodule_length = 0; my $presmodule_count = 0; - my $presmodule_friendly = ""; - my $presmodule_selectlist = ""; my $presmodule_config = $main::kiriwrite_config{"system_presmodule"}; - # Open and get the list of presentation modules (perl modules) by filtering - # out the + # Open and get the list of presentation modules (perl modules) by getting + # only files which end in .pm. opendir(OUTPUTSYSTEMDIR, "Modules/Presentation"); @presmodule_directory = grep /m*\.pm$/, readdir(OUTPUTSYSTEMDIR); closedir(OUTPUTSYSTEMDIR); - # Process each presentation module and add them to the list of available - # presentation modules. - foreach $presmodule_file (@presmodule_directory){ - # Get the length of the presentation module (perl module) filename. - - $presmodule_length = length($presmodule_file); - - # Get the friendly name of the Perl module (by getting rid of the - # .pm part of the filename). - - do { + # Remove the .pm suffix. - $presmodule_char = substr($presmodule_file, $presmodule_seek, 1); - - # Check if the current character is a dot and if it is then - # set the last dot found number to the current seek number. - - if ($presmodule_char eq "."){ - - # Put the seek value as the last dot found number. - - $presmodule_dot = $presmodule_seek; - - } - - # Increment the seek counter. - - $presmodule_seek++; - - } until ($presmodule_seek eq $presmodule_length); - - # Reset the seek counter as it is going to be used again. - - $presmodule_seek = 0; - - # Get the friendly name of the Perl module by the processing the file - # name to the last dot the previous 'do' tried to find. - - do { - - # Get the character the seek counter is currently set at. - - $presmodule_char = substr($presmodule_file, $presmodule_seek, 1); - - # Append the character to the friendly name of the presentation module. - - $presmodule_friendly = $presmodule_friendly . $presmodule_char; - - # Increment the seek counter. - - $presmodule_seek++; - - } until ($presmodule_seek eq $presmodule_dot); - - # Append the option to tbe list of available presentation modules. - - $presmodule_list{$presmodule_count}{Filename} = $presmodule_friendly; - - # Reset the following values. - - $presmodule_seek = 0; - $presmodule_length = 0; - $presmodule_char = ""; - $presmodule_friendly = ""; + $presmodule_file =~ s/.pm$//; + $presmodule_list{$presmodule_count}{Filename} = $presmodule_file; $presmodule_count++; } @@ -933,91 +897,47 @@ sub kiriwrite_settings_edit{ my @dbmodule_directory; my $dbmodule; my $dbmodule_file = ""; - my $dbmodule_char = ""; - my $dbmodule_dot = 0; - my $dbmodule_firstdot = 0; - my $dbmodule_firstdotfound = ""; - my $dbmodule_seek = 0; - my $dbmodule_length = 0; my $dbmodule_count = 0; - my $dbmodule_friendly = ""; - my $dbmodule_selectlist = ""; my $dbmodule_config = $main::kiriwrite_config{"system_dbmodule"}; - # Open and get the list of presentation modules (perl modules) by filtering - # out the + # Open and get the list of database modules (perl modules) by getting + # only files which end in .pm. opendir(DATABASEDIR, "Modules/Database"); @dbmodule_directory = grep /m*\.pm$/, readdir(DATABASEDIR); closedir(DATABASEDIR); - # Process each presentation module and add them to the list of available - # presentation modules. - foreach $dbmodule_file (@dbmodule_directory){ - # Get the length of the database module (perl module) filename. + # Remove the .pm suffix. - $dbmodule_length = length($dbmodule_file); - - # Get the friendly name of the Perl module (by getting rid of the - # .pm part of the filename). - - do { - - $dbmodule_char = substr($dbmodule_file, $dbmodule_seek, 1); - - # Check if the current character is a dot and if it is then - # set the last dot found number to the current seek number. - - if ($dbmodule_char eq "."){ - - # Put the seek value as the last dot found number. - - $dbmodule_dot = $dbmodule_seek; - - } - - # Increment the seek counter. - - $dbmodule_seek++; - - } until ($dbmodule_seek eq $dbmodule_length); - - # Reset the seek counter as it is going to be used again. - - $dbmodule_seek = 0; - - # Get the friendly name of the Perl module by the processing the file - # name to the last dot the previous 'do' tried to find. - - do { - - # Get the character the seek counter is currently set at. - - $dbmodule_char = substr($dbmodule_file, $dbmodule_seek, 1); - - # Append the character to the friendly name of the presentation module. - - $dbmodule_friendly = $dbmodule_friendly . $dbmodule_char; + $dbmodule_file =~ s/.pm$//; + $dbmodule_list{$dbmodule_count}{Filename} = $dbmodule_file; + $dbmodule_count++; - # Increment the seek counter. + } - $dbmodule_seek++; + my %outputmodule_list; + my @outputmodule_directory; + my $outputmodule; + my $outputmodule_file = ""; + my $outputmodule_count = 0; + my $outputmodule_config = $main::kiriwrite_config{"system_outputmodule"}; - } until ($dbmodule_seek eq $dbmodule_dot); + # Open and get the list of output modules (perl modules) by getting + # only files which end in .pm. - # Append the option to tbe list of available database modules. + opendir(DATABASEDIR, "Modules/Output"); + @outputmodule_directory = grep /m*\.pm$/, readdir(DATABASEDIR); + closedir(DATABASEDIR); - $dbmodule_list{$dbmodule_count}{Filename} = $dbmodule_friendly; + foreach $outputmodule_file (@outputmodule_directory){ - # Reset the following values. + # Remove the .pm suffix. - $dbmodule_seek = 0; - $dbmodule_length = 0; - $dbmodule_char = ""; - $dbmodule_friendly = ""; - $dbmodule_count++; + $outputmodule_file =~ s/.pm$//; + $outputmodule_list{$outputmodule_count}{Filename} = $outputmodule_file; + $outputmodule_count++; } @@ -1275,6 +1195,39 @@ sub kiriwrite_settings_edit{ $main::kiriwrite_presmodule->endcell(); $main::kiriwrite_presmodule->endrow(); + $main::kiriwrite_presmodule->startrow(); + $main::kiriwrite_presmodule->addcell("tablecell1"); + $main::kiriwrite_presmodule->addtext($main::kiriwrite_lang{setting}{outputmodule}); + $main::kiriwrite_presmodule->endcell(); + $main::kiriwrite_presmodule->addcell("tablecell2"); + + # Process the list of available output modules. + + $main::kiriwrite_presmodule->addselectbox("outputmodule"); + + foreach $outputmodule (keys %outputmodule_list){ + + # Check if the output module fileanme matches the filename in the + # configuration file. + + if ($outputmodule_list{$outputmodule}{Filename} eq $outputmodule_config){ + + $main::kiriwrite_presmodule->addoption($outputmodule_list{$outputmodule}{Filename}, { Value => $outputmodule_list{$outputmodule}{Filename} , Selected => 1 }); + + } else { + + $main::kiriwrite_presmodule->addoption($outputmodule_list{$outputmodule}{Filename}, { Value => $outputmodule_list{$outputmodule}{Filename} }); + + } + + + } + + $main::kiriwrite_presmodule->endselectbox(); + + $main::kiriwrite_presmodule->endcell(); + $main::kiriwrite_presmodule->endrow(); + $main::kiriwrite_presmodule->startrow(); $main::kiriwrite_presmodule->addcell("tablecell1"); $main::kiriwrite_presmodule->addtext($main::kiriwrite_lang{setting}{databasemodule}); @@ -1443,6 +1396,7 @@ sub kiriwrite_output_config{ # SystemLanguage Specifies the new language to use for Kiriwrite. # # PrsentationModule Specifies the new presentation module to use for # # Kiriwrite. # +# OutputModule Specifies the new output 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 to view. # @@ -1470,6 +1424,7 @@ sub kiriwrite_output_config{ my $settings_datetime = $passedsettings->{"DateTimeFormat"}; my $settings_systemlanguage = $passedsettings->{"SystemLanguage"}; my $settings_presmodule = $passedsettings->{"PresentationModule"}; + my $settings_outputmodule = $passedsettings->{"OutputModule"}; my $settings_dbmodule = $passedsettings->{"DatabaseModule"}; my $settings_textareacols = $passedsettings->{"TextAreaCols"}; @@ -1528,6 +1483,7 @@ sub kiriwrite_output_config{ $configdata = $configdata . "system_language = " . $settings_systemlanguage . "\r\n"; $configdata = $configdata . "system_presmodule = " . $settings_presmodule . "\r\n"; $configdata = $configdata . "system_dbmodule = " . $settings_dbmodule . "\r\n"; + $configdata = $configdata . "system_outputmodule = " . $settings_outputmodule . "\r\n"; $configdata = $configdata . "system_datetime = " . $settings_datetime . "\r\n\r\n"; $configdata = $configdata . "display_textareacols = " . $settings_textareacols . "\r\n"; diff --git a/cgi-files/install.cgi b/cgi-files/install.cgi index d51ea26..b486141 100755 --- a/cgi-files/install.cgi +++ b/cgi-files/install.cgi @@ -4,7 +4,7 @@ # Kiriwrite Installer Script (install.pl/install.cgi) # # Installation script for Kiriwrite # # # -# Version: 0.4.0 # +# Version: 0.5.0 # # mod_perl 2.x compatabile version # # # # Copyright (C) 2005-2008 Steve Brokenshire # @@ -26,13 +26,12 @@ use strict; # Throw errors if there's something wrong. use warnings; # Write warnings to the HTTP Server Log file. use utf8; -use CGI::Lite; eval "use CGI::Lite"; if ($@){ print "Content-type: text/html;\r\n\r\n"; - print "The CGI::Lite Perl Module is not installed. Please install CGI::Lite and then run this installation script again."; + print "The CGI::Lite Perl Module is not installed. Please install CGI::Lite and then run this installation script again. CGI::Lite can be installed through CPAN."; exit; } @@ -69,6 +68,8 @@ my $default_imagesuri = "/images/kiriwrite"; my $default_textarearows = "10"; my $default_textareacols = "50"; +my $default_outputmodule = "Normal"; + my $default_server = "localhost"; my $default_port = "3306"; my $default_protocol = "tcp"; @@ -119,11 +120,15 @@ $kiriwrite_lang{"en-GB"}{"languagename"} = "English (British)"; $kiriwrite_lang{"en-GB"}{"presmoduleblank"} = "The presentation module name given is blank."; $kiriwrite_lang{"en-GB"}{"presmoduleinvalid"} = "The presentation module name given is invalid."; - + $kiriwrite_lang{"en-GB"}{"dbmoduleblank"} = "The database module name given is blank."; $kiriwrite_lang{"en-GB"}{"dbmoduleinvalid"} = "The database module name given is invalid."; + $kiriwrite_lang{"en-GB"}{"outputmoduleblank"} = "The output module name given is blank."; + $kiriwrite_lang{"en-GB"}{"outputmoduleinvalid"} = "The output module name given is invalid."; + $kiriwrite_lang{"en-GB"}{"presmodulemissing"} = "The presentation module with the filename given is missing."; + $kiriwrite_lang{"en-GB"}{"outputmodulemissing"} = "The output module with the filename given is missing."; $kiriwrite_lang{"en-GB"}{"dbmodulemissing"} = "The database module with the filename given is missing."; $kiriwrite_lang{"en-GB"}{"languagefilenamemissing"} = "The language file with the filename given is missing."; @@ -196,6 +201,7 @@ $kiriwrite_lang{"en-GB"}{"languagename"} = "English (British)"; $kiriwrite_lang{"en-GB"}{"systemlanguage"} = "System Language"; $kiriwrite_lang{"en-GB"}{"modules"} = "Modules"; $kiriwrite_lang{"en-GB"}{"presentationmodule"} = "Presentation Module"; + $kiriwrite_lang{"en-GB"}{"outputmodule"} = "Output Module"; $kiriwrite_lang{"en-GB"}{"databasemodule"} = "Database Module"; $kiriwrite_lang{"en-GB"}{"databaseserver"} = "Database Server"; $kiriwrite_lang{"en-GB"}{"databaseport"} = "Database Port"; @@ -1032,6 +1038,7 @@ directory_noncgi_images = $passedsettings->{ImagesURIPath} system_language = $passedsettings->{Language} system_presmodule = $passedsettings->{PresentationModule} +system_outputmodule = $passedsettings->{OutputModule} system_dbmodule = $passedsettings->{DatabaseModule} system_datetime = $passedsettings->{DateFormat} @@ -1160,6 +1167,7 @@ if ($http_query_confirm eq 1){ my $http_query_language = $form_data->{'language'}; my $http_query_presmodule = $form_data->{'presmodule'}; + my $http_query_outputmodule = $form_data->{'outputmodule'}; my $http_query_dbmodule = $form_data->{'dbmodule'}; my $http_query_databaseserver = $form_data->{'databaseserver'}; @@ -1427,6 +1435,7 @@ if ($http_query_confirm eq 1){ # Check the module names to see if they're valid. my $kiriwrite_presmodule_modulename_check = kiriwrite_variablecheck($http_query_presmodule, "module", 0, 1); + my $kiriwrite_outputmodule_modulename_check = kiriwrite_variablecheck($http_query_outputmodule, "module", 0, 1); my $kiriwrite_dbmodule_modulename_check = kiriwrite_variablecheck($http_query_dbmodule, "module", 0, 1); if ($kiriwrite_presmodule_modulename_check eq 1){ @@ -1447,6 +1456,24 @@ if ($http_query_confirm eq 1){ } + if ($kiriwrite_outputmodule_modulename_check eq 1){ + + # The output module name is blank, so return + # an error. + + kiriwrite_error("outputmoduleblank"); + + } + + if ($kiriwrite_outputmodule_modulename_check eq 2){ + + # The output module name is invalid, so return + # an error. + + kiriwrite_error("outputmoduleinvalid"); + + } + if ($kiriwrite_dbmodule_modulename_check eq 1){ # The database module name is blank, so return @@ -1465,8 +1492,8 @@ if ($http_query_confirm eq 1){ } - # Check if the database module, presentation module and - # language file exists. + # Check if the database module, presentation module, + # output module and language file exists. if (!-e "Modules/Presentation/" . $http_query_presmodule . ".pm"){ @@ -1477,6 +1504,15 @@ if ($http_query_confirm eq 1){ } + if (!-e "Modules/Output/" . $http_query_outputmodule . ".pm"){ + + # The database module is missing so return an + # error. + + kiriwrite_error("outputmodulemissing"); + + } + if (!-e "Modules/Database/" . $http_query_dbmodule . ".pm"){ # The database module is missing so return an @@ -1692,7 +1728,7 @@ if ($http_query_confirm eq 1){ # Write the new configuration file. - kiriwrite_writeconfig({ DatabaseDirectory => $http_query_dbdirectory, OutputDirectory => $http_query_outputdirectory, ImagesURIPath => $http_query_imagesuripath, TextAreaCols => $http_query_textareacols, TextAreaRows => $http_query_textarearows, DateFormat => $finaldateformat, Language => $http_query_language, PresentationModule => $http_query_presmodule, DatabaseModule => $http_query_dbmodule, DatabaseServer => $http_query_databaseserver, DatabasePort => $http_query_databaseport, DatabaseProtocol => $http_query_databaseprotocol, DatabaseName => $http_query_databasename, DatabaseUsername => $http_query_databaseusername, DatabasePassword => $http_query_databasepassword, DatabaseTablePrefix => $http_query_databasetableprefix }); + kiriwrite_writeconfig({ DatabaseDirectory => $http_query_dbdirectory, OutputDirectory => $http_query_outputdirectory, ImagesURIPath => $http_query_imagesuripath, TextAreaCols => $http_query_textareacols, TextAreaRows => $http_query_textarearows, DateFormat => $finaldateformat, Language => $http_query_language, PresentationModule => $http_query_presmodule, OutputModule => $http_query_outputmodule, DatabaseModule => $http_query_dbmodule, DatabaseServer => $http_query_databaseserver, DatabasePort => $http_query_databaseport, DatabaseProtocol => $http_query_databaseprotocol, DatabaseName => $http_query_databasename, DatabaseUsername => $http_query_databaseusername, DatabasePassword => $http_query_databasepassword, DatabaseTablePrefix => $http_query_databasetableprefix }); my $installscriptmessage = ""; @@ -1784,10 +1820,6 @@ $test_list{CheckDBI}{Name} = "DBI"; $test_list{CheckDBI}{Type} = "dependency"; $test_list{CheckDBI}{Code} = "DBI"; -$test_list{CheckTieHash}{Name} = "Tie::IxHash"; -$test_list{CheckTieHash}{Type} = "dependency"; -$test_list{CheckTieHash}{Code} = "Tie::IxHash"; - $test_list{CheckCGILite}{Name} = "CGI::Lite"; $test_list{CheckCGILite}{Type} = "dependency"; $test_list{CheckCGILite}{Code} = "CGI::Lite"; @@ -1796,6 +1828,14 @@ $test_list{Encode}{Name} = "Encode"; $test_list{Encode}{Type} = "dependency"; $test_list{Encode}{Code} = "Encode"; +$test_list{HashSearch}{Name} = "Hash::Search"; +$test_list{HashSearch}{Type} = "dependency"; +$test_list{HashSearch}{Code} = "Hash::Search"; + +$test_list{CheckTieHash}{Name} = "Tie::IxHash"; +$test_list{CheckTieHash}{Type} = "dependency"; +$test_list{CheckTieHash}{Code} = "Tie::IxHash"; + $test_list{DBDmysql}{Name} = "DBD::mysql"; $test_list{DBDmysql}{Type} = "database"; $test_list{DBDmysql}{Code} = "DBD::mysql"; @@ -2037,7 +2077,7 @@ if ($file_error eq 1){ print ""; -kiriwrite_addtablerow("Filename", "tablecellheader", "Result", "tablecellheader"); +kiriwrite_addtablerow($kiriwrite_lang{$language_selected}{filename}, "tablecellheader", "Result", "tablecellheader"); foreach $test (keys %file_results) { @@ -2080,6 +2120,7 @@ if ($file_error eq 1){ my @language_short; my (%available_languages, $available_languages); my @presentation_modules; +my @output_modules; my @database_modules; my $select_data = ""; my (%language_data, $language_data); @@ -2088,6 +2129,7 @@ my $kiriwrite_languagefilehandle; my $language_out = ""; my ($presmodule_name, $presmodule_out) = ""; my ($dbmodule_name, $dbmodule_out) = ""; +my ($outputmodule_name, $outputmodule_out) = ""; # Get the list of available languages. @@ -2132,6 +2174,21 @@ foreach my $presmodule_file (@presmodule_directory){ } +# Get the list of output modules. + +opendir(OUTPUTDIR, "Modules/Output"); +my @outputmodule_directory = grep /m*\.pm$/, readdir(OUTPUTDIR); +closedir(OUTPUTDIR); + +foreach my $outputmodule_file (@outputmodule_directory){ + + # Get the friendly name for the database module. + + $outputmodule_file =~ s/.pm$//g; + push(@output_modules, $outputmodule_file); + +} + # Get the list of database modules. opendir(DATABASEDIR, "Modules/Database"); @@ -2181,16 +2238,28 @@ foreach my $language (keys %available_languages){ } kiriwrite_addtablerow($kiriwrite_lang{$language_selected}{systemlanguage}, "tablename", "", "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 . ""; } - kiriwrite_addtablerow($kiriwrite_lang{$language_selected}{databasemodule}, "tablename", "", "tabledata"); + +foreach $outputmodule_name (@output_modules){ + if ($default_outputmodule = $outputmodule_name){ + $outputmodule_out = $outputmodule_out . ""; + } else { + $outputmodule_out = $outputmodule_out . ""; + } +} +kiriwrite_addtablerow($kiriwrite_lang{$language_selected}{outputmodule}, "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"); diff --git a/cgi-files/kiriwrite.cgi b/cgi-files/kiriwrite.cgi index 43bed2d..36ec6ff 100755 --- a/cgi-files/kiriwrite.cgi +++ b/cgi-files/kiriwrite.cgi @@ -4,7 +4,7 @@ # Kiriwrite (kiriwrite.pl/kiriwrite.cgi) # # Main program script # # # -# Version: 0.4.0 # +# Version: 0.5.0 # # mod_perl 2.x compatabile version # # # # Copyright (C) 2005-2008 Steve Brokenshire # @@ -37,13 +37,14 @@ binmode STDOUT, ':utf8'; # Declare global variables for Kiriwrite settings and languages. -our ($kiriwrite_config, %kiriwrite_config, %kiriwrite_lang, $kiriwrite_lang, $kiriwrite_version, %kiriwrite_version, $kiriwrite_env, %kiriwrite_env, $kiriwrite_presmodule, $kiriwrite_dbmodule, $form_data, $kiriwrite_script_name, $kiriwrite_env_path); +our ($kiriwrite_config, %kiriwrite_config, %kiriwrite_lang, $kiriwrite_lang, $kiriwrite_version, %kiriwrite_version, $kiriwrite_env, %kiriwrite_env, $kiriwrite_presmodule, $kiriwrite_dbmodule, $kiriwrite_script_name, $kiriwrite_env_path); +our ($form_data, %form_data); # If you are using mod_perl please change these settings to the correct # directory where this script is being run from. -use lib '.'; -chdir('.'); +use lib '/home/kirinji/Websites/Xestia/cgi-bin/kiriwrite'; +chdir('/home/kirinji/Websites/Xestia/cgi-bin/kiriwrite'); # Load the common functions module. @@ -53,7 +54,7 @@ use Modules::System::Common; %kiriwrite_version = ( "major" => 0, - "minor" => 4, + "minor" => 5, "revision" => 0 ); @@ -65,7 +66,7 @@ my $query_lite = new CGI::Lite; # Check if a mode has been specified and if a mode has been specified, continue # and work out what mode has been specified. -$form_data = $query_lite->parse_form_data; +$form_data = $query_lite->parse_form_data(); if ($form_data->{'mode'}){ my $http_query_mode = $form_data->{'mode'}; @@ -343,7 +344,6 @@ if ($form_data->{'mode'}){ kiriwrite_output_header; # Output the header to browser/console/stdout. kiriwrite_output_page($kiriwrite_lang{pages}{editpagetitle}, $pagedata, "pages"); # Output the page to browser/console/stdout. exit; # End the script. - } elsif ($http_query_action eq "delete"){ @@ -880,10 +880,13 @@ if ($form_data->{'mode'}){ my $http_query_override = $form_data->{'enableoverride'}; my $http_query_overridetemplate = $form_data->{'overridetemplate'}; - + my $http_query_outputmodule = $form_data->{'outputmodule'}; + my @selectedlist = kiriwrite_selectedlist($form_data); - my $pagedata = kiriwrite_compile_makepages($http_query_type, $http_query_confirm, $http_query_override, $http_query_overridetemplate, @selectedlist); - + my %form_data_hash = $query_lite->parse_form_data; + kiriwrite_compile_loadhash(%form_data_hash); + my $pagedata = kiriwrite_compile_makepages($http_query_type, $http_query_confirm, $http_query_override, $http_query_overridetemplate, $http_query_outputmodule, @selectedlist); + kiriwrite_output_header; # Output the header to browser/console/stdout. kiriwrite_output_page($kiriwrite_lang{compile}{compilepages}, $pagedata, "compile"); # Output the page to browser/console/stdout. exit; # End the script. @@ -893,9 +896,11 @@ if ($form_data->{'mode'}){ # The action to compile the pages has not been confirmed # so write a form asking the user to confirm the action # of compiling the pages. - + + my $http_query_outputmodule = $form_data->{'outputmodule'}; + my @selectedlist = kiriwrite_selectedlist($form_data); - my $pagedata = kiriwrite_compile_makepages($http_query_type, $http_query_confirm, "", "", @selectedlist); + my $pagedata = kiriwrite_compile_makepages($http_query_type, $http_query_confirm, "", "", $http_query_outputmodule, @selectedlist); kiriwrite_output_header; # Output the header to browser/console/stdout. kiriwrite_output_page($kiriwrite_lang{compile}{compileselecteddatabases}, $pagedata, "compile"); # Output the page to browser/console/stdout. @@ -905,10 +910,11 @@ if ($form_data->{'mode'}){ } elsif ($http_query_type eq "single"){ - my $http_query_database = $form_data->{'database'}; + my $http_query_database = $form_data->{'database'}; + my $http_query_outputmodule = $form_data->{'outputmodule'}; my @selectedlist; $selectedlist[0] = $http_query_database; - my $pagedata = kiriwrite_compile_makepages($http_query_type, $http_query_confirm, "", "", @selectedlist); + my $pagedata = kiriwrite_compile_makepages($http_query_type, $http_query_confirm, "", "", $http_query_outputmodule, @selectedlist); kiriwrite_output_header; # Output the header to browser/console/stdout. kiriwrite_output_page($kiriwrite_lang{compile}{compiledatabase}, $pagedata, "compile"); @@ -926,7 +932,8 @@ if ($form_data->{'mode'}){ # in the database directory. Check if the action to # compile all of the databases has been confirmed. - my $http_query_confirm = $form_data->{'confirm'}; + my $http_query_confirm = $form_data->{'confirm'}; + my $http_query_outputmodule = $form_data->{'outputmodule'}; if (!$http_query_confirm){ @@ -937,13 +944,7 @@ if ($form_data->{'mode'}){ } - if ($http_query_confirm eq 1){ - - # The action to compile all the databases has been confirmed. - - } - - my $pagedata = kiriwrite_compile_all(); + my $pagedata = kiriwrite_compile_all($http_query_outputmodule); kiriwrite_output_header; # Output the header to browser/console/stdout. kiriwrite_output_page($kiriwrite_lang{compile}{compilealldatabases}, $pagedata, "compile"); @@ -1038,6 +1039,7 @@ if ($form_data->{'mode'}){ my $http_query_systemlanguage = $form_data->{'language'}; my $http_query_presmodule = $form_data->{'presmodule'}; my $http_query_dbmodule = $form_data->{'dbmodule'}; + my $http_query_outputmodule = $form_data->{'outputmodule'}; my $http_query_textareacols = $form_data->{'textareacols'}; my $http_query_textarearows = $form_data->{'textarearows'}; my $http_query_pagecount = $form_data->{'pagecount'}; @@ -1053,7 +1055,7 @@ if ($form_data->{'mode'}){ 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, 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 }); + 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, OutputModule => $http_query_outputmodule, 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. diff --git a/cgi-files/lang/en-GB.lang b/cgi-files/lang/en-GB.lang index 7709f87..6185cfd 100644 --- a/cgi-files/lang/en-GB.lang +++ b/cgi-files/lang/en-GB.lang @@ -272,6 +272,10 @@ compiledatabase = Compile Database compiledatabasemessage = Do you want to compile the '%s' database? compiledatabasebutton = Compile Database +selectoutputmodule = Select Output Module: +outputmodulesettings = Output Module Settings +selectbutton = Select + overridetemplate = Override the template being used. replacecurrenttemplate = Replace current template with: templatedbmissing = The template database does not exist so the template being used cannot be overridden. @@ -304,6 +308,7 @@ invalidpagefilename = The page '%s' has an invalid filename. Page skipped. templatefilemissing = The template with the filename '%s' for '%s' (%s) does not exist. pageinvalidpermissions = The page with the filename '%s' has invalid permissions set. Page not written. pagenotwritten = An error occured while writing the page with the filename '%s': %s +outputallerror = An error occured while outputting all of the pages: %s compiledpageblankname = (%s) was compiled. compiledpage = '%s' (%s) was compiled. databasefinish = Finished compiling pages in the '%s' database... @@ -338,6 +343,7 @@ language = Language systemlanguage = System Language modules = Modules presentationmodule = Presentation Module +outputmodule = Output Module databasemodule = Database Module altersettings = To alter the current settings, select the Edit Settings option at the top of the page. @@ -452,6 +458,10 @@ oldcopydatabasefileinvalidpermissions = The database that the selected pages are oldmovedatabasedatabaseerror = A database error has occurred in the database that the selected pages are being moved from. oldmovedatabasedoesnotexist = The database that the selected pages are moving from does not exist. oldmovedatabasefileinvalidpermissions = The database that the selected pages are moving from has invalid permissions set. +outputmoduleblank = The output module name given is blank. +outputmoduleinvalid = The output module name given is invalid. +outputmodulenametoolong = The output module name given is too long. +outputmodulenameinvalid = The output module name is invalid. outputdirectoryblank = The output directory name given was blank. outputdirectoryinvalid = The output directory name given was invalid. outputdirectorymissing = The output directory is missing diff --git a/cgi-files/page.html b/cgi-files/page.html index 3a4de2e..348847b 100644 --- a/cgi-files/page.html +++ b/cgi-files/page.html @@ -174,7 +174,7 @@
- ©2005-2008 Steve Brokenshire
+ ©2005-2009 Steve Brokenshire