]> git.wh0rd.org Git - tt-rss.git/commitdiff
since dojo dropdowns won't work in article content because of html escaping trick...
authorAndrew Dolgov <fox@madoka.volgo-balt.ru>
Thu, 28 Mar 2013 06:56:29 +0000 (10:56 +0400)
committerAndrew Dolgov <fox@madoka.volgo-balt.ru>
Thu, 28 Mar 2013 06:56:29 +0000 (10:56 +0400)
include/functions.php
js/viewfeed.js

index dae87dab3995b2cf70e81c57a54b6aedf7724f0e..dcaa67e569dcf708978b3881ed80ccde0d67fdc0 100644 (file)
                                $rv .= "<hr clear='both'/>";
                        }
 
-                       $rv .= "<br/><div dojoType=\"dijit.form.DropDownButton\">".
-                               "<span>" . __('Attachments')."</span>";
-                       $rv .= "<div dojoType=\"dijit.Menu\" style=\"display: none;\">";
+                       $rv .= "<select onchange=\"openSelectedAttachment(this)\">".
+                               "<option value=''>" . __('Attachments')."</option>";
 
-                       foreach ($entries_html as $entry) { $rv .= $entry; };
+                       foreach ($entries as $entry) {
+                               $rv .= "<option value=\"".htmlspecialchars($entry["url"])."\">" . htmlspecialchars($entry["filename"]) . "</option>";
 
-                       $rv .= "</div></div>";
+                       };
+
+                       $rv .= "</select>";
                }
 
                return $rv;
index 28d4ea8ec5feff0e4abf36d90ae3e47611ea22fe..1d04c42762d288d518bdb27fd538d1a3aa04b54e 100644 (file)
@@ -2115,3 +2115,16 @@ function displayArticleUrl(id) {
        }
 }
 
+function openSelectedAttachment(elem) {
+       try {
+               var url = elem[elem.selectedIndex].value;
+
+               if (url) {
+                       window.open(url);
+                       elem.selectedIndex = 0;
+               }
+
+       } catch (e) {
+               exception_error("openSelectedAttachment", e);
+       }
+}