remove obsolete row selection functions

move getUrlParam() to Utils
master
Andrew Dolgov 6 years ago
parent 2f85b50e36
commit 874560db54

@ -406,7 +406,7 @@ class Feeds extends Handler_Protected {
$reply['content'] .= "<div class='left'>";
$reply['content'] .= "<input dojoType=\"dijit.form.CheckBox\"
type=\"checkbox\" onclick=\"toggleSelectRow2(this)\"
type=\"checkbox\" onclick=\"Headlines.onRowChecked(this)\"
class='rchk'>";
$reply['content'] .= "$marked_pic";
@ -505,7 +505,7 @@ class Feeds extends Handler_Protected {
$tmp_content .= "<div style=\"vertical-align : middle\">";
$tmp_content .= "<input dojoType=\"dijit.form.CheckBox\"
type=\"checkbox\" onclick=\"toggleSelectRow2(this, false, true)\"
type=\"checkbox\" onclick=\"Headlines.onRowChecked(this)\"
class='rchk'>";
$tmp_content .= "$marked_pic";

@ -1435,7 +1435,7 @@ class Pref_Feeds extends Handler_Protected {
# id needed for selectTableRows()
print "<td width='5%' align='center'><input
onclick='toggleSelectRow2(this);' dojoType=\"dijit.form.CheckBox\"
onclick='Tables.onRowChecked(this);' dojoType=\"dijit.form.CheckBox\"
type=\"checkbox\" id=\"FUPDC-$feed_id\"></td>";
print "<td>";
@ -1500,7 +1500,7 @@ class Pref_Feeds extends Handler_Protected {
# id needed for selectTableRows()
print "<td width='5%' align='center'><input
onclick='toggleSelectRow2(this);' dojoType=\"dijit.form.CheckBox\"
onclick='Tables.onRowChecked(this);' dojoType=\"dijit.form.CheckBox\"
type=\"checkbox\" id=\"FERDC-$feed_id\"></td>";
print "<td>";

@ -429,7 +429,7 @@ class Pref_Filters extends Handler_Protected {
$data = htmlspecialchars(json_encode($line));
print "<li><input dojoType='dijit.form.CheckBox' type='checkbox' onclick='ListUtils.onChecked(this)'>".
print "<li><input dojoType='dijit.form.CheckBox' type='checkbox' onclick='Lists.onRowChecked(this)'>".
"<span onclick=\"dijit.byId('filterEditDlg').editRule(this)\">".$this->getRuleName($line)."</span>".
"<input type='hidden' name='rule[]' value=\"$data\"/></li>";
}
@ -473,7 +473,7 @@ class Pref_Filters extends Handler_Protected {
$data = htmlspecialchars(json_encode($line));
print "<li><input dojoType='dijit.form.CheckBox' type='checkbox' onclick='ListUtils.onChecked(this)'>".
print "<li><input dojoType='dijit.form.CheckBox' type='checkbox' onclick='Lists.onRowChecked(this)'>".
"<span onclick=\"dijit.byId('filterEditDlg').editAction(this)\">".$this->getActionName($line)."</span>".
"<input type='hidden' name='action[]' value=\"$data\"/></li>";
}

@ -799,7 +799,7 @@ class Pref_Prefs extends Handler_Protected {
$plugin_icon = $checked ? "plugin.png" : "plugin_disabled.png";
print "<td align='center'><input id='FPCHK-$name' name='plugins[]' value='$name' onclick='toggleSelectRow2(this);'
print "<td align='center'><input id='FPCHK-$name' name='plugins[]' value='$name' onclick='Tables.onRowChecked(this);'
dojoType=\"dijit.form.CheckBox\" $checked $disabled
type=\"checkbox\"></td>";
@ -1023,7 +1023,7 @@ class Pref_Prefs extends Handler_Protected {
print "<td width='5%' align='center'><input
id='FCATC-0'
onclick='toggleSelectRow2(this);'
onclick='Tables.onRowChecked(this);'
dojoType=\"dijit.form.CheckBox\"
type=\"checkbox\"></td>";
@ -1050,7 +1050,7 @@ class Pref_Prefs extends Handler_Protected {
$edit_title = htmlspecialchars($line["title"]);
print "<td width='5%' align='center'><input
onclick='toggleSelectRow2(this);'
onclick='Tables.onRowChecked(this);'
id='FCATC-$profile_id'
dojoType=\"dijit.form.CheckBox\"
type=\"checkbox\"></td>";

@ -419,7 +419,7 @@ class Pref_Users extends Handler_Protected {
$line["created"] = make_local_datetime($line["created"], false);
$line["last_login"] = make_local_datetime($line["last_login"], false);
print "<td align='center'><input onclick='toggleSelectRow2(this);'
print "<td align='center'><input onclick='Tables.onRowChecked(this);'
dojoType=\"dijit.form.CheckBox\" type=\"checkbox\"
id=\"UMCHK-$uid\"></td>";

@ -53,7 +53,7 @@
$site_url = htmlspecialchars($line["site_url"]);
$subscribers = $line["subscribers"];
$check_box = "<input onclick='ListUtils.onChecked(this)'
$check_box = "<input onclick='Lists.onRowChecked(this)'
dojoType=\"dijit.form.CheckBox\"
type=\"checkbox\" \">";
@ -73,7 +73,7 @@
$feed_url = htmlspecialchars($line["feed_url"]);
$site_url = htmlspecialchars($line["site_url"]);
$check_box = "<input onclick='ListUtils.onChecked(this)' dojoType=\"dijit.form.CheckBox\"
$check_box = "<input onclick='Lists.onRowChecked(this)' dojoType=\"dijit.form.CheckBox\"
type=\"checkbox\">";
if ($line['articles_archived'] > 0) {

@ -1244,7 +1244,7 @@
"g t" => "goto_tagcloud",
"g *p" => "goto_prefs",
// "other" => array(
"(9)|Tab" => "select_article_cursor", // tab
"r" => "select_article_cursor",
"c l" => "create_label",
"c f" => "create_filter",
"c s" => "collapse_sidebar",

@ -53,8 +53,8 @@ Array.prototype.remove = function(s) {
}
};
const ListUtils = {
onChecked: function(elem) {
const Lists = {
onRowChecked: function(elem) {
// account for dojo checkboxes
elem = elem.domNode || elem;
@ -62,11 +62,23 @@ const ListUtils = {
}
};
const Tables = {
onRowChecked: function(elem) {
// account for dojo checkboxes
elem = elem.domNode || elem;
elem.up("tr").toggleClassName("Selected");
}
}
const Utils = {
_rpc_seq: 0,
hotkey_prefix: 0,
hotkey_prefix_pressed: false,
hotkey_prefix_timeout: 0,
urlParam: function(param) {
return String(window.location.href).parseQuery()[param];
},
next_seq: function() {
this._rpc_seq += 1;
return this._rpc_seq;
@ -988,43 +1000,6 @@ function getCookie(name) {
return unescape(dc.substring(begin + prefix.length, end));
}
function toggleSelectRowById(sender, id) {
const row = $(id);
return toggleSelectRow(sender, row);
}
/* this is for dijit Checkbox */
function toggleSelectRow2(sender, row, is_cdm) {
if (!row)
if (!is_cdm)
row = sender.domNode.parentNode.parentNode;
else
row = sender.domNode.parentNode.parentNode.parentNode; // oh ffs
if (sender.checked && !row.hasClassName('Selected'))
row.addClassName('Selected');
else
row.removeClassName('Selected');
if (typeof Headlines != "undefined")
Headlines.updateSelectedPrompt();
}
function toggleSelectRow(sender, row) {
if (!row) row = sender.parentNode.parentNode;
if (sender.checked && !row.hasClassName('Selected'))
row.addClassName('Selected');
else
row.removeClassName('Selected');
if (typeof Headlines != "undefined")
Headlines.updateSelectedPrompt();
}
// noinspection JSUnusedGlobalSymbols
function displayIfChecked(checkbox, elemId) {
if (checkbox.checked) {
@ -1034,10 +1009,6 @@ function displayIfChecked(checkbox, elemId) {
}
}
function getURLParam(param){
return String(window.location.href).parseQuery()[param];
}
// noinspection JSUnusedGlobalSymbols
function closeInfoBox() {
const dialog = dijit.byId("infoBox");
@ -1140,7 +1111,7 @@ const Filters = {
new dijit.form.CheckBox({
onChange: function () {
ListUtils.onChecked(this);
Lists.onRowChecked(this);
},
}, cb);
@ -1189,7 +1160,7 @@ const Filters = {
new dijit.form.CheckBox({
onChange: function () {
ListUtils.onChecked(this);
Lists.onRowChecked(this);
},
}, cb);

@ -69,17 +69,17 @@ const App = {
Utils.setLoadingProgress(50);
notify("");
let tab = getURLParam('tab');
let tab = Utils.urlParam('tab');
if (tab) {
tab = dijit.byId(tab + "Tab");
if (tab) dijit.byId("pref-tabs").selectChild(tab);
}
const method = getURLParam('method');
const method = Utils.urlParam('method');
if (method == 'editFeed') {
const param = getURLParam('methodparam');
const param = Utils.urlParam('methodparam');
window.setTimeout(function () {
CommonDialogs.editFeed(param)

@ -414,7 +414,7 @@ const App = {
if (!row.hasClassName("active"))
cb.attr("checked", !cb.attr("checked"));
toggleSelectRowById(cb, "RROW-" + id);
Headlines.onRowChecked(cb);
return false;
}
}

@ -1109,6 +1109,14 @@ const Headlines = {
return rv;
},
onRowChecked: function(elem) {
// account for dojo checkboxes
elem = elem.domNode || elem;
elem.up("div[id*=RROW]").toggleClassName("Selected");
this.updateSelectedPrompt();
},
select: function(mode) {
// mode = all,none,unread,invert,marked,published
let query = "#headlines-frame > div[id*=RROW]";

Loading…
Cancel
Save