## $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. ## $Id$ //========================================================================== // File: OAIER_add.php (flexElink WI) // Description: Adds a new variable and the corresponding ER to the // configuration DB. // POST parameters: // type -----> (required) Input type the ER belongs to // varname --> (required) Internal variable name // att_id ---> (optional) varfield element attribute ID value // att_i1 ---> (optional) varfield element attribute I1 value (only // relevant if ftype=DATAFIELD) // att_i2 ---> (optional) varfield element attribute I2 value (only // relevant if ftype=DATAFIELD) // ftype ----> (required) field type (DATAFIELD, CONTROLFIELD), default // value DATAFIELD // Notes: If the variable-ER is succesfully added to the DB the current browser // is redirected to the OAI extraction rules list // Requires: DB, ERROR // Author: Hector.Sanchez@cern.ch //========================================================================== include("localconf.inc.php"); include(DB); include(ERROR); if( (!isset($type)) or (!trim($type)) ) { errorpage("Rule type hasn't been specified"); exit; } if( (!isset($varname)) or (!trim($varname)) ) { errorpage("Rule varname hasn't been specified"); exit; } if( (!isset($ftype))||(($ftype!="DATAFIELD")&&($ftype!="CONTROLFIELD")) ) $ftype="DATAFIELD"; if(!isset($att_id)) $att_id=""; if(!isset($att_i1)) $att_i1=""; if(!isset($att_i2)) $att_i2=""; $db=mysql_connect( $DB_HOST, $DB_USER, $DB_PASSWD ) or errormsg("Couldn't connect to mySQL") or exit; mysql_selectdb( $DB_DB ); $type=trim(strtoupper($type)); $varname=trim(strtoupper($varname)); $att_id=trim($att_id); $att_i1=trim($att_i1); $att_i2=trim($att_i2); $qry="insert into flxXMLMARCEXTRULES(type, varname, att_id, att_i1, att_i2, ftype) values ('$type', '$varname', '$att_id', '$att_i1', '$att_i2', '$ftype')"; if(!mysql_query( $qry )) { errorpage("Impossible to insert new rule:
".mysql_error()); mysql_close( $db ); exit; } mysql_close( $db ); header("location: OAIER_display.php"); ?>