]> git.wh0rd.org Git - tt-rss.git/commitdiff
tag editor: autocomplete
authorAndrew Dolgov <fox@madoka.spb.ru>
Fri, 10 Aug 2007 07:35:55 +0000 (08:35 +0100)
committerAndrew Dolgov <fox@madoka.spb.ru>
Fri, 10 Aug 2007 07:35:55 +0000 (08:35 +0100)
functions.js
modules/backend-rpc.php
modules/popup-dialog.php
tt-rss.css
tt-rss.php

index 3fa9c69c003beb6ce11ba36e3354ab3a3f6cf71b..c6ef5fba99f9829c3a2d90fd2e43a6645f9e5317 100644 (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);
index 7e83e816a291a8da8b88d8108b1a4aefcca0118d..3303b25f9e49c5d0a572ae3880703ba51007f715 100644 (file)
                        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>";
+
+               }
+
        }
 ?>
index 6590159d238bd8566a313d9048576b95509feb2c..2805f76537cbc94c4f5bcb2be70888a4631890a7 100644 (file)
 
                        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");
 
                        print_select("found_tags", '', $found_tags, "onchange=\"javascript:editTagsInsert()\"");
 
-                       print "</td>";
+                       print "</td>"; 
 
-                       print "</tr>";
+                       print "</tr>"; */
 
                        print "</table>";
 
index 8d613fa8cf1fe8ae81c18aea3cf58a68160e766f..61ae3fa144772a83d571644ceaf704a621962fdd 100644 (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;
+}
+
index c43cb5d81ac104937d2a32950d923487c0c90fed..690e1720c6fcf9bcbca9d3e35c903d061a1cd5bd 100644 (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>