From: Andrew Dolgov Date: Fri, 10 Aug 2007 07:35:55 +0000 (+0100) Subject: tag editor: autocomplete X-Git-Tag: 1.2.14~94 X-Git-Url: https://git.wh0rd.org/?a=commitdiff_plain;h=05fcdf52b292b7da75b6b12156dbc4ba678349e3;p=tt-rss.git tag editor: autocomplete --- diff --git a/functions.js b/functions.js index 3fa9c69c..c6ef5fba 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 7e83e816..3303b25f 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 6590159d..2805f765 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 8d613fa8..61ae3fa1 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 c43cb5d8..690e1720 100644 --- a/tt-rss.php +++ b/tt-rss.php @@ -49,8 +49,8 @@ + -