}
function csrf_ignore($method) {
- $csrf_ignored = array("index");
+ $csrf_ignored = array("index", "edit");
return array_search($method, $csrf_ignored) !== false;
}
global $access_level_names;
$id = $this->dbh->escape_string($_REQUEST["id"]);
- print "<form id=\"user_edit_form\" onsubmit='return false'>";
+ print "<form id=\"user_edit_form\" onsubmit='return false' dojoType=\"dijit.form.Form\">";
- print "<input type=\"hidden\" name=\"id\" value=\"$id\">";
- print "<input type=\"hidden\" name=\"op\" value=\"pref-users\">";
- print "<input type=\"hidden\" name=\"method\" value=\"editSave\">";
+ print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"id\" value=\"$id\">";
+ print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"op\" value=\"pref-users\">";
+ print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"method\" value=\"editSave\">";
$result = $this->dbh->query("SELECT * FROM ttrss_users WHERE id = '$id'");
print "<div class=\"dlgSecCont\">";
if ($sel_disabled) {
- print "<input type=\"hidden\" name=\"login\" value=\"$login\">";
- print "<input size=\"30\" style=\"font-size : 16px\"
- onkeypress=\"return filterCR(event, userEditSave)\" $sel_disabled
- value=\"$login\">";
- } else {
- print "<input size=\"30\" style=\"font-size : 16px\"
- onkeypress=\"return filterCR(event, userEditSave)\" $sel_disabled
- name=\"login\" value=\"$login\">";
+ print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"login\" value=\"$login\">";
}
+ print "<input size=\"30\" style=\"font-size : 16px\"
+ dojoType=\"dijit.form.ValidationTextBox\" required=\"1\"
+ onkeypress=\"return filterCR(event, userEditSave)\" $sel_disabled
+ name=\"login\" value=\"$login\">";
+
print "</div>";
print "<div class=\"dlgSec\">".__("Authentication")."</div>";
if (!$sel_disabled) {
print_select_hash("access_level", $access_level, $access_level_names,
- $sel_disabled);
+ "dojoType=\"dijit.form.Select\" $sel_disabled");
} else {
print_select_hash("", $access_level, $access_level_names,
- $sel_disabled);
- print "<input type=\"hidden\" name=\"access_level\" value=\"$access_level\">";
+ "dojoType=\"dijit.form.Select\" $sel_disabled");
+ print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"access_level\" value=\"$access_level\">";
}
- print "<br/>";
+ print "<hr/>";
- print __('Change password to') .
- " <input type=\"password\" size=\"20\" onkeypress=\"return filterCR(event, userEditSave)\"
+ print "<input dojoType=\"dijit.form.TextBox\" type=\"password\" size=\"20\" onkeypress=\"return filterCR(event, userEditSave)\" placeholder=\"Change password to\"
name=\"password\">";
print "</div>";
print "<div class=\"dlgSec\">".__("Options")."</div>";
print "<div class=\"dlgSecCont\">";
- print __('E-mail: ').
- " <input size=\"30\" name=\"email\" onkeypress=\"return filterCR(event, userEditSave)\"
+ print "<input dojoType=\"dijit.form.TextBox\" size=\"30\" name=\"email\" onkeypress=\"return filterCR(event, userEditSave)\" placeholder=\"Email\"
value=\"$email\">";
print "</div>";
print "</form>";
print "<div class=\"dlgButtons\">
- <button onclick=\"return userEditSave()\">".
+ <button dojoType=\"dijit.form.Button\" type=\"submit\">".
__('Save')."</button>
- <button onclick=\"return userEditCancel()\">".
+ <button dojoType=\"dijit.form.Button\" onclick=\"dijit.byId('userEditDlg').hide()\">".
__('Cancel')."</button></div>";
return;
try {
notify_progress("Loading, please wait...");
- var query = "?op=pref-users&method=edit&id=" +
+ var query = "backend.php?op=pref-users&method=edit&id=" +
param_escape(id);
- new Ajax.Request("backend.php", {
- parameters: query,
- onComplete: function(transport) {
- infobox_callback2(transport, __("User Editor"));
- document.forms['user_edit_form'].login.focus();
- } });
+ if (dijit.byId("userEditDlg"))
+ dijit.byId("userEditDlg").destroyRecursive();
+
+ dialog = new dijit.Dialog({
+ id: "userEditDlg",
+ title: __("User Editor"),
+ style: "width: 600px",
+ execute: function() {
+ if (this.validate()) {
+
+ notify_progress("Saving data...", true);
+
+ var query = dojo.formToQuery("user_edit_form");
+
+ new Ajax.Request("backend.php", {
+ parameters: query,
+ onComplete: function(transport) {
+ dialog.hide();
+ updateUsersList();
+ }});
+ }
+ },
+ href: query});
+
+ dialog.show();
} catch (e) {
exception_error("editUser", e);
return false;
}
-function userEditCancel() {
- closeInfoBox();
- return false;
-}
-
-function userEditSave() {
-
- try {
-
- var login = document.forms["user_edit_form"].login.value;
-
- if (login.length == 0) {
- alert(__("Login field cannot be blank."));
- return;
- }
-
- notify_progress("Saving user...");
-
- closeInfoBox();
-
- var query = Form.serialize("user_edit_form");
-
- new Ajax.Request("backend.php", {
- parameters: query,
- onComplete: function(transport) {
- updateUsersList();
- } });
-
- } catch (e) {
- exception_error("userEditSave", e);
- }
-
- return false;
-
-}
-
-
function editSelectedUser() {
var rows = getSelectedUsers();