Page MenuHomec4science

elementConfigDetsEDS.php.wml
No OneTemporary

File Metadata

Created
Fri, Aug 30, 23:14

elementConfigDetsEDS.php.wml

## $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.
<?
require("commonPhpFunctions.php");
?>
#include "cdspage.wml" \
title="Details of the <I><protect><?print $name;?></protect></I> Form Element" \
navtrail_previous_links="<a class=navtrail href=<WEBURL>/admin/<lang:star: index.*.html>><MSG_ADMIN_AREA></a> &gt; <a class=navtrail href=<WEBURL>/admin/websubmit/><MSG_ADMIN_SUBMIT></a>" \
navbar_name="admin" \
navbar_select="websubmit"
<?
<protect>
## $Id$
## DO NOT EDIT THIS FILE! IT WAS AUTOMATICALLY GENERATED FROM CDSware WML SOURCES.
/*********************Function Descriptions***************************/
function Jscript_submit($elementType, $dataRow)
{
/***************************************************************
When the page to display/edit the details of a given EDS element
description is loaded, the fields that are displayed depends upon
the type of element. This means that the JavaScript functions to
check these fields must be generated dynamically, as we dont know
which fields we will need to check until run-time.
Depending upon the type of element, this function makes the
function, passing the relevant params to it, and makes the submit
button to pass the relevant params to the function.
Created: 06/12/2000
Last Modified: 28/01/2001
***************************************************************/
# Test the element type, and make the relevant function & submit
# button.
if($elementType == "T")
{
# Output the Javascript functions...
print("<SCRIPT TYPE='text/javascript'>\n\n<!-" . "- hide\n\n"
. "function verifyChanges(curRows, sugRows, curCols,"
. " sugCols, curCode, sugCode, curMarc, sugMarc, curCoo, sugCoo, curMod, sugMod)"
. "\n{\n if((curRows == sugRows) && (curCols == "
. "sugCols) && (curCoo == sugCoo) && (curCode == sugCode) && (curMarc == sugMarc) && (curMod == sugMod))\n "
. "{\n alert('No Change In The Data Has Been Made! Can"
. "not Submit.');\n return false;\n }\n else\n"
. " {\n return true;\n }\n}\n\n// -->"
. "</SCRIPT>\n");
print("<TABLE ALIGN='center' BORDER=0 CELLSPACING=0 "
. "CELLPADDING=0>\n<TR>\n<TD ALIGN='right'>\n<INPUT TYPE='"
. "button' VALUE='SAVE CHANGES' onClick=\"for(i=0; i < "
. "cookie.length; i++) { if(cookie[i].checked) { break; } } "
. "if(verifyChanges(escape('" . ereg_replace("'","\\'",
htmlspecialchars($dataRow["rows"]))
. "'), escape(rows.value), escape('" . ereg_replace("'","\\'",
htmlspecialchars($dataRow["cols"]))
. "'), escape(cols.value), escape('" . ereg_replace("'","\\'",
htmlspecialchars($dataRow["alephcode"]))
. "'), escape(alephcode.value), escape('" . ereg_replace("'","\\'",
htmlspecialchars($dataRow["marccode"]))
. "'), escape(marccode.value),escape('");
if($dataRow["cookie"])
{
print("1");
} // END else
else
{
print("0");
} // END else
print("'), escape(cookie[i].value), escape('" . ereg_replace("'","\\'",htmlspecialchars($dataRow["modifytext"])) . "'), escape(modifytext.value))) { submit(); }\">\n</TD>\n"
. "<TD ALIGN='left'>\n<INPUT TYPE='button' VALUE='RESET CHANGES'"
. " onClick=\"reset();\">\n</TD>\n</TR>\n</TABLE>\n</FORM>\n");
} // END if
elseif($elementType == "I")
{
print("<SCRIPT TYPE='text/javascript'>\n\n<!-" . "- hide\n\n"
. "function verifyChanges(curSize, sugSize, curMaxlength,"
. " sugMaxlength, curVal, sugVal, curCode, sugCode, curMarc, sugMarc, curCoo, sugCoo, curMod, sugMod)"
. "\n{\n if((curSize == sugSize) && (curMaxlength == "
. "sugMaxlength) && (curVal == sugVal) && (curCode == sugCode) && (curCoo == "
. "sugCoo) && (curMarc == sugMarc) && (curMod == sugMod))\n "
. "{\n alert('No Change In The Data Has Been Made! Can"
. "not Submit.');\n return false;\n }\n else\n"
. " {\n return true;\n }\n}\n\n// -->"
. "</SCRIPT>\n");
print("<TABLE ALIGN='center' BORDER=0 CELLSPACING=0 "
. "CELLPADDING=0>\n<TR>\n<TD ALIGN='right'>\n<INPUT TYPE='"
. "button' VALUE='SAVE CHANGES' onClick=\"for(i=0; i < "
. "cookie.length; i++) { if(cookie[i].checked) { break; } } "
. "if(verifyChanges(escape"
. "('" . ereg_replace("'","\\'",
htmlspecialchars($dataRow["size"]))
. "'), escape(size.value), escape('" . ereg_replace("'","\\'",
htmlspecialchars($dataRow["maxlength"]))
. "'), escape(maxlength.value), escape('"
. ereg_replace("'","\\'",
htmlspecialchars($dataRow["val"]))
. "'), escape(val.value), escape('"
. ereg_replace("'","\\'",
htmlspecialchars($dataRow["alephcode"]))
. "'), escape(alephcode.value), escape('"
. ereg_replace("'","\\'",
htmlspecialchars($dataRow["marccode"]))
. "'), escape(marccode.value), escape('");
if($dataRow["cookie"])
{
print("1");
} // END else
else
{
print("0");
} // END else
print("'), escape(cookie[i].value), escape('" . ereg_replace("'","\\'",htmlspecialchars($dataRow["modifytext"])) . "'), escape(modifytext.value))) { submit(); }\">\n</TD>\n"
. "<TD ALIGN='left'>\n<INPUT TYPE='button' VALUE='RESET CHANGES'"
. " onClick=\"reset();\">\n</TD>\n</TR>\n</TABLE>\n</FORM>\n");
} // END elseif
elseif($elementType == "H")
{
print("<SCRIPT TYPE='text/javascript'>\n\n<!-" . "- hide\n\n"
. "function verifyChanges(curVal, sugVal, curCode, sugCode, curMarc, sugMarc, curCoo, sugCoo, curMod, sugMod)"
. "\n{\n if((curVal == sugVal) && (curCoo == sugCoo) && (curCode == sugCode) && (curMarc == sugMarc) && (curMod == sugMod))\n "
. " {\n alert('No Change In The Data Has Been Made! "
. "Can not Submit.');\n return false;\n }\n "
. "else\n"
. " {\n return true;\n }\n}\n\n// -->"
. "</SCRIPT>\n");
print("<TABLE ALIGN='center' BORDER=0 CELLSPACING=0 "
. "CELLPADDING=0>\n<TR>\n<TD ALIGN='right'>\n<INPUT TYPE='"
. "button' VALUE='SAVE CHANGES' onClick=\"for(i=0; i < "
. "cookie.length; i++) { if(cookie[i].checked) { break; } } "
. "if(verifyChanges(escape"
. "('" . ereg_replace("'","\\'",
htmlspecialchars($dataRow["val"]))
. "'), escape(val.value), escape('"
. ereg_replace("'","\\'",
htmlspecialchars($dataRow["alephcode"]))
. "'), escape(alephcode.value), escape('"
. ereg_replace("'","\\'",
htmlspecialchars($dataRow["marccode"]))
. "'), escape(marccode.value), escape('");
if($dataRow["cookie"])
{
print("1");
} // END else
else
{
print("0");
} // END else
print("'), escape(cookie[i].value), escape('" . ereg_replace("'","\\'",htmlspecialchars($dataRow["modifytext"])) . "'), escape(modifytext.value))) { submit(); }\">\n</TD>\n"
. "<TD ALIGN='left'>\n<INPUT TYPE='button' VALUE='RESET CHANGES'"
. " onClick=\"reset();\">\n</TD>\n</TR>\n</TABLE>\n</FORM>\n");
} // END elseif
elseif($elementType == "F")
{
print("<SCRIPT TYPE='text/javascript'>\n\n<!-" . "- hide\n\n"
. "function verifyChanges(curSize, sugSize, curMaxlength,"
. " sugMaxlength, curCode, sugCode, curMarc, sugMarc, curCoo, sugCoo, curMod, sugMod)"
. "\n{\n if((curSize == sugSize) && (curMaxlength == "
. "sugMaxlength) && (curCoo == sugCoo) && (curCode == sugCode) && (curMarc == sugMarc) && (curMod == sugMod))\n "
. "{\n alert('No Change In The Data Has Been Made! Can"
. "not Submit.');\n return false;\n }\n else\n"
. " {\n return true;\n }\n}\n\n// -->"
. "</SCRIPT>\n");
print("<TABLE ALIGN='center' BORDER=0 CELLSPACING=0 "
. "CELLPADDING=0>\n<TR>\n<TD ALIGN='right'>\n<INPUT TYPE='"
. "button' VALUE='SAVE CHANGES' onClick=\"for(i=0; i < "
. "cookie.length; i++) { if(cookie[i].checked) { break; } } "
. "if(verifyChanges(escape('" . ereg_replace("'","\\'",
htmlspecialchars($dataRow["size"]))
. "'), escape(size.value), escape('" . ereg_replace("'","\\'",
htmlspecialchars($dataRow["maxlength"]))
. "'), escape(maxlength.value), escape('" . ereg_replace("'","\\'",
htmlspecialchars($dataRow["alephcode"]))
. "'), escape(alephcode.value), escape('" . ereg_replace("'","\\'",
htmlspecialchars($dataRow["marccode"]))
. "'), escape(marccode.value), escape('");
if($dataRow["cookie"])
{
print("1");
} // END else
else
{
print("0");
} // END else
print("'), escape(cookie[i].value), escape('" . ereg_replace("'","\\'",htmlspecialchars($dataRow["modifytext"])) . "'), escape(modifytext.value))) { submit(); }\">\n</TD>\n"
. "<TD ALIGN='left'>\n<INPUT TYPE='button' VALUE='RESET CHANGES'"
. " onClick=\"reset();\">\n</TD>\n</TR>\n</TABLE>\n</FORM>\n");
} // END elseif
elseif($elementType == "D")
{
print("<SCRIPT TYPE='text/javascript'>\n\n<!-" . "- hide\n\n"
. "function verifyChanges(curFidesc, sugFidesc, curCode, sugCode, curMarc, sugMarc, curCoo, sugCoo, curMod, sugMod)"
. "\n{\n if(curFidesc == sugFidesc && curCoo == "
. "sugCoo && sugCode == curCode && sugMarc == curMarc && sugMod == curMod)\n "
. "{\n alert('No Change In The Data Has Been Made! Can"
. "not Submit.');\n return false;\n }\n else\n"
. " {\n return true;\n }\n}\n\n// -->"
. "</SCRIPT>\n");
print("<TABLE ALIGN='center' BORDER=0 CELLSPACING=0 "
. "CELLPADDING=0>\n<TR>\n<TD ALIGN='right'>\n<INPUT TYPE='"
. "button' VALUE='SAVE CHANGES' onClick=\"for(i=0; i < "
. "cookie.length; i++) { if(cookie[i].checked) { break; } } "
. "if(verifyChanges(escape('" . ereg_replace("\r", "",
ereg_replace("\n", "\\n",
ereg_replace("'","\\'",
htmlspecialchars($dataRow["fidesc"]))))
. "'), escape(fidesc.value), escape('" . ereg_replace("'","\\'",
htmlspecialchars($dataRow["alephcode"]))
. "'), escape(alephcode.value), escape('" . ereg_replace("'","\\'",
htmlspecialchars($dataRow["marccode"]))
. "'), escape(marccode.value), escape('");
if($dataRow["cookie"])
{
print("1");
} // END else
else
{
print("0");
} // END else
print("'), escape(cookie[i].value), escape('" . ereg_replace("'","\\'",htmlspecialchars($dataRow["modifytext"])) . "'), escape(modifytext.value))) { submit(); }\">\n</TD>\n"
. "<TD ALIGN='left'>\n<INPUT TYPE='button' VALUE='RESET CHANGES'"
. " onClick=\"reset();\">\n</TD>\n</TR>\n</TABLE>\n</FORM>\n");
} // END elseif
elseif($elementType == "R")
{
print("<SCRIPT TYPE='text/javascript'>\n\n<!-" . "- hide\n\n"
. "function verifyChanges(curFidesc, sugFidesc, curCode, sugCode, curMarc, sugMarc, curMod, sugMod)"
. "\n{\n if(curFidesc == sugFidesc"
. " && sugCode == curCode && sugMarc == curMarc && sugMod == curMod)\n "
. "{\n alert('No Change In The Data Has Been Made! Can"
. "not Submit.');\n return false;\n }\n else\n"
. " {\n return true;\n }\n}\n\n// -->"
. "</SCRIPT>\n");
print("<TABLE ALIGN='center' BORDER=0 CELLSPACING=0 "
. "CELLPADDING=0>\n<TR>\n<TD ALIGN='right'>\n<INPUT TYPE='"
. "button' VALUE='SAVE CHANGES' onClick=\" "
. "if(verifyChanges(escape('" . ereg_replace("\r", "",
ereg_replace("\n", "\\n",
ereg_replace("'","\\'",
htmlspecialchars($dataRow["fidesc"]))))
. "'), escape(fidesc.value), escape('" . ereg_replace("'","\\'",
htmlspecialchars($dataRow["alephcode"]))
. "'), escape(alephcode.value), escape('" . ereg_replace("'","\\'",
htmlspecialchars($dataRow["marccode"]))
. "'), escape(marccode.value), escape('");
print("'), escape('" . ereg_replace("'","\\'",htmlspecialchars($dataRow["modifytext"])) . "'), escape(modifytext.value))) { submit(); }\">\n</TD>\n"
. "<TD ALIGN='left'>\n<INPUT TYPE='button' VALUE='RESET CHANGES'"
. " onClick=\"reset();\">\n</TD>\n</TR>\n</TABLE>\n</FORM>\n");
} // END elseif
elseif($elementType == "S")
{
print("<SCRIPT TYPE='text/javascript'>\n\n<!-" . "- hide\n\n"
. "function verifyChanges(curFidesc, sugFidesc, curCode, sugCode, curMarc, sugMarc, curCoo, sugCoo, curMod, sugMod)"
. "\n{\n if(curFidesc == sugFidesc && curCoo == "
. "sugCoo && sugCode == curCode && sugMarc == curMarc && sugMod == curMod)\n "
. "{\n alert('No Change In The Data Has Been Made! Can"
. "not Submit.');\n return false;\n }\n else\n"
. " {\n return true;\n }\n}\n\n// -->"
. "</SCRIPT>\n");
print("<TABLE ALIGN='center' BORDER=0 CELLSPACING=0 "
. "CELLPADDING=0>\n<TR>\n<TD ALIGN='right'>\n<INPUT TYPE='"
. "button' VALUE='SAVE CHANGES' onClick=\"for(i=0; i < "
. "cookie.length; i++) { if(cookie[i].checked) { break; } } "
. "if(verifyChanges(escape('" . ereg_replace("\r", "",
ereg_replace("\n", "\\n",
ereg_replace("'","\\'",
htmlspecialchars($dataRow["fidesc"]))))
. "'), escape(fidesc.value), escape('" . ereg_replace("'","\\'",
htmlspecialchars($dataRow["alephcode"]))
. "'), escape(alephcode.value), escape('" . ereg_replace("'","\\'",
htmlspecialchars($dataRow["marccode"]))
. "'), escape(marccode.value), escape('");
if($dataRow["cookie"])
{
print("1");
} // END else
else
{
print("0");
} // END else
print("'), escape(cookie[i].value), escape('" . ereg_replace("'","\\'",htmlspecialchars($dataRow["modifytext"])) . "'), escape(modifytext.value))) { submit(); }\">\n</TD>\n"
. "<TD ALIGN='left'>\n<INPUT TYPE='button' VALUE='RESET CHANGES'"
. " onClick=\"reset();\">\n</TD>\n</TR>\n</TABLE>\n</FORM>\n");
} // END elseif
else
{
# Unknown file type, so just output a button not allowing the
# form to be submitted.
print("<TABLE ALIGN='center' BORDER=0 CELLSPACING=0 "
. "CELLPADDING=0>\n<TR>\n<TD ALIGN='right'>\n<INPUT TYPE='"
. "button' VALUE='SAVE CHANGES' onClick=\"alert('Unknown "
. "Element Type! Cannot Submit');"
. "\">\n</TD>\n<TD ALIGN='left'>\n<INPUT TYPE='button'"
. "VALUE='RESET CHANGES' onClick=\"reset();\">\n</TD>\n"
. "</TR>\n</TABLE>\n</FORM>\n");
} // END else
} // END function Jscript_submit()
//***************
function fabricateElementDetsFormEDS($name, $caller,
$subname = "", $pageNumber = "", $nPgs = "", $doctype = "")
{
/*****************************************************************
This function has the task of creating the html form that
contains the data of the element description. This form varies
depending upon what kind of "input" the element whose details are
being displayed is. This is because for some inputs, certain
parameters (like size or maxlength) are important, but are not
used for others. This means that we do not need to display
certain fields of the sbmFIELDS table for certain elements, that we
need to dislay for others.
Author: Nicholas Robinson
Email: Nicholas.Robinson@cern.ch
ca8nro@yahoo.co.uk
Created: 04/12/2000
Last Modified: 30/01/2001
*****************************************************************/
# Conduct a select query to retrieve the description details of the
# given element from the sbmFIELDDESC table.
$queryResult = mysql_query("SELECT * FROM sbmFIELDDESC WHERE name = "
. "'$name'");
# Take the relevant action depending upon whether it was
# successfully executed or not...
if($queryResult)
{
# In this case, the query executed successfully...
# Produce the appropriate output, depending upon the number of
# rows returned by the query...
if(mysql_num_rows($queryResult) == 1)
{
# In this case, as expected, there is one entry for the given
# element DESCRIPTION in the sbmFIELDDESC table..
# Now, display a quick set of page instructions for the user..
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 are "
. "the details of the <EM>$name</EM> element description.<BR>"
. "These details can be edited by alterring the values in the"
. " the various input boxes, and clicking on \"SAVE CHANGES\""
. ".<BR><BR>It is also possible to change the type of the "
. "element description, which will cause the page to<BR>"
. "refresh, displaying the fields relevant to the new element"
. " type.</P>\n</TD>\n</TR>\n</TABLE>\n");
# Make a horizontal rule to divide the page sections...
drawSeparator();
print("<DIV STYLE='text-align: center; color: navy; "
. "font-weight: bold; font-size: medium'>Element "
. "Preview</DIV>\n");
# Get the row of data
$dataRow = mysql_fetch_array($queryResult);
# Now, let us make a nice preview of the element...
print("<FORM>\n<TABLE ALIGN='center' BORDER=1 CELLSPACING=0 "
. "CELLPADDING=0 WIDTH='100%' BGCOLOR='#87CEFA'>\n<TR>\n<TD "
. "ALIGN='center' VALIGN='middle'>\n");
$leType = $dataRow["type"];
if($leType == "T")
{
# We can draw a textarea element
print("<TEXTAREA ROWS=" . $dataRow["rows"] . " COLS="
. $dataRow["cols"] . ">\n</TEXTAREA>\n");
} // END if
elseif($leType == "I")
{
# normal HTML input...
print("<INPUT TYPE='text' SIZE=" . $dataRow["size"]
. " VALUE='"
. ereg_replace("'", "&#39;",
htmlspecialchars($dataRow["val"]))
. "'>\n");
} // END elseif
elseif($leType == "H")
{
# say that it is a hidden input field...
print("<DIV STYLE='color: green; text-align: center; "
. "font-weight: bold; font-size: medium'>Hidden Input."
. " Contains Following:<BR><BR><SPAN STYLE='color: red'>"
. ereg_replace("'", "&#39;",
htmlspecialchars($dataRow["val"]))
. "</SPAN></DIV>\n");
} // END elseif
elseif($leType == "F")
{
# display a File input...
print("<INPUT TYPE='file' SIZE=" . $dataRow["size"]
. ">\n");
} // END elseif
elseif($leType == "D")
{
# display the user defined item - whatever it is
if($dataRow["fidesc"] != "")
{
# If the element has some data definition.
print("&nbsp;" . $dataRow["fidesc"] . "&nbsp;");
} // END if
else
{
print("<SPAN STYLE=\"color: green; font-size: medium; "
. "text-align: center; font-weight: bold\">Item "
. "Definition Not Yet Provided</SPAN>\n");
} // END else
} // END elseif
elseif($leType == "S")
{
# display the select box
if($dataRow["fidesc"] != "")
{
# If the element has some data definition.
print("&nbsp;" . $dataRow["fidesc"] . "&nbsp;");
} // END if
else
{
print("<SPAN STYLE=\"color: green; font-size: medium; "
. "text-align: center; font-weight: bold\">Item "
. "Definition Not Yet Provided</SPAN>\n");
} // END else
} // END elseif
elseif($leType == "R")
{
# cannot display the response element
print("<SPAN STYLE=\"color: green; font-size: medium; "
. "text-align: center; font-weight: bold\">Response "
. "Item: see description field</SPAN>\n");
} // END elseif
else
{
# Unknown element type. Therefore we can't display it.
print("<DIV STYLE='color: red; text-align: center; "
. "font-weight: bold; font-size: medium'>Unknown "
. "Element Type. Cannot Display.</DIV>\n");
} // END else
# Close up form & table
print("</TD>\n</TR>\n</TABLE>\n</FORM>\n");
# Make a horizontal rule to divide the page sections...
drawSeparator();
# ready to display the details of the
# element description in a form within a table. Each field of
# the element description will be contained within a form
# input box so that it can be edited if this is desirable.
# begin allowing the user to edit certain fields
# Element type (Will be a combo box, that allows you to change
# the type of the element
print("<FORM ACTION='elementConfigDetsEDS.php' METHOD='post'>"
. "\n<INPUT TYPE='hidden' NAME='changeType' VALUE='true'>\n"
. "<INPUT TYPE='hidden' NAME='caller' VALUE='$caller'>\n"
. "<INPUT TYPE='hidden' NAME='name' VALUE='"
. $dataRow["name"] . "'>\n");
# Add extra fields (if necessary)
if($caller == "pageDetsEDS.php")
{
print("<INPUT TYPE='hidden' NAME='subname' VALUE='"
. "$subname'>\n<INPUT TYPE='hidden' NAME='doctype' VALUE="
. "'$doctype'>\n<INPUT TYPE='hidden' NAME='pageNumber' "
. "VALUE='$pageNumber'>\n\n<INPUT TYPE='hidden' NAME='"
. "nPgs' VALUE='$nPgs'>\n");
} // END if
print("<TABLE BORDER=0 CELLSPACING=0 CELLPADDING=0 ALIGN='"
. "center' WIDTH='100%'>\n<TR>\n<TH WIDTH='20%' BGCOLOR='"
. "#87CEFA' ALIGN='right'>\nElement Type:&nbsp"
. ";</TH>\n<TD WIDTH='80%' ALIGN='left' BGCOLOR='#FFFFCC'>"
. "<SELECT NAME='type' onChange=\"submit();\">\n<OPTION VALUE"
. "='UNKNOWN_TYPE'>Unknown Element Type</OPTION>\n");
# Make User defined type option
print("<OPTION ");
if($dataRow["type"] == "D")
{
print("SELECTED ");
} // END if
print("VALUE='D'>User Defined Input</OPTION>\n");
# Make Select box type option
print("<OPTION ");
if($dataRow["type"] == "S")
{
print("SELECTED ");
} // END if
print("VALUE='S'>Select Box</OPTION>\n");
# Make File input type option
print("<OPTION ");
if($dataRow["type"] == "F")
{
print("SELECTED ");
} // END if
print("VALUE='F'>File Input</OPTION>\n");
# Make Hidden input type option...
print("<OPTION ");
if($dataRow["type"] == "H")
{
print("SELECTED ");
} // END if
print("VALUE='H'>Hidden Input</OPTION>\n");
# Make Text input type option...
print("<OPTION ");
if($dataRow["type"] == "I")
{
print("SELECTED ");
} // END if
print("VALUE='I'>Text Input</OPTION>\n");
# Make response type option...
print("<OPTION ");
if($dataRow["type"] == "R")
{
print("SELECTED ");
} // END if
print("VALUE='R'>Response</OPTION>\n");
# Make TextArea input type option...
print("<OPTION ");
if($dataRow["type"] == "T")
{
print("SELECTED ");
} // END if
print("VALUE='T'>Text Area Element</OPTION>\n</SELECT>\n</TD>"
. "\n</TR>\n</TABLE>\n</FORM>\n");
# Now make main form
print("<FORM ACTION='elementConfigDetsEDS.php' METHOD='post'>"
. "\n<INPUT TYPE='hidden' NAME='update' VALUE='true'>\n"
. "<INPUT TYPE='hidden' NAME='caller' VALUE='$caller'>\n"
. "<INPUT TYPE='hidden' NAME='type' VALUE='"
. $dataRow["type"] . "'>\n"
. "<TABLE BORDER=1 CELLSPACING=0 CELLPADDING=0 ALIGN='center"
. "' WIDTH='100%'>\n");
# Now make the table: names & fields
# Get the columns list
$columns = mysql_list_fields(DOCS_DATABASE, "sbmFIELDDESC");
# Get the number of fields
$numTblFlds = mysql_num_fields($columns);
# Before we display most of the table, we can first display
# the upper part of the table, which will be the fields, that
# shouldn't be modified by the user. These are the name, cd
# and md fields.
$tblHead = "<TABLE WIDTH='100%' ALIGN='center' CELLSPACING=0 "
. "CELLPADDING=0 BORDER=0>\n<TR>\n<TH BGCOLOR='#D3DCE3' ALIGN"
. "='right' WIDTH='20%'>\nElement:&nbsp;</TH>\n<TD "
. "ALIGN='left' BGCOLOR='#FFFFCC' WIDTH='80%'><INPUT "
. "TYPE='readonly' NAME='name' VALUE='"
. $dataRow["name"] . "'>\n</TD>\n</TR>\n<TR>\n<TH "
. "BGCOLOR='#D3DCE3' ALIGN='right' WIDTH='20%'>\nCreation "
. "Date:&nbsp;</TH>\n<TD WIDTH='80%' ALIGN='left' BGCOLOR="
. "'#FFFFCC'><INPUT TYPE='readonly' NAME='cd' VALUE='"
. $dataRow["cd"] . "'>\n</TD>\n</TR>\n<TR>\n<TH WIDTH='20"
. "%' BGCOLOR='#D3DCE3' ALIGN='right'>\nModification Date:"
. "&nbsp;</TH>\n<TD WIDTH='80%' ALIGN='left' BGCOLOR='"
. "#FFFFCC'><INPUT TYPE='readonly' NAME='md' VALUE='"
. $dataRow["md"] . "'>\n</TD>\n</TR>\n";
# Now make the alephcode field
$tblHead .= "<TR>\n<TH "
. "BGCOLOR='#87CEFA' ALIGN='right' WIDTH='20%'>\nAleph Code:"
. "&nbsp;</TH>\n<TD ALIGN='left' BGCOLOR='#FFFFCC' WIDTH='80%"
. "'><INPUT TYPE='text' NAME='alephcode' VALUE='"
. $dataRow["alephcode"] . "' SIZE="
. mysql_field_len($columns, 1) . ">\n</TD>\n</TR>\n";
# Now make the marccode field
$tblHead .= "<TR>\n<TH "
. "BGCOLOR='#87CEFA' ALIGN='right' WIDTH='20%'>\nMarc Code:"
. "&nbsp;</TH>\n<TD ALIGN='left' BGCOLOR='#FFFFCC' WIDTH='80%"
. "'><INPUT TYPE='text' NAME='marccode' VALUE='"
. $dataRow["marccode"] . "' SIZE="
. mysql_field_len($columns, 2) . ">\n</TD>\n</TR>\n";
# Now make the modifytext field
$tblHead .= "<TR>\n<TH "
. "BGCOLOR='#87CEFA' ALIGN='right' WIDTH='20%'>\nModification Text:"
. "&nbsp;</TH>\n<TD ALIGN='left' BGCOLOR='#FFFFCC' WIDTH='80%"
. "'><INPUT TYPE='text' NAME='modifytext' VALUE='"
. $dataRow["modifytext"] . "' SIZE="
. mysql_field_len($columns, 2) . ">\n</TD>\n</TR>\n";
# it is possible to show the rest of the data that will be
# editable.
# elements are a form of html forms input. This means that
# there can be several different types of input (text, file,
# etc). Different types of html input use different
# parameters, so depending upon what type of input the element
# whose details are being displayed is, only certain fields
# from the sbmFIELDDESC table will be displayed, and others will
# remain hidden, as they are not used by this element. This
# means that we must test to see what type of element it is,
# and then display the relevant fields based upon this
$elementType = $dataRow["type"];
if($elementType == "T")
{
# In this case, the element is a <TEXTAREA> element.
print("$tblHead");
print("<TR>\n<TH BGCOLOR='#87CEFA' ALIGN='right' WIDTH='"
. "20%'>\nRows:&nbsp;</TH>\n<TD ALIGN='left' BGCOLOR='#F"
. "FFFCC' WIDTH='80%'><INPUT TYPE='text' name='rows' "
. "VALUE='" . $dataRow["rows"] . "' SIZE="
. mysql_field_len($columns, 5) . ">\n</TD>\n</TR>\n<TR>\n"
. "<TH BGCOLOR='#87CEFA' ALIGN='right' WIDTH='20%'>\nColu"
. "mns:&nbsp;</TH>\n<TD ALIGN='left' BGCOLOR='#FFFFCC' "
. "WIDTH='80%'><INPUT TYPE='text' name='cols' VALUE='"
. $dataRow["cols"] . "' SIZE="
. mysql_field_len($columns, 6) . ">\n</TD>\n"
. "</TR>\n<TR>\n<TH BGCOLOR='#87CEFA' ALIGN='right' "
. "WIDTH='20%'>\nCookie:&nbsp;</TH>\n<TD ALIGN='left' "
. "BGCOLOR='#FFFFCC' WIDTH='80%'>");
printCookie($dataRow["cookie"]);
# close up the current row (it is actually the last row)
print("</TD>\n</TR>\n");
} // END if
elseif($elementType == "I")
{
# item is a normal html text input
print("$tblHead");
print("<TR>\n<TH BGCOLOR='#87CEFA' ALIGN='right' WIDTH='"
. "20%'>\nSize:&nbsp;</TH>\n<TD ALIGN='left' BGCOLOR='#F"
. "FFFCC' WIDTH='80%'><INPUT TYPE='text' name='size' VAL"
. "UE='" . $dataRow["size"] . "' SIZE=4"
. " MAXLENGTH=4"
. ">\n</TD>\n</TR>\n<TR>\n<TH BGCOLOR='#87CEFA' ALIGN='ri"
. "ght' WIDTH='20%'>\nMaxlength:&nbsp;</TH>\n<TD ALIGN='"
. "left' BGCOLOR='#FFFFCC' WIDTH='80%'><INPUT TYPE='text'"
. " name='maxlength' VALUE='" . $dataRow["maxlength"]
. "' SIZE=" . mysql_field_len($columns, 7)
. ">\n</TD>\n</TR>\n<TR>\n<TH "
. "BGCOLOR='#87CEFA' ALIGN='right' WIDTH='20%'>\nValue:"
. "&nbsp;</TH>\n<TD ALIGN='left' BGCOLOR='#FFFFCC' WIDTH='"
. "80%'><INPUT TYPE='text' name='val' VALUE='"
. ereg_replace("'", "&#39;",
htmlspecialchars($dataRow["val"]))
. "' SIZE=60 >\n</TD>\n</TR>\n<TR>\n"
. "<TH BGCOLOR='#87CEFA' ALIGN='right' WIDTH='20%'>\nCook"
. "ie:&nbsp;</TH>\n<TD ALIGN='left' BGCOLOR='#FFFFCC' WID"
. "TH='80%'>");
printCookie($dataRow["cookie"]);
# close up the current row (it is actually the last row)
print("</TD>\n</TR>\n");
} // END elseif
elseif($elementType == "H")
{
# item is a hidden input field.
print("$tblHead");
print("<TR>\n<TH BGCOLOR='#87CEFA' ALIGN='right' WIDTH='"
. "20%'>\nValue:&nbsp;</TH>\n<TD ALIGN='left' BGCOLOR='#FF"
. "FFCC' WIDTH='80%'><INPUT TYPE='text' name='val' VALUE='"
. ereg_replace("'", "&#39;",
htmlspecialchars($dataRow["val"]))
. "' SIZE=60 >\n</TD>\n</TR>\n<TR>\n"
. "<TH BGCOLOR='#87CEFA' ALIGN='right' WIDTH='20%'>\nCook"
. "ie:&nbsp;</TH>\n<TD ALIGN='left' BGCOLOR='#FFFFCC' WID"
. "TH='80%'>");
printCookie($dataRow["cookie"]);
# close up the current row (it is actually the last row)
print("</TD>\n</TR>\n");
} // END elseif
elseif($elementType == "F")
{
# item is a file input type.
print("$tblHead");
print("<TR>\n<TH BGCOLOR='#87CEFA' ALIGN='right' WIDTH='"
. "20%'>\nSize:&nbsp;</TH>\n<TD ALIGN='left' BGCOLOR='#FFF"
. "FCC' WIDTH='80%'><INPUT TYPE='text' NAME='size' VALUE='"
. $dataRow["size"] . "' SIZE="
. mysql_field_len($columns, 4)
. ">\n</TD>\n</TR>\n<TR>\n<TH "
. "BGCOLOR='#87CEFA' ALIGN='right' WIDTH='20%'>\nMaxlength"
. ":&nbsp;</TH>\n<TD ALIGN='left' BGCOLOR='#FFFFCC' "
. "WIDTH='80%'><INPUT TYPE='text' name='maxlength' VALUE='"
. $dataRow["maxlength"] . "' SIZE="
. mysql_field_len($columns, 7) . ">\n</TD>\n</TR>\n<TR>\n"
. "<TH BGCOLOR='#87CEFA' ALIGN='right' WIDTH='20%'>\n"
. "Cookie:&nbsp;</TH>\n<TD ALIGN='left' BGCOLOR='#FFFFCC'"
. " WIDTH='80%'>");
printCookie($dataRow["cookie"]);
# close up the current row (it is actually the last row)
print("</TD>\n</TR>\n");
} // END elseif
elseif($elementType == "D")
{
# item is a user defined input type.
print("$tblHead");
print("<TR>\n<TH BGCOLOR='#87CEFA' ALIGN='right' WIDTH='"
. "20%'>\nItem Description:&nbsp;</TH>\n<TD ALIGN='left' "
. "BGCOLOR='#FFFFCC' WIDTH='80%'><TEXTAREA COLS=100 ROWS=50"
. " NAME='fidesc' wrap='nowrap'>" . ereg_replace("'", "&#39;",
htmlspecialchars($dataRow["fidesc"]))
. "</TEXTAREA>\n</TD>\n</TR>\n<TH BGCOLOR='#87CEFA' "
. "ALIGN='right' WIDTH='20%'>\nCookie:&nbsp;</TH>\n<TD "
. "ALIGN='left' BGCOLOR='#FFFFCC' WIDTH='80%'>");
printCookie($dataRow["cookie"]);
# close up the current row (it is actually the last row)
print("</TD>\n</TR>\n");
} // END elseif
elseif($elementType == "R")
{
# item is a response input type.
print("$tblHead");
print("<TR>\n<TH BGCOLOR='#87CEFA' ALIGN='right' WIDTH='"
. "20%'>\nItem Description:&nbsp;</TH>\n<TD ALIGN='left' "
. "BGCOLOR='#FFFFCC' WIDTH='80%'><TEXTAREA COLS=100 ROWS=50"
. " NAME='fidesc' wrap='nowrap'>" . ereg_replace("'", "&#39;",
htmlspecialchars($dataRow["fidesc"]))
. "</TEXTAREA>\n</TD>\n</TR>\n");
} // END elseif
elseif($elementType == "S")
{
# item is a select box input type.
print("$tblHead");
print("<TR>\n<TH BGCOLOR='#87CEFA' ALIGN='right' WIDTH='"
. "20%'>\nItem Description:&nbsp;</TH>\n<TD ALIGN='left' "
. "BGCOLOR='#FFFFCC' WIDTH='80%'><TEXTAREA COLS=100 ROWS=50"
. " NAME='fidesc' wrap='nowrap'>" . ereg_replace("'", "&#39;",
htmlspecialchars($dataRow["fidesc"]))
. "</TEXTAREA>\n</TD>\n</TR>\n<TH BGCOLOR='#87CEFA' "
. "ALIGN='right' WIDTH='20%'>\nCookie:&nbsp;</TH>\n<TD "
. "ALIGN='left' BGCOLOR='#FFFFCC' WIDTH='80%'>");
printCookie($dataRow["cookie"]);
# close up the current row (it is actually the last row)
print("</TD>\n</TR>\n");
} // END elseif
print("</TABLE>\n");
# Now that the form has been constructed, it is possible to
# produce the buttons that allow the form to either be
# submitted, reset or the user to exit this page without
# making any chages, and return to the page from which they
# came.
if($caller == "pageDetsEDS.php")
{
print("<INPUT TYPE='hidden' NAME='subname' VALUE='"
. "$subname'>\n<INPUT TYPE='hidden' NAME='doctype' VALUE="
. "'$doctype'>\n<INPUT TYPE='hidden' NAME='pageNumber' "
. "VALUE='$pageNumber'>\n\n<INPUT TYPE='hidden' NAME='"
. "nPgs' VALUE='$nPgs'>\n<P>\n");
} // END if
Jscript_submit($elementType, $dataRow);
# Now that the details of this element description have been
# displayed, display links to all of the other submission
# pages that use an instance of this element.
# divide page sections
drawSeparator();
$othersRes = mysql_query("SELECT subname, pagenb FROM "
. "sbmFIELD WHERE fidesc='$name'");
if($othersRes)
{
# The query to discover all of the other submission pages
# that use this submission has been executed successfully.
print("<P STYLE=\"color: navy; font-weight: bold\">Element"
. " Used On The Following Submissions</P>");
print("<TABLE BORDER=0 ALIGN='center' CELLSPACING=0 "
. "CELLPADDING=0>\n");
if(mysql_num_rows($othersRes) > 0)
{
while($aRow = mysql_fetch_array($othersRes))
{
$str = "SELECT * FROM sbmIMPLEMENT WHERE subname = '"
. $aRow["subname"] . "' ORDER BY subname";
$sometmpRs = mysql_query("SELECT * FROM sbmIMPLEMENT "
. "WHERE subname = '" . $aRow["subname"]
. "' ORDER BY subname");
if($sometmpRs)
{
# Then the query to get the details of the
# location of each instance of the element has
# worked
if(mysql_num_rows($sometmpRs) == 1)
{
# If there is only one row for the given
# instance of the element as it appears in a
# submission
# Read the record into an array...
$line = mysql_fetch_array($sometmpRs);
# Display a link to a page that contains the
# details of the element instance...
print("<TR>\n");
print("<TD ALIGN='center'><A HREF='pageDets"
. "EDS.php?subname=" . $line["subname"]
. "&pageNumber=" . $aRow["pagenb"] . "&nPgs="
. $line["nbpg"] . "&doctype="
. $line["docname"] . "'>[" . $line["subname"]
. " Page " . $aRow["pagenb"]
. "]</A>\n</TD>\n</TR>\n");
} // END if
} // END if
} // END while
} // END if
else
{
# In this case, there are no submission pages that use
# this element description to make element instances
print("<TR>\n");
print("<TD ALIGN='center'>\n<SPAN STYLE=\"text-align: "
. "center; font-color: red; font-size: small\">Element"
. " Not Used In EDS Submissions</SPAN>\n</TD>\n</TR>");
} // END else
print("</TABLE>\n");
# divide page sections
drawSeparator();
# finished button:
print("<TABLE ALIGN='center' BORDER=0 CELLSPACING=0 "
. "CELLPADDING=0>\n<TR>\n<TD ALIGN='center'>\n"
. "<FORM ACTION='");
# Send browser to correct page
if($caller == "pageDetsEDS.php")
{
# pass back all of the extra
# info that is needed for going back to a given page of
# a given submission
print("pageDetsEDS.php' METHOD='post'>\n<INPUT "
. "TYPE='hidden' NAME='subname' VALUE='$subname"
. "'>\n<INPUT TYPE='hidden' NAME='pageNumber' VALUE='"
. "$pageNumber'>\n<INPUT TYPE='hidden' NAME='nPgs' "
. "VALUE='$nPgs'>\n<INPUT TYPE='hidden' NAME='doctype'"
. " VALUE='$doctype'>\n");
} // END if
else
{
# Came from allElementsEDS.php area, so go back
print("allElementsEDS.php' METHOD='post'>\n");
} // END else
print("<TD ALIGN='center'>\n<INPUT TYPE='button' "
. "VALUE='FINISHED' onClick=\"submit();\">\n</TD>\n</FORM>"
. "\n</TR>\n</TABLE>\n</P>\n");
# Free query result
mysql_free_result($othersRes);
} // END if
} // END if
elseif(mysql_num_rows($queryResult) > 1)
{
# more than 1 row for the
# element DESCRIPTION stored in the sbmFIELDDESC table, which
# means that the sbmFIELDDESC table must have some kind of
# primary key violations
print("<P CLASS='errorMsg'><SPAN STYLE=\"color: red\">ERROR:"
. "</SPAN> More than one row of data concerning the element "
. "description <EM>$name</EM> has been returned from "
. "the <EM>sbmFIELDDESC</EM> table.<BR>This indicates primary "
. "key duplication in this table.<BR>Please inform system "
. "administrator.</P>\n");
# Send a mail to the system admin people to warn them about
# this serious error..
$msgTxt = "When the elementConfigdetsEDS.php page attempted "
. "to retrieve the details of the <EM>$name</EM> element "
. "description, several rows were returned from the sbmFIELDDESC"
. " table. The query was made using the name field as the "
. "search key. As this field should uniquely "
. "identify an element description in EDS, there "
. "must be key violations in this table.\n\nThis problem "
. "should be corrected immediately.\n\nWebSubmit Administrator (";
$msgTxt .= makeDate();
$msgTxt .= ")";
mail(ADMIN_EMAIL, "sbmFIELDDESC Table Possible Key Violation!",
$msgTxt, "From: WebSubmit_Administrator");
} // END elseif
elseif(mysql_num_rows($queryResult) == 0)
{
# element DESCRIPTION has no entry
# in the sbmFIELDDESC table. This is a problem, as a link was
# clicked to get to this element, so there are references
# (probably element instances of it) somewhere in EDS, when
# the description of it doesn't exist. this is a
# data inconsistency problem.
print("<P CLASS='errorMsg'><SPAN STYLE=\"color: red\">"
. "ERROR:</SPAN> No data concerning the <EM>$name</EM> "
. "element description was found in the <EM>sbmFIELDDESC</EM> "
. "table.<BR>This suggests a data consistency error in"
. " the " . DOCS_DATABASE . " database.<BR>Please inform the "
. "system administrator.</P>\n");
# Now send an email to the administrator(s) to inform them of
# this error
$msgTxt = "When the elementConfigDetsEDS.php script attempted"
. " to retrieve the details of the $name element description,"
. " no rows were returned from the sbmFIELDDESC table.\n\n"
. "Because the user had to click a link to get to this page "
. "for the given element description, its details must be "
. "referred to in other tables of EDS. This suggests that "
. "there are either data inconsistencies or concurrency "
. "problems within EDS.\n\nThis should be investigated and "
. "corrected ASAP.\n\nWebSubmit Administrator (";
$msgTxt .= makeDate();
$msgTxt .= ")";
mail(ADMIN_EMAIL, "Possible Data Inconsistency Error!",
$msgTxt, "From: WebSubmit_Administrator");
} // END elseif
else
{
# Some other sort of error has ocurred, so present the error
# message on the screen.
print("<P CLASS='errorMsg'><SPAN STYLE=\"color: red\">"
. "ERROR:</SPAN> Unable to correctly retrieve data from the"
. " <EM>sbmFIELDDESC</EM> table of " . DOCS_DATABASE
. ".<BR>Please inform system administrator.</P>\n");
} // END else
# free query result
mysql_free_result($queryResult);
} // END if
else
{
# In this case, the query failed, so we must display the relevant
# error message
print("<P CLASS='errorMsg'><SPAN STYLE=\"color: red\">"
. "ERROR:</SPAN> Unable to conduct a query on the "
. "<EM>sbmFIELDDESC</EM> table of " . DOCS_DATABASE . ".<BR>Please"
. " inform system administrator.</P>\n");
} // END else
} // END function fabricateElementDetsFormEDS()
function displayPage()
{
global $doctype,$update,$changeType,$val,$rows,$cols,$cookie,$alephcode,$marccode,$type,$size,$maxlength,$fidesc,$name,$subname,$pageNumber,$nPgs,$caller,$modifytext;
# Conduct a test to see if this is the first call to this page, or a
# recursive call whereby the user is attempting to update the
# element descriptions details
if($update)
{
# In this case, this is a call to update the Element description.
# Therefore, update it, and redirect the "pageDetsEDS.php" page.
$updtStr = "UPDATE sbmFIELDDESC SET ";
# determine what kind of element we are
# actually updating here, as we only need to amend certain fields
# for certain elements
if($type == "T")
{
# <TEXTAREA> element.
$updtStr .="rows = '$rows', cols = '$cols', cookie = "
. "'$cookie', alephcode = '$alephcode', marccode = '$marccode', modifytext = '$modifytext'";
} // END if
elseif($type == "I")
{
# normal html text input
$updtStr .= "size = '$size', maxlength = '$maxlength', val = "
. "'$val', cookie = '$cookie', alephcode = '$alephcode', marccode = '$marccode', modifytext = '$modifytext'";
} // END elseif
elseif($type == "H")
{
# hidden input field.
$updtStr .= "val = '$val', cookie = '$cookie', alephcode = '$alephcode', marccode = '$marccode', modifytext = '$modifytext'";
} // END elseif
elseif($type == "F")
{
# file input type.
$updtStr .= "size = '$size', maxlength = '$maxlength', cookie"
. " = '$cookie', alephcode = '$alephcode', marccode = '$marccode', modifytext = '$modifytext'";
} // END elseif
elseif($type == "D")
{
# user defined input type.
$updtStr .= "fidesc = '$fidesc', cookie = '$cookie', alephcode = '$alephcode', marccode = '$marccode', modifytext = '$modifytext'";
} // END elseif
elseif($type == "R")
{
# response input type.
$updtStr .= "fidesc = '$fidesc', alephcode = '$alephcode', marccode = '$marccode', modifytext = '$modifytext'";
} // END elseif
elseif($type == "S")
{
# select box input type.
$updtStr .= "fidesc = '$fidesc', cookie = '$cookie', alephcode = '$alephcode', marccode = '$marccode', modifytext = '$modifytext'";
} // END elseif
else
{
# Element type is something unknown, so we will perform no
# updates upon it.
# Set an error flag...
$error = 1;
} // END else
if(isset($error))
{
# The error flag is set, so do no further processing. Simply
# display an error message, and redirect the page to
# pageDetsEDS.php.
print("<P CLASS=\"errorMsg\"><SPAN STYLE=\"color: red\">"
. "ERROR:</SPAN> Invalid Element Type. Cannot Update."
. "</P>\n");
print("<FORM ACTION='");
# Send the browser to the relevant page
if($caller == "pageDetsEDS.php")
{
print("pageDetsEDS.php' METHOD='post' "
. "NAME='referForm'>\n"
. "<INPUT TYPE='hidden' NAME='subname' VALUE='$subname'>\n"
. "<INPUT TYPE='hidden' NAME='pageNumber' "
. "VALUE='$pageNumber'>\n<INPUT TYPE='hidden' NAME='nPgs'"
. "VALUE='$nPgs'>\n<INPUT TYPE='hidden' NAME='doctype' "
. "VALUE='$doctype'>\n");
} // END if
else
{
print("allElementsEDS.php' METHOD='post' NAME='referForm'"
. ">\n");
} // END else
print("<TABLE ALIGN='center' BORDER=0>\n<TR>\n<TD ALIGN='"
. "center'>\n<INPUT TYPE='button' VALUE='OK' onClick=\""
. "submit();\">\n</TD>\n</TR>\n</TABLE>\n</FORM>\n<SCRIPT "
. "LANGUAGE=\"JavaScript\">\nsetTimeout(\"document.referForm"
. ".submit();\", 0);\n</SCRIPT>\n");
} // END if
else
{
# Get the data, so that it can be committed for the
# modification date field (md)
$dateDets = getdate();
# Now put the date into a variable in a nice MySQL friendly
# format
$modifiedDate = $dateDets['year'] . "-" . $dateDets['mon']
. "-" . $dateDets['mday'];
$updtStr .= ", md = '$modifiedDate' WHERE name = '$name'";
# Now execute the query, and take the relevant action based
# upon its result
$updtRes = mysql_query($updtStr);
if($updtStr)
{
# update has been executed successfully
if(mysql_affected_rows() == 1)
{
# Display a nice message informing the user that the
# update has been carried out...
print("<P STYLE=\"color: green; text-align: center; "
. "font-style: bold; font-size: large\">Element "
. "Description Modification Complete</P>\n");
# Send the administrator a message to inform them of the
# update that has taken place
$msgTxt = "An update has been carried out on the $name"
. " element description in the " . DOCS_DATABASE
. " database.\n\nWebSubmit Administrator (";
$msgTxt .= makeDate();
$msgTxt .= ")";
mail(ADMIN_EMAIL, "$name Element Description Updated",
$msgTxt, "From: WebSubmit_Administrator");
# We can now redirect the browser back to the the page
# showing the details of the element as it appears
# on the given submission type, or simply redisplay the
# form with the elements details in it if this came from
# the allElementsEDS.php area
print("<FORM ACTION='");
if($caller == "pageDetsEDS.php")
{
print("pageDetsEDS.php' METHOD='post' NAME='referFor"
. "m'>\n<INPUT TYPE='hidden' NAME='subname' VALUE='"
. "$subname'>\n<INPUT TYPE='hidden' NAME='pageNumber"
. "' VALUE='$pageNumber'>\n<INPUT TYPE='hidden' "
. "NAME='nPgs' VALUE='$nPgs'>\n<INPUT TYPE='hidden' "
. "NAME='doctype' VALUE='$doctype'>\n");
} // End if
else
{
print("elementConfigDetsEDS.php' METHOD='post' "
. "NAME='referForm'>\n<INPUT TYPE='hidden' "
. "NAME='caller' VALUE='$caller'>\n<INPUT TYPE='"
. "hidden' NAME='name' VALUE='$name'>\n");
} // END else
print("<TABLE ALIGN='center' BORDER=0>\n<TR>\n<TD "
. "ALIGN='center'>\n<INPUT TYPE='button' VALUE='OK' "
. "onClick=\"submit();\">\n</TD>\n</TR>\n</TABLE>\n"
. "</FORM>\n");
print("<SCRIPT TYPE='text/javascript'>\n"
. "setTimeout(\"document.referForm.submit();\", "
. "1000);\n</SCRIPT>\n");
} // END if
elseif(mysql_affected_rows() > 1)
{
# More than 1 row was updated -> bad news: key
# duplication
# Display an error message about this...
print("<P CLASS='errorMsg'><SPAN STYLE=\"color: red\">"
. "ERROR:</SPAN> Multiple rows have been updated in the"
. " <EM>sbmFIELDDESC</EM> table.<BR>This has resulted from"
. " an attempt to update the <EM>$name</EM> element "
. "description."
. "<BR>Please inform the system administrator.</P>\n");
# Now, email the administrator to let them know this, as
# it is a potentially dangerous error.
$msgTxt = "When a user updated the details of "
. "the $name element description using the EDS "
. "Administrator, several rows were affected in the "
. "sbmFIELDDESC table. The update was conducted using the"
. " \"name\" field as the key. As the \"name\" field "
. "is the primary key for the sbmFIELDDESC table, this "
. "means that there must be key violations in this "
. "table. There should only have been 1 row affected "
. "by this update.\n\nThis problem should be investiga"
. "ted and corrected immediately.\n\nWebSubmit Administrator"
. " (";
$msgTxt .= makeDate();
$msgTxt .= ")";
mail(ADMIN_EMAIL, "ERROR: sbmFIELDDESC Table Multiple Row"
. " Update!", $msgTxt, "From: WebSubmit_Administrator");
} // END elseif
else
{
# No rows were updated
# Display an error message about this...
print("<P CLASS='errorMsg'><SPAN STYLE=\"color: red\">"
. "ERROR:</SPAN> No rows have been updated in the "
. "<EM>sbmFIELDDESC</EM> table.<BR>This suggests that "
. "there could be data inconsistencies or concurrency "
. "problems.<BR>Please inform the system administrator"
. ".</P>\n");
# email the administrator & let them know...
$msgTxt = "When a user attempted to update the details"
. " of the $name element description using the EDS "
. "Administrator, no rows were affected in the sbmFIELDDE"
. "SC table by this update.\n\nBecause the user must "
. "have altered an element descriptions details to "
. "submit an update on it, it must have been present at"
. " around the time that the user submitted their "
. "update.\n\nThis 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");
} // END else
} // END if
else
{
# In this case, the execution of the query has not been
# successful, so we can display an error message, and
# redirect the page focus to "pageDetsEDS.php".
print("<P CLASS='errorMsg'><SPAN STYLE=\"color: red\">"
. "ERROR:</SPAN> No rows have been updated in the <EM>"
. "sbmFIELDDESC</EM> table.<BR>This was because it was not "
. "possible to conduct an UPDATE query.<BR>Please inform"
. " the system administrator.</P>\n");
} // END else
} // END else
} // END if
elseif(isset($changeType))
{
# we are changing the element type of the element,
# so we must update the type to the new type, then redisplay the
# form.
unset($changeType);
# update the type of the element to be whatever was
# selected.
if($type == "UNKNOWN_TYPE")
{
# simply redisplay the form, as the user
# has attempted to set the element type to unknown.
if($caller == "pageDetsEDS.php")
{
# Ensure that the function is called with the info to send
# it back to pageDetsEDS.php in the end.
fabricateElementDetsFormEDS($name, $caller,
$subname, $pageNumber, $nPgs, $doctype);
} // END if
else
{
# Just send the info req'd for eventual resending to the
# allElementsEDS.php page...
fabricateElementDetsFormEDS($name, $caller);
} // END else
} // END if
else
{
# element is ready for updating to the new type
# Get the data, so that it can be committed for the
# modification date field (md)...
$dateDets = getdate();
# Now put the date into a variable in a nice MySQL friendly
# format
$modifiedDate = $dateDets['year'] . "-" . $dateDets['mon']
. "-" . $dateDets['mday'];
$chTypeQ = "UPDATE sbmFIELDDESC SET type = '$type', "
. "md = '$modifiedDate'";
# check if the fields concerned with each row are
# blank, and if so, add some default values to them.
# Therefore, we must query the sbmFIELDDESC table.
$valsRes = mysql_query("SELECT * FROM sbmFIELDDESC WHERE name ="
. " '$name'");
if($valsRes)
{
$valsRow = mysql_fetch_array($valsRes);
if($type == "F" || $type == "I")
{
# The input type is a FILE input or a text input, both
# of whom have a size & maxlength field...
if($valsRow["size"] == "")
{
# No val for size, so give it one!
$chTypeQ .= ", size = '" . DEFAULT_SIZE . "'";
} // END if
if($valsRow["maxlength"] == "")
{
# No val for maxlength, so give it one
$chTypeQ .= ", maxlength = '" . DEFAULT_MAXLENGTH
. "'";
} // END if
} // END if
elseif($type == "T")
{
# changing the element to a <textarea> field..
if($valsRow["rows"] == "")
{
# No val for rows, so give it one...
$chTypeQ .= ", rows = '" . DEFAULT_ROWS . "'";
} // END if
if($valsRow["cols"] == "")
{
# No val for cols, so give it one...
$chTypeQ .= ", cols = '" . DEFAULT_COLS . "'";
} // END if
} // END elseif
mysql_free_result($valsRes);
} // END if
$chTypeQ .= " WHERE name = '$name'";
$chTypeQres = mysql_query($chTypeQ);
if(!$chTypeQres)
{
# Query failed. We will output an error message, and
# simply refresh the screen.
print("<SCRIPT TYPE='text/javascript'>\nalert('Unable to "
. "change element type.');\n</SCRIPT>\n");
} // END if
else
{
if(mysql_affected_rows() < 1)
{
# No update has been made. Better just tell the
# user & redisplay the form
print("<SCRIPT TYPE='text/javascript'>\nalert('Unable "
. "To Update Element Type');\n</SCRIPT>\n");
} // END if
elseif(mysql_affected_rows() > 1)
{
# More than 1 row was affected.
print("<SCRIPT TYPE='text/javascript'>\nalert('ERROR: "
. "Multiple Element Descriptions Updated');\n"
. "</SCRIPT>\n");
$msgTxt = "When a user attempted to change the type of "
. "the $name element description in the "
. DOCS_DATABASE . " database, "
. mysql_affected_rows() . " rows were updated in "
. "the sbmFIELDDESC table.\n\nWebSubmit Administrator ("
. makeDate() . ")";
mail(ADMIN_EMAIL, "Error: $name Element Desc - Multiple"
. " Updates", $msgTxt, "From: WebSubmit_Administrator");
} // END elseif
else
{
$msgTxt = "The type of the $name element description in"
. " the " . DOCS_DATABASE . " database, has been "
. "changed.\n\nWebSubmit Administrator (" . makeDate() . ")";
mail(ADMIN_EMAIL, "$name Element Desc Type Change",
$msgTxt, "From: WebSubmit_Administrator");
} // END else
} // END else
# Now we can redisplay our form for the new doctype...
if($caller == "pageDetsEDS.php")
{
# Ensure that the function is called with the info to send
# it back to pageDetsEDS.php in the end.
fabricateElementDetsFormEDS($name, $caller,
$subname, $pageNumber, $nPgs, $doctype);
} // END if
else
{
# Just send the info req'd for eventual resending to the
# allElementsEDS.php page...
fabricateElementDetsFormEDS($name, $caller);
} // END else
} // END else
} // END elseif
else
{
# Display the form containing the details of the Element
# description to update...
if($caller == "pageDetsEDS.php")
{
# Ensure that the function is called with the info to send
# it back to pageDetsEDS.php in the end.
fabricateElementDetsFormEDS($name, $caller, $subname,
$pageNumber, $nPgs, $doctype);
} // END if
else
{
# Just send the info req'd for eventual resending to the
# allElementsEDS.php page...
fabricateElementDetsFormEDS($name, $caller);
} // END else
} // END else
}
/**********************Start of main script***************************/
$caller = getCallingPage($HTTP_REFERER);
# Connect to the MySQL server
serverConnect(MYSQLDOCMACHINE, MYSQLDOCUSERID, MYSQLDOCPASSWORD);
# Select the CDS Search database...
dbSelect(DOCS_DATABASE);
$auth = canUseWebSubmitAdmin($uid,$doctype);
if (!$auth[0])
outWarning($auth[1]. "<br><br>" . "You are not allowed to access WebSubmit Admin for this type of documents");
else
displayPage();
/************************End of main script***************************/
</protect>
?>

Event Timeline