- improve existing category class
- use category class in category admin and appbrowse => fix adding a category which was broken => fix deleting a category which was broken => fix editing a category which was broken
This commit is contained in:
@@ -1,41 +1,57 @@
|
||||
<?php
|
||||
|
||||
include("path.php");
|
||||
include(BASE."include/"."incl.php");
|
||||
include(BASE."include/"."tableve.php");
|
||||
require(BASE."include/incl.php");
|
||||
require(BASE."include/category.php");
|
||||
|
||||
if(!$_SESSION['current']->hasPriv("admin"))
|
||||
{
|
||||
errorpage();
|
||||
exit;
|
||||
}
|
||||
else
|
||||
$oCat = new Category($_REQUEST['catId']);
|
||||
if($_REQUEST['submit'])
|
||||
{
|
||||
global $admin_mode;
|
||||
$admin_mode = 1;
|
||||
}
|
||||
|
||||
apidb_header("Add Application Category");
|
||||
|
||||
$t = new TableVE("create");
|
||||
|
||||
if($_POST)
|
||||
{
|
||||
$t->update($_POST);
|
||||
$oCat->update($_REQUEST['name'],$_REQUEST['description'],$_REQUEST['parentId']);
|
||||
redirect(apidb_fullurl("appbrowse.php?catId=".$oCat->iCatId));
|
||||
}
|
||||
else
|
||||
{
|
||||
$table = "appCategory";
|
||||
$query = "INSERT INTO $table VALUES(0, 'NONAME', null, 0)";
|
||||
|
||||
query_appdb("DELETE FROM $table WHERE catName = 'NONAME'");
|
||||
|
||||
if(debugging())
|
||||
echo "$query <br /><br />\n";
|
||||
|
||||
$t->create($query, $table, "catId");
|
||||
apidb_header("Add Category");
|
||||
$sQuery = "SELECT catId, catName FROM appCategory WHERE catId!='".$_REQUEST['catId']."'";
|
||||
$hResult = query_appdb($sQuery);
|
||||
while($oRow = mysql_fetch_object($hResult))
|
||||
{
|
||||
$aCatsIds[]=$oRow->catId;
|
||||
$aCatsNames[]=$oRow->catName;
|
||||
}
|
||||
echo "<form method=\"post\" action=\"addCategory.php\">
|
||||
<input type=\"hidden\" name=\"catId\" value=\"".$oCat->iCatId."\" />
|
||||
<table border=\"0\" width=\"100%\" cellspacing=\"0\" cellpadding=\"2\">
|
||||
<tr>
|
||||
<td width=\"15%\" class=\"box-label\"><b>Category name</b></td>
|
||||
<td class=\"box-body\">
|
||||
<input type=\"text\" size=\"50\" name=\"name\" value=\"".$oCat->sName."\" />
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td width=\"15%\" class=\"box-label\"><b>Description</b></td>
|
||||
<td class=\"box-body\">
|
||||
<input type=\"text\" size=\"50\" name=\"description\" value=\"".$oCat->sDescription."\" />
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td width=\"15%\" class=\"box-label\"><b>Parent</b></td>
|
||||
<td class=\"box-body\">
|
||||
".html_select("parentId",$aCatsIds,$oCat->iParentId,$aCatsNames)."
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan=\"2\" class=\"box-body\">
|
||||
<input type=\"submit\" name=\"submit\" value=\"Submit\" />
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>";
|
||||
}
|
||||
|
||||
apidb_footer();
|
||||
|
||||
?>
|
||||
|
||||
Reference in New Issue
Block a user