diff --git a/www/_templates/admin_doc_edit.php b/www/_templates/admin_doc_edit.php
index d084e79..359c013 100644
--- a/www/_templates/admin_doc_edit.php
+++ b/www/_templates/admin_doc_edit.php
@@ -20,7 +20,6 @@
echo $_GET["tag"];
}
?>">
- " >
diff --git a/www/_templates/admin_doc_listing.php b/www/_templates/admin_doc_listing.php
index a3c4102..eaa2814 100644
--- a/www/_templates/admin_doc_listing.php
+++ b/www/_templates/admin_doc_listing.php
@@ -2,7 +2,7 @@
= $tag["Name"] ?>
= $tag["Description"] ?>
-
">[edit tag]
+
">[edit tag]
endif; ?>
diff --git a/www/_templates/admin_wrap.php b/www/_templates/admin_wrap.php
index c949513..0f59d88 100644
--- a/www/_templates/admin_wrap.php
+++ b/www/_templates/admin_wrap.php
@@ -19,6 +19,7 @@
diff --git a/www/_util/PileDB.php b/www/_util/PileDB.php
index 661180a..b30a0f2 100644
--- a/www/_util/PileDB.php
+++ b/www/_util/PileDB.php
@@ -158,12 +158,12 @@ class PileDB {
return $stmt->execute()->fetchArray(SQLITE3_ASSOC);
}
- public function updateTag($id, $name, $description, $parent){
+ public function updateTag($id, $name, $description){
if (empty($id)){
$stmt = $this->db->prepare("INSERT INTO Tags
- (ID, Name, Description, Parent)
+ (ID, Name, Description)
VALUES
- (NULL, :name, :description, :parent");
+ (NULL, :name, :description)");
} else {
$stmt = $this->db->prepare("UPDATE Tags SET
Name=:name,
@@ -174,7 +174,6 @@ class PileDB {
}
$stmt->bindValue(":name", $name, SQLITE3_TEXT);
$stmt->bindValue(":description", $description, SQLITE3_TEXT);
- $stmt->bindValue(":parent", $parent, SQLITE3_INTEGER);
return $stmt->execute();
}
diff --git a/www/admin.php b/www/admin.php
index 2ee93e5..bebd5f9 100644
--- a/www/admin.php
+++ b/www/admin.php
@@ -14,10 +14,20 @@ if (isset($_SESSION['ID'])){
if (isset($_GET["action"])){
switch ($_GET["action"]){
case "new_tag":
- $content = $page->render("admin_doc_edit.php");
+ $content = $page->render("admin_tag_edit.php");
break;
case "edit_tag":
- $content = $page->render("admin_doc_edit.php");
+ if (isset($_POST["Name"])){
+ $db->updateTag(
+ $_GET["tag"],
+ $_POST["Name"],
+ $_POST["Description"]
+ );
+ }
+ if ( !empty($_GET["tag"]) ) {
+ $page->tag = $db->fetchTag($_GET["tag"]);
+ }
+ $content = $page->render("admin_tag_edit.php");
break;
case "new_item":
$content = $page->render("admin_doc_edit.php");
@@ -46,19 +56,21 @@ if (isset($_SESSION['ID'])){
}
$db->updateDoc(
- $_POST["ID"],
+ $_GET["item"],
$_POST["Title"],
$_POST["Author"],
$_POST["Description"],
$_POST["Published"],
$url,
$doc_tags
- );
+ );
}
+
if ( !empty($_GET["item"]) ) {
$page->doc = $db->fetchDoc($_GET["item"]);
- $content = $page->render("admin_doc_edit.php");
}
+ $content = $page->render("admin_doc_edit.php");
+
break;
case "remove":
if ( ! empty($_GET["confirm"]) && $_GET["confirm"] == "yes"){