Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F93066299
BIBREFORMAT_process.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
Mon, Nov 25, 22:57
Size
3 KB
Mime Type
text/x-c
Expires
Wed, Nov 27, 22:57 (2 d)
Engine
blob
Format
Raw Data
Handle
22565946
Attached To
R3600 invenio-infoscience
BIBREFORMAT_process.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 "config.wml"
#include "configbis.wml"
<?
include("security.inc.shtml");
<protect>
## DO NOT EDIT THIS FILE! IT WAS AUTOMATICALLY GENERATED FROM CDSware WML SOURCES.
</protect>
//==========================================================================
// File: BIBREFORMAT_process.shtml
// Description: Displays and manages the current reformatting processes
// POST parameters:
// Notes:
// Requires: DB,
// Author: Eduardo.Margallo@cern.ch
//==========================================================================
## load config variables:
$TMPDIR = "<TMPDIR>";
$CGIBINDIR = "<CGIBINDIR>";
include(DB);
/* returns a string limited to $length, truncating the original one if
necessary and adding ... */
function limit_length( $name, $length ) {
return strlen( $name ) < $length ?
$name : substr( $name, 0, $length-3 ) . "...";
}
/* Creates a query file in the temporary directory and starts a
new bibreformat process in the background so as to handle it. */
function admit_query( $QUERY, $FLEXELINK ) {
global $uid_email, $CGIBINDIR, $TMPDIR;
$bibreformat = $CGIBINDIR . "/bibreformat";
$date = addslashes( date("Y-m-d h:m:s") );
$user = addslashes( $uid_email );
$QUERY = addslashes( urlencode($QUERY) );
$FLEXELINK = addslashes( $FLEXELINK );
$query = "insert into flxREFORMAT values
(NULL,'".$user."', '".$date."', '".$QUERY."', '".$FLEXELINK."', 'waiting')";
mysql_query( $query );
exec( $bibreformat . " > /dev/null 2> /tmp/bibreformat.err &" );
}
if ( !empty($HTTP_GET_VARS) ) {
$cancel = 0;
$file = "";
while( $var = each($HTTP_GET_VARS) ) {
if( $var["key"] == "action" && $var["value"] == "cancel" )
$cancel = 1;
if( $var["key"] == "id" ) $id = $var["value"];
}
if( $cancel && isset($id) ) {
$query = "delete from flxREFORMAT where id=$id";
mysql_query( $query );
}
}
else if( !empty($HTTP_POST_VARS) ) {
$dict = array();
while( $var = each($HTTP_POST_VARS) ) {
if( $var["key"] <> "QUERY" ) {
$parts = split( "_", $var["key"] );
if( "chk" == $parts[0] ) {
$format = $var["value"];
$id = $parts[1];
if( $id <> "" ) {
$query = "select name from collection where id=$id";
$result = mysql_query( $query );
$row = mysql_fetch_array( $result );
$name = urlencode( $row["name"] );
}
else $name= "all";
if( !$dict[$name] ) {
$dict = array_merge( $dict, array( $name=>"$format," ) );
}
else {
$dict[$name] = $dict[$name] . "$format,";
}
}
}
}
while( $var = each( $dict ) ) {
if( $var[key]!=all ) $QUERY = "'c=" . $var["key"] . "'";
$FLEXELINK = "otype=" . substr( $var["value"], 0 , -1 );
admit_query( $QUERY, $FLEXELINK );
}
}
Header("Location:BIBREFORMAT_display.shtml");
?>
Event Timeline
Log In to Comment