feeds with errors: use client dialog
This commit is contained in:
parent
8464c619e4
commit
c36b2adf84
|
@ -1500,58 +1500,13 @@ class Pref_Feeds extends Handler_Protected {
|
||||||
FROM ttrss_feeds WHERE last_error != '' AND owner_uid = ?");
|
FROM ttrss_feeds WHERE last_error != '' AND owner_uid = ?");
|
||||||
$sth->execute([$_SESSION['uid']]);
|
$sth->execute([$_SESSION['uid']]);
|
||||||
|
|
||||||
print "<div dojoType=\"fox.Toolbar\">";
|
$rv = [];
|
||||||
print "<div dojoType=\"fox.form.DropDownButton\">".
|
|
||||||
"<span>" . __('Select')."</span>";
|
|
||||||
print "<div dojoType=\"dijit.Menu\" style=\"display: none;\">";
|
|
||||||
print "<div onclick=\"Tables.select('error-feeds-list', true)\"
|
|
||||||
dojoType=\"dijit.MenuItem\">".__('All')."</div>";
|
|
||||||
print "<div onclick=\"Tables.select('error-feeds-list', false)\"
|
|
||||||
dojoType=\"dijit.MenuItem\">".__('None')."</div>";
|
|
||||||
print "</div></div>";
|
|
||||||
print "</div>"; #toolbar
|
|
||||||
|
|
||||||
print "<div class='panel panel-scrollable'>";
|
while ($row = $sth->fetch()) {
|
||||||
print "<table width='100%' id='error-feeds-list'>";
|
array_push($rv, $row);
|
||||||
|
|
||||||
$lnum = 1;
|
|
||||||
|
|
||||||
while ($line = $sth->fetch()) {
|
|
||||||
|
|
||||||
$feed_id = $line["id"];
|
|
||||||
|
|
||||||
print "<tr data-row-id='$feed_id'>";
|
|
||||||
|
|
||||||
print "<td width='5%' align='center'><input
|
|
||||||
onclick='Tables.onRowChecked(this);' dojoType=\"dijit.form.CheckBox\"
|
|
||||||
type=\"checkbox\"></td>";
|
|
||||||
print "<td>";
|
|
||||||
|
|
||||||
print "<a class=\"visibleLink\" href=\"#\" ".
|
|
||||||
"title=\"".__("Click to edit feed")."\" ".
|
|
||||||
"onclick=\"CommonDialogs.editFeed(".$line["id"].")\">".
|
|
||||||
htmlspecialchars($line["title"])."</a>: ";
|
|
||||||
|
|
||||||
print "<span class=\"text-muted\">";
|
|
||||||
print htmlspecialchars($line["last_error"]);
|
|
||||||
print "</span>";
|
|
||||||
|
|
||||||
print "</td>";
|
|
||||||
print "</tr>";
|
|
||||||
|
|
||||||
++$lnum;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
print "</table>";
|
print json_encode($rv);
|
||||||
print "</div>";
|
|
||||||
|
|
||||||
print "<footer>";
|
|
||||||
print "<button style='float : left' class='alt-danger' dojoType='dijit.form.Button' onclick='App.dialogOf(this).removeSelected()'>"
|
|
||||||
.__('Unsubscribe from selected feeds')."</button> ";
|
|
||||||
print "<button dojoType='dijit.form.Button' class='alt-primary' type='submit'>".
|
|
||||||
__('Close this window')."</button>";
|
|
||||||
|
|
||||||
print "</footer>";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private function remove_feed_category($id, $owner_uid) {
|
private function remove_feed_category($id, $owner_uid) {
|
||||||
|
|
|
@ -188,52 +188,91 @@ const CommonDialogs = {
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
showFeedsWithErrors: function() {
|
showFeedsWithErrors: function() {
|
||||||
const dialog = new fox.SingleUseDialog({
|
|
||||||
id: "errorFeedsDlg",
|
|
||||||
title: __("Feeds with update errors"),
|
|
||||||
getSelectedFeeds: function () {
|
|
||||||
return Tables.getSelected("error-feeds-list");
|
|
||||||
},
|
|
||||||
removeSelected: function () {
|
|
||||||
const sel_rows = this.getSelectedFeeds();
|
|
||||||
|
|
||||||
if (sel_rows.length > 0) {
|
xhrJson("backend.php", {op: "pref-feeds", method: "feedsWithErrors"}, (reply) => {
|
||||||
if (confirm(__("Remove selected feeds?"))) {
|
|
||||||
Notify.progress("Removing selected feeds...", true);
|
|
||||||
|
|
||||||
const query = {
|
const dialog = new fox.SingleUseDialog({
|
||||||
op: "pref-feeds", method: "remove",
|
id: "errorFeedsDlg",
|
||||||
ids: sel_rows.toString()
|
title: __("Feeds with update errors"),
|
||||||
};
|
getSelectedFeeds: function () {
|
||||||
|
return Tables.getSelected("error-feeds-list");
|
||||||
|
},
|
||||||
|
removeSelected: function () {
|
||||||
|
const sel_rows = this.getSelectedFeeds();
|
||||||
|
|
||||||
xhrPost("backend.php", query, () => {
|
if (sel_rows.length > 0) {
|
||||||
Notify.close();
|
if (confirm(__("Remove selected feeds?"))) {
|
||||||
dialog.hide();
|
Notify.progress("Removing selected feeds...", true);
|
||||||
|
|
||||||
if (App.isPrefs())
|
const query = {
|
||||||
dijit.byId("feedTree").reload();
|
op: "pref-feeds", method: "remove",
|
||||||
else
|
ids: sel_rows.toString()
|
||||||
Feeds.reload();
|
};
|
||||||
|
|
||||||
});
|
xhrPost("backend.php", query, () => {
|
||||||
|
Notify.close();
|
||||||
|
dialog.hide();
|
||||||
|
|
||||||
|
if (App.isPrefs())
|
||||||
|
dijit.byId("feedTree").reload();
|
||||||
|
else
|
||||||
|
Feeds.reload();
|
||||||
|
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
alert(__("No feeds selected."));
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
content: `
|
||||||
|
<div dojoType="fox.Toolbar">
|
||||||
|
<div dojoType="fox.form.DropDownButton">
|
||||||
|
<span>${__('Select')}</span>
|
||||||
|
<div dojoType="dijit.Menu" style="display: none">
|
||||||
|
<div onclick="Tables.select('error-feeds-list', true)"
|
||||||
|
dojoType="dijit.MenuItem">${__('All')}</div>
|
||||||
|
<div onclick="Tables.select('error-feeds-list', false)"
|
||||||
|
dojoType="dijit.MenuItem">${__('None')}</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
} else {
|
<div class='panel panel-scrollable'>
|
||||||
alert(__("No feeds selected."));
|
<table width='100%' id='error-feeds-list'>
|
||||||
}
|
|
||||||
},
|
|
||||||
content: __("Loading, please wait...")
|
|
||||||
});
|
|
||||||
|
|
||||||
const tmph = dojo.connect(dialog, 'onShow', function () {
|
${reply.map((row) => `
|
||||||
dojo.disconnect(tmph);
|
<tr data-row-id='${row.id}'>
|
||||||
|
<td width='5%' align='center'>
|
||||||
|
<input onclick='Tables.onRowChecked(this)' dojoType="dijit.form.CheckBox"
|
||||||
|
type="checkbox">
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<a href="#" title="${__("Click to edit feed")}" onclick="CommonDialogs.editFeed(${row.id})">
|
||||||
|
${App.escapeHtml(row.title)}
|
||||||
|
</a>
|
||||||
|
</td>
|
||||||
|
<td class='text-muted small' align='right' width='50%'>
|
||||||
|
${App.escapeHtml(row.last_error)}
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
`).join("")}
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
|
||||||
xhrPost("backend.php", {op: "pref-feeds", method: "feedsWithErrors"}, (transport) => {
|
<footer>
|
||||||
dialog.attr('content', transport.responseText);
|
<button style='float : left' class='alt-danger' dojoType='dijit.form.Button' onclick='App.dialogOf(this).removeSelected()'>
|
||||||
})
|
${__('Unsubscribe from selected feeds')}
|
||||||
});
|
</button>
|
||||||
|
<button dojoType='dijit.form.Button' class='alt-primary' type='submit'>
|
||||||
|
${__('Close this window')}
|
||||||
|
</button>
|
||||||
|
</footer>
|
||||||
|
`
|
||||||
|
});
|
||||||
|
|
||||||
dialog.show();
|
dialog.show();
|
||||||
|
})
|
||||||
},
|
},
|
||||||
addLabel: function(select, callback) {
|
addLabel: function(select, callback) {
|
||||||
const caption = prompt(__("Please enter label caption:"), "");
|
const caption = prompt(__("Please enter label caption:"), "");
|
||||||
|
|
Loading…
Reference in New Issue