Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F91989254
BEH_ACTION_add.shtml.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
Sat, Nov 16, 10:19
Size
5 KB
Mime Type
text/x-c
Expires
Mon, Nov 18, 10:19 (1 d, 23 h)
Engine
blob
Format
Raw Data
Handle
22357440
Attached To
R3600 invenio-infoscience
BEH_ACTION_add.shtml.wml
View Options
## $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.
<?
include("localconf.inc.shtml");
?>
#include "cdspage.wml" \
title="Behaviours" \
navbar_name="admin" \
navbar_select="BEH_display" \
cdspageboxlefttopadd="<protect><?displayLoginMenu('admin');?> </protect>"
<?
include("security.inc.shtml");
<protect>## $Id$</protect>
//==========================================================================
// File: BEH_ACTION_add.shtml (flexElink WI)
// Description: Displays necessary controls to define a new behavior action
// or adds a defined behavior action to the DB if all the parameters are
// set
// POST parameters:
// otype --> (required) Behavior label the action corresponds to
// eorder -> (required) Evaluation order of the condition the actions
// corresponds to
// process -> (optional) If defined (value not relevant) the script adds
// the action to the DB; if not it displays options for defining it
// code ----> (optional) Action's EL code
// locator -> (optional) Not relevant
// aorder --> (optional) Action application order inside its corresponding
// condition; if i isn't specified, the script will look for the
// last one in the database for that condition
// Notes: If an action is succesfully added to the DB it refreshes the caller
// Requires: DB, ERROR
// Author: Hector.Sanchez@cern.ch
//==========================================================================
include(DB);
include(ERROR);
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));
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;
}
if(!isset($process))
{
?>
<form action="BEH_ACTION_add.shtml" method="POST">
<table>
<tr>
<td colspan="2" bgcolor="black">
<font color="white" align="center">
Add new action for condition '<? echo $otype." -- ".$eorder;?>'</font>
</td>
</tr>
<tr>
<td>Apply order: </td>
<td><input type="text" name="aorder"></td>
</tr>
<tr>
<td>Locator(only IENRICH types): </td>
<td><textarea name="locator" cols="80" rows="2"></textarea></td>
</tr>
<tr>
<td>EL Code: </td>
<td><textarea name="code" cols="80" rows="9"></textarea></td>
</tr>
<tr>
<td colspan="2" align="center"><input type="submit"></td>
</tr>
</table>
<input type="hidden" name="process" value="oo">
<input type="hidden" name="otype" value="<?echo $otype;?>">
<input type="hidden" name="eorder" value="<?echo $eorder;?>">
</form>
<?
}
else
{
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 "Code incorrect: <b>$msg</b><hr>
<a href=\"JavaScript:window.history.go(-1)\">[Go Back]</a>";
exit;
}
}
if( (!isset($locator)) )
$locator="";
if(!get_magic_quotes_gpc())
{
$code=addslashes($code);
$locator=addslashes($locator);
}
$db=mysql_connect( $DB_HOST, $DB_USER, $DB_PASSWD ) or errormsg("Couldn't connect to mySQL");
mysql_selectdb( $DB_DB );
if( (!isset($aorder)) or (trim($aorder)=="") )
{
$qry="select max(apply_order)+1
from flxBEHAVIORCONDITIONSACTIONS
where otype='$otype'
and eval_order='$eorder'";
$res=mysql_query( $qry );
$aorder=mysql_fetch_array( $res );
$aorder=$aorder[0];
if($aorder==null)
{
$aorder=0;
}
}
$qry="insert into flxBEHAVIORCONDITIONSACTIONS
(otype, eval_order, apply_order, locator, el_code)
values ('$otype', '$eorder', '$aorder', '$locator', '$code')";
if(!mysql_query( $qry ))
{
errorpage("Impossible to insert new action:<br> ".mysql_error());
mysql_close( $db );
exit;
}
mysql_close( $db );
?>
<script language="JavaScript">
opener.location.reload(false);
window.close();
</script>
<?
}
?>
Event Timeline
Log In to Comment