2006-08-13 22:29:16 +00:00
|
|
|
<?php
|
2008-08-05 22:43:14 +00:00
|
|
|
// This file is part of BOINC.
|
|
|
|
// http://boinc.berkeley.edu
|
|
|
|
// Copyright (C) 2008 University of California
|
|
|
|
//
|
|
|
|
// BOINC is free software; you can redistribute it and/or modify it
|
|
|
|
// under the terms of the GNU Lesser General Public License
|
|
|
|
// as published by the Free Software Foundation,
|
|
|
|
// either version 3 of the License, or (at your option) any later version.
|
|
|
|
//
|
|
|
|
// BOINC is distributed in the hope that it will be useful,
|
|
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
|
|
// See the GNU Lesser General Public License for more details.
|
|
|
|
//
|
|
|
|
// You should have received a copy of the GNU Lesser General Public License
|
|
|
|
// along with BOINC. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
|
2006-08-13 22:29:16 +00:00
|
|
|
include_once("../inc/db.inc");
|
|
|
|
include_once("../inc/util.inc");
|
|
|
|
include_once("../inc/prefs.inc");
|
|
|
|
|
|
|
|
$user = get_logged_in_user();
|
|
|
|
|
2010-09-04 22:13:27 +00:00
|
|
|
$action = sanitize_tags(get_str("action", true));
|
|
|
|
$subset = sanitize_tags(get_str("subset"));
|
|
|
|
$venue = sanitize_tags(get_str("venue", true));
|
2006-08-13 22:29:16 +00:00
|
|
|
$columns = get_str("cols", true);
|
|
|
|
$c = $columns?"&cols=$columns":"";
|
|
|
|
check_subset($subset);
|
|
|
|
|
|
|
|
if ($action) {
|
2007-05-30 21:35:14 +00:00
|
|
|
check_tokens($user->authenticator);
|
2006-08-13 22:29:16 +00:00
|
|
|
if ($subset == "global") {
|
|
|
|
$main_prefs = prefs_parse_global($user->global_prefs);
|
|
|
|
if ($venue) $prefs = $main_prefs->$venue;
|
|
|
|
else $prefs = $main_prefs;
|
|
|
|
$error = prefs_global_parse_form($prefs);
|
|
|
|
if ($error != false) {
|
2010-02-15 04:30:25 +00:00
|
|
|
$title = tra("Edit %1 preferences", subset_name($subset));
|
2006-08-13 22:29:16 +00:00
|
|
|
if ($venue) $title = "$title for $venue";
|
|
|
|
page_head($title);
|
|
|
|
|
|
|
|
echo PREFS_FORM_DESC1;
|
|
|
|
echo PREFS_FORM_ERROR_DESC;
|
|
|
|
|
2006-10-25 21:15:08 +00:00
|
|
|
print_prefs_form(
|
|
|
|
"edit", $subset, $venue, $user, $prefs, $columns, $error
|
|
|
|
);
|
2006-08-13 22:29:16 +00:00
|
|
|
} else {
|
|
|
|
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 {
|
|
|
|
$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) {
|
2010-02-15 04:30:25 +00:00
|
|
|
$title = tra("Edit %1 preferences", subset_name($subset));
|
|
|
|
if ($venue) $title = tra("%1 for %2", $title, $venue);
|
2006-08-13 22:29:16 +00:00
|
|
|
page_head($title);
|
|
|
|
|
|
|
|
echo PREFS_FORM_ERROR_DESC;
|
|
|
|
|
2006-10-25 21:15:08 +00:00
|
|
|
print_prefs_form(
|
|
|
|
"edit", $subset, $venue, $user, $prefs, $columns, $error,
|
|
|
|
$project_error
|
|
|
|
);
|
2006-08-13 22:29:16 +00:00
|
|
|
} else {
|
|
|
|
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);
|
|
|
|
}
|
2006-10-25 21:15:08 +00:00
|
|
|
Header("Location: prefs.php?subset=$subset&updated=1$c");
|
2006-08-13 22:29:16 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
} else {
|
2010-02-15 04:30:25 +00:00
|
|
|
$title = tra("Edit %1 preferences", subset_name($subset));
|
|
|
|
if ($venue) $title = tra("%1 for %2", $title, $venue);
|
2006-08-13 22:29:16 +00:00
|
|
|
page_head($title);
|
|
|
|
|
|
|
|
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);
|
|
|
|
}
|
2011-02-09 22:11:34 +00:00
|
|
|
echo "<a href=prefs.php?subset=$subset$c>".tra("Back to preferences")."</a>\n";
|
2006-08-13 22:29:16 +00:00
|
|
|
page_tail();
|
|
|
|
|
2006-10-25 21:15:08 +00:00
|
|
|
$cvs_version_tracker[]="\$Id$"; //Generated automatically - do not edit
|
2006-08-13 22:29:16 +00:00
|
|
|
?>
|