From 0b126ac277ed5480ef6090ddc7a23a15d21f2960 Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Thu, 7 Dec 2006 08:48:00 +0100 Subject: tag editor --- modules/backend-rpc.php | 40 ++++++++++++++++++++++++++++++++++++++++ modules/popup-dialog.php | 36 +++++++++++++++++++++++++++++++++++- 2 files changed, 75 insertions(+), 1 deletion(-) (limited to 'modules') diff --git a/modules/backend-rpc.php b/modules/backend-rpc.php index 92fe23468..153590589 100644 --- a/modules/backend-rpc.php +++ b/modules/backend-rpc.php @@ -202,5 +202,45 @@ $key : $value "; } + + if ($subop == "setArticleTags") { + $id = db_escape_string($_GET["id"]); + $tags_str = db_escape_string($_GET["tags_str"]); + + $tags = split(",", $tags_str); + + db_query($link, "BEGIN"); + + $result = db_query($link, "SELECT int_id FROM ttrss_user_entries WHERE + ref_id = '$id' AND owner_uid = '".$_SESSION["uid"]."' LIMIT 1"); + + if (db_num_rows($result) == 1) { + + $int_id = db_fetch_result($result, 0, "int_id"); + + db_query($link, "DELETE FROM ttrss_tags WHERE + post_int_id = $int_id AND owner_uid = '".$_SESSION["uid"]."'"); + + foreach ($tags as $tag) { + $tag = trim($tag); + + if (preg_match("/^[0-9]*$/", $tag)) { + continue; + } + + if ($tag != '') { + db_query($link, "INSERT INTO ttrss_tags + (post_int_id, owner_uid, tag_name) VALUES ('$int_id', '".$_SESSION["uid"]."', '$tag')"); + } + } + } + + db_query($link, "COMMIT"); + + print " + $id + "; + + } } ?> diff --git a/modules/popup-dialog.php b/modules/popup-dialog.php index d3933ae77..a1ead2b00 100644 --- a/modules/popup-dialog.php +++ b/modules/popup-dialog.php @@ -1,7 +1,7 @@ Edit Tags"; + print "
"; + + print "
"; + + print "Tags for this article (separated by commas):
"; + + $tags = get_article_tags($link, $param); + + $tags_str = join(", ", $tags); + + print ""; + + print ""; + + print "
"; + + print "
"; + + print " "; + + print ""; + + + print "
"; + + } + print "
"; } ?> -- cgit v1.2.3-54-g00ecf