diff --git a/modules/pref-feeds.php b/modules/pref-feeds.php index 193a1a4bc..fb791a930 100644 --- a/modules/pref-feeds.php +++ b/modules/pref-feeds.php @@ -519,22 +519,27 @@ if ($subop == "editCats") { - print "
".__('Category editor')."
"; - - print "
"; - $action = $_REQUEST["action"]; if ($action == "save") { - $cat_title = db_escape_string(trim($_GET["title"])); - $cat_id = db_escape_string($_GET["id"]); + $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"]; + + return; + } + print "
".__('Category editor')."
"; + + print "
"; + + if ($action == "add") { if (!WEB_DEMO_MODE) { @@ -625,10 +630,6 @@ print ""; - -/* print " - - "; */ $lnum = 0; @@ -637,54 +638,18 @@ $class = ($lnum % 2) ? "even" : "odd"; $cat_id = $line["id"]; - - $edit_cat_id = $_GET["id"]; - - if ($action == "edit" && $cat_id == $edit_cat_id) { - $class .= "Selected"; - $this_row_id = ""; - } else if ($action == "edit" && $cat_id != $edit_cat_id) { - $class .= "Grayed"; - $this_row_id = ""; - } else { - $this_row_id = "id=\"FCATR-$cat_id\""; - } + $this_row_id = "id=\"FCATR-$cat_id\""; print ""; $edit_title = htmlspecialchars($line["title"]); - if (!$edit_cat_id || $action != "edit") { - - print ""; - - print ""; - - } else if ($cat_id != $edit_cat_id) { - - print ""; - - print ""; - - } else { - - print ""; - - print ""; - - } + print ""; + + print ""; print ""; @@ -707,20 +672,10 @@ print "
"; - if ($action == "edit") { - print " - "; - } else { - - print " - + print " "; - } - + print "
"; print ""; diff --git a/prefs.js b/prefs.js index b1739bc95..edd1627d1 100644 --- a/prefs.js +++ b/prefs.js @@ -207,6 +207,31 @@ function changepass_callback() { } } +function infobox_feed_cat_callback() { + if (xmlhttp.readyState == 4) { + try { + + infobox_callback(); + + 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); + } + } + } + + } catch (e) { + exception_error("infobox_feed_cat_callback", e); + } + } +} + function updateFeedList(sort_key) { if (!xmlhttp_ready(xmlhttp)) { @@ -1615,7 +1640,7 @@ function editFeedCats() { } xmlhttp.open("GET", "backend.php?op=pref-feeds&subop=editCats", true); - xmlhttp.onreadystatechange=infobox_callback; + xmlhttp.onreadystatechange=infobox_feed_cat_callback; xmlhttp.send(null); }
 Title
" . - $edit_title . "$edit_title"; - - print ""; - print ""; - print ""; - print ""; - - print "" . + $edit_title . "