]> git.wh0rd.org Git - tt-rss.git/commitdiff
Implement the last part of #276: show the list of available feeds in the frontend...
authorChristian Weiske <cweiske@cweiske.de>
Tue, 9 Nov 2010 21:42:03 +0000 (22:42 +0100)
committerAndrew Dolgov <fox@madoka.volgo-balt.ru>
Wed, 10 Nov 2010 04:16:45 +0000 (07:16 +0300)
functions.js
modules/popup-dialog.php

index 62ecd135d62ced57e29b499f01f6ba5430301f4b..e4deab47ae388d919160d7f9dad28a048f8f71ed 100644 (file)
@@ -1322,9 +1322,31 @@ function subscribeToFeed() {
                                break;
                        case 2:
                        case 3:
-                       case 4:
                                alert(__("Can't subscribe to the specified URL."));
                                break;
+                       case 4:
+                               new Ajax.Request("backend.php", {
+                                       parameters: 'op=rpc&subop=extractfeedurls&url=' + encodeURIComponent(feed_url),
+                                       onComplete: function(transport) {
+                                               var result = transport.responseXML.getElementsByTagName('urls')[0];
+                                               var feeds = JSON.parse(result.firstChild.nodeValue);
+                                               var select = document.getElementById("faad_feeds_container_select");
+
+                                               while (select.hasChildNodes()) {
+                                                       select.removeChild(elem.firstChild);
+                                               }
+                                               var count = 0;
+                                               for (var feedUrl in feeds) {
+                                                       select.insert(new Option(feeds[feedUrl], feedUrl, false));
+                                                       count++;
+                                               }
+                                               if (count > 5) count = 5;
+                                               select.size = count;
+
+                                               Effect.Appear('fadd_feeds_container', {duration : 0.5});
+                                       }
+                               });
+                               break;
                        case 0:
                                alert(__("You are already subscribed to this feed."));
                                break;
index 28f954436cc61c4545e401e397d95ccab81d7207..520c9f95477a74e01bbc67db76379ad4b5ba5742 100644 (file)
 
                        print "</div>";
 
+                       print '<div id="fadd_feeds_container" style="display:none">
+
+                                       <div class="dlgSec">' . __('Available feeds') . '</div>
+                                       <div class="dlgSecCont">'
+
+                                       . ' <select name="feed" id="faad_feeds_container_select" size="3"></select>'
+                               . '</div></div>';
+
                        print "<div id='fadd_login_container' style='display:none'>
        
                                        <div class=\"dlgSec\">".__("Authentication")."</div>