Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F87931898
addElementDescrEDS.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
Tue, Oct 15, 20:00
Size
36 KB
Mime Type
text/x-c
Expires
Thu, Oct 17, 20:00 (1 d, 21 h)
Engine
blob
Format
Raw Data
Handle
21685112
Attached To
R3600 invenio-infoscience
addElementDescrEDS.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="Add an element description" \
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_listelements"
<?
<protect>
## $Id$
## DO NOT EDIT THIS FILE! IT WAS AUTOMATICALLY GENERATED FROM CDS Invenio WML SOURCES.
/*********************Function Descriptions***************************/
function enterEDSelementDescr($elename = "", $alephcode = "",
$size = "", $rows = "", $cols = "", $maxlength = "", $val = "",
$fidesc = "", $cookie = 0, $type = "", $modifytext = "")
{
/*******************************************************************
This function has the task of creating the form that allows a
user to enter the details of a new element description.
Author: Nicholas Robinson
Email: Nicholas.Robinson@cern.ch
ca8nro@yahoo.co.uk
Created: 10/01/2001
Last Modified: 08/02/2001
*******************************************************************/
# 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, is "
. "a form in which you can enter the details of a new "
. "element description."
. "<BR><BR>When you enter a new element description, it will "
. "not be accepted by the system unless you have given it a "
. "unique<BR>\"Element Name\".<BR>"
. "<BR>You can commit this new element description to the "
. "database by clicking on \"SAVE DETAILS\".</P>\n</TD>\n"
. "</TR>\n</TABLE>\n");
# Make a horizontal rule to divide the page sections...
drawSeparator();
print("<FORM ACTION='addElementDescrEDS.php' METHOD='post'>\n"
. "<INPUT TYPE='hidden' NAME='commitElement' VALUE='true'>\n"
. "<TABLE BORDER=1 CELLSPACING=0 CELLPADDING=0 ALIGN='center' "
. "WIDTH='100%'>\n");
# Get the columns list
$columns = mysql_list_fields(DOCS_DATABASE, "sbmFIELDDESC");
# Get the number of fields
$numTblFlds = mysql_num_fields($columns);
# Get the data, so that it can be committed for the modification
# date field (md)...
$dateDets = makeEDSmdDate();
# Now display the upper part of the table - fields that are system
# generated...
print("<TABLE WIDTH='100%' ALIGN='center' CELLSPACING=0 "
. "CELLPADDING=0 BORDER=0><INPUT TYPE='hidden' NAME='cd' VALUE='"
. "$dateDets'><INPUT TYPE='hidden' NAME='md' "
. "VALUE='$dateDets'>");
# Now create the fields that the user can edit...
# Make the name field...
print("<TR>\n<TH BGCOLOR='#87CEFA' ALIGN='right' WIDTH='20%'>\n"
. "Element Name <EM STYLE=\"font-size: small\">"
. "(Req'd)</EM>: </TH>\n<TD ALIGN='left' WIDTH='80%' "
. "BGCOLOR='#FFFFCC'>\n<INPUT TYPE='text' NAME='elename' SIZE="
. mysql_field_len($columns, 0) . " VALUE='"
. ereg_replace("'", "'",
htmlspecialchars($elename))
. "'>\n</TD>\n</TR>\n");
# Make the modify text field...
print("<TR>\n<TH BGCOLOR='#87CEFA' ALIGN='right' WIDTH='20%'>\n"
. "Modification Text: </TH>\n<TD ALIGN='left' WIDTH='80%' "
. "BGCOLOR='#FFFFCC'>\n<INPUT TYPE='text' NAME='modifytext' SIZE="
. mysql_field_len($columns, 0) . " VALUE='"
. ereg_replace("'", "'",
htmlspecialchars($modifytext))
. "'>\n</TD>\n</TR>\n");
# Make the type field...
print("<TR>\n<TH BGCOLOR='#87CEFA' ALIGN='right' WIDTH='20%'>\n"
. "Element Type <EM STYLE=\"font-size: small\">(Req'd)</EM>: "
. "</TH>\n<TD ALIGN='left' WIDTH='80%' BGCOLOR='#FFFFCC'>\n"
. "<SELECT NAME='type'>\n<OPTION VALUE='NONE_SELECTED'>"
. "Select Element Type...</OPTION>\n");
# Now test to see if this is a recall (due to erroneous form
# filling), whereby a given type must be 'selected'.
# Make User defined type option
print("<OPTION ");
if($type == "D")
{
# D was already selected...
print("SELECTED ");
} // END if
print("VALUE='D'>User Defined Input</OPTION>\n");
# Make Select box type option
print("<OPTION ");
if($type == "S")
{
# S was already selected...
print("SELECTED ");
} // END if
print("VALUE='S'>Select Box</OPTION>\n");
# Make File input type option
print("<OPTION ");
if($type == "F")
{
# F was already selected...
print("SELECTED ");
} // END if
print("VALUE='F'>File Input</OPTION>\n");
# Make Hidden input type option...
print("<OPTION ");
if($type == "H")
{
# H was already selected...
print("SELECTED ");
} // END if
print("VALUE='H'>Hidden Input</OPTION>\n");
# Make Text input type option...
print("<OPTION ");
if($type == "I")
{
# I was already selected...
print("SELECTED ");
} // END if
print("VALUE='I'>Text Input</OPTION>\n");
# Make Response type option...
print("<OPTION ");
if($type == "R")
{
# I was already selected...
print("SELECTED ");
} // END if
print("VALUE='R'>Response</OPTION>\n");
# Make TextArea input type option...
print("<OPTION ");
if($type == "T")
{
# T was already selected...
print("SELECTED ");
} // END if
print("VALUE='T'>Text Area Element</OPTION>\n</SELECT>\n</TD>\n"
. "</TR>\n");
for($indx = 0; $indx < $numTblFlds; $indx++)
{
# Get the name of the current field...
$currentField = mysql_field_name($columns, $indx);
# Ensure we dont once again print certain fields
if(($currentField != "cd") && ($currentField != "md")
&& ($currentField != "name") && ($currentField != "type")
&& ($currentField != "cookie") && ($currentField != "modifytext")
&& ($currentField != "fddfi2"))
{
# First display the form field label...
print("<TR>\n<TH BGCOLOR='#87CEFA' ALIGN='right' "
. "WIDTH='20%'>\n");
if($currentField == "alephcode")
{
print("Aleph Code <EM STYLE=\"font-size: small\">"
. "</EM>:");
} // END if
elseif($currentField == "marccode")
{
print("Marc Code:");
} // END elseif
elseif($currentField == "size")
{
print("Size <EM STYLE=\"font-size: small\">(Text"
. ")</EM>:");
} // END elseif
elseif($currentField == "rows")
{
print("No. Rows <EM STYLE=\"font-size: small\">(TextArea)"
. "</EM>:");
} // END elseif
elseif($currentField == "cols")
{
print("No. Cols <EM STYLE=\"font-size: small\">(TextArea)"
. "</EM>:");
} // END elseif
elseif($currentField == "maxlength")
{
print("Max Length <EM STYLE=\"font-size: small\">(Text)"
. "</EM>:");
} // END elseif
elseif($currentField == "val")
{
print("Value <EM STYLE=\"font-size: small\">(Text"
. "/Hidden)</EM>:");
} // END elseif
elseif($currentField == "fidesc")
{
print("Item Description <EM STYLE=\"font-size: small\">"
. "(User Defined)</EM>:");
} // END elseif
else
{
print("$currentField:");
} // END else
print(" </TH>\n<TD ALIGN='left' WIDTH='80%' BGCOLOR='"
. "#FFFFCC'>\n");
if($currentField == "fidesc")
{
# Here, we ought to make a textarea for fidesc...
print("<TEXTAREA NAME='$currentField' ROWS=25 COLS=50>"
. ereg_replace("'", "'",
htmlspecialchars(${mysql_field_name($columns, $indx)}))
. "</TEXTAREA>\n");
} // END if
else
{
# Just a normal text input will do...
print("<INPUT TYPE='text' NAME='$currentField' "
. "SIZE=");
if(mysql_field_type($columns, $indx) == "blob")
{
print("60");
} // END if
else
{
print(mysql_field_len($columns, $indx));
} // END else
print(" VALUE='" . ereg_replace("'", "'",
htmlspecialchars(${mysql_field_name($columns, $indx)}))
. "'>\n");
} // END else
print("</TD>\n</TR>\n");
} // END if
} // END for
print("<TR>\n<TH BGCOLOR='#87CEFA' ALIGN='right' WIDTH='20%'>\n"
. "Sets Cookie?: </TH>\n<TD ALIGN='left' BGCOLOR='#FFFFCC'"
. "WIDTH='80%'>");
printCookie($cookie);
# Close up the cookie row, and the table!
print("</TH>\n</TR>\n</TABLE>\n");
# Now make the commit, reset, and cancel buttons for the form...
print("<TABLE ALIGN='center' CELLSPACING=2 CELLPADDING=2 BORDER=0>"
. "<TR>\n<TD ALIGN='left'>\n<INPUT TYPE='button' VALUE='SAVE DETAIL"
. "S' onClick=\"submit();\">\n</TD><TD "
. "ALIGN='center'>\n<INPUT TYPE='button' VALUE='RESET' onClick=\""
. "reset();\">\n</TD>\n</FORM>\n<FORM ACTION='allElementsEDS.php' "
. "METHOD='post'>\n<TD ALIGN='left'>\n<INPUT TYPE='button' VALUE='"
. "CANCEL' onClick=\"submit();\">\n</TD>\n</FORM>\n</TR>\n</TABLE>"
. "\n");
} // END enterEDSelementDescr()
//************
function charIsInt($thing)
{
/*******************************************************************
This function tests to see if a string only contains integer
characters.
Author: Nicholas Robinson
Email: Nicholas.Robinson@cern.ch
ca8nro@yahoo.co.uk
Created: 11/01/2001
Last Modified: 11/01/2001
*******************************************************************/
# Reset an error flag
$errorFlag = 0;
# get the length of the string..
$len = strlen($thing);
for($i = 0; $i < $len; $i++)
{
if($thing[$i] < "0" || $thing[$i] > "9")
{
$errorFlag = 1;
break;
} // END if
} // END for
# Return true/false depending upon string status
return ($errorFlag == 1) ? false : true;
} // END function charIsInt($thing)
//********
function insertBon($elename)
{
/*******************************************************************
This function has the task of displaying a message on the screen
to say that the insertion of the new element was successful. It
also displays a button to click to send the browser to the page
displaying the details of the new element description.
Author: Nicholas Robinson
Email: Nicholas.Robinson@cern.ch
ca8nro@yahoo.co.uk
Created: 11/01/2001
Last Modified: 11/01/2001
*******************************************************************/
print("<P STYLE=\"font-size: large; font-weight: bold; text-align: "
. "center; color: green\">Element Added.<BR>Click To View details."
. "</P>\n<FORM ACTION='elementConfigDetsEDS.php' METHOD='post' NAME"
. "='referForm'>\n<INPUT TYPE='hidden' NAME='name' VALUE='$elename'"
. ">\n<INPUT TYPE='hidden' NAME='caller' VALUE='allElementsEDS.php"
. "'>\n<TABLE ALIGN='center' BORDER=0 CELLSPACING=0 CELLPADDING="
. "0>\n<TR>\n<TD ALIGN='center'>\n<INPUT TYPE='button' VALUE='VIEW "
. "DETAILS' onClick=\"submit();\">\n</TD>\n</TR>\n</TABLE>\n</FORM>"
. "\n<SCRIPT TYPE='text/javascript'>\nsetTimeout(\"document.refer"
. "Form.submit();\",1000);\n</SCRIPT>\n");
} // END function insertBon()
//***********
function insertMal()
{
/*******************************************************************
This function handles the situation whereby the insert of the new
element description has failed, and we wish to inform the user,
and provide a button to click to goto the list all element
descriptions page.
Author: Nicholas Robinson
Email: Nicholas.Robinson@cern.ch
ca8nro@yahoo.co.uk
Created: 12/01/2001
Last Modified: 12/01/2001
*******************************************************************/
print("<P CLASS=\"errorMsg\">\n<SPAN STYLE=\"color: red\">ERROR:"
. "</SPAN> Unable to insert new element description.</P>\n"
. "<TABLE ALIGN='center' BORDER=0>\n<TR>\n<TD ALIGN='center'>\n"
. "<FORM ACTION='allElementsEDS.php' METHOD='post'>\n<INPUT TYPE="
. "'button' VALUE='OK' onClick=\"submit();\">\n</FORM>\n</TD>\n"
. "</TR>\n</TABLE>\n");
print mysql_error();
} // END function insertMal()
//************
function emailRecord($elename)
{
/*******************************************************************
Since it is necessary to email the admin informing them about the
success of the addition of a new element description, this
function has been written, which does just that.
Author: Nicholas Robinson
Email: Nicholas.Robinson@cern.ch
ca8nro@yahoo.co.uk
Created: 11/01/2001
Last Modified: 25/01/2001
*******************************************************************/
$msgTxt = "A new element description was successfully added to the "
. DOCS_DATABASE . " database. This was the $elename element "
. "description.\n\nWebSubmit Administrator. (";
$msgTxt .= makeDate();
$msgTxt .= ")";
# Now send the mail..
mail(ADMIN_EMAIL, "$elename Element Description Added",
$msgTxt, "From: WebSubmit_Administrator");
} // END function emailRecord($elename)
function displayPage()
{
global $commitElement,$elename,$alephcode,$marccode,$size,$rows,$cols,$maxlength,$val,$fidesc,$cookie,$type,$modifytext;
if($commitElement)
{
# In this case, this is a self-referential call to the form, and
# it is time to process the addition of the new element.
# Carry out some form validation and take the relevant action
# based upon the resuts
if($type == "NONE_SELECTED")
{
# In this case, the user has not selected a type for the new
# element. Therefore redisplay the form with the values in
# that they have already entered.
print("<P STYLE=\"font-size: medium; text-align: center; "
. "font-weight: bold; color: red\">Selection Of Element "
. "Type is Mandatory.</P>\n");
enterEDSelementDescr($elename, $alephcode, $size,
$rows, $cols, $maxlength, stripslashes($val),
stripslashes($fidesc), $cookie, "",$modifytext);
} // END if
else
{
# The element type was selected, but we must now ensure that
# the other various field combos were correct
if(!$elename)
{
# User has not input the element name, or aleph code.
print("<P STYLE=\"font-size: medium; text-align: center; "
. "font-weight: bold; color: red\">The Element Name "
. "Field Is Mandatory.</P>\n");
enterEDSelementDescr($elename, $alephcode, $size,
$rows, $cols, $maxlength, stripslashes($val),
stripslashes($fidesc), $cookie, $type, $modifytext);
} // END if
else
{
if(!test_key_legal($elename))
{
# invalid characters in either the alephcode or the element name
print("<P STYLE=\"font-size: medium; text-align: center"
. "; font-weight: bold; color: red\">The Element Name "
. "May Only Contain Alphabetical"
. " Characters, Integer Digits or Underscores.</P>\n");
enterEDSelementDescr("", $alephcode, $size,
$rows, $cols, $maxlength, stripslashes($val),
stripslashes($fidesc), $cookie, $type,$modifytext);
} // END if
else
{
# General Mandatory fields all filled correctly. Now
# make specialised tests
if($type == "T")
{
# Element is TextArea - can have rows and cols.
if($rows)
{
if(!charIsInt($rows))
{
# non-int value given for $rows
print("<P STYLE=\"font-size: medium; text-ali"
. "gn: center; font-weight: bold; color: "
. "red\">The <EM>No. Rows</EM> Field Must Have"
. " an Integer Value.</P>");
# Make an error flag to mark this fact
$rowsInvalid = true;
enterEDSelementDescr($elename,
$alephcode,
$size, "", $cols, $maxlength,
stripslashes($val), stripslashes($fidesc),
$cookie, $type,$modifytext);
} // END if
} // END if
if($cols && !$rowsInvalid)
{
if(!charIsInt($cols))
{
# non-int value given for $rows
print("<P STYLE=\"font-size: medium; text-ali"
. "gn: center; font-weight: bold; color: "
. "red\">The <EM>No. Cols</EM> Field Must Have"
. " an Integer Value.</P>");
# Set an error flag to mark this failure
$colsInvalid = true;
enterEDSelementDescr($elename,
$alephcode, $size, $rows, "", $maxlength,
stripslashes($val),
stripslashes($fidesc), $cookie, $type,$modifytext);
} // END if
} // END if
if(!$rowsInvalid && !$colsInvalid)
{
# Well now. If we have reached this far, then the
# TEXTAREA present and valid: make new element description and commit to DB
$insStr = "INSERT INTO sbmFIELDDESC (name, alephcode"
. ", marccode, type, size, rows, cols, maxlength, val, "
. "fidesc, cd, md, modifytext, fddfi2, cookie) VALUES"
. "('$elename', '$alephcode', '$marccode', '$type', NULL, ";
# Deal with rows
if(isset($rows) && $rows != "")
{
# A value was provided for rows
$insStr .= "'$rows', ";
} // END if
else
{
# No value was provided for rows
$insStr .= "NULL, ";
} // END else
# Deal with cols
if(isset($cols) && $cols != "")
{
# A value was provided for rows
$insStr .= "'$cols', ";
} // END if
else
{
# No value was provided for rows
$insStr .= "NULL, ";
} // END else
$insStr .= "NULL, NULL, NULL, NOW(), NOW(), ".(isset($modifytext)?"'$modifytext', ":"NULL, ") . " NULL, '$cookie')";
$insRes = mysql_query($insStr);
if($insRes)
{
# insert of element description successful.
emailRecord($elename);
insertBon($elename);
} // END if
else
{
insertMal();
} // END else
} // END if
} // END if
elseif($type == "I")
{
# Element is HTML text input - needs size, maxlength, val
if($size)
{
if(!charIsInt($size))
{
# non-int value given for $size
print("<P STYLE=\"font-size: medium; text-ali"
. "gn: center; font-weight: bold; color: "
. "red\">The <EM>Size</EM> Field Must Have an"
. " Integer Value.</P>");
# Make a flag to mark this failure
$sizeFailed = true;
enterEDSelementDescr($elename,
$alephcode, "", $rows, $cols, $maxlength,
stripslashes($val), stripslashes($fidesc),
$cookie, $type,$modifytext);
} // END if
} // END if
if($maxlength && !$sizeFailed)
{
if(!charIsInt($maxlength))
{
# non-int value given for $maxlength
print("<P STYLE=\"font-size: medium; text-alig"
. "n: center; font-weight: bold; color: red\">"
. "The <EM>Max Length</EM> Field Must Have an "
. "Integer Value.</P>");
# Make a flag to mark this failure
$maxlengthFailed = true;
enterEDSelementDescr($elename,
$alephcode, $size, $rows, $cols, "",
stripslashes($val), stripslashes($fidesc),
$cookie, $type,$modifytext);
} // END if
} // END if
if(!$sizeFailed && !$maxlengthFailed)
{
# commit new element description to DB
$insStr = "INSERT INTO sbmFIELDDESC (name, alephcode, marccode"
. ", type, size, rows, cols, maxlength, val, "
. "fidesc, cd, md, modifytext, fddfi2, cookie) "
. "VALUES('$elename', '$alephcode', '$marccode', '$type', ";
# Deal with size
if(isset($size) && $size != "")
{
# A value was provided for rows
$insStr .= "'$size', ";
} // END if
else
{
# No value was provided for rows
$insStr .= "NULL, ";
} // END else
$insStr .= "NULL, NULL, ";
# Deal with maxlength
if(isset($maxlength) && $maxlength != "")
{
# A value was provided for rows
$insStr .= "'$maxlength', ";
} // END if
else
{
# No value was provided for rows
$insStr .= "NULL, ";
} // END else
# Deal with val
if(isset($val) && $val != "")
{
# A value was provided for rows
$insStr .= "'$val', ";
} // END if
else
{
# No value was provided for rows
$insStr .= "NULL, ";
} // END else
$insStr .= "NULL, NOW(), NOW(), ".(isset($modifytext)?"'$modifytext', ":"NULL, ")."NULL, "
. "'$cookie')";
$insRes = mysql_query($insStr);
if($insRes)
{
# insert of element description successful
emailRecord($elename);
insertBon($elename);
} // END if
else
{
insertMal();
} // END else
} // END if
} // END elseif
elseif($type == "H")
{
# Element is hidden - can have val
$insStr = "INSERT INTO sbmFIELDDESC (name, alephcode, marccode, "
. "type, size, rows, cols, maxlength, val, fidesc, "
. "cd, md, modifytext, fddfi2, cookie) VALUES('"
. "$elename', '$alephcode', '$marccode', '$type', NULL, NULL, "
. "NULL, NULL, ";
# Deal with val
if(isset($val) && $val != "")
{
# A value was provided for rows
$insStr .= "'$val', ";
} // END if
else
{
# No value was provided for rows
$insStr .= "NULL, ";
} // END else
$insStr .= "NULL, NOW(), NOW(), ".(isset($modifytext)?"'$modifytext', ":"NULL, ")."NULL, "
. "'$cookie')";
$insRes = mysql_query($insStr);
if($insRes)
{
# Insert successful
emailRecord($elename);
insertBon($elename);
} // END if
else
{
# Insert failed
insertMal();
} // END else
} // END elseif
elseif($type == "F")
{
# Element is file - needs size, maxlength
if($size)
{
if(!charIsInt($size))
{
# non-int value given for $size
print("<P STYLE=\"font-size: medium; text-"
. "align: center; font-weight: bold; color:"
. " red\">The <EM>Size</EM> Field Must Have "
. "an Integer Value.</P>");
# Make a flag to mark this failure
$sizeFailed = true;
enterEDSelementDescr($elename,
$alephcode, "", $rows, $cols, $maxlength,
stripslashes($val), stripslashes($fidesc),
$cookie, $type,$modifytext);
} // END if
} // END if
if($maxlength && !$sizeFailed)
{
if(!charIsInt($maxlength))
{
# non-int value given for $maxlength
print("<P STYLE=\"font-size: medium; text-alig"
. "n: center; font-weight: bold; color: red\">"
. "The <EM>Max Length</EM> Field Must Have an "
. "Integer Value.</P>");
# Make a flag to mark this failure
$maxlengthFailed = true;
enterEDSelementDescr($elename,
$alephcode, $size, $rows, $cols, "",
stripslashes($val), stripslashes($fidesc),
$cookie, $type,$modifytext);
} // END if
} // END if
if(!$sizeFailed && !$maxlengthFailed)
{
# commit new element to DB
$insStr = "INSERT INTO sbmFIELDDESC (name, alephcode"
. ", marccode, type, size, rows, cols, maxlength, val, "
. "fidesc, cd, md, modifytext, fddfi2, cookie) "
. "VALUES('$elename', '$alephcode', '$marccode', '$type', ";
# Deal with size
if(isset($size) && $size != "")
{
# A value was provided for rows
$insStr .= "'$size', ";
} // END if
else
{
# No value was provided for rows
$insStr .= "NULL, ";
} // END else
$insStr .= "NULL, NULL, ";
# Deal with maxlength
if(isset($maxlength) && $maxlength != "")
{
# A value was provided for rows
$insStr .= "'$maxlength', ";
} // END if
else
{
# No value was provided for rows
$insStr .= "NULL, ";
} // END else
$insStr .= "NULL, NULL, NOW(), NOW(), ".(isset($modifytext)?"'$modifytext', ":"NULL, ")."NULL,"
. " '$cookie')";
# Execute the insertion
$insRes = mysql_query($insStr);
if($insRes)
{
emailRecord($elename);
insertBon($elename);
} // END if
else
{
insertMal();
} // END else
} // END if
} // END elseif
elseif($type == "D")
{
# Element is user defined - needs fidesc
$insStr = "INSERT INTO sbmFIELDDESC (name, alephcode, marccode, "
. "type, size, rows, cols, maxlength, val, fidesc, "
. "cd, md, modifytext, fddfi2, cookie) VALUES('"
. "$elename', '$alephcode', '$marccode', '$type', NULL, NULL, "
. "NULL, NULL, NULL, ";
$insStr .= "'$fidesc', NOW(), NOW(), ".(isset($modifytext)?"'$modifytext', ":"NULL, ")."NULL, "
. "'$cookie')";
# Execute the insertion
$insRes = mysql_query($insStr);
if($insRes)
{
# Insert succesful
emailRecord($elename);
insertBon($elename);
} // END if
else
{
# Insert failed
insertMal();
} // END else
} // END elseif
elseif($type == "R")
{
# Element is of response type - needs fidesc
$insStr = "INSERT INTO sbmFIELDDESC (name, alephcode, marccode, "
. "type, size, rows, cols, maxlength, val, fidesc, "
. "cd, md, modifytext, fddfi2, cookie) VALUES('"
. "$elename', '$alephcode', '$marccode', '$type', NULL, NULL, "
. "NULL, NULL, NULL, ";
$insStr .= "'$fidesc', NOW(), NOW(), ".(isset($modifytext)?"'$modifytext', ":"NULL, ")."NULL, "
. "'$cookie')";
$insRes = mysql_query($insStr);
if($insRes)
{
emailRecord($elename);
insertBon($elename);
} // END if
else
{
insertMal();
} // END else
} // END elseif
elseif($type == "S")
{
# Element is user defined - needs fidesc
$insStr = "INSERT INTO sbmFIELDDESC (name, alephcode, marccode, "
. "type, size, rows, cols, maxlength, val, fidesc, "
. "cd, md, modifytext, fddfi2, cookie) VALUES('"
. "$elename', '$alephcode', '$marccode', '$type', NULL, NULL, "
. "NULL, NULL, NULL, ";
$insStr .= "'$fidesc', NOW(), NOW(), ".(isset($modifytext)?"'$modifytext', ":"NULL, ")."NULL, "
. "'$cookie')";
$insRes = mysql_query($insStr);
if($insRes)
{
emailRecord($elename);
insertBon($elename);
} // END if
else
{
insertMal();
} // END else
} // END elseif
else
{
# Element type invalid! deny commit, redisplay form
print("<P STYLE=\"font-size: medium; text-align: "
. "center; font-weight: bold; color: red\">Invalid "
. "Element Type is Mandatory.</P>\n");
enterEDSelementDescr($elename, $alephcode,
$size, $rows, $cols, $maxlength,
stripslashes($val), stripslashes($fidesc),
$cookie,"",$modifytext);
} // END else
} // END else
} // END else
} // END else
} // END if
else
{
# In this case, this is not a self-referential call to this page,
# and it is therefore time to display a form in which the user
# can enter the details of the element description...
enterEDSelementDescr();
} // 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