## OpenCA Command
## (c) 1998-2003 by Massimiliano Pala and OpenCA Group
## (c) Copyright 2004 The OpenCA Project
##
##   File Name: getStaticPage
##       Brief: get a static page
## Description: get a static page to support session management
##  Parameters: name

use strict;

sub cmdGetStaticPage {

    our ($query, $xml_cache);

    ##     bp
    ##     init
    ##     initCA
    ##     initUser
    ##     initRA
    ##     selectCSRtype
    ##     thanks

    my ($item_list, $name, $exp) = (undef, "", "");

    if ($query->param('name') =~ /workflow/)
    {
        $name = gettext ("Statemachine based workflow management");
        $exp  = gettext ("This is the management interface for OpenCA's batch processing system. Please use and configure it carefully because it works fullautomatically.");

        $item_list->[1]->[0] = gettext ("Operations and Management");
        $item_list->[1]->[1] = '<a href="'.$query->param("HTTP_CGI_SCRIPT").'?cmd=getParams;GET_PARAMS_CMD=bpDoStep">'.
                               gettext ("Do one step for all workflows").'</a>';
        $item_list->[1]->[2] = '<a href="'.$query->param("HTTP_CGI_SCRIPT").'?cmd=bpListUser">'.
                               gettext ("List Users").'</a>';

        $item_list->[2]->[0] = gettext ("Import data into batch system");
        $item_list->[2]->[1] = '<a href="'.$query->param("HTTP_CGI_SCRIPT").'?cmd=getParams;GET_PARAMS_CMD=bpImportNewUser">'.
                               gettext ("Import new users").'</a>';
        $item_list->[2]->[2] = '<a href="'.$query->param("HTTP_CGI_SCRIPT").'?cmd=getParams;GET_PARAMS_CMD=bpImportNewProcess">'.
                               gettext ("Import new processes for the users").'</a>';
        $item_list->[2]->[3] = '<a href="'.$query->param("HTTP_CGI_SCRIPT").'?cmd=getParams;GET_PARAMS_CMD=bpImportProcessData">'.
                               gettext ("Import data for the processes of the users").'</a>';

        $item_list->[2]->[4] = '<a href="'.$query->param("HTTP_CGI_SCRIPT").'?cmd=getParams;GET_PARAMS_CMD=bpImportProcessDataCompact">'.
                               gettext ("Quickimport - see manual !").'</a>';

        $item_list->[3]->[0] = gettext ("Enrollment");
        $item_list->[3]->[1] = '<a href="'.$query->param("HTTP_CGI_SCRIPT").'?cmd=getParams;GET_PARAMS_CMD=bpExportPIN">'.
                               gettext ("Export PINs").'</a>';
        my $filename = $xml_cache->get_xpath(
                           FILENAME => getRequired ('StateMachineConfiguration'),
                           XPATH    => [ "statemachine/functions/enrollment/pkcs12/dir" ],
                           COUNTER  => [ 0 ]);
        $item_list->[3]->[2] = i18nGettext ("Enrolled PKCS#12 files are already in __DIR__.",
                                            "__DIR__", $filename);

        #$item_list->[1]->[3] = '<a href="'.$query->param("HTTP_CGI_SCRIPT").'?cmd=getParams;GET_PARAMS_CMD=bpImportUpdateUser">'.
        #                       gettext ("Import an update for the users").'</a>';
        #$item_list->[1]->[4] = '<a href="'.$query->param("HTTP_CGI_SCRIPT").'?cmd=getParams;GET_PARAMS_CMD=bpImportACL">'.
        #                       gettext ("Import permissions").'</a>';

        #$item_list->[2]->[0] = gettext ("New key-lifecycle");
        #$item_list->[2]->[1] = '<a href="'.$query->param("HTTP_CGI_SCRIPT").'?cmd=bpCreatePIN">'.
        #                       gettext ("Create PINs").'</a>';
        #$item_list->[2]->[3] = '<a href="'.$query->param("HTTP_CGI_SCRIPT").'?cmd=bpCreateKey">'.
        #                       gettext ("Create new key pairs").'</a>';
        #$item_list->[2]->[4] = '<a href="'.$query->param("HTTP_CGI_SCRIPT").'?cmd=bpBackupKey">'.
        #                       gettext ("Backup key pairs").'</a>';
        #$item_list->[2]->[5] = '<a href="'.$query->param("HTTP_CGI_SCRIPT").'?cmd=bpCreateCSR">'.
        #                       gettext ("Create Requests").'</a>';
        #$item_list->[2]->[6] = '<a href="'.$query->param("HTTP_CGI_SCRIPT").'?cmd=bpApprovePendingCSR">'.
        #                       gettext ("Approve Requests").'</a>';
        #$item_list->[2]->[7] = '<a href="'.$query->param("HTTP_CGI_SCRIPT").'?cmd=getParams;GET_PARAMS_CMD=bpExportPKCS12">'.
        #                       gettext ("Export PKCS#12-files").'</a>';
        #$item_list->[2]->[7] = '<a href="'.$query->param("HTTP_CGI_SCRIPT").'?cmd=bpDeletePIN">'.
        #                       gettext ("Delete not hashed PINs").'</a>';
        #$item_list->[2]->[7] = '<div class="warning">'.
        #                       gettext ("(don't do this if you have not already exported all PINs to the users)").
        #                       '</div>';

        #$item_list->[3]->[0] = gettext ("Renew key-lifecycle");
        #$item_list->[3]->[1] = '<a href="'.$query->param("HTTP_CGI_SCRIPT").'?cmd=getParams;GET_PARAMS_CMD=bpRenewCSR">'.
        #                       gettext ("Renew requests").'</a>';
        #$item_list->[3]->[2] = '<a href="'.$query->param("HTTP_CGI_SCRIPT").'?cmd=bpApproveRenewedCSR">'.
        #                       gettext ("Approve renewed users").'</a>';

    } elsif ($query->param('name') =~ /dataexchange/)
    {
        $name = gettext ("Dataexchange");
        $exp  = gettext ("Please choose what do you want to export from or import into the CA.");

        $item_list->[0]->[0] = gettext ("Enroll data to a lower level of the hierarchy");
        $item_list->[0]->[1] = '<a href="'.$query->param("HTTP_CGI_SCRIPT").'?cmd=getParams;GET_PARAMS_CMD=nodeEnrollAll">'.
                               gettext ("All").'</a>';
        $item_list->[0]->[2] = '<a href="'.$query->param("HTTP_CGI_SCRIPT").'?cmd=getParams;GET_PARAMS_CMD=nodeEnrollCert">'.
                               gettext ("Certificates").'</a>';
        $item_list->[0]->[3] = '<a href="'.$query->param("HTTP_CGI_SCRIPT").'?cmd=getParams;GET_PARAMS_CMD=nodeEnrollCRL">'.
                               gettext ("CRLs").'</a>';
        $item_list->[0]->[4] = '<a href="'.$query->param("HTTP_CGI_SCRIPT").'?cmd=getParams;GET_PARAMS_CMD=nodeEnrollConfig">'.
                               gettext ("Configuration").'</a>';
        $item_list->[0]->[5] = '<a href="'.$query->param("HTTP_CGI_SCRIPT").'?cmd=getParams;GET_PARAMS_CMD=nodeEnrollBP">'.
                               gettext ("Batchprocessors").'</a>';

        $item_list->[1]->[0] = gettext ("Receive data from a lower level of the hierarchy");
        $item_list->[1]->[1] = '<a href="'.$query->param("HTTP_CGI_SCRIPT").'?cmd=getParams;GET_PARAMS_CMD=nodeReceiveAll">'.
                               gettext ("All").'</a>';
        $item_list->[1]->[2] = '<a href="'.$query->param("HTTP_CGI_SCRIPT").'?cmd=getParams;GET_PARAMS_CMD=nodeReceiveCSR">'.
                               gettext ("Requests").'</a>';
        $item_list->[1]->[3] = '<a href="'.$query->param("HTTP_CGI_SCRIPT").'?cmd=getParams;GET_PARAMS_CMD=nodeReceiveCRR">'.
                               gettext ("CRRs").'</a>';

        $item_list->[2]->[0] = gettext ("Download data from a higher level of the hierarchy");
        $item_list->[2]->[1] = '<a href="'.$query->param("HTTP_CGI_SCRIPT").'?cmd=getParams;GET_PARAMS_CMD=nodeDownloadAll">'.
                               gettext ("All").'</a>';
        $item_list->[2]->[2] = '<a href="'.$query->param("HTTP_CGI_SCRIPT").'?cmd=getParams;GET_PARAMS_CMD=nodeDownloadCert">'.
                               gettext ("Certificates").'</a>';
        $item_list->[2]->[3] = '<a href="'.$query->param("HTTP_CGI_SCRIPT").'?cmd=getParams;GET_PARAMS_CMD=nodeDownloadCRL">'.
                               gettext ("CRLs").'</a>';
        $item_list->[2]->[4] = '<a href="'.$query->param("HTTP_CGI_SCRIPT").'?cmd=getParams;GET_PARAMS_CMD=nodeDownloadConfig">'.
                               gettext ("Configuration").'</a>';
        $item_list->[2]->[5] = '<a href="'.$query->param("HTTP_CGI_SCRIPT").'?cmd=getParams;GET_PARAMS_CMD=nodeDownloadBP">'.
                               gettext ("Batchprocessors").'</a>';

        $item_list->[3]->[0] = gettext ("Upload data to a higher level of the hierarchy");
        $item_list->[3]->[1] = '<a href="'.$query->param("HTTP_CGI_SCRIPT").'?cmd=getParams;GET_PARAMS_CMD=nodeUploadAll">'.
                               gettext ("All").'</a>';
        $item_list->[3]->[2] = '<a href="'.$query->param("HTTP_CGI_SCRIPT").'?cmd=getParams;GET_PARAMS_CMD=nodeUploadCSR">'.
                               gettext ("Requests").'</a>';
        $item_list->[3]->[3] = '<a href="'.$query->param("HTTP_CGI_SCRIPT").'?cmd=getParams;GET_PARAMS_CMD=nodeUploadCRR">'.
                               gettext ("CRRs").'</a>';

    } elsif ($query->param('name') =~ /safety/)
    {
        $name = gettext ("Backup and Recovery");

        $item_list->[0]->[0] = gettext ("BACKUP");
        $item_list->[0]->[1] = gettext ("Please take in mind that you must care about the private key of the CA by yourself.");
        $item_list->[0]->[2] = '<a href="'.$query->param("HTTP_CGI_SCRIPT").'?cmd=getParams;GET_PARAMS_CMD=exportDB">'.
                               gettext ("Database").'</a>';

        $item_list->[1]->[0] = gettext ("RECOVERY");
        $item_list->[1]->[1] = '<a href="'.$query->param("HTTP_CGI_SCRIPT").'?cmd=genDB">'.
                               gettext ("Initialize Database").'</a>';
        $item_list->[1]->[2] = '<a href="'.$query->param("HTTP_CGI_SCRIPT").'?cmd=getParams;GET_PARAMS_CMD=importDB">'.
                               gettext ("Restore Database").'</a>';
        $item_list->[1]->[3] = '<a href="'.$query->param("HTTP_CGI_SCRIPT").'?cmd=rebuildOpenSSLindexDB">'.
                               gettext ("Rebuild OpenSSL's database and next serialnumber").'</a>';

    } elsif ($query->param('name') =~ /initCA/) {
        $name = gettext ("Init Certification Authority");
        $exp  = gettext ("This page is intended to be used when you run OpenCA for the first time or you have to import CA certificate apporved by your Root CA.\nPlease use one of the following links. WATCH OUT, you can delete the CA secret key that will be impossible to recover, so be careful and know what you are going to do.\nPlease note that the dB initialization is required only once just after CA installation.");

        $item_list->[0]->[0] = gettext ("DB Setup");
        $item_list->[0]->[1] = '<a href="'.$query->param("HTTP_CGI_SCRIPT").'?cmd=genDB;mode=DRYRUN">'.
                               gettext ("Show SQL statements for database initialization").
                               '</a>';
        $item_list->[0]->[2] = '<a href="'.$query->param("HTTP_CGI_SCRIPT").'?cmd=genDB">'.
                               gettext ("Initialize Database").
                               '</a>';

        $item_list->[1]->[0] = gettext ("Key pair Setup");
        $item_list->[1]->[1] = '<a href="'.$query->param("HTTP_CGI_SCRIPT").'?cmd=getParams;GET_PARAMS_CMD=genSKey">'.
                               gettext ("Generate new CA secret key").'</a>';

        $item_list->[2]->[0] = gettext ("Request Setup");
        $item_list->[2]->[1] = '<a href="'.$query->param("HTTP_CGI_SCRIPT").'?cmd=getParams;GET_PARAMS_CMD=genCAReq">'.
                               gettext ("Generate new CA Certificate Request (use generated secret key)").'</a>';

        $item_list->[3]->[0] = gettext ("Certificate Setup");
        $item_list->[3]->[1] = gettext ("Selfsigned CA-Certificate");
        $item_list->[3]->[2] = '<a href="'.$query->param("HTTP_CGI_SCRIPT").'?cmd=getParams;GET_PARAMS_CMD=genCACert">'.
                               gettext ("Self Signed CA Certificate (from altready generated request)").'</a>';
        $item_list->[3]->[3] = gettext ("Signed by another CA");
        $item_list->[3]->[4] = '<a href="'.
                               '?cmd=getParams;GET_PARAMS_CMD=exportCAReqCert;dataType=REQUEST">'.
                               gettext ("Export CA Certificate Request").'</a>';
        $item_list->[3]->[5] = '<a href="'.$query->param("HTTP_CGI_SCRIPT").'?cmd=importCACert">'.
                               gettext ("Import CA certificate ( approved by Root CA )").'</a>';

        $item_list->[4]->[0] = gettext ("Final Setup");
        $item_list->[4]->[1] = '<a href="'.$query->param("HTTP_CGI_SCRIPT").'?cmd=rebuildChain">'.
                               gettext ("Rebuild CA Chain").'</a>';

    } elsif ($query->param('name') =~ /initUser/) {
        $name = gettext ("Init First User");
        $exp  = gettext ("This page is intended to be used when you run OpenCA for the first time.\nPlease use the following links to create the first user of the PKI. This user should be an administrator.");

        $item_list->[0]->[0] = gettext ("Init first user workflow");
        $item_list->[0]->[1] = '<a href="'.$query->param("HTTP_CGI_SCRIPT").'?cmd=setupInitialCert&dest=basic_csr">'.
                               gettext ("Create a new request").
                               '</a>';
        $item_list->[0]->[2] = '<a href="'.$query->param("HTTP_CGI_SCRIPT").'?cmd=setupInitialCert&dest=editCSR">'.
                               gettext ("Edit the request").
                               '</a>';
        $item_list->[0]->[3] = '<a href="'.$query->param("HTTP_CGI_SCRIPT").'?cmd=setupInitialCert&dest=viewCSR">'.
                               gettext ("Issue the certificate").
                               '</a>';
        $item_list->[0]->[4] = '<a href="'.$query->param("HTTP_CGI_SCRIPT").'?cmd=setupInitialCert&dest=viewCert">'.
                               gettext ("Handle the certificate").
                               '</a>';

    } elsif ($query->param('name') =~ /initRA/) {
        $name = gettext ("Init Online Server");
        $exp  = gettext ("This page is intended to be used when you run OpenCA for the first time.\nPlease use the following links to create the first server certificate of the PKI. This user should be a web server.");

        $item_list->[0]->[0] = gettext ("Init first user workflow");
        $item_list->[0]->[1] = '<a href="'.$query->param("HTTP_CGI_SCRIPT").'?cmd=setupInitialCert&dest=basic_csr">'.
                               gettext ("Create a new request").
                               '</a>';
        $item_list->[0]->[2] = '<a href="'.$query->param("HTTP_CGI_SCRIPT").'?cmd=setupInitialCert&dest=editCSR">'.
                               gettext ("Edit the request").
                               '</a>';
        $item_list->[0]->[3] = '<a href="'.$query->param("HTTP_CGI_SCRIPT").'?cmd=setupInitialCert&dest=viewCSR">'.
                               gettext ("Issue the certificate").
                               '</a>';
        $item_list->[0]->[4] = '<a href="'.$query->param("HTTP_CGI_SCRIPT").'?cmd=setupInitialCert&dest=viewCert">'.
                               gettext ("Handle the certificate").
                               '</a>';

    } elsif ($query->param('name') =~ /initNode/) {
        $name = gettext ("Init New Node");
        $exp  = gettext ("This page is intended to be used when you run an OpenCA node for the first time.\nPlease use one of the following links. \nPlease note that the database initialization is required only once just after the installation.");

        $item_list->[0]->[0] = gettext ("Database Setup");
        $item_list->[0]->[1] = '<a href="'.$query->param("HTTP_CGI_SCRIPT").'?cmd=genDB;mode=DRYRUN">'.
                               gettext ("Show SQL statements for database initialization").
                               '</a>';
        $item_list->[0]->[2] = '<a href="'.$query->param("HTTP_CGI_SCRIPT").'?cmd=genDB">'.
                               gettext ("Initialize Database").
                               '</a>';

        $item_list->[1]->[0] = gettext ("PKI Setup");
        $item_list->[1]->[1] = '<a href="'.$query->param("HTTP_CGI_SCRIPT").'?cmd=getParams;GET_PARAMS_CMD=nodeDownloadConfig">'.
                               gettext ("Import Configuration").'</a>';

    } elsif ($query->param('name') =~ /init/) {
        $name = gettext ("OpenCA Init");
        $exp  = gettext ("This page is used to initialize your PKI. Please complete carefully every phase until you continue with the next phase. All phases are required if you start initializing a new CA. If you want to recover from a crash please use the functions on the page Input and Output.");

        $item_list->[0]->[0] = gettext ("Phase I");
        $item_list->[0]->[1] = '<a href="'.$query->param("HTTP_CGI_SCRIPT").'?cmd=getStaticPage&name=initCA">'.
                               gettext ("Initialize the Certification Authority").
                               '</a>';

        $item_list->[1]->[0] = gettext ("Phase II");
        $item_list->[1]->[1] = '<a href="'.$query->param("HTTP_CGI_SCRIPT").'?cmd=getStaticPage&name=initUser">'.
                               gettext ("Create the initial administrator").
                               '</a>';

        $item_list->[2]->[0] = gettext ("Phase III");
        $item_list->[2]->[1] = '<a href="'.$query->param("HTTP_CGI_SCRIPT").'?cmd=getStaticPage&name=initRA">'.
                               gettext ("Create the initial RA certificate").
                               '</a>';

    } elsif ($query->param('name') =~ /selectCSRtype/) {
        $name = gettext ("Request a certificate");
        $exp  = gettext ("To request a certificate use one of this links. You will be asked to fill in a form and to confirm inserted data. After having completed the request you will have to go to the chosen RA for request approval.");

        $item_list->[0]->[1] = gettext ("[Use this link if you don't know what to do]");
        $item_list->[0]->[0] = '<a href="'.$query->param("HTTP_CGI_SCRIPT").'?cmd=basic_csr">'.
                               gettext ("Request a certificate with automatic browserdetection").
                               '</a>';

        my @types = getRequiredList ('DN_TYPES');
        foreach my $type (@types)
        {
            $_ = $type;
            my $i = scalar @{$item_list};
            SWITCH:
            {
                if ($type =~ /^BASIC$/i)
                {
                    $item_list->[$i]->[1] = gettext ("[Serverside Key- and Requestgeneration]");
                    $item_list->[$i]->[0] = '<a href="'.$query->param("HTTP_CGI_SCRIPT").
                                            '?cmd=basic_csr&CSR_TYPE=basic">'.
                                            gettext ("Basic Request").
                                            '</a>';
                    last SWITCH;
                }
                if ($type =~ /^SPKAC$/i)
                {
                    $item_list->[$i]->[1] = gettext ("[User's Browser Request - SPKAC]");
                    $item_list->[$i]->[0] = '<a href="'.$query->param("HTTP_CGI_SCRIPT").
                                           '?cmd=basic_csr&CSR_TYPE=spkac">'.
                                           gettext ("Netscape's Request").
                                           '</a>';
                    last SWITCH;
                }
                if ($type =~ /^PKCS10$/i)
                {
                    $item_list->[$i]->[1] = gettext ("[PKCS#10 PEM formatted Request]");
                    $item_list->[$i]->[0] = '<a href="'.$query->param("HTTP_CGI_SCRIPT").
                                           '?cmd=pkcs10_req">'.
                                           gettext ("Server Request").
                                           '</a>';
                    last SWITCH;
                }
                if ($type =~ /^IE$/i)
                {
                    $item_list->[$i]->[1] = gettext ("[User's Browser Request - Microsoft]");
                    $item_list->[$i]->[0] = '<a href="'.$query->param("HTTP_CGI_SCRIPT").
                                            '?cmd=basic_csr&CSR_TYPE=ie">'.
                                            gettext ("Internet Explorer Request").
                                            '</a>';
                    last SWITCH;
                }
                if ($type =~ /^TOKEN$/i)
                {
                    $item_list->[$i]->[1] = gettext ("[Request a hardware token from the registration authority]");
                    $item_list->[$i]->[0] = '<a href="'.$query->param("HTTP_CGI_SCRIPT").
                                           '?cmd=basic_csr&CSR_TYPE=token">'.
                                           gettext ("Token Request").
                                           '</a>';
                    last SWITCH;
                }
            }
        }
        if (getRequired ("LDAP_BASED_CSR_GENERATION") =~ /(ON|YES)/i)
        {
            my $i = scalar @{$item_list};
            $item_list->[$i]->[1] = gettext ("[Use this link to load the data from an LDAP server]");
            $item_list->[$i]->[0] = '<a href="'.$query->param("HTTP_CGI_SCRIPT").'?cmd=getParams;GET_PARAMS_CMD=ldapCreateCSR">'.
                                    gettext ("Request a certificate with LDAP assistance").
                                   '</a>';
        }
    } elsif ($query->param('name') =~ /thanks/) {
        $name = gettext ("Thanks");
        $exp  = gettext ("Thanks goes to all the developers and contributors who have actively supported the OpenCA project. We also like to thank the people who tests and documents the software.");

    } elsif ($query->param('name') =~ /search_cert/) {
        my ($hidden_list, $info_list, $cmd_panel) = (undef, undef, undef);

        $name = gettext ("Search Certificates");
        $exp  = gettext ("Please enter the parameters for the search.");

        $hidden_list->{"cmd"}      = "search";
        $hidden_list->{"dataType"} = "CERTIFICATE";
        $hidden_list->{"pcounter"} = "5";
        $hidden_list->{"name_1"}   = "CN";
        $hidden_list->{"name_2"}   = "EMAILADDRESS";
        $hidden_list->{"name_3"}   = "DN";
        $hidden_list->{"name_4"}   = "ROLE";
	$hidden_list->{"name_5"}   = "KEY";

        $cmd_panel->[0] = '<input type=submit value="'.gettext ("OK").'">';
        $cmd_panel->[1] = '<input type=reset value="'.gettext ("Reset").'">';

        $info_list->{BODY}->[0]->[0] = gettext ("Name");
        $info_list->{BODY}->[0]->[1] = '<input type=text name="value_1">';
        $info_list->{BODY}->[1]->[0] = gettext ("Emailaddress");
        $info_list->{BODY}->[1]->[1] = '<input type=text name="value_2">';
        $info_list->{BODY}->[2]->[0] = gettext ("Distinguished Name");
        $info_list->{BODY}->[2]->[1] = '<input type=text name="value_3">';
        $info_list->{BODY}->[3]->[0] = gettext ("Role");
        $info_list->{BODY}->[3]->[1] = '<input type=text name="value_4">';
	$info_list->{BODY}->[4]->[0] = gettext ("Request Serial #");
        $info_list->{BODY}->[4]->[1] = '<input type=text name="value_5">';


        return libSendReply (
                              "NAME"        => $name,
                              "EXPLANATION" => $exp,
                              "HIDDEN_LIST" => $hidden_list,
                              "CMD_PANEL"   => $cmd_panel,
                              "INFO_LIST"   => $info_list
                             );
    } elsif ($query->param('name') =~ /search_csr/) {
        my ($hidden_list, $info_list, $cmd_panel) = (undef, undef, undef);

        $name = gettext ("Search Requests");
        $exp  = gettext ("Please enter the parameters for the search.");

        $hidden_list->{"cmd"}      = "search";
        $hidden_list->{"dataType"} = "REQUEST";
        $hidden_list->{"pcounter"} = "4";
        $hidden_list->{"name_1"}   = "CN";
        $hidden_list->{"name_2"}   = "EMAILADDRESS";
        $hidden_list->{"name_3"}   = "DN";
        $hidden_list->{"name_4"}   = "ROLE";
        $hidden_list->{"name_5"}   = "REQUEST_SERIAL";

        $cmd_panel->[0] = '<input type=submit value="'.gettext ("OK").'">';
        $cmd_panel->[1] = '<input type=reset value="'.gettext ("Reset").'">';

        $info_list->{BODY}->[0]->[0] = gettext ("Name");
        $info_list->{BODY}->[0]->[1] = '<input type=text name="value_1">';
        $info_list->{BODY}->[1]->[0] = gettext ("Emailaddress");
        $info_list->{BODY}->[1]->[1] = '<input type=text name="value_2">';
        $info_list->{BODY}->[2]->[0] = gettext ("Distinguished Name");
        $info_list->{BODY}->[2]->[1] = '<input type=text name="value_3">';
        $info_list->{BODY}->[3]->[0] = gettext ("Role");
        $info_list->{BODY}->[3]->[1] = '<input type=text name="value_4">';
        $info_list->{BODY}->[4]->[0] = gettext ("Request Serial #");
        $info_list->{BODY}->[4]->[1] = '<input type=text name="value_5">';

        return libSendReply (
                              "NAME"        => $name,
                              "EXPLANATION" => $exp,
                              "HIDDEN_LIST" => $hidden_list,
                              "CMD_PANEL"   => $cmd_panel,
                              "INFO_LIST"   => $info_list
                             );
    } elsif ($query->param('name') =~ /search_log/) {
        my ($hidden_list, $info_list, $cmd_panel) = (undef, undef, undef);

        $name = gettext ("Search Logging Messages");
        $exp  = gettext ("Please enter the parameters for the search.");

        $hidden_list->{"cmd"}      = "search";
        $hidden_list->{"dataType"} = "LOG";
        $hidden_list->{"pcounter"} = "2";
        $hidden_list->{"name_1"}   = "CLASS";
        $hidden_list->{"name_2"}   = "LEVEL";

        $cmd_panel->[0] = '<input type=submit value="'.gettext ("OK").'">';
        $cmd_panel->[1] = '<input type=reset value="'.gettext ("Reset").'">';

        $info_list->{BODY}->[0]->[0] = gettext ("Class of messages");
        $info_list->{BODY}->[0]->[1] = '<input type=text name="value_1">';
        $info_list->{BODY}->[1]->[0] = gettext ("Level of messages");
        $info_list->{BODY}->[1]->[1] = '<input type=text name="value_2">';

        return libSendReply (
                              "NAME"        => $name,
                              "EXPLANATION" => $exp,
                              "HIDDEN_LIST" => $hidden_list,
                              "CMD_PANEL"   => $cmd_panel,
                              "INFO_LIST"   => $info_list
                             );
    } elsif ($query->param('name') =~ /download_root_cacert/) {
        $name = gettext ("Download and Install CA Certificates");
        $exp  = gettext ("This page contains the Virginia Tech Root CA-Certificates in various formats. Please import one if you want to communicate with the users of our PKI. To import it into your browser, just click on the appropriate link.");

        $item_list->[0]->[1] = gettext ("[Mozilla, Netscape and Microsoft Internet Explorer importable format]");
        $item_list->[0]->[0] = '<a href="'.getRequired('HtdocsUrlPrefix').'/rootca/rootca.crt">'.
                               gettext ("Virginia Tech Root CA certificate in format CRT").
                               '</a>';

        $item_list->[1]->[1] = gettext ("[Server importable format]");
        $item_list->[1]->[0] = '<a href="'.getRequired('HtdocsUrlPrefix').'/rootca/rootca.pem">'.
                               gettext ("Virginia Tech Root CA certificate in format PEM").
                               '</a>';

        $item_list->[2]->[1] = gettext ("[Another Microsoft Internet Explorer importable format]");
        $item_list->[2]->[0] = '<a href="'.getRequired('HtdocsUrlPrefix').'/rootca/rootca.der">'.
                               gettext ("Virginia Tech Root CA certificate in format DER").
                               '</a>';

        $item_list->[3]->[1] = gettext ("[Another Microsoft Internet Explorer importable format]");
        $item_list->[3]->[0] = '<a href="'.getRequired('HtdocsUrlPrefix').'/rootca/rootca.cer">'.
                               gettext ("Virginia Tech Root CA certificate in format CER").
                               '</a>';

        $item_list->[4]->[1] = gettext ("[Just for information]");
        $item_list->[4]->[0] = '<a href="'.getRequired('HtdocsUrlPrefix').'/rootca/rootca.txt">'.
                               gettext ("Virginia Tech Root CA certificate in text format").
                               '</a>';
    } elsif ($query->param('name') =~ /download_crl/) {
        $name = gettext ("Download and Install CRLs");
        $exp  = gettext ("This page contains the current CRL (Certificate Revocation List). Please download it as frequently as you can to keep your browser's CRL as up to date as possible. To import it into your browser, just click on the appropriate Link. Other format versions are also available to encourage usage of CRLs on any software you are currently using.");

        $item_list->[0]->[1] = gettext ("[Browser Importable CRL - DER]");
        $item_list->[0]->[0] = '<a href="'.getRequired('HtdocsUrlPrefix').'/crl/cacrl.crl">'.
                               gettext ("OpenCA's CRL").
                               '</a>';

        $item_list->[1]->[1] = gettext ("[PEM format]");
        $item_list->[1]->[0] = '<a href="'.getRequired('HtdocsUrlPrefix').'/crl/cacrl.pem">'.
                               gettext ("OpenCA's CRL").
                               '</a>';

        $item_list->[2]->[1] = gettext ("[Just for information]");
        $item_list->[2]->[0] = '<a href="'.getRequired('HtdocsUrlPrefix').'/crl/cacrl.txt">'.
                               gettext ("CRL in text format").
                               '</a>';
    } elsif ($query->param('name') =~ /download_cacert/) {
        $name = gettext ("Download and Install CA Certificates");
        $exp  = gettext ("This page contains the CA-Certificates in various formats. Please import one if you want to communicate with the users of our PKI. To import it into your browser, just click on the appropriate link.");

        $item_list->[0]->[1] = gettext ("[Mozilla, Netscape and Microsoft Internet Explorer importable format]");
        $item_list->[0]->[0] = '<a href="'.getRequired('HtdocsUrlPrefix').'/cacert/cacert.crt">'.
                               gettext ("CA certificate in format CRT").
                               '</a>';

        $item_list->[1]->[1] = gettext ("[Server importable format]");
        $item_list->[1]->[0] = '<a href="'.getRequired('HtdocsUrlPrefix').'/cacert/cacert.pem">'.
                               gettext ("CA certificate in format PEM").
                               '</a>';

        $item_list->[2]->[1] = gettext ("[Another Microsoft Internet Explorer importable format]");
        $item_list->[2]->[0] = '<a href="'.getRequired('HtdocsUrlPrefix').'/cacert/cacert.der">'.
                               gettext ("CA certificate in format DER").
                               '</a>';

        $item_list->[3]->[1] = gettext ("[Another Microsoft Internet Explorer importable format]");
        $item_list->[3]->[0] = '<a href="'.getRequired('HtdocsUrlPrefix').'/cacert/cacert.cer">'.
                               gettext ("CA certificate in format CER").
                               '</a>';

        $item_list->[4]->[1] = gettext ("[Just for information]");
        $item_list->[4]->[0] = '<a href="'.getRequired('HtdocsUrlPrefix').'/cacert/cacert.txt">'.
                               gettext ("CA certificate in text format").
                               '</a>';
    } elsif ($query->param('name') =~ /download_crl/) {
        $name = gettext ("Download and Install CRLs");
        $exp  = gettext ("This page contains the current CRL (Certificate Revocation List). Please download it as frequently as you can to keep your browser's CRL as up to date as possible. To import it into your browser, just click on the appropriate Link. Other format versions are also available to encourage usage of CRLs on any software you are currently using.");

        $item_list->[0]->[1] = gettext ("[Browser Importable CRL - DER]");
        $item_list->[0]->[0] = '<a href="'.getRequired('HtdocsUrlPrefix').'/crl/cacrl.crl">'.
                               gettext ("OpenCA's CRL").
                               '</a>';

        $item_list->[1]->[1] = gettext ("[PEM format]");
        $item_list->[1]->[0] = '<a href="'.getRequired('HtdocsUrlPrefix').'/crl/cacrl.pem">'.
                               gettext ("OpenCA's CRL").
                               '</a>';

        $item_list->[2]->[1] = gettext ("[Just for information]");
        $item_list->[2]->[0] = '<a href="'.getRequired('HtdocsUrlPrefix').'/crl/cacrl.txt">'.
                               gettext ("CRL in text format").
                               '</a>';
    } elsif ($query->param('name') =~ /index/) {
        print
'<html>'."\n".
'  <head>'."\n".
'    <title>OpenCA</title>'."\n".
'    <link rel="stylesheet" href="'.getRequired('HtdocsUrlPrefix').'/default.css" type="text/css" />'."\n".
'  </head>'."\n".
'  <frameset rows="160,*" border="0" >'."\n".
#'        <frame src="'.$query->param("HTTP_CGI_SCRIPT").'?cmd=genMenu" scrolling="no"  border="0" name="top">'."\n".
#'        <frame src="'.$query->param("HTTP_CGI_SCRIPT").'?cmd=genMenu" border="0" name="top">'."\n".
#'	<frame src="'.$query->param("HTTP_CGI_SCRIPT").'?cmd=serverInfo" border=0 name="main">'."\n".
'        <frame src="'.$query->param("HTTP_CGI_SCRIPT").'?cmd=genMenu" border="0" name="top">'."\n".
'	<frame src="'.$query->param("HTTP_CGI_SCRIPT").'?cmd=serverInfo" border=0 name="main">'."\n".
'  </frameset>'."\n".
'  <noframes>'."\n".
'        Sorry, this document can be viewed only with a '."\n".
'        frames-capable browser.'."\n".
'  </noframes>'."\n".
'</html>';

        return 1;
    } else {
        configError ("There is no static page which can be build for this question.");
    };

    return libSendStatic (
                          "NAME"        => $name,
                          "EXPLANATION" => $exp,
                          "ITEM_LIST"   => $item_list
                         );
}

1;
