Page MenuHomec4science

Test_BI.php.wml
No OneTemporary

File Metadata

Created
Thu, Feb 27, 18:47

Test_BI.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 Test_BI
## This function checks whwther the Bibliographic Information
## has already been submitted or not (title file)
## Author: T.Baron
## PARAMETERS: titleFile: name of the file in which the title should be
## found
function Test_BI ($param_array,$MAINPATH)
{
global $doctype,$STORAGE,$access,$act;
// Retrieve the directory for the Submission of Bib data
$res = mysql_query("
SELECT dir
FROM sbmACTION
WHERE sactname='SBI'");
$row = mysql_fetch_row($res);
$sbidir = $row[0];
$RUNDIR = $STORAGE."/".$sbidir."/".$doctype."/".$access;
// Retrieve the directory for the Submission of Bib data current action
$res = mysql_query("
SELECT dir
FROM sbmACTION
WHERE sactname='$act'");
$row = mysql_fetch_row($res);
$curdir = $row[0];
$WAITDIR = $STORAGE."/".$curdir."/".$doctype."/".$access;
$doc_type = $GLOBALS[VARS]->get_doctype();
$access_number = $GLOBALS[VARS]->get_access_number();
$action = "SBI";
if (file_exists("$MAINPATH/".$param_array[titleFile])
&& filesize("$MAINPATH/".$param_array[titleFile]) != 0)
$TI = "found";
else
$TI = "";
$First_File = Get_First_File($doc_type,$access_number,$curdir);
if ($TI == "")
{
Request_Print("A", "It is necessary to submit the bibliographic "
. "information for this document");
Request_Print("S", "</table>");
// The script needs to alter a few of the files in the
// current directory.
//Remove all of the files regarding the FTT physical document.
if(is_file("$First_File"))
unlink("$First_File");
if(is_file("$WAITDIR/object_log"))
unlink("$WAITDIR/object_log");
if(is_file("$WAITDIR/Format"))
unlink("$WAITDIR/Format");
//change the details of the act config files (overwrite existing
// files).
$fp_act = fopen("$WAITDIR/act", "w");
$fp_file = fopen("$WAITDIR/file", "w");
fwrite($fp_act,"SBI", 3);
fwrite($fp_file,"SBILHB", 6);
fclose($fp_act);
fclose($fp_file);
rename("$WAITDIR","$RUNDIR");
//output JavaScrit to auto reload return the user to the SBI page
Request_Print("A","<BR><SCRIPT LANGUAGE=\"JavaScript1.1\" >
var file = \"$file_status\";
function reload()
{
document.forms[1].action = \"../Main.php\";
document.forms[1].page.value = 1;
document.forms[1].act.value = \"$action\";
document.forms[1].dir.value = \"$sbidir\";
document.forms[1].submit();
}
if (file == \"$first_file[0]\")
{
alert(\"Please complete Bibliographic Information first.\");
document.forms[1].action = \"../Main.php\";
document.forms[1].act.value = \"$action\";
document.forms[1].page.value = 1;
document.forms[1].dir.value = \"$sbidir\";
document.forms[1].submit();
}
reload();
</SCRIPT>\n");
// THE SCRIPT STOPS EXECUTION AT THIS POINT
exit;
}
}
function Get_First_File($doc_type,$access_number,$curdir)
{
global $doctype,$STORAGE,$access;
$WAITDIR = $STORAGE."/".$curdir."/".$doctype."/".$access;
// This function could just as well be in line however it nacked up the
// frames on reload so here it is and here it must stay. Returns the Main
// File named value from the parameters table of the MySQL MESS database.
//get the directory of the first_file from MESS database.
$db_result = mysql_query("
SELECT value
FROM sbmPARAMETERS
WHERE doctype = '$doc_type' and
name='firstfile'");
$first_file = mysql_fetch_row($db_result);
$file = "$WAITDIR/$first_file[0]";
return($file);
}
</protect>
?>

Event Timeline