Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F93840995
KB_edit.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
Sun, Dec 1, 22:40
Size
4 KB
Mime Type
text/html
Expires
Tue, Dec 3, 22:40 (15 h, 16 m)
Engine
blob
Format
Raw Data
Handle
22710412
Attached To
R3600 invenio-infoscience
KB_edit.shtml.wml
View Options
<?
/*********************************************************************
This file is part of the CERN Document Server Software (CDSware).
Copyright (C) 2002 CERN.
1211 Geneva 23 - Switzerland
<cds.support@cern.ch>
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
*********************************************************************/
//==========================================================================
// File: KB_edit.shtml (flexElink WI)
// Description: Allows to modify KB data and updates the changes in the DB.
// DB table is not available for modifcation
// POST parameters:
// name --> (required) Name (id) of the KB to be modified
// process -> (optional) When is set, the script updates the KB data
// in the DB with the parameter values
// name_orig -> (required if process is set) Original name of the KB
// to be updated (the KB format may be changed)
// doc ----> (optional) Description of the purpose of the KB
// Notes: If the KB is succesfully updated in the DB it closes the current
// browser and refreshes the opener one
// Requires: DB, ERROR
// Author: Hector.Sanchez@cern.ch
//==========================================================================
include("localconf.inc.shtml");
include(DB);
include(ERROR);
if( (!isset($name)) or (trim($name)=="") )
{
print "<b>KB name</b> hasn't been specified";
print "<hr>";
print "<a align=\"center\" href=\"JavaScript:window.close();\">[Close]</a>";
exit;
}
$db=mysql_connect( $DB_HOST, $DB_USER, $DB_PASSWD );
mysql_selectdb( $DB_DB );
$name=trim(strtoupper($name));
//--------DISPLAY
if(!isset($process))
{
$qry="select kb_table, doc from flxKBS where kb_name='$name'";
$qh=mysql_query( $qry );
if(mysql_num_rows( $qh )<1)
{
print "<b>KB '$name'</b> not found";
print "<hr>";
print "<a align=\"center\" href=\"JavaScript:window.close();\">[Close]</a>";
exit;
}
$row=mysql_fetch_array($qh);
list($table, $doc)=$row;
?>
<form action="KB_edit.shtml" method="POST">
<table witdth="100%" bgcolor="#CCCCCC" cellpadding="4" cellspacing="4">
<tr align="center">
<td bgcolor="#FFCC99" colspan="2">
<font size="4">
Editing KB <b>'<? echo $name;?>'</b></font>
</td>
</tr>
<td bgcolor="#FFFFFF">
<b>KB Name</b> <input name="name" value="<?echo $name;?>">
</td>
<td bgcolor="#FFFFFF">
<b>Table name: </b><? echo $table;?>
</td>
<tr>
<td align="center" bgcolor="#FFFFFF" colspan="2">
<b>Documentation</b><br>
<textarea name="doc" cols="100" rows="5"><?echo $doc;?></textarea>
</td>
</tr>
<tr>
<td colspan="2" align="center"><input type="submit" value="UPDATE"></td>
</tr>
</table>
<input type="hidden" name="process" value="oo">
<input type="hidden" name="name_orig" value="<?echo $name;?>">
</form>
<?
}
else
{
if( (!isset($doc)) )
$doc="";
if(!get_magic_quotes_gpc())
{
$doc=addslashes($doc);
}
$qry="update flxKBS
set kb_name='$name',
doc='$doc'
where kb_name='$name_orig'";
if(!mysql_query( $qry ))
{
print "Impossible to update KB '$name_orig': ".mysql_error();
print "<hr><a href=\"JavaScript:window.history.go(-1)\">[Go Back]</a>";
exit();
}
mysql_close( $db );
?>
<script language="JavaScript">
opener.location.reload(false);
window.close();
</script>
<?
}
?>
Event Timeline
Log In to Comment