cosmetics, tag editing
This commit is contained in:
parent
0c1fc8431a
commit
5e09b901ce
5 changed files with 22 additions and 11 deletions
|
@ -20,7 +20,6 @@
|
|||
echo $_GET["tag"];
|
||||
}
|
||||
?>"><br>
|
||||
<input type="hidden" name="ID" value="<?= empty($doc) ? "" : $doc["ID"] ?>" >
|
||||
<input type="submit">
|
||||
</form>
|
||||
</div>
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
<div class="text tag-text">
|
||||
<h1><?= $tag["Name"] ?></h1>
|
||||
<p class="tag-desc"><?= $tag["Description"] ?></p>
|
||||
<a class="tag-edit-link" href="?action=edit&tag=<?= $tag["ID"] ?>">[edit tag]</a>
|
||||
<a class="tag-edit-link" href="?action=edit_tag&tag=<?= $tag["ID"] ?>">[edit tag]</a>
|
||||
</div>
|
||||
<? endif; ?>
|
||||
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
<ul id="sidebar-taglist-overview">
|
||||
<li id="sidebar-taglist-top"><a href="?tag=*">ALL (<?= $all_count ?>)</a></li>
|
||||
<li id="sidebar-taglist-top"><a href="?tag=_">UNTAGGED (<?= $none_count ?>)</a></li>
|
||||
<li id="sidebar-taglist-top"><a href="?action=new_tag">ADD TAG</a></li>
|
||||
</ul>
|
||||
<ul>
|
||||
<?
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
||||
|
|
|
@ -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,7 +56,7 @@ if (isset($_SESSION['ID'])){
|
|||
}
|
||||
|
||||
$db->updateDoc(
|
||||
$_POST["ID"],
|
||||
$_GET["item"],
|
||||
$_POST["Title"],
|
||||
$_POST["Author"],
|
||||
$_POST["Description"],
|
||||
|
@ -55,10 +65,12 @@ if (isset($_SESSION['ID'])){
|
|||
$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"){
|
||||
|
|
Loading…
Reference in a new issue