diff --git a/modules/websubmit/web/admin/viewActionEDS.php.wml b/modules/websubmit/web/admin/viewActionEDS.php.wml index 30ee7b94a..da570737f 100644 --- a/modules/websubmit/web/admin/viewActionEDS.php.wml +++ b/modules/websubmit/web/admin/viewActionEDS.php.wml @@ -1,434 +1,434 @@ ## $Id$ ## This file is part of the CERN Document Server Software (CDSware). ## Copyright (C) 2002, 2003, 2004, 2005 CERN. ## ## The CDSware is free software; you can redistribute it and/or ## modify it under the terms of the GNU General Public License as ## published by the Free Software Foundation; either version 2 of the ## License, or (at your option) any later version. ## ## The CDSware is distributed in the hope that it will be useful, but ## WITHOUT ANY WARRANTY; without even the implied warranty of ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ## General Public License for more details. ## ## You should have received a copy of the GNU General Public License ## along with CDSware; if not, write to the Free Software Foundation, Inc., ## 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. #include "cdspage.wml" \ title="Details of the action" \ navtrail_previous_links="/admin/> > /admin/websubmit/>" \ navbar_name="admin" \ navbar_select="websubmit_listactions" ## $Id$ ## DO NOT EDIT THIS FILE! IT WAS AUTOMATICALLY GENERATED FROM CDSware WML SOURCES. ?> \n"); print("\n\n\n\n\n"); + . "'), escape(statustext.value))) { submit(); }\">\n\n\n\n"); if($caller == "documentEDS.php") { // Pass a doctype back to it... print("\n"); } print("\n\n\n
" . "\n\n
\n" . "
\n

\n"); } //************* function displayEDSaction($actname, $caller, $doctype = "") { /******************************************************************* This function has the task of displaying the details of an EDS action. The details are displayed in a form, so that they can be modified and resubmitted to the database. This function basically has the task of producing the page to be displayed for the 'viewActionEDS.php' page. *******************************************************************/ // Execute a query on the sbmACTION table for the given action $queryResult = mysql_query("SELECT * from sbmACTION WHERE sactname = " . "'$actname'"); if($queryResult) { if(mysql_num_rows($queryResult) == 1) { // as expected there is one entry for the given // action in the sbmACTION table print("\n\n\n
\n

Below are " . "the details of the $actname action.
You can " . "edit them by alterring values in boxes, and clicking on " . "\"SAVE CHANGES\".

