|
From: Benjamin C. <bc...@us...> - 2002-04-04 15:35:24
|
Update of /cvsroot/phpbt/phpbt/admin
In directory usw-pr-cvs1:/tmp/cvs-serv29408/admin
Modified Files:
project.php
Log Message:
Added deleting of unused versions and components
Index: project.php
===================================================================
RCS file: /cvsroot/phpbt/phpbt/admin/project.php,v
retrieving revision 1.37
retrieving revision 1.38
diff -u -r1.37 -r1.38
--- project.php 3 Apr 2002 00:58:26 -0000 1.37
+++ project.php 4 Apr 2002 13:30:17 -0000 1.38
@@ -25,6 +25,15 @@
define('TEMPLATE_PATH', 'admin');
include '../include.php';
+function del_version($versionid, $projectid) {
+ global $db, $me;
+
+ if (!$db->getOne('select count(*) from '.TBL_BUG." where version_id = $versionid")) {
+ $db->query("delete from ".TBL_VERSION." where version_id = $versionid");
+ }
+ header("Location: $me?op=edit&id=$projectid&");
+}
+
function save_version($versionid = 0) {
global $db, $me, $_pv, $STRING, $now, $u, $t;
@@ -69,6 +78,15 @@
$t->display('admin/version-edit.html');
}
+function del_component($componentid, $projectid) {
+ global $db, $me;
+
+ if (!$db->getOne('select count(*) from '.TBL_BUG." where component_id = $componentid")) {
+ $db->query("delete from ".TBL_COMPONENT." where component_id = $componentid");
+ }
+ header("Location: $me?op=edit&id=$projectid&");
+}
+
function save_component($componentid = 0) {
global $db, $me, $_pv, $u, $STRING, $now, $t;
@@ -207,7 +225,7 @@
}
function show_project($projectid = 0, $error = null) {
- global $db, $me, $t, $name, $description, $active, $TITLE, $_gv, $_pv;
+ global $db, $me, $t, $TITLE, $_gv, $_pv, $QUERY;
if (is_array($error)) $t->assign($error);
else $t->assign('error', $error);
@@ -218,10 +236,10 @@
$t->assign($db->getRow('select * from '.TBL_PROJECT
." where project_id = $projectid"));
$t->assign(array(
- 'components' => $db->getAll("select * from ".TBL_COMPONENT.
- " where project_id = $projectid"),
- 'versions' => $db->getAll("select * from ".TBL_VERSION.
- " where project_id = $projectid")
+ 'components' => $db->getAll(sprintf($QUERY['admin-list-components'],
+ $projectid)),
+ 'versions' => $db->getAll(sprintf($QUERY['admin-list-versions'],
+ $projectid))
));
$t->display('admin/project-edit.html');
@@ -270,6 +288,8 @@
case 'edit' : show_project($_gv['id']); break;
case 'edit_component' : show_component($_gv['id']); break;
case 'edit_version' : show_version($_gv['id']); break;
+ case 'del_component' : del_component($_gv['id'], $_gv['project_id']); break;
+ case 'del_version' : del_version($_gv['id'], $_gv['project_id']); break;
}
} elseif (isset($_pv['do'])) {
switch($_pv['do']) {
|