Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F91046270
viewChecksEDS.php.wml
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Thu, Nov 7, 07:08
Size
12 KB
Mime Type
text/x-c
Expires
Sat, Nov 9, 07:08 (2 d)
Engine
blob
Format
Raw Data
Handle
22185289
Attached To
R3600 invenio-infoscience
viewChecksEDS.php.wml
View Options
## $Id$
## This file is part of CDS Invenio.
## Copyright (C) 2002, 2003, 2004, 2005, 2006 CERN.
##
## CDS Invenio 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.
##
## CDS Invenio 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 CDS Invenio; if not, write to the Free Software Foundation, Inc.,
## 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
<?
require("commonPhpFunctions.php");
?>
#include "cdspage.wml" \
title="Edit the <I><protect><?print $chname;?></protect></i> javascript checking function" \
navtrail_previous_links="<a class=navtrail href=<WEBURL>/admin/<lang:star: index.*.html>>_(Admin Area)_</a> > <a class=navtrail href=<WEBURL>/admin/websubmit/>_(WebSubmit Administration)_</a>" \
navbar_name="admin" \
navbar_select="websubmit_listchecks"
<?
<protect>
## $Id$
## DO NOT EDIT THIS FILE! IT WAS AUTOMATICALLY GENERATED FROM CDS Invenio WML SOURCES.
/********************Function Declarations****************************/
function errorOKbutton()
{
/*******************************************************************
This function has the simple task of creating an "OK" button,
which when pressed, sends the browser back to the
"allChecksEDS.php" page. It will only be displayed when there has
been some sort of error ocurrence.
Created: 19/12/2000
Last Modified: 19/12/2000
*******************************************************************/
print("<TABLE ALIGN='center' CELLSPACING=0 CELLPADDING=0 BORDER=0>"
. "\n<FORM ACTION='allChecksEDS.php' METHOD='post'>\n<TR><TD ALIGN"
. "='center'>\n<INPUT TYPE='button' VALUE='OK' onClick=\"submit();"
. "\">\n</TD>\n</TR>\n</FORM>\n</TABLE>\n");
} // END function errorOKbutton()
//*************
function displayEDScheckDetsForm($chname)
{
/*****************************************************************
This function has the task of constructing the form that contains
the details of a given check that is to be viewed or editied. It
first conducts a query on the CHECK table to retrieve the details
of the check. If it can't, it displays the relevant error
messages. Otherwise, it displays all of the details of the check
in an HTML form. It also of course displays the buttons to
submit the form, or go back to another page.
Created: 19/12/2000
Last Modified: 19/12/2000
*****************************************************************/
# Execute a query to retrieve the details of the given check...
$qRes = mysql_query("SELECT * FROM sbmCHECKS WHERE chname = "
. "'$chname'");
if($qRes)
{
# In this case, the query worked sans probleme
if(mysql_num_rows($qRes) < 1)
{
# Oh dear, the current check doesn't seem to exist.
print("<P CLASS=\"errorMsg\"><SPAN STYLE=\"color: red\">ERR"
. "OR:</SPAN> The $chname Checking Function Does Not Exist "
. "In " . DOCS_DATABASE . ".<BR>Inform System Administrator."
. "</P>\n");
# Display a button...
errorOKbutton();
# Now mail the admin to tell them this news.
$msgTxt = "An error has ocurred while attempting to retrieve "
. "the details of the $chname checking function from "
. DOCS_DATABASE . ". The query to select the details of this "
. "checking function returned no rows. There must have been "
. "a record for this checking function however, because the "
. "use must have clicked on a link for it to retrieve the "
. "details of it.\n\nThis suggests that there is a problem "
. "with concurrency. Perhaps another user deleted the check "
. "from " . DOCS_DATABASE . " just before the user who tried "
. "to view its details clicked on the link to it.\n\nEDS "
. "Administrator (";
$msgTxt .= makeDate();
$msgTxt .= ")";
# Now send the mail..
mail(ADMIN_EMAIL, "ERROR: Cannot Retrieve $chname Check "
. "Details", $msgTxt, "From: WebSubmit_Administrator");
} // END if
elseif(mysql_num_rows($qRes) > 1)
{
# several instances of the check
print("<P CLASS=\"errorMsg\"><SPAN STYLE=\"color: red\">ERR"
. "OR:</SPAN> Several Rows Have Been Retrieved For The "
. "<EM>$chname</EM> Checking Function.<BR>Inform System "
. "Administrator.</P>\n");
errorOKbutton();
# mail admin
$msgTxt = "An error has ocurred while attempting to retrieve "
. "the details of the $chname checking function from "
. DOCS_DATABASE . ". The query to select the details of this "
. "checking function returned several rows. The 'chname' "
. "field of the sbmCHECKS table should be unique, as it is used "
. "as the key of the table. This means that there should "
. "only ever be 1 row in the sbmCHECKS table for a given chname "
. "value.\n\nThis means that there must be key violations in "
. "the sbmCHECKS table, and this problem should be examined and "
. "corrected immediately.\n\nWebSubmit Administrator (";
$msgTxt .= makeDate();
$msgTxt .= ")";
mail(ADMIN_EMAIL, "ERROR: sbmCHECKS Table Key Violation "
. "($chname)", $msgTxt, "From: WebSubmit_Administrator");
} // END elseif
else
{
# Provide a quick description of the pages function...
print("<TABLE WIDTH='90%' BGCOLOR='#D3DCE3' ALIGN='center' "
. "CELLSPACING=0 CELLPADDING=0 BORDER=1>\n<TR><TD "
. "ALIGN='center'>\n<P STYLE=\"color: blue; text-align: "
. "center; font-size: small; font-weight: bold\">Below, is a"
. " table that allows you to view or edit the details of an "
. "EDS JavaScript checking function.<BR><BR>If you wish to "
. "edit the checking function, you can edit the details of "
. "the <EM>Check Description</EM> field, and then click on"
. " the \"SAVE CHANGES\" button.<BR>If you do not wish to "
. "make any changes to the checking function, simply click on"
. " the \"FINISHED\" button, which will return you to the "
. "page<BR>displaying a list of all checks.</P>\n</TD>\n</TR>"
. "\n</TABLE>\n");
# divide page sections
drawSeparator();
# Get a list of the fields in the sbmCHECKS table
$columns = mysql_list_fields(DOCS_DATABASE, "sbmCHECKS");
$dataRow = mysql_fetch_array($qRes);
# Now begin making the form...
print("<TABLE WIDTH='100%' ALIGN='center' BORDER=0 "
. "CELLSPACING=0 CELLPADDING=0>\n<FORM ACTION='viewChecksEDS"
. ".php' METHOD='post'>\n<INPUT TYPE='hidden' NAME='update"
. "Check' VALUE='true'>\n<TR>\n<TH BGCOLOR='#D3DCE3' ALIGN"
. "='right' WIDTH='20%'>Creation Date: </TH>\n<TD ALI"
. "GN='left' BGCOLOR='#FFFFCC' WIDTH='80%'><INPUT TYPE='"
. "readonly' NAME='cd' VALUE='". $dataRow["cd"] . "'></TD>\n"
. "<TR>\n<TH BGCOLOR='#D3DCE3' ALIGN='right' WIDTH='20%'>"
. "Modification Date: </TH>\n<TD ALIGN='left' BGCOLOR='"
. "#FFFFCC' WIDTH='80%'><INPUT TYPE='readonly' NAME='md' "
. "VALUE='" . $dataRow["md"] . "'></TD>\n</TR>\n<TR>\n<TH BG"
. "COLOR='#D3DCE3' ALIGN='right' WIDTH='20%'>Check Name:"
. " </TH>\n<TD ALIGN='left' WIDTH='80%' BGCOLOR='#FFFFC"
. "C'><INPUT TYPE='readonly' NAME='chname' VALUE='"
. $dataRow["chname"] . "'>\n</TD>\n</TR>\n<TR>\n<TH "
. "BGCOLOR='#87CEFA' ALIGN='right' WIDTH='20%'>Check "
. "Description: </TH>\n<TD ALIGN='left' BGCOLOR='#FFFFC"
. "C' WIDTH='80%'><TEXTAREA COLS=50 ROWS=20 NAME='chdesc'>"
. $dataRow["chdesc"] . "</TEXTAREA></TD>\n</TR>\n</TABLE>\n");
# Now make an other table to hold the various buttons...
print("<TABLE BORDER=0 CELLPADDING=2 CELLSPACING=2 ALIGN='"
. "center'>\n<TR>\n<TD ALIGN='right'><INPUT TYPE='button' "
. "VALUE='SAVE CHANGES' onClick=\"if(confirm('Are You Sure "
. "That You Wish To Alter This Checking Function Descriptio"
. "n?')) { submit(); }\"></TD>\n<TD ALIGN='center'><INPUT "
. "TYPE='button' "
. "VALUE='RESET' onClick=\"reset();\"></TD>\n</FORM>\n<FORM "
. "ACTION='allChecksEDS.php' METHOD='post'>\n<TD ALIGN='left"
. "'><INPUT TYPE='button' VALUE='CANCEL' onClick=\"submit();"
. "\"></TD>\n</TR>\n</TABLE>\n");
} // END else
} // END if
else
{
# query to retrieve the details of the
# check failed, so we can simply output an error message
print("<P CLASS=\"errorMsg\"><SPAN STYLE=\"color: red\">ERROR:"
. "</SPAN> Could not query the <EM>sbmCHECKS</EM> table of "
. DOCS_DATABASE . ".<BR>Contact System Administrator.</P>\n");
errorOKbutton();
} // END else
} // END function displayEDScheckDetsForm()
function displayPage()
{
global $updateCheck,$chdesc,$chname;
if($updateCheck)
{
# In this case, this call to the script is a call to commit
# updated details of the given check to the database.
# Get the date for the md field...
$modifiedDate = makeEDSmdDate();
# Make an update string...
$updStr = "UPDATE sbmCHECKS SET md = '$modifiedDate', chdesc = '"
. "$chdesc' WHERE chname = '$chname'";
$updRes = mysql_query($updStr);
if($updRes)
{
if(mysql_affected_rows() == 1)
{
# check has been updated
print("<div style=\"color: green; font-weight: bold; font-size: large; text-align: center;"
. "\">Check Updated</div>\n");
$msgTxt = "The $chname checking function has been updated"
. " in " . DOCS_DATABASE . ".\n\nWebSubmit Administrator (";
$msgTxt .= makeDate();
$msgTxt .= ")";
mail(ADMIN_EMAIL, "$chname Check Updated",
$msgTxt, "From: WebSubmit_Administrator");
mysql_free_result($updRes);
# Redisplay the form with the check in it
displayEDScheckDetsForm($chname);
} // END if
else
{
# The query didn't actually update anything.
print("<P CLASS=\"errorMsg\"><SPAN STYLE=\"color: red\">Error: Check Could Not Be Updated!</span></p>\n");
displayEDScheckDetsForm($chname);
} // END else
} // END if
else
{
# update failed, so we can just inform
# the user of this, and redisplay the details of the check in
# the form
print("<p class=\"errorMsg\"><span style=\"color: red\">Error: Check Could Not Be Updated!</span></p>\n");
displayEDScheckDetsForm($chname);
} // END else
} // END if
else
{
# Display the interface...
displayEDScheckDetsForm($chname);
} // END else
}
/**********************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();
/************************End of main script***************************/
</protect>
?>
Event Timeline
Log In to Comment