summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authorAndrew Dolgov <[email protected]>2006-12-07 08:48:00 +0100
committerAndrew Dolgov <[email protected]>2006-12-07 08:48:00 +0100
commit0b126ac277ed5480ef6090ddc7a23a15d21f2960 (patch)
treef8cb200f57f056da4ace2a754931e585f9103d7f /modules
parentfaf40998b3c1c075e30020031db001fbc89276cc (diff)
tag editor
Diffstat (limited to 'modules')
-rw-r--r--modules/backend-rpc.php40
-rw-r--r--modules/popup-dialog.php36
2 files changed, 75 insertions, 1 deletions
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 @@
<message>$key : $value</message>
</rpc-reply>";
}
+
+ 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 "<rpc-reply>
+ <message>$id</message>
+ </rpc-reply>";
+
+ }
}
?>
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 @@
<?php
function module_popup_dialog($link) {
$id = $_GET["id"];
- $param = $_GET["param"];
+ $param = db_escape_string($_GET["param"]);
if ($id == "quickAddFeed") {
@@ -270,6 +270,40 @@
}
+ if ($id == "editArticleTags") {
+
+ print "<div id=\"infoBoxTitle\">Edit Tags</div>";
+ print "<div class=\"infoBoxContents\">";
+
+ print "<form id=\"tag_edit_form\">";
+
+ print "Tags for this article (separated by commas):<br>";
+
+ $tags = get_article_tags($link, $param);
+
+ $tags_str = join(", ", $tags);
+
+ print "<input type=\"hidden\" name=\"id\" value=\"$param\">";
+
+ print "<textarea rows='4' class='iedit' name='tags_str'>$tags_str</textarea>";
+
+ print "</form>";
+
+ print "<div align='right'>";
+
+ print "<input class=\"button\"
+ type=\"submit\" onclick=\"return editTagsSave()\"
+ value=\"Save\"> ";
+
+ print "<input class=\"button\"
+ type=\"submit\" onclick=\"return closeInfoBox()\"
+ value=\"Cancel\">";
+
+
+ print "</div>";
+
+ }
+
print "</div>";
}
?>