Page MenuHomec4science

UDF_display.php.wml
No OneTemporary

File Metadata

Created
Tue, May 14, 20:04

UDF_display.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("localconf.inc.php");
?>
#include "cdspage.wml" \
title="User Defined Functions (UDFs)" \
navbar_name="admin" \
navbar_select="UDF_display" \
cdspageboxlefttopadd="<protect><?displayLoginMenu('admin');?> </protect>"
<?
include("security.inc.php");
<protect>## $Id$</protect>
//==========================================================================
// File: UDF_display.php (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\">&nbsp;</td>\n";
while($func=mysql_fetch_array($res_func))
{
list($fname, $rtype, $doc)=$func;
$doc=str_replace("\n", "<br>", $doc);
$doc=str_replace(" ", "&nbsp;", $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&nbsp;</td>\n";
print "<td bgcolor=\"$cCells\"><font size=\"2\">$doc&nbsp;</font></td>\n";
print "<td align=\"center\" bgcolor=\"$cCells\"><a href=\"JavaScript:openwindowlink( 'UDF_showone.php?fname=$fname', 'UDFC$fname' )\"><font size=\"2\">[Code]</font></a></td>\n";
print "<td align=\"center\" bgcolor=\"$cCells\"><a href=\"JavaScript:openwindowlink( 'UDF_edit.php?fname=$fname', 'UDFM$fname' )\"><font size=\"2\">[Modify]</font></a></td>\n";
print "<td align=\"center\" bgcolor=\"$cCells\"><a href=\"UDF_del.php?fname=$fname\"><font size=\"2\">[Delete]</font></a></td>\n";
print "</tr>";
}
print "</table>\n";
mysql_close( $db );
?>
<br>
<form action="UDF_add.php" 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