Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F93553123
UDF_display.shtml.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, Nov 29, 16:39
Size
4 KB
Mime Type
text/x-c
Expires
Sun, Dec 1, 16:39 (1 d, 23 h)
Engine
blob
Format
Raw Data
Handle
22662767
Attached To
R3600 invenio-infoscience
UDF_display.shtml.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("localconf.inc.shtml");
?>
#include "cdspage.wml" \
title="User Defined Functions (UDFs)" \
navbar_name="admin" \
navbar_select="UDF_display" \
cdspageboxlefttopadd="<protect><?displayLoginMenu('admin');?> </protect>"
<?
include("security.inc.shtml");
<protect>## $Id$</protect>
//==========================================================================
// File: UDF_display.shtml (flexElink WI)
// Description: Shows a list of the existing UDFs and their parameters, and
// allows to access to their details, add or delete
// POST parameters:
// Notes:
// Requires: DB, ERROR, FUNCTION_LIB
// Author: Hector.Sanchez@cern.ch
//==========================================================================
include(DB);
include(ERROR);
include(FUNCTION_LIB);
include(HEADER);
?>
<p>Define your own functions that you can reuse when creating your
own output formats. This enables you to do complex formatting without
ever touching the BibFormat core code.
<em>Example:</em> You can define a function how to match and
extract email addresses out of a text file.<p>
<script language="javascript">
<!---
function openwindowlink( addr, name )
{
window.open( addr, "Window"+name, "height=560,witdh=220,scrollbars,resizable" )
}
//-->
</script>
<?
$cBorder="#CCCCCC";
$cHeaders="#FFFFFFCC";
$cCells="#FFFFFFFF";
$cImpCells="#FFFFFFF0";
$db=mysql_connect( $DB_HOST, $DB_USER, $DB_PASSWD ) or errormsg("Couldn't conn
ect to mySQL");
mysql_selectdb( $DB_DB ) or errormsg(sprintf("Couldn't connect into database %
s", $DB_DB));
$qry_func="select fname, rtype, doc from flxUDFS order by fname";
$res_func=mysql_query( $qry_func );
print '<table border="1" bgcolor="'.$cBorder.'">'."\n";
print "<tr align=\"center\">\n
<td bgcolor=\"$cHeaders\"><B>Function name</b></td>\n";
print "<td bgcolor=\"$cHeaders\"><b>Params</b></td>\n";
print "<td bgcolor=\"$cHeaders\"><b>Description</b></td>\n";
print "<td bgcolor=\"$cHeaders\" colspan=\"3\"> </td>\n";
while($func=mysql_fetch_array($res_func))
{
list($fname, $rtype, $doc)=$func;
$doc=str_replace("\n", "<br>", $doc);
$doc=str_replace(" ", " ", $doc);
print "<tr>";
print "<td bgcolor=\"$cImpCells\"><b>$fname</b></td>\n";
$qry_par="select pname from flxUDFPARAMS where fname='$fname' order by ord";
$pars="";
$res_par=mysql_query( $qry_par );
while($par=mysql_fetch_array( $res_par ))
{
$par=$par["pname"];
$pars.=$par."<br>";
}
print "<td valign=\"top\" bgcolor=\"$cCells\">$pars </td>\n";
print "<td bgcolor=\"$cCells\"><font size=\"2\">$doc </font></td>\n";
print "<td align=\"center\" bgcolor=\"$cCells\"><a href=\"JavaScript:openwindowlink( 'UDF_showone.shtml?fname=$fname', 'UDFC$fname' )\"><font size=\"2\">[Code]</font></a></td>\n";
print "<td align=\"center\" bgcolor=\"$cCells\"><a href=\"JavaScript:openwindowlink( 'UDF_edit.shtml?fname=$fname', 'UDFM$fname' )\"><font size=\"2\">[Modify]</font></a></td>\n";
print "<td align=\"center\" bgcolor=\"$cCells\"><a href=\"UDF_del.shtml?fname=$fname\"><font size=\"2\">[Delete]</font></a></td>\n";
print "</tr>";
}
print "</table>\n";
mysql_close( $db );
?>
<br>
<form action="UDF_add.shtml" method="POST">
<table align="center">
<tr>
<td bgcolor="#000000" align="center" colspan="2">
<font color="#FFFFFF">Add new function</font>
</td>
</tr>
<tr>
<td>Function Name</td>
<td><input type="text" name="fname"></td>
</tr>
<tr>
<td>Params</td>
<td><input type="text" name="params" size="40"></td>
</tr>
<tr>
<td>PHP Code</td>
<td><textarea name="code" cols="65" rows="20"></textarea><td>
</tr>
<tr>
<td>UDF documentation</td>
<td><textarea name="doc" cols="65" rows="10"></textarea><td>
</tr>
<tr>
<td colspan="2" align="center"><input type="submit" value="Add"></td>
</tr>
</table>
</form>
<?
include(FOOTER);
?>
Event Timeline
Log In to Comment