$cat_title = db_escape_string(trim($_REQUEST["value"]));
$cat_id = db_escape_string($_GET["cid"]);
-
- $result = db_query($link, "UPDATE ttrss_feed_categories SET
- title = '$cat_title' WHERE id = '$cat_id' AND owner_uid = ".$_SESSION["uid"]);
- print $_REQUEST["value"];
+ db_query($link, "BEGIN");
+
+ $result = db_query($link, "SELECT title FROM ttrss_feed_categories
+ WHERE id = '$cat_id' AND owner_uid = ".$_SESSION["uid"]);
+
+ if (db_num_rows($result) == 1) {
+
+ $old_title = db_fetch_result($result, 0, "title");
+
+ if ($cat_title != "") {
+ $result = db_query($link, "UPDATE ttrss_feed_categories SET
+ title = '$cat_title' WHERE id = '$cat_id' AND
+ owner_uid = ".$_SESSION["uid"]);
+
+ print $cat_title;
+ } else {
+ print $old_title;
+ }
+ } else {
+ print $_REQUEST["value"];
+ }
+
+ db_query($link, "COMMIT");
return;
<option value=\"facDefault\" selected>".__('Actions...')."</option>
<option disabled>--------</option>
<option style=\"color : #5050aa\" disabled>".__('Selection:')."</option>
- <option value=\"facEdit\"> ".__('Edit')."</option>
- <option value=\"facPurge\"> ".__('Manual purge')."</option>
+ <option value=\"facEdit\"> ".__('Edit')."</option>";
+
+ if (FORCE_ARTICLE_PURGE == 0) {
+ print
+ "<option value=\"facPurge\"> ".__('Manual purge')."</option>";
+ }
+
+ print "
<option value=\"facClear\"> ".__('Clear feed data')."</option>
<option value=\"facRescore\"> ".__('Rescore articles')."</option>
<option value=\"facUnsubscribe\"> ".__('Unsubscribe')."</option>";
}
}
-function infobox_feed_cat_callback() {
- if (xmlhttp.readyState == 4) {
- try {
-
- infobox_callback();
-
- if (document.getElementById("prefFeedCatList")) {
- var elems = document.getElementById("prefFeedCatList").getElementsByTagName("SPAN");
+function init_cat_inline_editor() {
+ try {
- for (var i = 0; i < elems.length; i++) {
- if (elems[i].id && elems[i].id.match("FCATT-")) {
- var cat_id = elems[i].id.replace("FCATT-", "");
+ if (document.getElementById("prefFeedCatList")) {
+ var elems = document.getElementById("prefFeedCatList").getElementsByTagName("SPAN");
+ for (var i = 0; i < elems.length; i++) {
+ if (elems[i].id && elems[i].id.match("FCATT-")) {
+ var cat_id = elems[i].id.replace("FCATT-", "");
new Ajax.InPlaceEditor(elems[i],
- 'backend.php?op=pref-feeds&subop=editCats&action=save&cid=' + cat_id);
- }
+ 'backend.php?op=pref-feeds&subop=editCats&action=save&cid=' + cat_id);
}
}
+ }
+
+ } catch (e) {
+ exception_error("init_cat_inline_editor", e);
+ }
+}
+
+function infobox_feed_cat_callback() {
+ if (xmlhttp.readyState == 4) {
+ try {
+
+ infobox_callback();
+ init_cat_inline_editor();
} catch (e) {
exception_error("infobox_feed_cat_callback", e);
xmlhttp.open("GET", "backend.php?op=pref-feeds&subop=editCats&action=add&cat=" +
param_escape(cat.value), true);
- xmlhttp.onreadystatechange=infobox_callback;
+ xmlhttp.onreadystatechange=infobox_feed_cat_callback;
xmlhttp.send(null);
link.value = "";
xmlhttp.open("GET", "backend.php?op=pref-feeds&subop=editCats&action=remove&ids="+
param_escape(sel_rows.toString()), true);
- xmlhttp.onreadystatechange=infobox_callback;
+ xmlhttp.onreadystatechange=infobox_feed_cat_callback;
xmlhttp.send(null);
}