Page MenuHomec4science

Create_Modify_Interface.php.wml
No OneTemporary

File Metadata

Created
Sat, Nov 16, 14:40

Create_Modify_Interface.php.wml

## $Id$
## This file is part of the CERN Document Server Software (CDSware).
## Copyright (C) 2002 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.
<?
<protect>
## $Id$
## DO NOT EDIT THIS FILE! IT WAS AUTOMATICALLY GENERATED FROM CDSware WML SOURCES.
## Description: function Create_Modify_Interface
## This function creates the html form allowing the user to
## some bibliographic fields
## Author: T.Baron
## PARAMETERS: fieldnameMBI: name of the file containing the
## "+"-separated list of fields to modify
require_once ("${HTDOCSDIR}submit/MESS/functions/Retrieve_Data.php");
function Create_Modify_Interface($param_array,$MAINPATH)
{
// variables declaration
$fieldname = "$param_array[fieldnameMBI]";
$username = "$param_array[username]";
$password = "$param_array[password]";
$modifybase = "$param_array[modifybase]";
$sysno = $GLOBALS[VARS]->get_sysno();
$api_path = $GLOBALS[api_path];
// Path of file containing fields to modify
$fd = fopen( "$MAINPATH/$fieldname", "r" );
$fields = fread( $fd, filesize("$MAINPATH/$fieldname"));
fclose( $fd );
$fields = ereg_replace("\n*$","",$fields);
$fields = ereg_replace ("\n","+","$fields");
$fields = $fields . "+";
#output some text
Request_Print("A", "<CENTER bgcolor=white>The document <B>" . $GLOBALS[VARS]->get_report_number() . "</B> has been found in the database.</CENTER><BR>Please modify the following fields:<BR>Then press the 'END' button at the bottom of the page<BR>\n");
while ( $fields != "" )
{
#Get field name
$field = ereg_replace("\+.*","",$fields);
$subfield = "";
#retrieve and display the modification text
Request_Print("A", "<FONT color=darkblue>\n");
$sth = mysql_query("
SELECT modd
FROM sbmMODIFY
WHERE modn='$field'") or outError ("Create_Modify_Interface: Error in MySQL "
. "query: ".mysql_error());
$array = mysql_fetch_array($sth);
Request_Print("A", "<small>$array[0]</small> </FONT>\n");
$res = mysql_query("
SELECT marccode
FROM sbmFIELDDESC
WHERE name='$field'");
$row = mysql_fetch_row($res);
$marccode = $row[0];
$value = "";
if ($marccode != "")
$value = Get_Field("$marccode","$sysno");
$sth = mysql_query("
SELECT *
FROM sbmFIELDDESC
WHERE name = '$field'") or outError("Create_Modify_Interface: Error in MySQL "
. "query: ".mysql_error());
$array = mysql_fetch_array($sth);
$type = "$array[type]";
if ($type == "T")
$text="<TEXTAREA name=\"$field\" rows=$array[rows] cols=$array[cols] wrap>$value</TEXTAREA>";
elseif ($type == "F")
$text="<INPUT TYPE=file name=\"$field\" size=$array[size] maxlength=$array[maxlength]>";
elseif ($type == "I")
{
# JY correction, 15.6.01
$text="<INPUT name=\"$field\" size=$array[size] value=\"$value\">";
$text.="<SCRIPT>document.forms[1].$field.value=\"$value\";"
. "</SCRIPT>";
}
elseif ($type == "H")
{
$text="<INPUT type=hidden name=\"$field\" value=$array[val]>";
$text="$text<SCRIPT>document.forms[1].$field.value=\"$value\";"
. "</SCRIPT>";
}
elseif ($type == "S")
{
$value = ereg_replace("[\n\r]+","",$value);
$text="$array[fidesc]";
$text .= "<SCRIPT>
var i = 0;
while (i != document.forms[1].".$field.".length)
{
if (document.forms[1].".$field.".options[i].value != \"\")
{
if (document.forms[1].".$field.".options[i].value == \"$value\")
{
document.forms[1].".$field.".selectedIndex = i;
}
}
else
{
if (document.forms[1].".$field.".options[i].text == \"$value\")
{
document.forms[1].".$field.".selectedIndex = i;
}
}
i = i+1;
}
</script>\n";
}
elseif ($type == "D")
$text="$array[fidesc]";
else
$text="$field: unknown field type";
Request_Print("A","<small>$text</small>");
$text = "";
$fields = strstr($fields,"+");
$fields = substr($fields, 1);
}
#output some more text
Request_Print("A","<BR><BR><CENTER><small><INPUT type=button width=400 "
. "height=50 name=End value=END onClick=\"document.forms[1].step.value = 2;document.forms[1].submit();\"></small></CENTER></H4>");
}
</protect>
?>

Event Timeline