]> git.wh0rd.org - tt-rss.git/commitdiff
rework subtoolbar actions dropdown
authorAndrew Dolgov <fox@bah.spb.su>
Tue, 20 Jan 2009 17:46:21 +0000 (18:46 +0100)
committerAndrew Dolgov <fox@bah.spb.su>
Tue, 20 Jan 2009 17:46:21 +0000 (18:46 +0100)
feedlist.js
functions.php
images/down_arrow.png
tt-rss.css
viewfeed.js

index 68c93e4c5dc9f12a23651390b1864ea00a4f428a..177f057cd9d87db9ea1a1244f69e289967d0b8d9 100644 (file)
@@ -8,6 +8,7 @@ var mouse_y = 0;
 var mouse_x = 0;
 
 var resize_enabled = false;
+var selection_disabled = false;
 var counters_last_request = 0;
 
 function toggle_sortable_feedlist(enabled) {
@@ -552,6 +553,10 @@ function mouse_move_handler(e) {
        }
 }
 
+function enable_selection(b) {
+       disable_selection = !b;
+}
+
 function enable_resize(b) {
        resize_enabled = b;
 }
@@ -569,6 +574,12 @@ function mouse_down_handler(e) {
                        document.onselectstart = function() { return false; };
                        return false;
                }
+
+               if (selection_disabled) {
+                       document.onselectstart = function() { return false; };
+                       return false;
+               }
+
        } catch (e) {
                exception_error("mouse_move_handler", e);
        }
@@ -577,7 +588,13 @@ function mouse_down_handler(e) {
 function mouse_up_handler(e) {
        try {
                mouse_is_down = false;
-               document.onselectstart = null;
+
+               if (!disable_selection) {
+                       document.onselectstart = null;
+                       var e = document.getElementById("headlineActionsBody");
+                       if (e) Element.hide(e);
+               }
+
        } catch (e) {
                exception_error("mouse_move_handler", e);
        }
index 50374dc1dbe759ad4e715f9787a446dd3fbf6eee..be793c49a034df0212ae9b66c7896310cc3f5fb4 100644 (file)
 
                        }
 
-                               if (strpos($_SESSION["client.userAgent"], "MSIE") === false) {
+                                       print "<td class=\"headlineActions$rtl_cpart\">";
 
-                                       print "<td class=\"headlineActions$rtl_cpart\">
-                                               <ul class=\"headlineDropdownMenu\">
+
+/*                                     print"<ul class=\"headlineDropdownMenu\">
                                                <li class=\"top2\">
                                                ".__('Select:')."
                                                        <a href=\"$sel_all_link\">".__('All')."</a>,
                                                        <li><span class=\"insensitive\">".__('Mark as read:')."</span></li>
                                                        <li onclick=\"$catchup_sel_link\">&nbsp;&nbsp;".__('Selection')."</li>";
 
-/*                             if (!get_pref($link, 'COMBINED_DISPLAY_MODE')) {
-       
-                                       print "
-                                               <li onclick=\"catchupRelativeToArticle(0)\">&nbsp;&nbsp;".__("Above active article")."</li>
-                                               <li onclick=\"catchupRelativeToArticle(1)\">&nbsp;&nbsp;".__("Below active article")."</li>";
-                               } else {
-                                       print "
-                                               <li><span class=\"insensitive\">&nbsp;&nbsp;".__("Above active article")."</span></li>
-                                               <li><span class=\"insensitive\">&nbsp;&nbsp;".__("Below active article")."</span></li>";
-
-                               } */
-
                                print "<li onclick=\"$catchup_feed_link\">&nbsp;&nbsp;".__('Entire feed')."</li>";
 
                                //print "<li><span class=\"insensitive\">--------</span></li>";
                                        }
                        }
 
