|
|
@ -132,6 +132,17 @@ const App = {
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
const Prefs = {
|
|
|
|
const Prefs = {
|
|
|
|
|
|
|
|
clearFeedAccessKeys: function() {
|
|
|
|
|
|
|
|
if (confirm(__("This will invalidate all previously generated feed URLs. Continue?"))) {
|
|
|
|
|
|
|
|
notify_progress("Clearing URLs...");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
xhrPost("backend.php", {op: "pref-feeds", method: "clearKeys"}, () => {
|
|
|
|
|
|
|
|
notify_info("Generated URLs cleared.");
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
},
|
|
|
|
clearEventLog: function() {
|
|
|
|
clearEventLog: function() {
|
|
|
|
if (confirm(__("Clear event log?"))) {
|
|
|
|
if (confirm(__("Clear event log?"))) {
|
|
|
|
|
|
|
|
|
|
|
@ -264,57 +275,30 @@ const Prefs = {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
function notify_callback2(transport, sticky) {
|
|
|
|
const Users = {
|
|
|
|
notify_info(transport.responseText, sticky);
|
|
|
|
reload: function(sort) {
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function updateFeedList() {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const user_search = $("feed_search");
|
|
|
|
|
|
|
|
let search = "";
|
|
|
|
|
|
|
|
if (user_search) { search = user_search.value; }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
xhrPost("backend.php", { op: "pref-feeds", search: search }, (transport) => {
|
|
|
|
|
|
|
|
dijit.byId('feedConfigTab').attr('content', transport.responseText);
|
|
|
|
|
|
|
|
notify("");
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function updateUsersList(sort_key) {
|
|
|
|
|
|
|
|
const user_search = $("user_search");
|
|
|
|
const user_search = $("user_search");
|
|
|
|
const search = user_search ? user_search.value : "";
|
|
|
|
const search = user_search ? user_search.value : "";
|
|
|
|
|
|
|
|
|
|
|
|
const query = { op: "pref-users", sort: sort_key, search: search };
|
|
|
|
xhrPost("backend.php", { op: "pref-users", sort: sort, search: search }, (transport) => {
|
|
|
|
|
|
|
|
|
|
|
|
xhrPost("backend.php", query, (transport) => {
|
|
|
|
|
|
|
|
dijit.byId('userConfigTab').attr('content', transport.responseText);
|
|
|
|
dijit.byId('userConfigTab').attr('content', transport.responseText);
|
|
|
|
notify("");
|
|
|
|
notify("");
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
add: function() {
|
|
|
|
function addUser() {
|
|
|
|
const login = prompt(__("Please enter username:"), "");
|
|
|
|
const login = prompt(__("Please enter login:"), "");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (login == null) {
|
|
|
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (login == "") {
|
|
|
|
|
|
|
|
alert(__("Can't create user: no login specified."));
|
|
|
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (login) {
|
|
|
|
notify_progress("Adding user...");
|
|
|
|
notify_progress("Adding user...");
|
|
|
|
|
|
|
|
|
|
|
|
xhrPost("backend.php", { op: "pref-users", method: "add", login: login }, (transport) => {
|
|
|
|
xhrPost("backend.php", {op: "pref-users", method: "add", login: login}, (transport) => {
|
|
|
|
notify_callback2(transport);
|
|
|
|
alert(transport.responseText);
|
|
|
|
updateUsersList();
|
|
|
|
Users.reload();
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
},
|
|
|
|
function editUser(id) {
|
|
|
|
edit: function(id) {
|
|
|
|
|
|
|
|
|
|
|
|
const query = "backend.php?op=pref-users&method=edit&id=" +
|
|
|
|
const query = "backend.php?op=pref-users&method=edit&id=" +
|
|
|
|
param_escape(id);
|
|
|
|
param_escape(id);
|
|
|
|
|
|
|
|
|
|
|
@ -331,7 +315,7 @@ function editUser(id) {
|
|
|
|
|
|
|
|
|
|
|
|
xhrPost("backend.php", dojo.formToObject("user_edit_form"), (transport) => {
|
|
|
|
xhrPost("backend.php", dojo.formToObject("user_edit_form"), (transport) => {
|
|
|
|
dialog.hide();
|
|
|
|
dialog.hide();
|
|
|
|
updateUsersList();
|
|
|
|
Users.reload();
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
},
|
|
|
@ -339,58 +323,9 @@ function editUser(id) {
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
dialog.show();
|
|
|
|
dialog.show();
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
resetSelected: function() {
|
|
|
|
function getSelectedUsers() {
|
|
|
|
const rows = this.getSelection();
|
|
|
|
return Tables.getSelected("prefUserList");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function removeSelectedUsers() {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const sel_rows = getSelectedUsers();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (sel_rows.length > 0) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (confirm(__("Remove selected users? Neither default admin nor your account will be removed."))) {
|
|
|
|
|
|
|
|
notify_progress("Removing selected users...");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const query = { op: "pref-users", method: "remove",
|
|
|
|
|
|
|
|
ids: sel_rows.toString() };
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
xhrPost("backend.php", query, () => {
|
|
|
|
|
|
|
|
updateUsersList();
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
alert(__("No users are selected."));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function editSelectedUser() {
|
|
|
|
|
|
|
|
const rows = getSelectedUsers();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (rows.length == 0) {
|
|
|
|
|
|
|
|
alert(__("No users are selected."));
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (rows.length > 1) {
|
|
|
|
|
|
|
|
alert(__("Please select only one user."));
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
notify("");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
editUser(rows[0]);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function resetSelectedUserPass() {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const rows = getSelectedUsers();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (rows.length == 0) {
|
|
|
|
if (rows.length == 0) {
|
|
|
|
alert(__("No users are selected."));
|
|
|
|
alert(__("No users are selected."));
|
|
|
@ -398,7 +333,7 @@ function resetSelectedUserPass() {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (rows.length > 1) {
|
|
|
|
if (rows.length > 1) {
|
|
|
|
alert(__("Please select only one user."));
|
|
|
|
alert(__("Please select one user."));
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -407,16 +342,36 @@ function resetSelectedUserPass() {
|
|
|
|
|
|
|
|
|
|
|
|
const id = rows[0];
|
|
|
|
const id = rows[0];
|
|
|
|
|
|
|
|
|
|
|
|
xhrPost("backend.php", { op: "pref-users", method: "resetPass", id: id }, (transport) => {
|
|
|
|
xhrPost("backend.php", {op: "pref-users", method: "resetPass", id: id}, (transport) => {
|
|
|
|
notify_info(transport.responseText, true);
|
|
|
|
notify('');
|
|
|
|
|
|
|
|
alert(transport.responseText);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
removeSelected: function() {
|
|
|
|
|
|
|
|
const sel_rows = this.getSelection();
|
|
|
|
|
|
|
|
|
|
|
|
function selectedUserDetails() {
|
|
|
|
if (sel_rows.length > 0) {
|
|
|
|
|
|
|
|
if (confirm(__("Remove selected users? Neither default admin nor your account will be removed."))) {
|
|
|
|
|
|
|
|
notify_progress("Removing selected users...");
|
|
|
|
|
|
|
|
|
|
|
|
const rows = getSelectedUsers();
|
|
|
|
const query = {
|
|
|
|
|
|
|
|
op: "pref-users", method: "remove",
|
|
|
|
|
|
|
|
ids: sel_rows.toString()
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
xhrPost("backend.php", query, () => {
|
|
|
|
|
|
|
|
this.reload();
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
alert(__("No users are selected."));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
editSelected: function() {
|
|
|
|
|
|
|
|
const rows = this.getSelection();
|
|
|
|
|
|
|
|
|
|
|
|
if (rows.length == 0) {
|
|
|
|
if (rows.length == 0) {
|
|
|
|
alert(__("No users are selected."));
|
|
|
|
alert(__("No users are selected."));
|
|
|
@ -424,27 +379,16 @@ function selectedUserDetails() {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (rows.length > 1) {
|
|
|
|
if (rows.length > 1) {
|
|
|
|
alert(__("Please select only one user."));
|
|
|
|
alert(__("Please select one user."));
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
const query = "backend.php?op=pref-users&method=userdetails&id=" + param_escape(rows[0]);
|
|
|
|
this.edit(rows[0]);
|
|
|
|
|
|
|
|
|
|
|
|
if (dijit.byId("userDetailsDlg"))
|
|
|
|
|
|
|
|
dijit.byId("userDetailsDlg").destroyRecursive();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const dialog = new dijit.Dialog({
|
|
|
|
|
|
|
|
id: "userDetailsDlg",
|
|
|
|
|
|
|
|
title: __("User details"),
|
|
|
|
|
|
|
|
style: "width: 600px",
|
|
|
|
|
|
|
|
execute: function () {
|
|
|
|
|
|
|
|
dialog.hide();
|
|
|
|
|
|
|
|
},
|
|
|
|
},
|
|
|
|
href: query
|
|
|
|
getSelection :function() {
|
|
|
|
});
|
|
|
|
return Tables.getSelected("prefUserList");
|
|
|
|
|
|
|
|
}
|
|
|
|
dialog.show();
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function opmlImportComplete(iframe) {
|
|
|
|
function opmlImportComplete(iframe) {
|
|
|
|
if (!iframe.contentDocument.body.innerHTML) return false;
|
|
|
|
if (!iframe.contentDocument.body.innerHTML) return false;
|
|
|
@ -541,19 +485,6 @@ function opmlRegenKey() {
|
|
|
|
return false;
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function clearFeedAccessKeys() {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (confirm(__("This will invalidate all previously generated feed URLs. Continue?"))) {
|
|
|
|
|
|
|
|
notify_progress("Clearing URLs...");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
xhrPost("backend.php", { op: "pref-feeds", method: "clearKeys" }, () => {
|
|
|
|
|
|
|
|
notify_info("Generated URLs cleared.");
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function gotoExportOpml(filename, settings) {
|
|
|
|
function gotoExportOpml(filename, settings) {
|
|
|
|
const tmp = settings ? 1 : 0;
|
|
|
|
const tmp = settings ? 1 : 0;
|
|
|
|
document.location.href = "backend.php?op=opml&method=export&filename=" + filename + "&settings=" + tmp;
|
|
|
|
document.location.href = "backend.php?op=opml&method=export&filename=" + filename + "&settings=" + tmp;
|
|
|
|