\n
\n"); drawSeparator(); print("
\n" . "\n" . "\n"); if($caller == "documentEDS.php") { // Add a doctype print("\n"); } print("\n"); $columns = mysql_list_fields(DOCS_DATABASE, "sbmACTION"); $numTblFlds = mysql_num_fields($columns); $dataRow = mysql_fetch_array($queryResult); // Before we display most of the table, we can first display // the upper part of the table, which will be the sactname, cd, // and md fields, that can't be modified... print("
\n\n\n\n\n\n\n\n\n\n\n\n\n"); print(""); // Now fill this new table with all of the details for($indx = 0; $indx < $numTblFlds; $indx++) { $currentField = mysql_field_name($columns, $indx); if(($currentField != "sactname") && ($currentField != "cd") && ($currentField != "md") && ($currentField != "actionbutton")) { print("\n\n\n\n"); } } print("
\nAction Code: \n
\nCreation " . "Date: \n
\nModification " . "Date: \n
\n"); if($currentField == "lactname") { print("Action Description: "); } else { print("$currentField" . ": "); } print(" \n\n
\n\n"); // "SAVE" button, and a "FINISHED button: if($caller == "documentEDS.php") { makeButtons($dataRow, $caller, $doctype); } else { makeButtons($dataRow, $caller); } } elseif(mysql_num_rows($queryResult) > 1) { // too many rows for the action print("

" . "ERROR: More than one row of data concerning the $actname " . "action was returned from the sbmACTION table of " . "the" . DOCS_DATABASE . ".
This indicates primary key " . "duplication in this table.
Please inform system administrator.

\n"); $msgTxt = "When a user attempted to look at the details of " . "the $actname action using the WebSubmit Administrator, several " . "rows were returned for this action from the sbmACTION table." . " The query was made using the \"sactname\" as the search" . " key. As the \"sactname\" field is the primary key for " . "the sbmACTION table, this means that there must be key " . "violations in this table.\n\nThis problem should be " . "corrected immediately.\n\nWebSubmit Administrator ("; $msgTxt .= makeDate(); $msgTxt .= ")"; mail(ADMIN_EMAIL, "sbmACTION Table Key Violation!", $msgTxt, "From: WebSubmit_Administrator"); } elseif(mysql_num_rows($queryResult) == 0) { print("

" . "ERROR: No data concerning the $actname action was found in the" . " sbmACTION table.
This suggests a data " . "consistency error in the " . DOCS_DATABASE . " database." . "
Please inform the system administrator.

\n"); $dateDets = getdate(); $msgTxt = "When a user attempted to look at the details of " . "the $actname action using the WebSubmit Administrator, no rows " . "were returned from the sbmACTION table for this " . "action.\n\nBecause the user had to click a link to view " . "the details of this action, it must be referred to in " . "other tables of EDS. This means that there are data " . "inconsistencies within EDS.\n\nThis should be investigated" . " and corrected ASAP.\n\nWebSubmit Administrator ("; $msgTxt .= makeDate(); $msgTxt .= ")"; mail(ADMIN_EMAIL, "Data Inconsistency Error!", $msgTxt, "From: WebSubmit_Administrator"); } else { print("

" . "ERROR: Unable to correctly retrieve data from the sbmACTION " . "table of " . DOCS_DATABASE . ".
Please inform system " . "administrator.

\n"); } } else { print("

" . "ERROR: Unable to conduct a query on the " . "sbmACTION table of " . DOCS_DATABASE . ".
Please" . " inform system administrator.

\n"); } } function displayPage($update,$actname) { - global $lactname,$sactname,$dir,$actionbutton,$statustext; + global $lactname,$sactname,$dir,$actionbutton,$statustext,$caller,$doctype; if($update) { // update the actions details unset($update); $dateDets = getdate(); $modifiedDate = $dateDets['year'] . "-" . $dateDets['mon'] . "-" . $dateDets['mday']; $queryString = "UPDATE sbmACTION SET lactname = '$lactname', dir =" . " '$dir', md = '$modifiedDate', actionbutton = '$actionbutton'" . ", statustext = '$statustext' " . "WHERE sactname = '$sactname'"; $updateResult = mysql_query($queryString); if($updateResult) { if(mysql_affected_rows() == 1) { $dateDets = getdate(); $msgTxt = "An update has been carried out on the $sactname" . " action in the " . DOCS_DATABASE . " database.\n\nEDS " . "Administrator ("; $msgTxt .= makeDate(); $msgTxt .= ")"; mail(ADMIN_EMAIL, "EDS Action Updated", $msgTxt, "From: WebSubmit_Administrator"); // now redisplay all of the details for the action if($caller == "documentEDS.php") { displayEDSaction($sactname, $caller, $doctype); } else { displayEDSaction($sactname, $caller); } } elseif(mysql_affected_rows() > 1) { // More than 1 row was updated print("

" . "ERROR: Multiple rows have been updated in the " . "sbmACTION table.
This has resulted from an " . "attempt to update the $sactname action.
" . "Please inform the system administrator.

\n"); $msgTxt = "When a user updated the details of " . "the $sactname action using the WebSubmit Administrator, seve" . "ral rows were affected in the sbmACTION table. The update" . " was conducted using the \"sactname\" field as the key." . " As the \"sactname\" field is the primary key for the " . "sbmACTION table, this means that there must be key violati" . "ons in this table. There should only have been 1 row " . "affected by this update.\n\nThis problem should be " . "investigated and corrected immediately.\n\nEDS Administ" . "rator ("; $msgTxt .= makeDate(); $msgTxt .= ")"; mail(ADMIN_EMAIL, "ERROR: sbmACTIONS Table Multiple Row " . "Update!", $msgTxt, "From: WebSubmit_Administrator"); } else { // No rows were updated print("

" . "ERROR: No rows have been updated in the " . "sbmACTION table.
This suggests that there could " . "be data inconsistencies or concurrency problems.
" . "Please inform the system administrator.

\n"); $msgTxt = "When a user attempted to update the details of " . "the $sactname action using the WebSubmit Administrator, no " . "rows were affected in the sbmACTION table by this update." . "\n\nBecause the user must have altered an actions " . "details to submit an update on it, it must have been " . "present at around the time that the user submitted thei" . "r update.\n\n" . "This suggests the possibility of concurrency or data " . "inconsistency problems in this table.\n\nThis should be" . " investigated and corrected ASAP.\n\nWebSubmit Administrator " . "("; $msgTxt .= makeDate(); $msgTxt .= ")"; mail(ADMIN_EMAIL, "Error: Possible Concurrency Problems", $msgTxt, "From: WebSubmit_Administrator"); } } else { // The query couldn't be executed print("

ERROR:" . " Unable to update deatails for $sactname " . "action in sbmACTION table.
Please inform system " . "administrator.

\n"); } } else { if($caller == "documentEDS.php") { displayEDSaction($actname, $caller, $doctype); } else { displayEDSaction($actname, $caller); } } } /**********************Start of main script***************************/ // Connect to the MySQL server serverConnect(MYSQLDOCMACHINE, MYSQLDOCUSERID, MYSQLDOCPASSWORD); // Select the CDS Search database... dbSelect(DOCS_DATABASE); $auth = canUseWebSubmitAdmin($uid); if (!$auth[0]) outWarning($auth[1]); else displayPage($update,$actname); /************************End of main script***************************/ ?>