rework subtoolbar actions dropdown

This commit is contained in:
Andrew Dolgov 2009-01-20 18:46:21 +01:00
parent 3381c755be
commit bf3c98384d
5 changed files with 127 additions and 36 deletions

View File

@ -8,6 +8,7 @@ var mouse_y = 0;
var mouse_x = 0; var mouse_x = 0;
var resize_enabled = false; var resize_enabled = false;
var selection_disabled = false;
var counters_last_request = 0; var counters_last_request = 0;
function toggle_sortable_feedlist(enabled) { 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) { function enable_resize(b) {
resize_enabled = b; resize_enabled = b;
} }
@ -569,6 +574,12 @@ function mouse_down_handler(e) {
document.onselectstart = function() { return false; }; document.onselectstart = function() { return false; };
return false; return false;
} }
if (selection_disabled) {
document.onselectstart = function() { return false; };
return false;
}
} catch (e) { } catch (e) {
exception_error("mouse_move_handler", e); exception_error("mouse_move_handler", e);
} }
@ -577,7 +588,13 @@ function mouse_down_handler(e) {
function mouse_up_handler(e) { function mouse_up_handler(e) {
try { try {
mouse_is_down = false; 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) { } catch (e) {
exception_error("mouse_move_handler", e); exception_error("mouse_move_handler", e);
} }

View File

@ -3978,10 +3978,10 @@
} }
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\"> <li class=\"top2\">
".__('Select:')." ".__('Select:')."
<a href=\"$sel_all_link\">".__('All')."</a>, <a href=\"$sel_all_link\">".__('All')."</a>,
@ -3998,18 +3998,6 @@
<li><span class=\"insensitive\">".__('Mark as read:')."</span></li> <li><span class=\"insensitive\">".__('Mark as read:')."</span></li>
<li onclick=\"$catchup_sel_link\">&nbsp;&nbsp;".__('Selection')."</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 onclick=\"$catchup_feed_link\">&nbsp;&nbsp;".__('Entire feed')."</li>";
//print "<li><span class=\"insensitive\">--------</span></li>"; //print "<li><span class=\"insensitive\">--------</span></li>";
@ -4032,29 +4020,60 @@
} }
} }
print "</ul></li></ul>"; print "</ul></li></ul>"; */
print "</td>";
} else { print __('Select:')."
// old style subtoolbar: <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 "<td class=\"headlineActions$rtl_cpart\">". print "&nbsp;&nbsp;";
__('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 "<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 "<td class=\"headlineTitle$rtl_cpart\">";
print "<span id=\"subtoolbar_search\" print "<span id=\"subtoolbar_search\"

Binary file not shown.

Before

Width:  |  Height:  |  Size: 208 B

After

Width:  |  Height:  |  Size: 135 B

View File

@ -2130,3 +2130,39 @@ pre, code {
font-size : 12px; font-size : 12px;
font-family : monospace; 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;
}

View 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);
}
}