-#################################################################################
-# compile.lib: Kiriwrite Compile Library #
-# #
-# This library is under the same license as the main Kiriwrite script. #
-#################################################################################
-
-# This section of the file is for when the library is called from the main
-# Kiriwrite script.
-
-# If the action option is left blank, then print out a form where the list
-# of databases to compile are available.
-
-if ($form_data->{'action'}){
-
- my $http_query_action = $form_data->{'action'};
-
- if ($http_query_action eq "compile"){
-
- # The specified action is to compile the pages, check if the
- # action to compile the page has been confirmed.
-
- my $http_query_confirm = $form_data->{'confirm'};
- my $http_query_type = $form_data->{'type'};
-
- # If it is blank, set the confirm value to 0.
-
- if (!$http_query_confirm){
-
- # The http_query_confirm variable is uninitalised, so place a
- # '0' (meaning an unconfirmed action).
-
- $http_query_confirm = 0;
-
- }
-
- # If the compile type is blank then return an error.
-
- if (!$http_query_type){
-
- # Compile type is blank so return an error.
-
- kiriwrite_error("blankcompiletype");
-
- }
-
- if ($http_query_type eq "multiple"){
-
- if ($http_query_confirm eq 1){
-
- # The action to compile the pages has been confirmed so
- # compile the pages.
-
- my $http_query_override = $form_data->{'enableoverride'};
- my $http_query_overridetemplate = $form_data->{'overridetemplate'};
-
- my @selectedlist = kiriwrite_selectedlist();
- my $pagedata = kiriwrite_compile_makepages($http_query_type, $http_query_confirm, $http_query_override, $http_query_overridetemplate, @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.
-
- } else {
-
- # 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 @selectedlist = kiriwrite_selectedlist();
- my $pagedata = kiriwrite_compile_makepages($http_query_type, $http_query_confirm, "", "", @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.
- exit; # End the script.
-
- }
-
- } elsif ($http_query_type eq "single"){
-
- my $http_query_database = $form_data->{'database'};
- my @selectedlist;
- $selectedlist[0] = $http_query_database;
- my $pagedata = kiriwrite_compile_makepages($http_query_type, $http_query_confirm, "", "", @selectedlist);
-
- kiriwrite_output_header; # Output the header to browser/console/stdout.
- kiriwrite_output_page($kiriwrite_lang->{compile}->{compiledatabase}, $pagedata, "compile");
- exit; # End the script.
-
- } else {
-
- kiriwrite_error("invalidcompiletype");
-
- }