Page MenuHomec4science

commonPhpFunctions.php.wml
No OneTemporary

File Metadata

Created
Thu, Jun 27, 07:50

commonPhpFunctions.php.wml

## $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.
## read config variables:
#include "config.wml"
#include "configbis.wml"
<?
<protect>
## $Id$
## DO NOT EDIT THIS FILE! IT WAS AUTOMATICALLY GENERATED FROM CDS Invenio WML SOURCES.
</protect>
## load config variables:
define("DOCS_DATABASE", "<DBNAME>");
define("MYSQLDOCMACHINE","<DBHOST>");
define("MYSQLDOCUSERID","<DBUSER>");
define("MYSQLDOCPASSWORD","<DBPASS>");
define("ADMIN_EMAIL","<ADMINEMAIL>");
$IMAGES="<WEBURL>/img";
## okay, config variables loaded, the script can continue:
/*********************************************************************
This script is not executable in a browser. It contains the
definitions of all PHP functions that are common to all of the
scripts in the WebSubmit Administrator system. This script has been
adapted from its WebSubmit counterpart, and contains some of the
functions of that script.
*********************************************************************/
/********************Common Global Constants*************************/
# Make a global constant to store the color for the background of cells
# in the page header for linking to other pages/administrative tools...
define("MENU_NAME_COLOUR", "cornflowerblue");
# Make another golbal constant to store the colour for the background
# of cells for the options in the menus...
define("MENU_OPTION_COLOUR", "#9AE2C0");
/********************Includes*************************/
include("<WEBDIR>/sessinit.inc.php");
require_once("<LIBDIR>/php/invenio/errors/errorHandling.php");
/*********************Authentication*******************************/
function canUseWebSubmitAdmin($uid,$doctype='%')
{
$uid_email = getEmail($uid);
$auth = acc_authorize_action($uid, "cfgwebsubmit");
if($auth[0] == 0)
return array(true, $auth[1]);
else
return array(false, $auth[1]);
}
function makeEDSmdDate()
{
/****************************************************************
This function creates a date in the numeric format YYYY-MM-DD.
This date is made into a text string, and returned by this
function.
Author: Nicholas Robinson
Email: Nicholas.Robinson@cern.ch
ca8nro@yahoo.co.uk
Created: 14/12/2000
Last Modified: 14/12/2000
***************************************************************/
# Get the date, so that it can be committed for the
# modification date field (md) and the creation date field
# (cd)...
$dateDets = getdate();
# Now put the date into a variable in a nice MySQL friendly
# format
$theDate = $dateDets['year'] . "-" . $dateDets['mon'] . "-"
. $dateDets['mday'];
# Now return our newly created date...
return $theDate;
} // END function makeEDSmdDate()
function makeDate()
{
/***************************************************************
This function has the simple task of getting the date from the
system, and printing it to a variable in the form "Thursday 16
Nov 2000, at 11:54". The contents of this string are then
returned to the calling function, to be concatenated to another
string.
Author: Nicholas Robinson
Email: Nicholas.Robinson@cern.ch
ca8nro@yahoo.co.uk
Created: 16/11/2000
Last Modified: 16/11/2000
***************************************************************/
# Get the current date and time...
$dateDets = getdate();
# Make a string containing the date...
$dateString = $dateDets['weekday'] . " "
. $dateDets['mday'] . " " . $dateDets['month'] . " "
. $dateDets['year'] . ", at " . $dateDets['hours'] . ":"
. $dateDets['minutes'];
# Now return this strings contents...
return $dateString;
} // END function makeDate()
function getCallingPage($theRefererPage)
{
/******************************************************************
We don't want to allow the user to call a page by simply
typing something in the uri bar of his/her browser. We only want
a given page to be called from certain other scripts belonging to
the WebSubmit2 administrator. This is a security feature, as we don't
want the user to be able to corrupt the database either
accidentally, or maliciously by typing URIs of scripts with CGI
variables being passed to them. We can ensure this doesn't
happen by testing the special HTTP variable HTTP_REFERER to
ensure that it contains the name of a legal WebSubmit2 administrator
script.
This function gets the name of the calling page from the
variable theRefererPage, which is actually a copy of the
HTTP_REFERER variable that has been passed from the calling
script. The name of the calling page is then returned to the
calling script for evaluation.
Author: Nicholas Robinson.
Email: Nicholas.Robinson@cern.ch
Created: 09/08/2000
Last Modified: 02/02/2001
*******************************************************************/
# Test to see if the string is empty... if it is, it means that the
# page has not been called by another page...i.e. somebody has typed
# a URL into the location bar. This means we can return a string
# containing a character that would never feature in a URL, so that
# it is known that the page calling was invalid...
# This has actually come about due to the fact that the page can be
# a legitimate call when there is no page name when the page is
# called index.
if($theRefererPage == "")
{
# Return a garbage string so that no confusion is made about the
# referer variable being empty...
return "";
} // END if
else
{
$callingPage = $theRefererPage;
if(strstr($callingPage, '?'))
{
# If it did have variables encoded in the URL...
# Find the position of the question mark that separates the
# page URL from the variables...
$posQuestMark = strpos($callingPage, "?");
# Remove the portion of the string from the ? onwards, as we
# are only required to test the name of the calling page, not
# any arguments passed to it. Set the value of $callingPage...
$callingPage = substr($callingPage, 0, $posQuestMark);
} // End if
$posLastSlash = strrpos($callingPage, "/");
# Increment $posLastSlash, as it is the data after the slash that
# is of interest to us here, as that is the page name...
$posLastSlash++;
# Now, use PHPs substr function to find the remainder of the
# theRefererPage string, which should actually be the name of the
# calling page...
$callingPage = substr($callingPage, $posLastSlash);
# Return the name of the calling page for further processing in
# the system...
return $callingPage;
} // END else
} // End function getCallingPage(theRefererPage)
// ******************************
function displayInvalidEntry()
{
/******************************************************************
This function merely displays a simple warning message on the
screen, informing the user that permission has been denied to
load the page, and provides a link to the home page. This
function will be called when the user has attempted to load one
of the administrator pages in an inappropriate way, such as
typing the URI into the location bar, and pressing enter, instead
of following the WebSubmit2 Administrator pages through the hierarchy
to get to a specific page.
Author: Nicholas Robinson
Email: Nicholas.Robinson@cern.ch
Created: 09/08/2000
Last Modified: 24/10/2000
*****************************************************************/
# Display the error message...
print('<H3 STYLE="color: red">Permission Denied: Please ');
print('Start At The <A HREF="index.php">Main ');
print('Page</A>.</H3>');
} // End function displayInvalidEntry()
// ******************************
function serverConnect($host, $username, $password)
{
/******************************************************************
This function is a very simple function that allows a user to
connect to a mySQL server of their choice. The function uses the
mysql_connect function provided by php to attempt to connect to
the server. If connection fails, an appropriate error message is
displayed, otherwise the connection link is returned.
Function modified on 28/09/2000 to add </td>, </tr>, and </table>
tags, as the message wasn't being printed due to the fact that
when the die() function was executed, it stopped processing,
hence the table that contains the pages data was never being
closed, resulting in it being impossible to display anything in
this table.
Author: Nicholas Robinson
Email: Nicholas.Robinson@cern.ch
Created: 21/08/2000
Last Modified: 28/09/2000
*****************************************************************/
# Make a connection to the database server...
$link = mysql_connect($host, $username, $password) or
die('<BR><P><H3 ALIGN="center">Unable To '
. 'Connect To SQL Server. Try Reload Of Page.'
. '</H3></P></TD></TR></TABLE></BODY>'
. '</HTML>');
# Return the link to the connection...
return $link;
} // END function serverConnect($host, $username, $password)
// ******************************
function dbSelect($dbName)
{
/******************************************************************
This function is a very simple function that allows a user to
select a mySQL database of their choice. The function uses the
mysql_select_db function provided by php to attempt to select the
DB. If selection fails, an appropriate error message is
displayed, and processing terminates. Otherwise the function
ends normally, returning control to the calling function.
Function modified on 28/09/2000 to add </td>, </tr>, and </table>
tags, as the message wasn't being printed due to the fact that
when the die() function was executed, it stopped processing,
hence the table that contains the pages data was never being
closed, resulting in it being impossible to display anything in
this table.
Author: Nicholas Robinson
Email: Nicholas.Robinson@cern.ch
Created: 21/08/2000
Last Modified: 28/09/2000
******************************************************************/
# Select the database...
mysql_select_db($dbName) or
die('<BR><P><H3 ALIGN="center">Unable To Select'
. ' $dbName Database. Try Reload Of Page.'
. '</H3></P></TD></TR></TABLE></BODY>'
. '</HTML>');
} // END function dbSelect($dbName)
// ******************************
function makeTableHeaderRow($columns, $indexValue)
{
/****************************************************************
This function serves the single purpose of producing a header row
for a table. The function is passed a variable $columns, which
is a list of all columns in the table whose header is to be
produced. The function is also passed a variable $indexValue,
which should hold an integer that the for loop index is to be
initialised to. This has the purpose of allowing the table to
start from any column. This function loops through each column in
the table, FROM the column specified by $indexValue, and prints
this columns title inside a table cell using HTMLs <TH> notation.
It should be noted that it does not open or close the table with
the <TABLE> or </TABLE> tags, as it is assumed that it will only
be called to add the header information to a table, as this is a
commonly done thing for all tables.
Author: Nicholas Robinson
Email: Nicholas.Robinson@cern.ch
Created: 23/08/2000
Last Modified: 23/08/2000
****************************************************************/
for($index = $indexValue; $index < mysql_num_fields($columns);
$index++)
{
print('<TH>&nbsp;');
print(mysql_field_name($columns, $index));
print('&nbsp;</TH>');
} // END for
} // END function makeTableHeaderRow($columns, $indexValue)
//**********************
function resToArray($queryResult)
{
/******************************************************************
This function has the purpose of making a 2D array from the
result of a select query. The query result pointer is passed to
the function, and each row of the result is read into an array
cell. When the query result set has been exhausted, it is
returned to the calling function.
Author: Nicholas Robinson
Email: Nicholas.Robinson@cern.ch
Created: 28/08/2000
Last Modified: 28/08/2000
******************************************************************/
# Make a counter for the rows...
$rowCount = 0;
# Put the contents of the query dynaset into
# a temporary array...
while($dataRow = mysql_fetch_row($queryResult))
{
$allRows[$rowCount] = $dataRow;
$rowCount++;
} // End while
return $allRows;
} // END function resToArray($queryResult)
//******************
function drawSeparator()
{
/***************************************************************
This is a very simple function to draw a horizontal separator
line across the page. This line is encapsulated in <P>aragraph
tags.
Author: Nicholas Robinson
Email: Nicholas.Robinson@cern.ch
Created: 02/10/2000
Last Modified: 02/10/2000
***************************************************************/
# Draw the horizontal separator line...
print('<P><HR WIDTH="100%" ALIGN="center"></P>');
} // END function drawSeparator()
//***************
function displayParams($paramResult, $function)
{
/**************************************************************
This function has the task of displaying the parameters of a
function in a table. The function is passed a query result,
which should point to a dynaset of parameters. If the result set
contains rows (i.e. there are parameters to display), the query
displays these parameters in the table. If however the result
set is empty (there are no parameters to display), the functions
outputs a suitable message to say this.
Author: Nicholas Robinson
Email: Nicholas.Robinson@cern.ch
Created: 02/10/2000
Last Modified: 31/01/2001
**************************************************************/
global $IMAGES;
if(mysql_num_rows($paramResult) > 0)
{
# Output the parameter details in a table...
print('<BR><TABLE BORDER=1 CELLSPACING=0 CELLPADDING=0 '
. 'ALIGN="center"><TR BGCOLOR="#CCDDFF">');
# Output the table headers...
print('<TH>Field</TH>');
print('<TH STYLE="color: red">Delete</TH></TR>');
# Now output the body of the table...
while($dataRow = mysql_fetch_array($paramResult))
{
print('<TR BGCOLOR="#FFFFCC">'
. '<TD>&nbsp;' . $dataRow['param'] . '&nbsp;</TD>');
# Now, we can display a button icon on which to click to
# delete a parameter from the current function...
print('<FORM ACTION="veditFunDets.php" METHOD="post" '
. 'onSubmit="if(confirm(\'Really Remove This Parameter '
. 'From This Function?\')) { return true; } else { '
. 'return false; }">'
. '<INPUT TYPE="hidden" NAME="deleteParam" VALUE="true">'
. '<INPUT TYPE="hidden" NAME="function" VALUE="'.$function.'">'
. '<INPUT TYPE="hidden" NAME="param" VALUE="'
. $dataRow['param'] . '">'
. '<TD ALIGN="center"><INPUT TYPE="image" SRC="'
. $IMAGES.'/answer_bad.gif" WIDTH=14 HEIGHT=14 BORDER=0 '
. 'ALT="Delete Parameter" onClick="submit();"></TD>'
. '</FORM></TR>');
} // END while
# Now that the table has been filled, we can close it up...
print('</TABLE>');
} // END if
else
{
# If this clause has been reached, then it means that the
# query on the sbmFUNDESC table has returned no rows, hence
# meaning that the function in question takes no
# parameters...
print('<H4 STYLE="text-align: center; color: red;'
. ' background-color: transparent">This function'
. ' takes'
. ' no parameters</H4>');
} // END else
} // END function displayParams($paramResult, $function)
//***********************
function offerAddParam($function, $formsAction)
{
/****************************************************************
This function has the task of offering the user the option to
add parameters to the function. It effectively displays a table
with cells containing various input boxes where the parameter can
be chosen, and then submitted by means of a submit button.
The function displays one select list for the table part of the
parameter, and one select list for the fields part of the
parameter, if the table that the parameter is to be found in has
been selected.
It had been my intention to implement this feature by means of a
nested dropdown list, made using JavaScript, (as at this stage,
browsers do not support HTML 4s optgroup tag), but for reasons
of compatibility, I have decided against this idea. Maybe at
some point in the future, that is what I shall do. For now
however, I think I shall just use html selection boxes.
Author: Nicholas Robinson
Email: Nicholas.Robinson@cern.ch
Created: 02/10/2000
Last Modified: 03/10/2000
****************************************************************/
dbSelect(DOCS_DATABASE);
# Open a table in which to contain this section...
print('<TABLE BORDER=1 CELLSPACING=0 CELLPADDING=0 '
. 'ALIGN=center BGCOLOR=#E0E0E0 WIDTH=95%>'
. '<TR><TD ALIGN=left>');
# Output the title of the section, along with a short description
# of how to add a parameter...
print('<H4>Add A Parameter:</H4>'
. '<SMALL><EM>Please select the parameter you want to add to this function:<BR></EM></SMALL>');
# Run a SELECT query to obtain a list of all tables in the WebSubmit
# database. This will be used as the table that the parameter is
# to be found in when a user adds a parameter to the function.
print('<TABLE BORDER=1 ALIGN=center CELLSPACING=0 '
. 'CELLPADDING=0 BGCOLOR=ivory WIDTH=80%>'
. '<TR><TD ALIGN=center WIDTH=50%'
. ' BGCOLOR=ivory>');
print('<FORM ACTION='.$formsAction.' METHOD=get>'
. '<INPUT TYPE=hidden NAME=insertParam'
. ' VALUE=true>'
. '<INPUT TYPE=hidden NAME=function'
. ' VALUE='.$function.'>'
. '<SELECT NAME=theParam>'
. '<OPTION SELECTED VALUE=NO_VALUE>Select a'
. ' field...</OPTION>');
$res = mysql_query("select DISTINCT name from sbmPARAMETERS order by name");
while ($row = mysql_fetch_row($res))
{
print '<option value="'.$row[0].'">'.$row[0].'</OPTION>';
}
print('</SELECT>');
print ' <small>or enter a new one: <INPUT size=25 name=newParam></small>';
# We can now shut the cell down, and insert a button to
# allow the user to add the parameter to the function...
print('</TD></TR></TABLE>');
print('<BR><CENTER><INPUT TYPE=button VALUE=\'UPDATE'
. ' PARAMETER\' onClick="if(theParam.options[theParam.'
. 'selectedIndex].value == \'NO_VALUE\' && newParam.value == \'\')'
. ' { alert(\'A table field must be selected in order'
. ' to add a parameter!\'); } else { if(confirm(\'Warning:'
. '\\nAdding a parameter to a function will mean that'
. ' further manual updating of the WebSubmit database is '
. 'necessary.\\nAre you sure you wish to undertake'
. ' this action?\')) { submit(); } }"'
. '></CENTER></FORM>');
# Now that the section is finished, we can close the table up...
print('</TD></TR></TABLE>');
} // END function offerAddParam()
//*****************
function displayFuncDets($queryResult, $formsAction)
{
/**************************************************************
This function has the task of making an input form that contains
the details of the function (its name, and its description). The
form is contained within 2 tables. The first table contains the
actual input fields for the form, and the second table contains
the submit button for the form, which allows the user to submit
an update to the description field.
Author: Nicholas Robinson
Email: Nicholas.Robinson@cern.ch
Created: 02/10/2000
Last Modified: 02/10/2000
**************************************************************/
# Get a list of the fields in the sbmALLFUNCDESCR table
$fields = mysql_list_fields(DOCS_DATABASE, "sbmALLFUNCDESCR");
# Now get the length of the description field...
$descLen = mysql_field_len($fields, 1);
# Read the only row of the query dynaset into an array...
$dataRow = mysql_fetch_array($queryResult);
# Open an HTML form to allow the user to view the details of
# the function name, and description fields, and to edit the
# function description field if they so wish...
print('<FORM METHOD=post ACTION="'.$formsAction.'">'
. '<TABLE BORDER=0 CELLSPACING=0 CELLPADDING=0>'
. '<INPUT TYPE='
. 'hidden NAME=function VALUE="' . $dataRow['function']
. '"><TR><TD ALIGN=right><STRONG>'
. '<H4>description:</H4></STRONG></TD>'
. '<TD>&nbsp;&nbsp;</TD><TD ALIGN=left>'
. '<INPUT TYPE=text NAME=description VALUE="'
. ereg_replace("'", "&#39;",
htmlspecialchars($dataRow['description']))
. '" SIZE=60'
. '></TD></TR></TABLE>');
/***************************************************************
Add a submit button to the form to allow the user to update
the function description details if they so wish:
For this, we also need to add 2 new hidden input fields. One
of these is to contain a flag to indicate that the page has
been called before, and the other is to contain a flag to
indicate that the next instance of the page will be for
updating the function description (updateDescr).
***************************************************************/
print('<TABLE BORDER=0 CELLSPACING=0 CELLPADDING=0'
. ' ALIGN=center><TR><TD>'
. '<INPUT TYPE=hidden NAME=updateFunDets VALUE=true>'
. '</TD><TD ALIGN=center><INPUT TYPE=button '
. 'VALUE="UPDATE'
. ' DETAILS" onClick="submit()"></TD><TD>&nbsp;</TD>'
. '</TR></TABLE></FORM>');
} // END function displayFuncDets($queryResult)
//****************
function makePageBody($function, $formsAction)
{
/*****************************************************************
This is the function that creates the page. It does so by
executing a number of queries, and then calling other functions
to display their results.
Author: Nicholas Robinson
Email: Nicholas.Robinson@cern.ch
Created: 02/10/2000
Last Modified: 22/03/2001
*****************************************************************/
# Execute a query to get all of the information about a given
# function from the sbmFUNDESC table...
# Apply table locks
if($lockRes = mysql_query("LOCK TABLES sbmALLFUNCDESCR READ, sbmFUNDESC READ"))
{
$queryResult = mysql_query("SELECT * FROM sbmALLFUNCDESCR WHERE "
. "function = '$function'");
# If the function has an entry in the mandatory function
# description table (sbmALLFUNCDESCR)...
if($queryResult)
{
# Display the details of the function in a form, offering the
# user the chance to update the description...
displayFuncDets($queryResult, $formsAction);
# Add a separator...
drawSeparator();
# Now display the parameters for the function (if any)...
print('<P><H4>Parameters:</H4></P>');
/*************************************************************
We must test to see if the function takes parameters. If it
does take parameters, these parameters will be found in the
sbmFUNDESC table, as this table contains details of parameters
for functions. This means that we can simply query the sbmFUNDESC
table for functions matching the functions whose details we
are displaying...
*************************************************************/
$paramResult = mysql_query("SELECT param FROM
sbmFUNDESC
WHERE function = '$function'");
# Unlock the tables...
$unlockRes = mysql_query("UNLOCK TABLES");
# Now take the appropriate action (whether to display
# parameters or not), depending upon whether this query
# returned rows...
if($paramResult)
{
# If the query for retrieving parameters has been
# successful, display these parameters...
displayParams($paramResult, $function);
} // END if
else
{
# If this clause has been reached, then the system has been
# unable to query the sbmFUNDESC table for some reason, and
# hence an error message should be displayed...
print('<SCRIPT TYPE="text/javascript">alert("Error:'
. 'Unable to query sbmFUNDESC table. Inform system '
. 'administrator.")</SCRIPT>');
} // END else
# Now, we can once again separate sections with a horizontal
# rule...
drawSeparator();
# Now offer the user the option to add parameters to the
# function
offerAddParam($function, $formsAction);
# Add a separator to close the section...
drawSeparator();
} // END if
else
{
# Unlock the tables...
$unlockRes = mysql_query("UNLOCK TABLES");
# Display error message...
print('<SCRIPT TYPE="text/javascript">alert("Error:'
. 'Unable to retrieve information concerning the function '
. 'from the sbmALLFUNCDESCR table");</SCRIPT>');
} // END else
} # END if
else
{
# Oh dear - unable to get table lock - simply display error
# message.
print('<DIV STYLE="color: navy; text-align: center; font-size:'
. ' large; font-weight: bold"><SPAN STYLE="color: red">Error:'
. '</SPAN> Unable to retrieve function information.</DIV>'
. mysql_error().'<BR>');
} # END else
} // END function makePageBody()
//*****************
function test_key_legal($theKey)
{
/*******************************************************************
It has been decided that it is safe if a unique "key" for a table
is made up only of alphabetical characters, integer digits, and
underscores. This stops any other characters from causing errors
due to "wild card" features. This function loops through a
string and ensures that it meets these requirements. It returns
true if the string is legal, and false if not.
Author: Nicholas Robinson
Email: Nicholas.Robinson@cern.ch
ca8nro@yahoo.co.uk
Created: 11/01/2001
Last Modified: 11/01/2001
*******************************************************************/
# Set an error flag to false...
$errorFlag = 0;
# Get the length of the string to be tested...
$len = strlen($theKey);
for($i = 0; $i < $len; $i++)
{
if(($theKey[$i] < "a" || $theKey[$i] > "z")
&& ($theKey[$i] < "A" || $theKey[$i] > "Z")
&& ($theKey[$i] < "0" || $theKey[$i] > "9")
&& ($theKey[$i] != "_"))
{
# If the current character in the string is not an
# alphabetical character, a number, or an underscore, then it
# is illegal!
# Set the error flag...
$errorFlag = 1;
break;
} // END if
} // END for
# Return true/false, depending upon string legality...
return ($errorFlag == 1) ? false : true;
} // END function test_key_legal($theKey)
//*****************
function printCookie($coookeee)
{
/****************************************************************
Because when we are offering the opportunity to change the
details of an element description, we want to offer the user the
chance to change the set cookie flag by using a radio button, we
need to write the same piece of code several times. To counter
this, a nice function has been made.
Author: Nicholas Robinson
Email: Nicholas.Robinson@cern.ch
ca8nro@yahoo.co.uk
Created: 30/11/2000
Last Modified: 10/01/2001
****************************************************************/
if($coookeee)
{
print('<INPUT TYPE=radio NAME=cookie '
. 'VALUE=0>No<BR><INPUT TYPE=radio NAME=cookie '
. 'VALUE=1 checked>Yes');
} // END if
else
{
print('<INPUT TYPE=radio NAME=cookie VALUE=0 '
. 'checked>No<BR><INPUT TYPE=radio NAME=cookie '
. 'VALUE=1>Yes');
} // END else
} // END function printCookie($cookeee)
//***************
//************
//**************
function updateEDSDOCTYPEmd($doctype, $md)
{
/******************************************************************
This function has been created, because it is often necessary to
update the modification date field of the sbmDOCTYPE table for a
given EDS doctype. This is because whenever we make alterations
to a submission or its elements etc, we are also making
alterations to the actual doctype that this submission belongs
to. This means that we must update the modification date field
of this doctype to reflect that it has been changed in some way.
Author: Nicholas Robinson
Email: Nicholas.Robinson@cern.ch
ca8nro@yahoo.co.uk
Created: 14/12/2000
Last Modified: 14/12/2000
******************************************************************/
$mdResult = mysql_query("UPDATE sbmDOCTYPE SET md = '$md' WHERE "
. "sdocname = '$doctype'");
if($mdResult)
{
# In this case, the update result for updating the
# modification date of a doctype worked, so we can free
# it's result pointer
mysql_free_result($mdResult);
} // END if
else
{
# Update the submission md query error...output a quick alert
print('<SCRIPT TYPE="text/javascript">alert("ERROR: Unable'
. ' to update the Modification Date field for the '
. 'current document type<BR>in the sbmDOCTYPE table.");'
. '</SCRIPT>');
} // END else
} // END function updateEDSDOCTYPEmd($doctype)
//************
function sendToPageDets($subname, $pageNumber, $nPgs, $doctype)
{
/*******************************************************************
This function simply redirects the browser focus to the
"pageDetsEDS.php" page.
Author: Nicholas Robinson
Email: Nicholas.Robinson@cern.ch
ca8nro@yahoo.co.uk
Created: 12/12/2000
Last Modified: 06/02/2001
*******************************************************************/
# We can now redirect the browser to the the page showing the
# details of this document type & its submissions
print('<FORM ACTION="pageDetsEDS.php" METHOD="post" '
. 'NAME="referForm">'
. '<INPUT TYPE=hidden NAME=doctype VALUE="'.$doctype.'">'
. '<INPUT TYPE=hidden NAME=subname VALUE="'.$subname.'">'
. '<INPUT TYPE=hidden NAME=pageNumber VALUE="'.$pageNumber
. '"><INPUT TYPE=hidden NAME=nPgs VALUE="'.$nPgs.'">'
. '</FORM>');
print('<SCRIPT TYPE="text/javascript">'
. 'setTimeout("document.referForm.submit();", 1000);'
. '</SCRIPT>');
} // END function sendToPageDets()
/*************End of header file commonPhpFunctions.php*************/
?>

Event Timeline