From 6080730067013d629cde1d33e70472055a9b6e03 Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Sat, 20 Nov 2010 22:11:34 +0300 Subject: rework pref-prefs to use dijit Form --- modules/pref-prefs.php | 182 ++++++++++++++++++++++++++++++++----------------- 1 file changed, 120 insertions(+), 62 deletions(-) (limited to 'modules/pref-prefs.php') diff --git a/modules/pref-prefs.php b/modules/pref-prefs.php index e0d4c232f..98211aa0d 100644 --- a/modules/pref-prefs.php +++ b/modules/pref-prefs.php @@ -30,9 +30,9 @@ if ($subop == "change-password") { - $old_pw = $_POST["OLD_PASSWORD"]; - $new_pw = $_POST["NEW_PASSWORD"]; - $con_pw = $_POST["CONFIRM_PASSWORD"]; + $old_pw = $_POST["old_password"]; + $new_pw = $_POST["new_password"]; + $con_pw = $_POST["confirm_password"]; if ($old_pw == "") { print "ERROR: ".__("Old password cannot be blank."); @@ -49,12 +49,9 @@ return; } - $old_pw_hash1 = encrypt_password($_POST["OLD_PASSWORD"]); - $old_pw_hash2 = encrypt_password($_POST["OLD_PASSWORD"], - $_SESSION["name"]); - - $new_pw_hash = encrypt_password($_POST["NEW_PASSWORD"], - $_SESSION["name"]); + $old_pw_hash1 = encrypt_password($old_pw); + $old_pw_hash2 = encrypt_password($old_pw, $_SESSION["name"]); + $new_pw_hash = encrypt_password($new_pw, $_SESSION["name"]); $active_uid = $_SESSION["uid"]; @@ -160,15 +157,6 @@ if (!SINGLE_USER_MODE) { - $result = db_query($link, "SELECT id FROM ttrss_users - WHERE id = ".$_SESSION["uid"]." AND pwd_hash - = 'SHA1:5baa61e4c9b93f3f0682250b6cf8331b7ee68fd8'"); - - if (db_num_rows($result) != 0) { - print format_warning(__("Your password is at default value, - please change it."), "default_pass_warning"); - } - /* if ($_SESSION["pwd_change_result"] == "failed") { print format_warning("Could not change the password."); } @@ -192,8 +180,22 @@ print "
"; print "
"; - print "
"; - + print ""; + + print ""; + print ""; $result = db_query($link, "SELECT email,full_name, @@ -204,79 +206,103 @@ $full_name = htmlspecialchars(db_fetch_result($result, 0, "full_name")); print ""; - print ""; print ""; - print ""; if (!SINGLE_USER_MODE) { - $access_level = db_fetch_result($result, 0, "access_level"); - print ""; print ""; - } print "
".__('Full name')."
".__('E-mail')."
".__('Access level')."" . $access_level_names[$access_level] . "
"; - print ""; - print ""; - - print "
"; + print ""; + print ""; - print "

"; + print ""; + print "

"; # pane print "
"; - print "
"; - + $result = db_query($link, "SELECT id FROM ttrss_users + WHERE id = ".$_SESSION["uid"]." AND pwd_hash + = 'SHA1:5baa61e4c9b93f3f0682250b6cf8331b7ee68fd8'"); + + if (db_num_rows($result) != 0) { + print format_warning(__("Your password is at default value, please change it."), "default_pass_warning"); + } + + print ""; + + print ""; + print ""; print ""; - print ""; + name=\"old_password\">"; print ""; - print ""; + name=\"new_password\">"; print ""; - print ""; + name=\"confirm_password\">"; print "
".__("Old password")."
".__("New password")."
".__("Confirm password")."
"; - print ""; - print ""; + print ""; + print ""; - print "
"; - - print "

"; + print ""; print "

"; #pane } @@ -307,8 +333,25 @@ owner_uid = ".$_SESSION["uid"]." ORDER BY section_id,short_desc"); - print "
"; + print ""; + + print ""; $lnum = 0; @@ -343,9 +386,9 @@ $user_theme = get_pref($link, "_THEME_ID"); $themes = get_all_themes(); - print ""; print ""; - print ""; + print ""; foreach ($themes as $t) { $base = $t['base']; @@ -392,13 +435,14 @@ $timezones = explode("\n", file_get_contents("lib/timezones.txt")); - print_select($pref_name, $value, $timezones); + print_select($pref_name, $value, $timezones, 'dojoType="dijit.form.FilteringSelect"'); } else if ($pref_name == "DEFAULT_UPDATE_INTERVAL") { global $update_intervals_nodefault; - print_select_hash($pref_name, $value, $update_intervals_nodefault); + print_select_hash($pref_name, $value, $update_intervals_nodefault, + 'dojoType="dijit.form.Select"'); } else if ($type_name == "bool") { // print_select($pref_name, $value, array("true", "false")); @@ -410,12 +454,25 @@ } print_radio($pref_name, $value, __("Yes"), array(__("Yes"), __("No"))); - - } else { - print ""; + + } else { + $regexp = ($type_name == 'integer') ? 'regexp="^\d*$"' : ''; + + print ""; } print ""; @@ -427,15 +484,16 @@ print ""; - print ""; + print ""; + print ""; - print "

"; - print " "; - print "

"; print "
"; -- cgit v1.2.3