Page MenuHomec4science

action.php.wml
No OneTemporary

File Metadata

Created
Tue, Jul 23, 07:20

action.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.
#include "configbis.wml"
<?
require("<LIBDIR>/php/cdsware/websubmit/commonPhpFunctions.php");
#######################################################
#parses database to get all data
#######################################################
//CATEGORY TABLE
$query = "
SELECT *
FROM sbmCATEGORIES
WHERE doctype='$doctypes'
ORDER BY lname";
$res = mysql_query("$query");
$nbCateg = 0;
while ($arr = mysql_fetch_row($res))
{
$nbCateg++;
$snameCateg[$nbCateg] = $arr[1];
$lnameCateg[$nbCateg] = $arr[2];
}
//sbmDOCTYPE DATABASE
$query = "
SELECT *
FROM sbmDOCTYPE
WHERE sdocname='$doctypes'";
$res = mysql_query("$query");
if ($arr = mysql_fetch_row($res))
{
$nbDoctypes++;
$docFullDesc = "$arr[0]";
$docShortDesc = "$arr[1]";
$description = "$arr[4]";
//sbmIMPLEMENT DATABASE (displayed actions)
$query = "
SELECT *
FROM sbmIMPLEMENT
LEFT JOIN sbmACTION on sbmACTION.sactname=sbmIMPLEMENT.actname
WHERE docname='$arr[1]' and
displayed='Y'
ORDER BY sbmIMPLEMENT.buttonorder";
$res2 = mysql_query("$query");
$actions = "";
$nbActions = 0;
$j=0;
while ($arr2 = mysql_fetch_row($res2))
{
$nbActions ++;
$j++;
$ma[$j] = "$arr2[1];";
//sbmACTION table
$query = "
SELECT *
FROM sbmACTION
WHERE sactname='$arr2[1]'";
$res = mysql_query("$query");
while ($arr = mysql_fetch_row($res))
{
$actionShortDesc[$j] = "$arr[1]";
$dir[$j] = "$arr[2]";
$actionbutton[$j] = "$arr[5]";
$statustext[$j] = "$arr[6]";
}
}
}
?>
#include "cdspage.wml" \
title="<protect><?print $docFullDesc;?></protect>" \
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.
// database connection
connectDB(DOCS_DATABASE);
$formnb = 1;
?>
<SCRIPT LANGUAGE="JavaScript" TYPE="text/javascript">
var checked=0;
function tester(action)
{
<?
if (AUTHENTICATION && ($uid_email == "" || $uid_email == "guest"))
{
print "alert(\"please log in first.\\nUse the left menu to log in.\\nIf".
" it is the first time you have to login in CDS, please click on ".
"the 'new user?' link in the left menu\");return false;\n";
}
elseif (AUTHENTICATION)
{
//CAN THE USER USE THIS ACTION???
#for each action
for ($i=1;$i<$nbActions+1;$i++)
{
// test if the submissionuser rule is associated with this type of
// document.
$res = mysql_query("
SELECT id_rule
FROM user_rule,
rules
WHERE rules.name='submissionuser' and
rules.id=id_rule and
param1='$doctypes' and
(param2='$actionShortDesc[$i]' or param2='*')");
if ($row = mysql_fetch_row($res))
if (!authenticate($uid_email,'submissionuser',$doctypes,
$actionShortDesc[$i]))
{
print "if (action == '$actionShortDesc[$i]')\n";
print "{\n";
print " alert(\"Sorry, user $uid_email does not have the".
" right to perform this action.\");\n";
print " return false;\n";
print "}\n";
}
}
}
?>
if (checked == 0)
{
alert ("please select a category");
return false;
}
else
{
return true;
}
}
function clicked()
{
checked=1;
}
function mouseoverbutton(img)
{
window.status='Submit a document';
<?
print " document.images[img].src='".$IMAGES."/blank_button_highlight.gif';";
?>
}
function mouseoutbutton(img)
{
window.status='';
<?
print " document.images[img].src='".$IMAGES."/blank_button.gif';";
?>
}
function mouseclickbutton(img)
{
return false;
}
<?
print "function selectdoctype(nb)\n";
print "{\n";
print " document.forms[$formnb].act.value = docname[nb];\n";
print "}\n";
?>
</SCRIPT>
<?
print "<FORM method=get action=\"" . SUBMISSION_SECURE_DIR .
"/SBICDD.php\">\n";
print "<INPUT type=\"hidden\" name=\"doctypes\" value=\"$doctypes\">\n";
?>
<INPUT type="hidden" name="dir">
<?
$id = getmypid();
$now=time();
$wday=strftime("%w",$now);
$hour=strftime("%H",$now);
$min=strftime("%M",$now);
$sec=strftime("%S",$now);
if ($hour < 10) { $hour = "0$hour"; }
if ($min < 10) { $min = "0$min"; }
if ($sec < 10) { $sec = "0$sec"; }
print "<input type=hidden name=access value=\"$wday$hour$min$sec";
print "_$id\">\n";
?>
<INPUT type="hidden" name="act">
<INPUT type="hidden" name="startPg" value=1>
<?
print "<INPUT type=hidden name=mainmenu value=\"$URLPATH/access/".
"action.php?doctypes=$doctypes\">\n";
?>
<TABLE cellpadding=0 cellspacing=0 border=0 width=100%>
<?
if ($description != "")
print "<TR bgcolor=\"#EEEEEE\"><TD><SMALL>$description</SMALL></TD>".
"</TR>\n";
print "<TR><TD><BR>\n";
?>
<SCRIPT LANGUAGE="JavaScript" TYPE="text/javascript">
var nbimg = document.images.length;
</SCRIPT>
<BR>
<TABLE align=center cellpadding=0 cellspacing=0 border=0>
<TR>
<?
if ($nbCateg != 0)
{
print "<TD align=right>\n";
for ($i=1;$i<$nbCateg+1;$i++)
{
print "<small>$lnameCateg[$i]</small><INPUT TYPE=radio ".
"NAME=\"combo$doctypes\" value=\"$snameCateg[$i]\" ".
"onClick=\"clicked()\">&nbsp;<BR>\n";
}
print "</TD>\n";
}
else
print "<SCRIPT>checked=1;</SCRIPT>\n";
?>
<TD>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</TD>
<TD>
<TABLE>
<?
#display list of actions
for ($i=1;$i<$nbActions+1;$i++)
{
if ($nbCateg != 0)
{
print " <TR>\n";
print " <TD>\n";
print " <A HREF=\"\" onClick=\"if (".
"tester('$actionShortDesc[$i]')){".
"document.forms[$formnb].dir.value='$dir[$i]';".
"document.forms[$formnb].act.value='$actionShortDesc[$i]';".
"document.forms[$formnb].action='$URLPATH/access/protected/".
"$actionShortDesc[$i]$doctypes.php';".
"document.forms[$formnb].submit();}; return false;\" ".
"onmouseover=\"document.images[$i + nbimg - 1].".
"src='".$IMAGES."/highlight_$actionbutton[$i]';".
"window.status='$statustext[$i]';\" ".
"onmouseout=\"document.images[$i + nbimg - 1].".
"src='".$IMAGES."/$actionbutton[$i]';\">\n";
print " <IMG src=\"".$IMAGES."/".
"$actionbutton[$i]\" border=0 ALT=\"$statustext[$i]\" ".
"ID=\"img$i\"></A><BR>\n";
}
else
{
print " <TR>\n";
print " <TD>\n";
print " <A HREF=\"\" onClick=\"if (".
"tester('$actionShortDesc[$i]')){".
"document.forms[$formnb].dir.value='$dir[$i]';".
"document.forms[$formnb].act.value='$actionShortDesc[$i]';".
"document.forms[$formnb].action='$URLPATH/access/protected/".
"$actionShortDesc[$i]$doctypes.php';".
"document.forms[$formnb].submit();return false;}".
"else return false;\" ".
"onmouseover=\"document.images[$i + nbimg - 1].".
"src='".$IMAGES."/highlight_$actionbutton[$i]';".
"window.status='$statustext[$i]'\" ".
"onmouseout=\"document.images[$i + nbimg - 1].".
"src='".$IMAGES."/$actionbutton[$i]';\">\n";
print " <IMG src=\"".$IMAGES."/".
"$actionbutton[$i]\" border=0 ALT=\"$statustext[$i]\" ".
"ID=\"img$i\"></A><BR>\n";
}
if ($i == 1) { print "<BR>&nbsp;"; }
print " </TD>\n";
print " </TR>\n";
}
?>
</TABLE>
</TD>
</TR>
</TABLE>
<BR>
<SMALL>
<?
if ($nbCateg != 0)
{
print "<STRONG class=headline>Notice:</STRONG><BR>\n";
print "Select a category and then click the button to perform the".
" action you chose.\n";
}
?>
</SMALL>
<BR><BR>
</TD>
</TR>
</TABLE>
<BR>
</FORM>
<?
print "<FORM action=\"../Access.php\"><HR>\n";
print "<font color=black><small>To continue an interrupted submission,".
" enter your access number directly in the input box.</small></FONT>";
print "<TABLE border=0 bgcolor=\"#CCCCCC\" width=\"100%\"><TR>".
"<TD width=\"100%\">\n";
print "<small>Access Number: <INPUT size=15 name=AN><INPUT type=hidden".
" name=doctype value=\"$doctypes\"> <INPUT type=submit value=\" go! \">".
"</small></TD></TR></TABLE><HR></FORM>\n";
</protect>
?>

Event Timeline