Page MenuHomec4science

listFunctions.php.wml
No OneTemporary

File Metadata

Created
Fri, Jul 5, 10:24

listFunctions.php.wml

## $Id$
## This file is part of the CERN Document Server Software (CDSware).
## Copyright (C) 2002, 2003, 2004, 2005 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.
<?
require("commonPhpFunctions.php");
?>
#include "cdspage.wml" \
title="Available Functions" \
navtrail_previous_links="<a class=navtrail href=<WEBURL>/admin/<lang:star: index.*.html>><MSG_ADMIN_AREA></a> &gt; <a class=navtrail href=<WEBURL>/admin/websubmit/><MSG_ADMIN_SUBMIT></a>" \
navbar_name="admin" \
navbar_select="websubmit_listfunctions"
<?
<protect>
## $Id$
## DO NOT EDIT THIS FILE! IT WAS AUTOMATICALLY GENERATED FROM CDSware WML SOURCES.
/*************************Function Declarations********************/
function makeFunctionTable($queryResult)
{
/*****************************************************************
This function produces a table, which contains a list of all of
the functions in the WebSubmit system database. The function is
passed a query result that points to a list of all functions in
the WebSubmit database (obtained by querying the sbmALLFUNCDESCR table
for function).
The table that is produced contains the functions name, a form
with a graphical input button that when pressed, takes the user
to a page where they can view the usage of the function
throughout WebSubmit, and a form with a graphical input button, which
when pressed, takes the user to a page where they can view/edit
details of that particular function (e.g. adding parameters,
changing the function description, etc...
Author: Nicholas Robinson
Email: Nicholas.Robinson@cern.ch
Created: 18/09/2000
Last Modified: 25/01/2001
*****************************************************************/
global $IMAGES;
# Open the table, and display the column headings...
print("<TABLE ALIGN='center' BORDER=1 CELLSPACING=0 CELLPADDING=0>"
. "\n<TR BGCOLOR='#CCDDFF'>\n<TH>Function Name</TH>\n"
. "<TH>View<BR>Function Usage</TH>\n<TH>View/Edit<BR>Function "
. "Details</TH>\n</TR>\n");
# For each function in the array, (each function in WebSubmit), display
# its name, and make the input forms...
while(list($funName) = mysql_fetch_row($queryResult))
{
print("<TR BGCOLOR='#FFFFCC'>\n<TD>&nbsp;$funName"
. "&nbsp;</TD>\n"
. "<FORM METHOD='post' ACTION='funcUsage.php'><TD "
. "ALIGN='center'><INPUT TYPE='hidden' NAME='function'"
. " VALUE='$funName'><INPUT TYPE='image' BORDER=0 "
. "SRC='".$IMAGES."/tick.gif'></TD></FORM>\n"
. "<FORM METHOD='post' ACTION='veditFunDets.php'><TD "
. "ALIGN='center'><INPUT TYPE='hidden' NAME='function' "
. "VALUE='$funName'><INPUT TYPE='image' BORDER=0"
. " SRC='".$IMAGES."/tick.gif'></TD></FORM>\n</TR>\n");
} // END for
# Close the table...
print("</TABLE>\n");
} // END function makeFunctionTable($queryResult)
/**************************Start of Main Script*********************/
/**********************************************************************
This script displays a table of all functions in the WebSubmit database
on the browser screen. Effectively, it makes a table, containing
the name of each function, and for each function, a link to a page
that shows the functions usage in WebSubmit, and a link to a page that
allows the user to view and/or edit the details of that function.
It is worth making a note at this stage about the operation of this
script. I had at first thought that the WebSubmit table sbmFUNDESC
contained the details of every function in the WebSubmit database, and
therefore it would be possible to simply query this table to get the
names of all functions in WebSubmit. Further observations however,
revealed that sbmFUNDESC only contains entries for functions that take
parameters, which meant that functions without parameters would not
be listed by querying this table. This meant that it was necessaray
to create a new table that contained the function name, and a
descrtiption of the function.
This table was added to mess, and called sbmALLFUNCDESCR. It was
decided that it would be made compulsary that all functions have an
entry in this new table, so that obtaining a list of all functions
in WebSubmit would be very easy and efficient.
**********************************************************************/
function displayPage()
{
# Place a READ lock on the sbmALLFUNCDESCR table
if($lockRes = mysql_query("LOCK TABLES sbmALLFUNCDESCR READ"))
{
# Run a query to retrieve all of the functions in the WebSubmit...
$funcQuery = mysql_query("SELECT function FROM sbmALLFUNCDESCR ORDER
BY function");
# We must unlock our table...
$unlockRes = mysql_query("UNLOCK TABLES");
if($funcQuery) # If the query to get all functions was successful
{
# Display the query results on the screen...
makeFunctionTable($funcQuery);
# Now print out an action button to give the user to add a
# function...
print("<TABLE BORDER=0 CELLSPACING=0 CELLPADDING=0 "
. "ALIGN='center'>\n"
. "<TR>\n<FORM METHOD='post' ACTION='newFunc.php'><TD "
. "ALIGN='center'><INPUT TYPE='button' VALUE='ADD FUNCTION'"
. " onClick=\"submit();\">\n</TD></FORM>\n</TR>\n"
. "</TABLE>\n");
} // END if
else # If the function did not execute successfully...
{
# Display an error message on the screen in the form of a
# JavaScript alert...
print("<SCRIPT TYPE='text/javascript'>alert('ERROR: Unable"
. " to execute query for all "
. "functions in WebSubmit');</SCRIPT>");
} // END else
} # END if
else
{
# Could not lock the table. No display allowed.
print("<DIV STYLE='text-align: center; font-weight: bold; "
. "font-size: large; color: navy'>\n<SPAN STYLE='color: red'>"
. "Error:</SPAN> Unable to retrieve information.</DIV>\n<BR>".mysql_error()."\n"
. "<A STYLE='text-align: center; font-size: medium' HREF='"
. "listFunctions.php'>Please retry</A>\n<BR>\n");
} # END else
}
/**********************Start of main script***************************/
# Connect to the MySQL server
serverConnect(MYSQLDOCMACHINE, MYSQLDOCUSERID, MYSQLDOCPASSWORD);
# Select the CDS Search database...
dbSelect(DOCS_DATABASE);
$auth = canUseWebSubmitAdmin($uid);
if (!$auth[0])
outWarning($auth[1]);
else
displayPage();
/************************End of main script***************************/
</protect>
?>

Event Timeline