diff --git a/functions.js b/functions.js index 3fa9c69c0..c6ef5fba9 100644 --- a/functions.js +++ b/functions.js @@ -1470,6 +1470,15 @@ function infobox_callback() { box.style.display = "block"; } } + + /* FIXME this needs to be moved out somewhere */ + + if (document.getElementById("tags_choices")) { + new Ajax.Autocompleter('tags_str', 'tags_choices', + "backend.php?op=rpc&subop=completeTags", + { tokens: ',', paramName: "search" }); + } + notify(""); } catch (e) { exception_error("infobox_callback", e); diff --git a/modules/backend-rpc.php b/modules/backend-rpc.php index 7e83e816a..3303b25f9 100644 --- a/modules/backend-rpc.php +++ b/modules/backend-rpc.php @@ -320,5 +320,22 @@ print_error_xml(6); } + if ($subop == "completeTags") { + + $search = db_escape_string($_REQUEST["search"]); + + $result = db_query($link, "SELECT DISTINCT tag_name FROM ttrss_tags + WHERE owner_uid = '".$_SESSION["uid"]."' AND + tag_name LIKE '$search%' ORDER BY tag_name + LIMIT 10"); + + print ""; + + } + } ?> diff --git a/modules/popup-dialog.php b/modules/popup-dialog.php index 6590159d2..2805f7653 100644 --- a/modules/popup-dialog.php +++ b/modules/popup-dialog.php @@ -376,9 +376,13 @@ print ""; - print ""; + print " +
+ "; - print "".__('Add existing tag:').""; +/* print "".__('Add existing tag:').""; $result = db_query($link, "SELECT DISTINCT tag_name FROM ttrss_tags WHERE owner_uid = '".$_SESSION["uid"]."' ORDER BY tag_name"); @@ -395,9 +399,9 @@ print_select("found_tags", '', $found_tags, "onchange=\"javascript:editTagsInsert()\""); - print ""; + print ""; - print ""; + print ""; */ print ""; diff --git a/tt-rss.css b/tt-rss.css index 8d613fa8c..61ae3fa14 100644 --- a/tt-rss.css +++ b/tt-rss.css @@ -1649,3 +1649,32 @@ a[target="_new"], a[target="_blank"] { border-color : #778899; border-style : dotted; } + +div.autocomplete { + position : absolute; + width : 250px; + background-color : white; + border :1px solid #778899; + margin : 0px; + padding : 0px; +} + +div.autocomplete ul { + list-style-type : none; + margin : 0px; + padding : 0px; +} + +div.autocomplete ul li.selected { + background-color : #fff7d5; +} + +div.autocomplete ul li { + list-style-type : none; + display : block; + margin : 0; + padding : 2px; + height : 32px; + cursor : pointer; +} + diff --git a/tt-rss.php b/tt-rss.php index c43cb5d81..690e1720c 100644 --- a/tt-rss.php +++ b/tt-rss.php @@ -49,8 +49,8 @@ + -