Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F90868065
BEH_COND_edit.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, Nov 5, 12:15
Size
6 KB
Mime Type
text/x-c
Expires
Thu, Nov 7, 12:15 (2 d)
Engine
blob
Format
Raw Data
Handle
22149355
Attached To
R3600 invenio-infoscience
BEH_COND_edit.php.wml
View Options
## $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.
<?
include("localconf.inc.php");
?>
#include "cdspage.wml" \
title="Behaviours" \
navtrail_previous_links="<a class=navtrail href=<WEBURL>/admin/<lang:star: index.*.html>><MSG_ADMIN_AREA></a> > <a class=navtrail href=<WEBURL>/admin/bibformat/>BibFormat Admin</a>" \
navbar_name="admin" \
navbar_select="BEH_display"
<?
include("security.inc.php");
<protect>## $Id$</protect>
//==========================================================================
// File: BEH_COND_edit.php (flexElink WI)
// Description: Allows to modify a condition data and updates changes in
// the configuration DB
// POST parameters:
// otype --> (required) Behavior label the condition corresponds to
// process -> (optional) If defined (value not relevant) the script updates
// condition data in the DB with the new values passed as
// parameters
// eorder -> (required if process is not set) Evaluation order of the
// condition inside the owner behaviour. If this parameter is not
// set, the script will look for the last evaluation order value
// inside the corresponding behaviour
// old_eorder -> (required if process is set) Original evaluation order of
// the condition to be modified
// code ----> (optional) Action's EL code
// Notes: If an action is succesfully added to the DB it closes the current
// browser and refreshes the opener one
// Requires: DB
// Author: Hector.Sanchez@cern.ch
//==========================================================================
include(DB);
if( (!isset($otype)) or (trim($otype)=="") )
{
print "<b>Output type</b> hasn't been specified";
print "<hr>";
print "<a align=\"center\" href=\"JavaScript:window.close();\">[Close]</a>";
exit;
}
$otype=trim(strtoupper($otype));
$db=mysql_connect( $DB_HOST, $DB_USER, $DB_PASSWD )
or errormsg("Couldn't connect to mySQL") or exit;
mysql_selectdb( $DB_DB );
if(!isset($process))
{
if( (!isset($eorder)) or (trim($eorder)=="") )
{
print "<b>Condition evaluation order</b> hasn't been specified";
print "<hr>";
print "<a align=\"center\" href=\"JavaScript:window.close();\">[Close]</a>";
exit;
}
$qry="select el_condition
from flxBEHAVIORCONDITIONS
where otype='$otype'
and eval_order='$eorder'";
$qh=mysql_query($qry, $db);
list($code)=mysql_fetch_array($qh);
mysql_close($db);
?>
<form action="BEH_COND_edit.php" method="POST">
<table>
<tr>
<td colspan="2" bgcolor="black">
<font color="white" align="center">
Editing condition <?echo $eorder;?> for output type'<? echo $otype;?>'</font>
</td>
</tr>
<tr>
<td>Evaluation order: </td>
<td><input type="text" name="eorder" value="<?echo $eorder;?>"></td>
</tr>
<tr>
<td>EL Code: </td>
<td><textarea name="code" cols="80" rows="9"><?echo $code;?></textarea></td>
</tr>
<tr>
<td colspan="2" align="center"><input class="formbutton" type="submit"></td>
</tr>
</table>
<input type="hidden" name="process" value="oo">
<input type="hidden" name="otype" value="<?echo $otype;?>">
<input type="hidden" name="old_eorder" value="<?echo $eorder;?>">
</form>
<?
}
else
{
if( (!isset($old_eorder)) or (trim($old_eorder)=="") )
{
print "<b>Condition original evaluation order</b> hasn't been specified";
print "<hr>";
print "<a align=\"center\" href=\"JavaScript:window.close();\">[Close]</a>";
exit;
}
if( (!isset($code)) )
$code="";
else
{
$temp_code=$code;
if(get_magic_quotes_gpc())
$temp_code=stripslashes($temp_code);
include(EXECUTOR);
$a=new AELExecutor();
list($ok, $msg)=$a->checkCode( $temp_code );
if(!$ok)
{
print "Condition code incorrect: <b>$msg</b><hr>
<a href=\"JavaScript:window.history.go(-1)\">[Go Back]</a>";
exit;
}
}
if(!get_magic_quotes_gpc())
$code=addslashes($code);
if( (!isset($eorder)) or (trim($eorder)=="") )
{
$qry="select max(eval_order)+1
from flxBEHAVIORCONDITIONS
where otype='$otype'
and eval_order<>$old_eorder";
$res=mysql_query( $qry );
$order=mysql_fetch_array( $res );
$eorder=$order[0];
if($eorder==null)
{
$eorder=0;
}
}
if($eorder!=$old_eorder)
{
$qry="update flxBEHAVIORCONDITIONSACTIONS
set eval_order='$eorder'
where otype='$otype'
and eval_order='$old_eorder'";
if(!mysql_query( $qry ))
{
print "Impossible to update actions related to this condition:<br> ".mysql_error();
print "<hr>";
print "<a align=\"center\" href=\"JavaScript:window.history.go(-1);\">[Go Back]</a>";
mysql_close( $db );
exit;
}
}
$qry="update flxBEHAVIORCONDITIONS
set eval_order='$eorder',
el_condition='$code'
where otype='$otype'
and eval_order='$old_eorder'";
if(!mysql_query( $qry ))
{
print "Impossible to insert update condition:<br> ".mysql_error();
print "<hr>";
print "<a align=\"center\" href=\"JavaScript:window.history.go(-1);\">[Go Back]</a>";
mysql_close( $db );
exit;
}
mysql_close( $db );
?>
<script language="JavaScript">
opener.location.reload(false);
window.close();
</script>
<?
}
?>
Event Timeline
Log In to Comment