diff --git a/html/inc/boinc_db.inc b/html/inc/boinc_db.inc index 1775803b6e..3cc1aa1a60 100644 --- a/html/inc/boinc_db.inc +++ b/html/inc/boinc_db.inc @@ -542,6 +542,10 @@ class BoincBadge { $db = BoincDb::get(); return $db->lookup('badge', 'BoincBadge', $clause); } + function delete() { + $db = BoincDb::get(); + return $db->delete($this, 'badge'); + } } class BoincBadgeUser { @@ -567,6 +571,10 @@ class BoincBadgeUser { $db = BoincDb::get(); $db->delete_aux('badge_user', $clause); } + static function count($clause) { + $db = BoincDb::get(); + return $db->count('badge_user', $clause); + } } class BoincBadgeTeam { @@ -592,6 +600,10 @@ class BoincBadgeTeam { $db = BoincDb::get(); $db->delete_aux('badge_team', $clause); } + static function count($clause) { + $db = BoincDb::get(); + return $db->count('badge_team', $clause); + } } diff --git a/html/inc/util_ops.inc b/html/inc/util_ops.inc index 6389b1d046..ae0ee68db1 100644 --- a/html/inc/util_ops.inc +++ b/html/inc/util_ops.inc @@ -28,38 +28,11 @@ define("TABLE", ""); define("TABLE2", "
"); function admin_page_head($title) { - $stylesheet = URL_BASE.STYLESHEET; - - echo ""; - echo "$title - - - "; - if (defined('ADMIN_STYLESHEET')) { - echo ""; - } - echo " - - -

".PROJECT.": $title

- "; + return page_head($title); } function admin_page_tail() { - echo "

- Back to Main admin page | - "; - $user = get_logged_in_user_ops(); - if ($user) { - echo "logged in as $user->name. Log out"; - } else { - echo "Log in"; - } - - echo " -
- - "; + echo "\n"; } // TODO: get rid of all the following diff --git a/html/ops/badge_admin.php b/html/ops/badge_admin.php index 3105190903..91997eef9f 100644 --- a/html/ops/badge_admin.php +++ b/html/ops/badge_admin.php @@ -25,21 +25,27 @@ function show_form() { table_header( "ID", "name", - "type
0=user
1=team", + "type
0=user
1=team
", "title", "description", "image URL", "level", "tags", - "SQL rule" + "SQL rule", + "", "" ); $badges = BoincBadge::enum(""); + $i = 0; foreach ($badges as $badge) { - echo ""; - echo "id>"; + echo ""; + $i = 1-$i; echo "\n"; - echo "\n"; + echo "id>"; + $nu = BoincBadgeUser::count("badge_id=$badge->id"); + $nt = BoincBadgeTeam::count("badge_id=$badge->id"); + $x = "
Assigned to $nu users
Assigned to $nt teams
"; + echo "\n"; echo "\n"; echo "\n"; echo "\n"; @@ -52,6 +58,7 @@ function show_form() { echo "\n"; echo "\n"; echo "\n"; } @@ -65,7 +72,7 @@ function show_form() { echo "\n"; echo "\n"; echo "\n"; - echo "\n"; + echo "\n"; echo "\n"; end_table(); @@ -107,11 +114,23 @@ function update_badge() { } } +function delete_badge() { + $id = post_int("id"); + $badge = BoincBadge::lookup_id($id); + if (!$badge) { + admin_error_page("no such badge"); + } + BoincBadgeUser::delete("badge_id=$id"); + BoincBadgeTeam::delete("badge_id=$id"); + $badge->delete(); +} if (post_str('add_badge', true)) { add_badge(); } else if (post_str('update', true)) { update_badge(); +} else if (post_str('delete', true)) { + delete_badge(); } admin_page_head("Manage badges"); show_form(); diff --git a/html/ops/logout.php b/html/ops/logout.php index b60367fe9c..6b4e3e533e 100644 --- a/html/ops/logout.php +++ b/html/ops/logout.php @@ -5,7 +5,9 @@ require_once("../inc/util_ops.inc"); $user = get_logged_in_user_ops(); if ($user) { clear_cookie('auth', true); + header("Location: index.php"); admin_page_head("Logged out"); + echo "You are now logged out"; admin_page_tail(); } else { admin_error_page("not logged in"); diff --git a/html/ops/manage_app_versions.php b/html/ops/manage_app_versions.php index 2f1bf558b5..1babf6d7c1 100644 --- a/html/ops/manage_app_versions.php +++ b/html/ops/manage_app_versions.php @@ -63,6 +63,7 @@ function show_form() { $avs = BoincAppVersion::enum( "true order by appid, platformid, plan_class, version_num" ); + $i = 0; foreach ($avs as $av) { // grey out deprecated versions // @@ -72,7 +73,8 @@ function show_form() { $f2=""; } - echo "\n"; + echo "\n"; + $i = 1-$i; echo "id>"; echo " \n"; diff --git a/html/ops/manage_apps.php b/html/ops/manage_apps.php index 843944f73e..9d90ff00f8 100644 --- a/html/ops/manage_apps.php +++ b/html/ops/manage_apps.php @@ -86,7 +86,8 @@ function show_form() { "homogeneous app version?
details", "deprecated?", "Non-CPU-intensive?", - "Beta?" + "Beta?", + "" ); $total_weight = BoincApp::sum("weight"); @@ -96,6 +97,7 @@ function show_form() { } $apps = BoincApp::enum(""); + $i = 0; foreach ($apps as $app) { // grey-out deprecated versions $f1=$f2=''; @@ -103,7 +105,8 @@ function show_form() { $f1 = ""; $f2 = ""; } - echo ""; + echo ""; + $i = 1-$i; echo "id>"; echo " \n"; diff --git a/tools/make_project b/tools/make_project index 99449ed2c4..357f7ea649 100755 --- a/tools/make_project +++ b/tools/make_project @@ -242,19 +242,19 @@ t = project.config.tasks.make_node_and_append("task") t.period = '24 hours' t.output = 'db_dump.out' t.cmd = 'db_dump -d 2 --dump_spec ../db_dump_spec.xml' -t.disabled = 1 +t.disabled = 0 t = project.config.tasks.make_node_and_append("task") t.period = '1 days' t.output = 'update_uotd.out' t.cmd = 'run_in_ops ./update_uotd.php' -t.disabled = 1 +t.disabled = 0 t = project.config.tasks.make_node_and_append("task") t.period = '1 hour' t.output = 'update_forum_activities.out' t.cmd = 'run_in_ops ./update_forum_activities.php' -t.disabled = 1 +t.disabled = 0 t = project.config.tasks.make_node_and_append("task") t.period = '1 days' @@ -266,7 +266,7 @@ t = project.config.tasks.make_node_and_append("task") t.period = '24 hours' t.output = 'update_profile_pages.out' t.cmd = 'run_in_ops ./update_profile_pages.php' -t.disabled = 1 +t.disabled = 0 t = project.config.tasks.make_node_and_append("task") t.period = '24 hours' @@ -278,7 +278,13 @@ t = project.config.tasks.make_node_and_append("task") t.period = '24 hours' t.output = 'notify.out' t.cmd = 'run_in_ops ./notify.php' -t.disabled = 1 +t.disabled = 0 + +t = project.config.tasks.make_node_and_append("task") +t.period = '24 hours' +t.output = 'badge_assign.out' +t.cmd = 'run_in_ops ./badge_assign.php' +t.disabled = 0 project.config.write()
$badge->idname\">name\">$xtype\">title\">description\">tags\">sql_rule\">\n"; + echo "\n"; echo "
$f1 $av->id $f2
$f1 $app->id $f2