tag editor: autocomplete

This commit is contained in:
Andrew Dolgov 2007-08-10 08:35:55 +01:00
parent d84f95234a
commit 05fcdf52b2
5 changed files with 64 additions and 5 deletions

View File

@ -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);

View File

@ -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 "<ul>";
while ($line = db_fetch_assoc($result)) {
print "<li>" . $line["tag_name"] . "</li>";
}
print "</ul>";
}
}
?>

View File

@ -376,9 +376,13 @@
print "<tr><td colspan='2'><input type=\"hidden\" name=\"id\" value=\"$param\"></td></tr>";
print "<tr><td colspan='2'><textarea rows='4' class='iedit' name='tags_str'>$tags_str</textarea></td></tr>";
print "<tr><td colspan='2'><textarea rows='4' class='iedit' id='tags_str'
name='tags_str'>$tags_str</textarea>
<div class=\"autocomplete\" id=\"tags_choices\"
style=\"display:none\"></div>
</td></tr>";
print "<tr><td>".__('Add existing tag:')."</td>";
/* print "<tr><td>".__('Add existing tag:')."</td>";
$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 "</td>";
print "</td>";
print "</tr>";
print "</tr>"; */
print "</table>";

View File

@ -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;
}

View File

@ -49,8 +49,8 @@
<link rel="shortcut icon" type="image/png" href="images/favicon.png">
<script type="text/javascript" src="prototype.js"></script>
<script type="text/javascript" src="scriptaculous/scriptaculous.js"></script>
<script type="text/javascript" src="localized_js.php?<?php echo $dt_add ?>"></script>
<script type="text/javascript" src="tt-rss.js?<?php echo $dt_add ?>"></script>
<script type="text/javascript" src="functions.js?<?php echo $dt_add ?>"></script>
<script type="text/javascript" src="feedlist.js?<?php echo $dt_add ?>"></script>