From 031605a3c771bda2bd3f262986d55034035c07fe Mon Sep 17 00:00:00 2001 From: David Anderson Date: Sun, 13 Aug 2006 22:29:16 +0000 Subject: [PATCH] *** empty log message *** svn path=/trunk/boinc/; revision=10905 --- html/user/prefs_edit.php | 105 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 105 insertions(+) create mode 100644 html/user/prefs_edit.php diff --git a/html/user/prefs_edit.php b/html/user/prefs_edit.php new file mode 100644 index 0000000000..80a9efd713 --- /dev/null +++ b/html/user/prefs_edit.php @@ -0,0 +1,105 @@ +global_prefs); + if ($venue) $prefs = $main_prefs->$venue; + else $prefs = $main_prefs; + $error = prefs_global_parse_form($prefs); + if ($error != false) { + // We encountered an error during parsing lets display the form again + $title = "Edit ".subset_name($subset)." preferences"; + if ($venue) $title = "$title for $venue"; + page_head($title); + $x = $venue?"&venue=$venue":""; + + echo PREFS_FORM_DESC1; + echo PREFS_FORM_ERROR_DESC; + + print_prefs_form("edit", $subset, $venue, $user, $prefs, $columns, $error); + } else { + // No error occured so lets update the values and go back to prefs page + if ($venue) $main_prefs->$venue = $prefs; + else $main_prefs = $prefs; + global_prefs_update($user, $main_prefs); + Header("Location: prefs.php?subset=$subset&updated=1$c"); + } + } else { + // process the submited data for project specific prefs + $main_prefs = prefs_parse_project($user->project_prefs); + if ($venue) $prefs = $main_prefs->$venue; + else $prefs = $main_prefs; + + $project_error = prefs_project_parse_form($prefs); + $error = prefs_resource_parse_form($prefs); + if ($error != false || $project_error != false) { + // We encountered an error during parsing lets display the form again + $title = "Edit ".subset_name($subset)." preferences"; + if ($venue) $title = "$title for $venue"; + page_head($title); + $x = $venue?"&venue=$venue":""; + + echo PREFS_FORM_ERROR_DESC; + + print_prefs_form("edit", $subset, $venue, $user, $prefs, $columns, $error, $project_error); + } else { + // No error occured so lets update the values and go back to prefs page + if ($venue) { + $main_prefs->$venue = $prefs; + } else { + $main_prefs = $prefs; + prefs_privacy_parse_form($user); + } + + project_prefs_update($user, $main_prefs); + + if (!$venue) { + venue_parse_form($user); + venue_update($user); + } + Header("Location: prefs.php?subset=$subset&updated=1$c"); + } + } +} else { +// We got no data to process so lets display the current values + $title = "Edit ".subset_name($subset)." preferences"; + if ($venue) $title = "$title for $venue"; + page_head($title); + $x = $venue?"&venue=$venue":""; + + if ($subset == "global") { + echo PREFS_FORM_DESC1; + $prefs = prefs_parse_global($user->global_prefs); + if ($venue) { + $prefs = $prefs->$venue; + } + } else { + $prefs = prefs_parse_project($user->project_prefs); + if ($venue) { + $prefs = $prefs->$venue; + } + } + print_prefs_form("edit", $subset, $venue, $user, $prefs, $columns); +} +echo "Back to preferences\n"; +page_tail(); + +?>