Select... dropdown: replace dijit Select with DropDownButton, simplify layout

PluginHost: add HOOK_HEADLINE_TOOLBAR_SELECT_MENU_ITEM
Headlines.onActionChanged: removed
master
Andrew Dolgov 4 years ago
parent 7a2ad08a7d
commit 25520e9784

@ -61,51 +61,42 @@ class Feeds extends Handler_Protected {
$reply .= "<span class=\"right\">"; $reply .= "<span class=\"right\">";
$reply .= "<span id='selected_prompt'></span>"; $reply .= "<span id='selected_prompt'></span>";
$reply .= "&nbsp;"; $reply .= "&nbsp;";
$reply .= "<select dojoType=\"fox.form.Select\"
onchange=\"Headlines.onActionChanged(this)\">";
$reply .= "<option value=\"0\" disabled='1'>".__('Select...')."</option>"; $reply .= "<div dojoType='fox.form.DropDownButton' title='".__('Select articles')."'>
<span>".__("Select...")."</span>
$reply .= "<option value=\"Headlines.select('all')\">".__('All')."</option>"; <div dojoType='dijit.Menu' style='display: none;'>
$reply .= "<option value=\"Headlines.select('unread')\">".__('Unread')."</option>"; <div dojoType='dijit.MenuItem' onclick='Headlines.select(\"all\")'>".__('All')."</div>
$reply .= "<option value=\"Headlines.select('invert')\">".__('Invert')."</option>"; <div dojoType='dijit.MenuItem' onclick='Headlines.select(\"unread\")'>".__('Unread')."</div>
$reply .= "<option value=\"Headlines.select('none')\">".__('None')."</option>"; <div dojoType='dijit.MenuItem' onclick='Headlines.select(\"invert\")'>".__('Invert')."</div>
<div dojoType='dijit.MenuItem' onclick='Headlines.select(\"none\")'>".__('None')."</div>
$reply .= "<option value=\"0\" disabled=\"1\">".__('Selection toggle:')."</option>"; <div dojoType='dijit.MenuSeparator'></div>
<div dojoType='dijit.MenuItem' onclick='Headlines.selectionToggleUnread()'>".__('Toggle unread')."</div>
$reply .= "<option value=\"Headlines.selectionToggleUnread()\">".__('Unread')."</option> <div dojoType='dijit.MenuItem' onclick='Headlines.selectionToggleMarked()'>".__('Toggle starred')."</div>
<option value=\"Headlines.selectionToggleMarked()\">".__('Starred')."</option> <div dojoType='dijit.MenuItem' onclick='Headlines.selectionTogglePublished()'>".__('Toggle published')."</div>
<option value=\"Headlines.selectionTogglePublished()\">".__('Published')."</option>"; <div dojoType='dijit.MenuSeparator'></div>
<div dojoType='dijit.MenuItem' onclick='Headlines.catchupSelection()'>".__('Mark as read')."</div>
$reply .= "<option value=\"0\" disabled=\"1\">".__('Selection:')."</option>"; <div dojoType='dijit.MenuItem' onclick='Article.selectionSetScore()'>".__('Set score')."</div>";
$reply .= "<option value=\"Headlines.catchupSelection()\">".__('Mark as read')."</option>";
$reply .= "<option value=\"Article.selectionSetScore()\">".__('Set score')."</option>";
if ($feed_id == 0 && !$is_cat) {
$reply .= "<option value=\"Headlines.deleteSelection()\">".__('Delete')."</option>";
}
if (PluginHost::getInstance()->get_plugin("mail")) { if (PluginHost::getInstance()->get_plugin("mail")) {
$reply .= "<option value=\"Plugins.Mail.send()\">".__('Forward by email'). $reply .= "<div dojoType='dijit.MenuItem' value='Plugins.Mail.send()'>".__('Forward by email')."</div>";
"</option>";
} }
if (PluginHost::getInstance()->get_plugin("mailto")) { if (PluginHost::getInstance()->get_plugin("mailto")) {
$reply .= "<option value=\"Plugins.Mailto.send()\">".__('Forward by email'). $reply .= "<div dojoType='dijit.MenuItem' value='Plugins.Mailto.send()'>".__('Forward by email')."</div>";
"</option>";
} }
//$reply .= "<option value=\"0\" disabled=\"1\">".__('Feed:')."</option>"; foreach (PluginHost::getInstance()->get_hooks(PluginHost::HOOK_HEADLINE_TOOLBAR_SELECT_MENU_ITEM) as $p) {
$reply .= $p->hook_headline_toolbar_select_menu_item($feed_id, $is_cat);
//$reply .= "<option value=\"catchupPage()\">".__('Mark as read')."</option>"; }
/*$reply .= "<option value=\"App.displayDlg('".__("Show as feed")."','generatedFeed', '$feed_id:$is_cat:$rss_link')\">". if ($feed_id == 0 && !$is_cat) {
__('Show as feed')."</option>";*/ $reply .= "<div dojoType='dijit.MenuSeparator'></div>
<div dojoType='dijit.MenuItem' class='text-error' onclick='Headlines.deleteSelection()'>".__('Delete permanently')."</div>";
}
$reply .= "</select>"; $reply .= "</div>"; /* menu */
//$reply .= "</h2"; $reply .= "</div>"; /* dropdown */
foreach (PluginHost::getInstance()->get_hooks(PluginHost::HOOK_HEADLINE_TOOLBAR_BUTTON) as $p) { foreach (PluginHost::getInstance()->get_hooks(PluginHost::HOOK_HEADLINE_TOOLBAR_BUTTON) as $p) {
$reply .= $p->hook_headline_toolbar_button($feed_id, $is_cat); $reply .= $p->hook_headline_toolbar_button($feed_id, $is_cat);

@ -69,6 +69,7 @@ class PluginHost {
const HOOK_ENCLOSURE_IMPORTED = 45; const HOOK_ENCLOSURE_IMPORTED = 45;
const HOOK_HEADLINES_CUSTOM_SORT_MAP = 46; const HOOK_HEADLINES_CUSTOM_SORT_MAP = 46;
const HOOK_HEADLINES_CUSTOM_SORT_OVERRIDE = 47; const HOOK_HEADLINES_CUSTOM_SORT_OVERRIDE = 47;
const HOOK_HEADLINE_TOOLBAR_SELECT_MENU_ITEM = 48;
const KIND_ALL = 1; const KIND_ALL = 1;
const KIND_SYSTEM = 2; const KIND_SYSTEM = 2;

@ -1207,11 +1207,6 @@ const Headlines = {
}); });
} }
}, },
onActionChanged: function (elem) {
// eslint-disable-next-line no-eval
eval(elem.value);
elem.attr('value', 'false');
},
scrollToArticleId: function (id) { scrollToArticleId: function (id) {
const container = $("headlines-frame"); const container = $("headlines-frame");
const row = $("RROW-" + id); const row = $("RROW-" + id);

Loading…
Cancel
Save