-                               print   "</ul></li></ul>";
-                               print "</td>"; 
-       
-                               } else {
-                                       // old style subtoolbar:
-       
-                                       print "<td class=\"headlineActions$rtl_cpart\">".
-                                               __('Select:')."
-                                                                       <a href=\"$sel_all_link\">".__('All')."</a>,
-                                                                       <a href=\"$sel_unread_link\">".__('Unread')."</a>,
-                                                                       <a href=\"$sel_none_link\">".__('None')."</a>
-                                                       &nbsp;&nbsp;".
-                                                       __('Toggle:')." <a href=\"$tog_unread_link\">".__('Unread')."</a>,
-                                                               <a href=\"$tog_marked_link\">".__('Starred')."</a>
-                                                       &nbsp;&nbsp;".
-                                                       __('Mark as read:')."
-                                                               <a href=\"#\" onclick=\"$catchup_page_link\">".__('Page')."</a>,
-                                                               <a href=\"#\" onclick=\"$catchup_feed_link\">".__('Feed')."</a>";
-
-                                       print "</td>";  
-       
+                               print   "</ul></li></ul>"; */
+
+                               print __('Select:')."
+                                                       <a href=\"$sel_all_link\">".__('All')."</a>,
+                                                       <a href=\"$sel_unread_link\">".__('Unread')."</a>,
+                                                       <a href=\"$sel_inv_link\">".__('Invert')."</a>,
+                                                       <a href=\"$sel_none_link\">".__('None')."</a></li>";
+
+                               print "&nbsp;&nbsp;";
+
+                                       print "<span 
+                                               onmouseover=\"enable_selection(false)\" 
+                           onmouseout=\"enable_selection(true)\"
+                                               onclick=\"toggleHeadlineActions()\" id=\"headlineActionsDrop\">".
+                                               __("Actions...") . "&nbsp;&nbsp;<img src=\"images/down_arrow.png\">
+                                               </span>";
+
+                               print "<ul id=\"headlineActionsBody\" style=\"display : none\">";
+
+                               print "<li><span class=\"insensitive\">".__('Selection toggle:')."</span></li>
+                                       <li onclick=\"$tog_unread_link\">&nbsp;&nbsp;".__('Unread')."</li>
+                                       <li onclick=\"$tog_marked_link\">&nbsp;&nbsp;".__('Starred')."</li>
+                                       <li onclick=\"$tog_published_link\">&nbsp;&nbsp;".__('Published')."</li>
+                                       <!-- <li><span class=\"insensitive\">--------</span></li> -->
+                                       <li><span class=\"insensitive\">".__('Mark as read:')."</span></li>
+                                       <li onclick=\"$catchup_sel_link\">&nbsp;&nbsp;".__('Selection')."</li>";
+
+                               print "<li onclick=\"$catchup_feed_link\">&nbsp;&nbsp;".__('Entire feed').
+                                       "</li>";
+
+                               //print "<li><span class=\"insensitive\">--------</span></li>";
+                               print "<li><span class=\"insensitive\">".__('Assign label:')."</span></li>";
+
+                               $result = db_query($link, "SELECT id, caption FROM ttrss_labels2 WHERE
+                                       owner_uid = '".$_SESSION["uid"]."' ORDER BY caption");
+
+                               while ($line = db_fetch_assoc($result)) {
+
+                                       $label_id = $line["id"];
+                                       $label_caption = $line["caption"];
+
+                                       if ($feed_id < -10 && $feed_id == -11-$label_id) {
+                                               print "<li onclick=\"javascript:selectionRemoveLabel($label_id)\">
+                                                       &nbsp;&nbsp;$label_caption ".__('(remove)')."</li>";
+                                       } else {                                        
+                                               print "<li onclick=\"javascript:selectionAssignLabel($label_id)\">
+                                                       &nbsp;&nbsp;$label_caption</li>";
+                                       }
                                }
 
+                               print "</ul>";
+
+                               print "</td>"; 
+       
                        print "<td class=\"headlineTitle$rtl_cpart\">";
 
                        print "<span id=\"subtoolbar_search\" 
index c2a8c2787d66cbb6d9e74173667879104d3ebb97..ded833282f6d4fc290ec15ae0b1e415157fa6199 100644 (file)
Binary files a/images/down_arrow.png and b/images/down_arrow.png differ
index fe8f11a284e239ae310bbf560e4e803ded7fb5d0..48db0f9a61b0640cb0af8bad2ba3d88f72d2f812 100644 (file)
@@ -2130,3 +2130,39 @@ pre, code {
        font-size : 12px;
        font-family : monospace;
 }
+
+span#headlineActionsDrop {
+       border : 1px solid #c0c0c0;
+       padding : 1px 5px 1px 10px;
+       color : #063064;
+       cursor : pointer;
+}
+
+ul#headlineActionsBody {
+       list-style-type : none;
+       position : absolute;
+       margin : 0px;
+       padding : 0px;
+       background-color : white;
+       width : 150px;
+       z-index : 4;
+       top : auto;
+       left : auto;
+       border-width : 1px 1px 1px 1px;
+       border-color : #c0c0c0;
+       border-style : solid;
+       margin-left : -1px;
+       max-height : 250px;
+       overflow : auto;
+}
+
+ul#headlineActionsBody li {
+       padding : 2px 5px 2px 10px;
+       color : black;
+}
+
+ul#headlineActionsBody li:hover {
+       color : #4684ff;
+       cursor : pointer;
+       background : #ecf4ff;
+}
index e5f1f8aeb017cc50fe2db64b964b7d568aefcefc..de7f268129fa1ecaba33a240354b47b1e376a9de 100644 (file)
@@ -2038,3 +2038,22 @@ function show_labels_in_headlines(transport) {
 
        }
 }
+
+function toggleHeadlineActions() {
+       try {
+               var e = document.getElementById("headlineActionsBody");
+               var p = document.getElementById("headlineActionsDrop");
+
+               if (!Element.visible(e)) {
+                       Element.show(e);
+               } else {
+                       Element.hide(e);
+               }
+
+               e.style.left = (p.offsetLeft + 1) + "px";
+//             e.style.top = (p.offsetTop + p.offsetHeight - 1) + "px";
+
+       } catch (e) {
+               exception_error("toggleHeadlineActions", e);
+       }
+}