Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F77798116
pro.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
Fri, Aug 16, 11:28
Size
27 KB
Mime Type
text/x-c
Expires
Sun, Aug 18, 11:28 (1 d, 23 h)
Engine
blob
Format
Raw Data
Handle
19920968
Attached To
R3600 invenio-infoscience
pro.php.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 "configbis.wml"
<?
require("<LIBDIR>/php/cdsware/websubmit/commonPhpFunctions.php");
?>
#include "cdspage.wml" \
title="Submitting..." \
navbar_name="main" \
navbar_select="submit" \
cdspageboxlefttopadd="<protect><?displayLoginMenu('submit');?></protect>"
<?
<protect>
## $Id$
## DO NOT EDIT THIS FILE! IT WAS AUTOMATICALLY GENERATED FROM CDSware WML SOURCES.
include("../specialchars.php");
///////////////////////
// Preliminary tasks //
///////////////////////
// The following words are reserved and should not be used as field names
$reserved_words = array("stop","file","nextPg","startPg","access","page",
"nbPg","doctypes","act","dir","summary","summaryX","summaryY","doctype",
"mode","step","deleted","file_path","userfile_name");
// This defines the path to the directory containing the action data
$MAINPATH = $STORAGE."/".$dir."/".$doctype."/".$access;
umask(000);
// Create basic storage directory if it does not exist
if (!is_dir("$STORAGE"))
if (!mkdir ("$STORAGE", 0777))
outError("File System: Cannot create working directory $STORAGE");
// store the original main menu
if (is_file("$STORAGE/$dir/$doctypes/$access/mainmenu"))
$mainmenu = `cat $STORAGE/$dir/$doctypes/$access/mainmenu`;
else
$mainmenu = "$URLPATH";
// database connection
connectDB(DOCS_DATABASE);
// we also retrieve the name of the file in which the reference of
// the submitted document will be stored
$res = mysql_query("
SELECT value
FROM sbmPARAMETERS
WHERE doctype='$doctypes' and
name='edsrn'");
$row = mysql_fetch_row($res);
$edsrn = $row[0];
// Now we test whether the user has already completed the action and
// reloaded the page (in this case we don't want the functions to be called
// once again
$reloaded = Test_Reload();
// We must determine if the action is finished (ie there is no other steps
// after the current one
$res = mysql_query("
SELECT step
FROM sbmFUNCTIONS
WHERE action='$act' and
doctype='$doctypes' and
step > $step");
if (mysql_fetch_row($res) == 0)
$finished = 1;
else
$finished = 0;
mysql_free_result($res);
// If the $dir variable has not been passed through the cgi line, we
// retrieve its value from the database
if ($dir == "")
{
$res = mysql_query("
SELECT dir
FROM sbmACTION
WHERE sactname='$act'");
$row = mysql_fetch_array($res);
$dir = $row['dir'];
}
//////////////////////////////////////////////////////////////////
// Save the form fields entered in the previous submission page //
//////////////////////////////////////////////////////////////////
$rundir = "$STORAGE/$dir/$doctypes/$access";
// If the form was sent with the GET method
if (isset($HTTP_GET_VARS) && count($HTTP_GET_VARS) != 0)
$varArray = $HTTP_GET_VARS;
else
$varArray = $HTTP_POST_VARS;
// we parse all the form variables
reset ($varArray);
while ((list ($key, $val) = each ($varArray)))
{
if (!in_array($key,$reserved_words))
{
if (!is_array($val) && $val != "" && $val != "Select:")
{
// simple variables (text inputs, textareas...)
$val = stripslashes($val);
$val = specialchars($val);
$fp = fopen("$rundir/$key","w+");
fwrite($fp,"$val");
fclose($fp);
}
elseif (is_array($val))
{
// array variables (selects)
reset ($val);
$fp = fopen("$rundir/$key","w+");
while ($value = each ($val))
{
$value[1] = stripslashes($value[1]);
$value[1] = specialchars($value[1]);
fwrite($fp,"$value[1]\n");
}
fclose($fp);
}
// if the found field is the reference of the document
// we save this value in the "journal of submissions"
if (AUTHENTICATION && $uid_email != "" && $uid_email != "guest")
if ($key == "$edsrn")
mysql_query("
UPDATE sbmSUBMISSIONS
SET reference='$val'
WHERE doctype='$doctypes' and
id='$access' and
email='$uid_email'");
// Now deal with the cookies
// If the fields must be saved as a cookie, we do so
// In this case, the value of the field will be retrieved and
// displayed as the default value of the field next time the user
// does a submission
$res = mysql_query("select cookie from sbmFIELDDESC where name='$key'");
$arr = mysql_fetch_row($res);
mysql_free_result($res);
if ( $arr[0] == 1 )
setcookie("$key","$val",time()+31104000,"/","$MACHINE");
}
}
// Now we will save the files transfered by file upload
if (isset($HTTP_POST_FILES))
{
reset ($HTTP_POST_FILES);
while (list ($key, $val) = each ($HTTP_POST_FILES))
{
if (is_file(${$key}))
{
if (! is_dir("$rundir/files"))
mkdir ("$rundir/files", 0777);
if (! is_dir("$rundir/files/$key"))
mkdir ("$rundir/files/$key", 0777);
$val[name] = stripslashes($val[name]);
$val[name] = ereg_replace(" ","_",$val[name]);
$fp = fopen("$rundir/$key","w+");
fwrite($fp,"$val[name]");
fclose($fp);
$fp = fopen("$rundir/lastuploadedfile","w+");
fwrite($fp,"$key/$val[name]");
fclose($fp);
copy("${$key}","$rundir/files/$key/$val[name]");
}
}
}
////////////////////////
// //
// Objects definition //
// //
////////////////////////
class doc_vars {
// The document variables which are not held in tables are stored in this
// global object.
// Although it is global its components can only be accessed through the
// methods exported by the class type
// The document type. It doesn't change so is only set through constructor.
var $doctype;
// The action. It doesn't change so is only set through constructor.
var $act;
// The submission number.It doesn't change so is set through constructor
var $access_num;
// The reference of the document - Set at runtime
var $report_num;
// The full path to the bibliographic record created by the uploader
var $record;
// The running script's running mode (Users or supervisor mode)
var $mode;
// The system number of the record
var $sysno;
// The CGI variables array
var $cgi;
function doc_vars ($document_type="",
$access_number="",
$mode="",
$cgi="",
$act="",
$step=1)
{
// Constructor.
$this->doctype = $document_type;
$this->access_num = $access_number;
$this->mode = $mode;
$this->cgi = $cgi;
$this->act = $act;
$this->step = $step;
}
function get_cgi ()
{
return $this->cgi;
}
function set_cgi ($cgi)
{
$this->cgi = $cgi;
}
function get_doctype ()
{
return $this->doctype;
}
function get_access_number ()
{
return $this->access_num;
}
function get_mode ()
{
return $this->mode;
}
function set_report_number ($rn)
{
global $uid_email,$doctypes,$access;
// First we save the value in the global object
$this->report_num = $rn;
// then we save this value in the "journal of submissions"
if (AUTHENTICATION && $uid_email != "" && $uid_email != "guest")
mysql_query("
UPDATE sbmSUBMISSIONS
SET reference='$rn'
WHERE doctype='$doctypes' and
id='$access' and
email='$uid_email'");
}
function get_report_number ()
{
return $this->report_num;
}
function set_record_path ($pth)
{
$this->record = $pth;
}
function get_record_path ()
{
return $this->record;
}
function set_sysno ($sn)
{
$this->sysno = $sn;
}
function get_sysno ()
{
return $this->sysno;
}
function set_action ($act)
{
$this->act = $act;
}
function get_action ()
{
return $this->act;
}
function set_step ($step)
{
$this->step = $step;
}
function get_step ()
{
return $this->step;
}
}
////////////////////////
// //
// Global Functions //
// //
////////////////////////
function Request_Print($m, $txt)
{
// The argumemts to this function are the display mode ($m) and the text to
// be displayed ($txt)
// If the argument mode is 'ALL' then the text is unconditionally echoed
// $m can also take values S (Supervisor Mode) and U (User Mode). In these
// circumstances $txt is only echoed if the argument mode is the same as
// the current mode (as held in the global object)
If (($m == "A")
|| ($m == $GLOBALS[VARS]->get_mode())
|| ($m == "S" && $TEST))
echo $txt;
}
////////////////////////
// //
// Main Engine //
// //
////////////////////////
function Evaluate_Parameter ($field, $doc_type)
{
// Returns the literal value of the parameter. Assumes that the value is
// uniquely determined by the doctype, i.e. doctype is the primary key in
// the table
// If the table name is not null, evaluate the parameter
$literals = mysql_query("
SELECT value
FROM sbmPARAMETERS
WHERE doctype = '$doc_type' and
name='$field'")
or outError("Error with SQL request: SELECT * from sbmPARAMETERS where ".
"doctype = '$doc_type'");
// If no data is found then the data concerning the DEF(ault) doctype
// is used
if (mysql_num_rows($literals) == 0)
{
$literals = mysql_query("
SELECT value
FROM sbmPARAMETERS
WHERE doctype = 'DEF' and
name='$field'");
}
$literal = mysql_fetch_array($literals);
// return the found value
return $literal[value];
}
function Get_Parameters ($fun_name, $doc_type)
{
// Returns the function parameters, in an array, for the function
// Gets a description of the parameter
$params = mysql_query("
SELECT *
FROM sbmFUNDESC
WHERE function = '$fun_name' ") or die ("horriblyb");
for ($counter = 0; $param = mysql_fetch_array($params); $counter++)
{
$parray[$param[param]] = Evaluate_Parameter ($param[param] , $doc_type);
// Evaluates parameter description to yield the literal value
}
// return the found value
return $parray;
}
function get_level ($doc_type, $action_name)
{
$implements = mysql_query("
SELECT *
FROM sbmIMPLEMENT
WHERE docname = '$doc_type' and
actname = '$action_name'");
$implement = mysql_fetch_array($implements);
return $implement[level];
}
function action_details ($doc_type, $action_name)
{
// Prints whether the action is mandatory or optional. The score of the
// action is returned (-1 if the action was optional)
$implements = mysql_query("
SELECT *
FROM sbmIMPLEMENT
WHERE docname = '$doc_type' and
actname = '$action_name'");
$implement = mysql_fetch_array($implements);
if ($implement[level] != "0")
return $implement[score];
else
return -1;
}
function print_function_calls ($doc_type, $action_name, $step)
{
// Calls the functions required by an "$action_name" action on a "$doc_type"
// document
// In supervisor mode, a table of the function calls is produced
global $HTDOCSDIR,$STORAGE,$doctype,$access,$MAINPATH;
// Get the list of functions to be called
$functions = mysql_query("
SELECT *
FROM sbmFUNCTIONS
WHERE action='${action_name}' and
doctype = '$doc_type' and
step = $step
ORDER BY score");
// If no data is found then the data concerning the DEF(ault) doctype is
// used
if (mysql_num_rows($functions) == 0)
{
$functions = mysql_query("
SELECT *
FROM sbmFUNCTIONS
WHERE action='${action_name}' and
doctype = 'DEF' and
step = $step
ORDER BY score");
}
// If functions exist....
if (mysql_num_rows($functions) > 0)
{
Request_Print("S", "<br><br>Here is the $action_name function list for".
" $doc_type documents at level $step <P>");
Request_Print("S", "<table border cellpadding = 15><tr><th>Function".
"</th><th>Score</th><th>Running Function</th></tr>");
// The "dir" field of the sbmACTION table states in which directory
// the files containing the submission collected data may be found
$res = mysql_query("
SELECT dir
FROM sbmACTION
WHERE sactname='$action_name'");
$row = mysql_fetch_array($res);
$MAINPATH = $STORAGE."/".$row[dir]."/".$doctype."/".$access;
// while there are functions left...
while ($function = mysql_fetch_array($functions))
{
$call_function = "$function[function]"; //Get the function name
if(file_exists("${HTDOCSDIR}submit/MESS/functions/$call_function.php"))
{
Request_Print("S", "<tr><td>$function[function]</td><td>".
"$function[score]</td><td>");
// Get the function itself
include "${HTDOCSDIR}submit/MESS/functions/${call_function}.php";
// Evaluate the parameters, and place them in an array
$arr = Get_Parameters($call_function,$doc_type);
// Call function
$call_function($arr,$MAINPATH);
// Really cunning bit of code. The text $call_function is replaced
// by its runtime value, and then the function with that name is
// called.
// Each function is called with $arr - the associative array
// containing the parameters retrieved from the database,
// and $MAINPATH which is the full path name of the directory
// containing all the files for the document
Request_Print("S","</td></tr>");
}
}
Request_Print("S","</table>");
}
else
Request_Print("S","<br><br><b>Your chosen action is not supported by".
" the document</b>");
}
function Set_Path($doc_type, $action_name, $step)
{
global $MAINPATH,$STORAGE,$doctype,$access;
$res = mysql_query("
SELECT dir
FROM sbmACTION
WHERE sactname='$action_name'");
$row = mysql_fetch_array($res);
$MAINPATH = $STORAGE."/".$row[dir]."/".$doctype."/".$access;
}
function Propose_Next_Action ($doc_type,$action_score,$access,$currentlevel)
{
global $MACHINE,$STORAGE,$act,$access,$dir;
$acts = mysql_query("
SELECT *
FROM sbmIMPLEMENT
WHERE docname = '$doc_type' and
level != '0' and
level = '$currentlevel' and
score > '$action_score'
ORDER BY score");
$res = mysql_query("
SELECT dir
FROM sbmACTION
WHERE sactname='$action_name'");
$row = mysql_fetch_array($res);
if (mysql_num_rows($acts) > 0)
{
Request_Print("A","<BR><BR>You now have to<ul>");
$action = mysql_fetch_array($acts);
$new_score = $action[score];
do {
$RN = $GLOBALS[VARS]->get_report_number();
$doctype = $GLOBALS[VARS]->get_doctype();
Request_Print("A","
<LI>
<A HREF=\"\" onClick=\" document.forms[1].action='../Main.php';document.forms[1].startPg.value='$action[stpage]';document.forms[1].act.value='$action[actname]';document.forms[1].doctypes.value='$action[docname]';document.forms[1].dir.value='".$row[dir]."';document.forms[1].access.value='$access';document.forms[1].fromdir.value='$dir';document.forms[1].submit();return false;\"> $action[endtxt] </a>");
$action = mysql_fetch_array($acts);
if ($action)
Request_Print("A"," <b>or</b>");
} while ($action[score] == $new_score);
Request_Print("A","</ul>");
}
}
////////////////////////
// //
// Display Functions //
// //
////////////////////////
function displayMain()
{
global $HTDOCSDIR,$file,$nextPg,$startPg,$access,$page,$nbPg,$doctype,$act;
global $dir,$summary,$finished,$IMAGES,$mainmenu;
if (SUMMARYON)
include("${HTDOCSDIR}submit/Navigation_Functions.php");
else
include("${HTDOCSDIR}submit/Fake_Navigation_Functions.php");
?>
<SCRIPT LANGUAGE="JavaScript1.1" TYPE="text/javascript">
document.onMouseUp = "enddrag(event)";
document.onmousemove = "drag(event)";
</SCRIPT>
<?
#those fields are necessary for the navigation
print "<FORM ENCTYPE=\"multipart/form-data\" action=\"pro.php\" ".
"method=\"POST\">\n";
print "<INPUT type=\"hidden\" name=\"stop\" value=\"now\">\n";
print "<INPUT type=\"hidden\" name=\"file\" value=\"$file\">\n";
print "<INPUT type=\"hidden\" name=\"nextPg\" value=\"$nextPg\">\n";
print "<INPUT type=\"hidden\" name=\"startPg\" value=\"$startPg\">\n";
print "<INPUT type=\"hidden\" name=\"access\" value=\"$access\">\n";
print "<INPUT type=\"hidden\" name=\"page\" value=\"$page\">\n";
print "<INPUT type=\"hidden\" name=\"nbPg\" value=\"$nbPg\">\n";
print "<INPUT type=\"hidden\" name=\"doctypes\" value=\"$doctype\">\n";
print "<INPUT type=\"hidden\" name=\"act\" value=\"$act\">\n";
print "<INPUT type=\"hidden\" name=\"dir\" value=\"$dir\">\n";
print "<INPUT type=\"hidden\" name=\"fromdir\" value=\"\">\n";
print "<INPUT type=\"hidden\" name=\"mainmenu\" value=\"$mainmenu\">\n";
if (SUMMARYON)
{
print "<INPUT type=\"hidden\" name=\"summary\" value=\"$summary\">\n";
print "<INPUT type=\"hidden\" name=\"summaryX\">\n";
print "<INPUT type=\"hidden\" name=\"summaryY\">\n";
}
#parameters for new MESS end scripts
print "<INPUT type=\"hidden\" name=\"doctype\" value=\"$doctype\">\n";
print "<INPUT type=\"hidden\" name=\"mode\" value=\"U\">\n";
print "<INPUT type=\"hidden\" name=\"step\" value=\"1\">\n";
print "<INPUT type=\"hidden\" name=\"deleted\" value=\"no\">\n";
print "<INPUT type=\"hidden\" name=\"file_path\" value=\"\">\n";
print "<INPUT type=\"hidden\" name=\"userfile_name\" value=\"\">\n";
# Get document name
$res = mysql_query("
SELECT ldocname
FROM sbmDOCTYPE
WHERE sdocname='$doctype'");
$row = mysql_fetch_row($res);
$docname = $row[0];
# Get action name
$res = mysql_query("
SELECT lactname
FROM sbmACTION
WHERE sactname='$act'");
$row = mysql_fetch_row($res);
$actname = $row[0];
# Get number of pages
$res = mysql_query("
SELECT nbpg
FROM sbmIMPLEMENT
WHERE subname='$act$doctype'");
$row = mysql_fetch_row($res);
$nbpages = $row[0];
#Display table header
print "<CENTER>\n";
print "<TABLE cellspacing=0 cellpadding=0 border=0>\n";
print "<TR>\n";
print " <TD class=headerselected><B>$docname </B></TD>\n";
print " <TD class=headerselected><small>$actname </small></TD>\n";
print " <TD align=left valign=bottom>\n";
print " <TABLE cellspacing=0 cellpadding=0 border=0>\n";
print " <TR>\n";
print " <TD class=headerselected align=right>\n";
print " <IMG SRC=\"$IMAGES/right-part-".
"topless-trans.gif\" border=0 alt=\"onglet\" align=top></TD>";
if ($finished == 1)
{
print "</TR></TABLE></TD>\n";
print "<TD colspan=2>\n";
print " <TABLE cellspacing=0 cellpadding=0 border=0>\n";
print " <TR>\n";
print " <TD><IMG SRC=\"$IMAGES/left-part-topless-trans.gif\" ".
"border=0 alt=\"onglet\" align=middle></TD>\n";
print " <TD>\n";
print " <TABLE cellspacing=0 cellpadding=0 border=0>\n";
print " <TR>\n";
print " <TD bgcolor=black width=\"20\"><IMG ".
"SRC=\"$IMAGES/line.gif\" border=0 alt=\"onglet\" align=top></TD>\n";
print " </TR>\n";
print " <TR align=center>\n";
print " <TD><small> FINISHED! </small><IMG ".
"SRC=\"$IMAGES/line-up-trans.gif\" border=0 alt=\"onglet\" ".
"align=top></TD>\n";
print " </TR>\n";
print " </TABLE></TD>\n";
print " <TD><IMG SRC=\"$IMAGES/last-right-part-trans.gif\" ".
"border=0 alt=\"onglet\" align=middle></TD></TR></TABLE></TD>\n";
}
else
{
for ($i=1;$i<=$nbpages;$i++)
{
if ($i == 1)
$leftimage = "<TD><IMG SRC=\"$IMAGES/left-part-topless-".
"trans.gif\" border=0 alt=\"onglet\" align=middle></TD>";
else
$leftimage = "";
if ($i == $nbpages)
$rightimage = "";
else
$rightimage = "<TD><IMG SRC=\"$IMAGES/right-part-trans.gif\" ".
"border=0 alt=\"onglet\" align=middle></TD>";
print "$leftimage\n";
print " <TD>\n";
print " <TABLE cellspacing=0 cellpadding=0 border=0>\n";
print " <TR>\n";
print " <TD bgcolor=black width=\"20\"><IMG ".
"SRC=\"$IMAGES/line.gif\" border=0 alt=\"onglet\" align=top>".
"</TD>\n";
print " </TR>\n";
print " <TR align=center>\n";
print " <TD>\n";
print " <small><A HREF='' onClick=\"if ".
"(tester2() == 1){document.forms[1].action='../Main.php';".
"document.forms[1].page.value=$i;document.forms[1].submit();".
"return false;} else { return false; }\"> $i </A></small>".
"<IMG SRC=\"$IMAGES/line-up-trans.gif\" border=0 alt=\"onglet\" ".
"align=top></TD>\n";
print " </TR>\n";
print " </TABLE></TD>\n";
print "$rightimage\n";
}
print "<TD class=header><IMG SRC=\"$IMAGES/left-part-trans.gif\" ".
"border=0 alt=\"onglet\" align=middle></TD>\n";
print "<TD class=header>\n";
print " <TABLE cellspacing=0 cellpadding=0 border=0>\n";
print " <TR>\n";
print " <TD bgcolor=black width=\"20\"><IMG SRC=\"$IMAGES/".
"line.gif\" border=0 alt=\"onglet\" align=top></TD>\n";
print " </TR>\n";
print " <TR align=center>\n";
print " <TD><small> end of action </small><IMG SRC=\"$IMAGES/".
"line-up-trans.gif\" border=0 alt=\"onglet\" align=top></TD>\n";
print " </TR>\n";
print " </TABLE></TD>\n";
print " <TD class=header><IMG SRC=\"$IMAGES/last-right-part-".
"trans.gif\" border=0 alt=\"onglet\" align=middle></TD>\n";
print " </TR>\n";
print " </TABLE>\n";
print "</TD>\n";
if (SUMMARYON)
print "<TD align=right valign=bottom><TABLE cellspacing=0 ".
"cellpadding=0 border=0><TR><TD class=headerselected >".
"<IMG SRC=\"$IMAGES/left-part-topless-trans.gif\" border=0 ".
"align=top alt=\"onglet\"></TD></TR></TABLE></TD><TD ".
"class=headerselected align=right><A HREF='' onClick=\"popUp".
"('Summary',true,event);return false;\" onClick=\"return false;\"".
"><font color=white><small>SUMMARY</small>² </font><IMG ".
"SRC=\"$IMAGES/down-trans.gif\" border=0 align=bottom ".
"alt=\"down\"></A> </TD>\n";
}
print "</TR>\n";
#Display main cell
print "<TR>\n";
print " <TD colspan=5 class=header>\n";
print " <small><BR><BR>\n";
}
function Test_Reload()
{
global $uid_email,$doctype,$act,$access,$mainmenu;
if (AUTHENTICATION)
{
$res = mysql_query("
SELECT *
FROM sbmSUBMISSIONS
WHERE doctype='$doctype' and
action='$act' and
id='$access' and
email='$uid_email' and
status='finished'");
if (mysql_num_rows($res) > 0)
return true;
else
return false;
}
else
return false;
}
////////////////////////
// //
// Main Program //
// //
////////////////////////
displayMain();
// Some runtime specific document variables, which can not be held in the
// database, are stored in this global object.
// Although it is global, its components can only be accessed through the
// methods exported by the class type
$VARS = new doc_vars;
if (getenv("REQUEST_METHOD") == "GET")
$VARS->doc_vars($doctypes,$access,$mode,$HTTP_GET_VARS,$act,$step);
else
$VARS->doc_vars($doctypes,$access,$mode,$HTTP_POST_VARS,$act,$step);
// we specify here whether we are in the last step of the action or not
$db_result = mysql_query("
SELECT step
FROM sbmFUNCTIONS
WHERE action='$act' and
doctype='$doctype' and
step>$step");
$result = mysql_fetch_row($db_result);
if ($result == "")
$last_step = 1;
else
$last_step = 0;
// Prints the action details, returning the mandatory score
$action_score = action_details ($doctype, $act);
$current_level = get_level($doctype, $act);
if (AUTHENTICATION && $reloaded)
print "<b> Sorry, this action has already been completed. Please go".
" back to the main menu to start a new action.</b>";
else
{
// Calls all the function's actions
print_function_calls ($doctype, $act, $step);
// If the action was mandatory we propose the next mandatory action (if
// there is one)
if ($action_score != -1 && $last_step == 1)
Propose_Next_Action($doctype,$action_score,$access,$current_level);
// If we are in the last step of an action, we can update the
// "journal of submissions"
if ($last_step == 1)
{
if (AUTHENTICATION && $uid_email != "" && $uid_email != "guest")
{
$repno = $GLOBALS[VARS]->get_report_number();
$res = mysql_query("
SELECT *
FROM sbmSUBMISSIONS
WHERE doctype='$doctype' and
action='$act' and
id='$access' and
email='$uid_email'");
if (mysql_num_rows($res) == 0)
mysql_query("
INSERT
INTO sbmSUBMISSIONS
values('$uid_email','$doctype','$act','finished','$access','$repno',
NOW(),NOW())");
else
mysql_query("
UPDATE sbmSUBMISSIONS
SET md=NOW(),
reference='$repno',
status='finished'
WHERE doctype='$doctype' and
action='$act' and
id='$access' and
email='$uid_email'");
}
}
}
?>
<BR><BR>
</TD>
</TR>
<TR class=headerselected>
<TD class=headerselected colspan=5 align=center>
<?
if ($finished == 0)
{
print "<small>Submission no</small>²:\n";
print "<small>$access</small>\n";
}
else
print " \n";
?>
</TD>
</TR>
</TABLE>
</center>
</form>
<?
// Add the "back to main menu" button
if ($finished == 0)
print " <A HREF=\"$mainmenu\" onClick=\"return confirm('Are you sure you want to quit this submission?')\">\n";
else
print " <A HREF=\"$mainmenu\">\n";
print "<IMG SRC=\"$IMAGES/mainmenu.gif\" border=0 ALT=\"back to main menu\" align=\"right\"></A><BR><BR>\n";
// Add the summary window definition if needed
if (SUMMARYON)
include("${HTDOCSDIR}submit/Print_Summary.php");
</protect>
?>
Event Timeline
Log In to Comment