Page MenuHomec4science

functionnew.html.wml
No OneTemporary

File Metadata

Created
Tue, Jul 2, 20:34

functionnew.html.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"
#include "cdspage.wml" \
title="Create a new function" \
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> &gt; <a class=navtrail href=<lang:star: index.*.html>><MSG_GUIDE></a>" \
navbar_name="admin" \
navbar_select="websubmit-admin-guide"
<h3>How to get there?</h3>
<BLOCKQUOTE>
&nbsp;<span class="guideheader">C</span>lick on the "Available Functions" link in the websubmit admin right
menu. Then click on the "Add New Function" button.
</BLOCKQUOTE>
<h3>How to do this?</h3>
<BLOCKQUOTE>
&nbsp;<span class="guideheader">E</span>nter the name of the new function as well as a text description if
you wish.<br>
&nbsp;<span class="guideheader">Y</span>ou will then reach a page where you can add parameters to your
new function.<br><br>
&nbsp;<span class="guideheader">D</span>on't forget to add the function file inside the
<LIBDIR>/python/cdsware/websubmit_functions directory and to name the file after the function. Functions must
be written in Python. Here is an example implementation of a function:<BR><BR>
<LIBDIR>/python/cdsware/websubmit_functions/Get_Report_Number.py:</SMALL>
<TABLE border=0 width=75% bgcolor="eeeeff"><TR><TD><small><pre><br>
def Get_Report_Number (parameters,curdir,form):
global rn
#Path of file containing report number
if os.path.exists("%s/%s" % (curdir,parameters['edsrn'])):
fp = open("%s/%s" % (curdir,parameters['edsrn']),"r")
rn = fp.read()
rn = rn.replace("/","_")
rn = re.sub("[\n\r ]+","",rn)
else:
rn = ""
return ""
<pre></small></TD></TR></TABLE>
<br>
The function parameters are passed to the function through the parameters dictionary.<br>
The curdir parameter contains the current submission directory path.<br>
The form parameter contains the form passed to the current web page for possible reference from inside the
function.
</BLOCKQUOTE>
<h3>See also:</h3>
<BLOCKQUOTE>
<li><A HREF="functionedit.<lang:star: *>.html">edit a function</A><BR>
<li><A HREF="functiondelete.<lang:star: *>.html">delete a function</A><BR>
</BLOCKQUOTE>

Event Timeline