From 77d95c330e4d19762b0f2ef70974c9f5acfd6e8d Mon Sep 17 00:00:00 2001 From: Robert Sesek Date: Wed, 27 May 2015 01:32:54 -0400 Subject: [PATCH] Migrate 4 builtin fields to fields2: priority, resolution, severity, status. Since the new upgrade system is not in place yet, there's no full migration path, but docs/migrate_to_fields2.php can be used as the basis for that. --- admin/priority.php | 162 --------------------------- admin/resolution.php | 162 --------------------------- admin/setting.php | 18 +-- admin/severity.php | 162 --------------------------- admin/status.php | 165 ---------------------------- docs/migrate_to_fields2.php | 94 ++++++++++++++++ docs/schema_changes.sql | 8 ++ includes/api_priority.php | 96 ---------------- includes/api_resolution.php | 96 ---------------- includes/api_severity.php | 96 ---------------- includes/api_status.php | 97 ---------------- includes/class_admin_navigation.php | 128 --------------------- includes/functions_datastore.php | 80 -------------- 13 files changed, 103 insertions(+), 1261 deletions(-) delete mode 100644 admin/priority.php delete mode 100644 admin/resolution.php delete mode 100644 admin/severity.php delete mode 100644 admin/status.php create mode 100644 docs/migrate_to_fields2.php delete mode 100644 includes/api_priority.php delete mode 100644 includes/api_resolution.php delete mode 100644 includes/api_severity.php delete mode 100644 includes/api_status.php diff --git a/admin/priority.php b/admin/priority.php deleted file mode 100644 index ef7dc6a..0000000 --- a/admin/priority.php +++ /dev/null @@ -1,162 +0,0 @@ -set_focus('tab', 'fields', null); - -if (!can_perform('canadminfields')) -{ - admin_login(); -} - -// ################################################################### - -if (empty($_REQUEST['do'])) -{ - $_REQUEST['do'] = 'modify'; -} - -// ################################################################### - -if ($_REQUEST['do'] == 'kill') -{ - $priority = new PriorityAPI($bugsys); - $priority->set('priorityid', $bugsys->in['priorityid']); - $priority->set_condition(); - $priority->delete(); - - $admin->redirect('priority.php?do=modify'); -} - -// ################################################################### - -if ($_REQUEST['do'] == 'delete') -{ - $admin->page_confirm(T('Are you sure you want to delete this priority? Doing so will revert all bugs to the default priority (which is set in the options panel)?'), 'priority.php', 'kill', array('priorityid' => $bugsys->input_clean('priorityid', TYPE_UINT))); -} - -// ################################################################### - -if ($_POST['do'] == 'insert') -{ - $priority = new PriorityAPI($bugsys); - $priority->set('priority', $bugsys->in['priority']); - $priority->set('displayorder', $bugsys->in['displayorder']); - $priority->insert(); - - $admin->redirect('priority.php?do=modify'); -} - -// ################################################################### - -if ($_REQUEST['do'] == 'add') -{ - NavLinks::prioritiesAdd(); - $navigator->set_focus('link', 'priorities-add', 'priorities'); - - $admin->page_start(T('Add New Priority')); - - $admin->form_start('priority.php', 'insert'); - $admin->table_start(); - $admin->table_head(T('New Priority')); - $admin->row_input(T('Priority Title
The title of this priority flag (eg: `Slated for Development` or `Address Now`)
'), 'priority'); - $admin->row_input(T('Display Order
The order in which the priorities are displayed. The higher the number, the lower down in the list it is.
'), 'displayorder'); - $admin->row_submit(); - $admin->table_end(); - $admin->form_end(); - - $admin->page_end(); -} - -// ################################################################### - -if ($_POST['do'] == 'update') -{ - $priority = new PriorityAPI($bugsys); - $priority->set('priorityid', $bugsys->in['priorityid']); - $priority->set_condition(); - $priority->set('priority', $bugsys->in['priority']); - $priority->set('displayorder', $bugsys->in['displayorder']); - $priority->update(); - - $admin->redirect('priority.php?do=modify'); -} - -// ################################################################### - -if ($_REQUEST['do'] == 'edit') -{ - NavLinks::prioritiesEdit($bugsys->in['priorityid']); - $navigator->set_focus('link', 'fields-pages-priorities', 'fields-pages'); - - $priority = new PriorityAPI($bugsys); - $priority->set('priorityid', $bugsys->in['priorityid']); - $priority->set_condition(); - $priority->fetch(); - - $admin->page_start(T('Edit Priority')); - - $admin->form_start('priority.php', 'update'); - $admin->form_hidden_field('priorityid', $priority->objdata['priorityid']); - $admin->table_start(); - $admin->table_head(sprintf(T('Edit Priority `%1$s` (id: %2$s)'), $priority->objdata['priority'], $priority->objdata['priorityid'])); - $admin->row_input(T('Priority Title
The title of this priority flag (eg: `Slated for Development` or `Address Now`)
'), 'priority', $priority->objdata['priority']); - $admin->row_input(T('Display Order
The order in which the priorities are displayed. The higher the number, the lower down in the list it is.
'), 'displayorder', $priority->objdata['displayorder']); - $admin->row_submit(); - $admin->table_end(); - $admin->form_end(); - - $admin->page_end(); -} - -// ################################################################### - -if ($_REQUEST['do'] == 'modify') -{ - NavLinks::prioritiesAdd(); - $navigator->set_focus('link', 'fields-pages-priorities', 'fields-pages'); - - $admin->page_start(T('Priority Manager')); - - $priorities = $db->query("SELECT * FROM " . TABLE_PREFIX . "priority ORDER BY displayorder"); - - $admin->form_start('priority.php', 'null'); - $admin->table_start(); - $admin->table_head(T('Priority Manager')); - - while ($priority = $db->fetch_array($priorities)) - { - $admin->row_text("$priority[displayorder]: $priority[priority]", "(priorityid: $priority[priorityid]) [" . T('Edit') . "] [" . T('Delete') . "]"); - } - $db->free_result($priorities); - - $admin->table_end(); - $admin->form_end(); - - $admin->page_end(); -} - diff --git a/admin/resolution.php b/admin/resolution.php deleted file mode 100644 index 649a024..0000000 --- a/admin/resolution.php +++ /dev/null @@ -1,162 +0,0 @@ -set_focus('tab', 'fields', null); - -if (!can_perform('canadminfields')) -{ - admin_login(); -} - -// ################################################################### - -if (empty($_REQUEST['do'])) -{ - $_REQUEST['do'] = 'modify'; -} - -// ################################################################### - -if ($_REQUEST['do'] == 'kill') -{ - $resolution = new ResolutionAPI($bugsys); - $resolution->set('resolutionid', $bugsys->in['resolutionid']); - $resolution->set_condition(); - $resolution->delete(); - - $admin->redirect('resolution.php?do=modify'); -} - -// ################################################################### - -if ($_REQUEST['do'] == 'delete') -{ - $admin->page_confirm(T('Are you sure you want to delete this resolution? Doing so will revert all bugs to the default resolution (which is set in the options panel)?'), 'resolution.php', 'kill', array('resolutionid' => $bugsys->input_clean('resolutionid', TYPE_UINT))); -} - -// ################################################################### - -if ($_POST['do'] == 'insert') -{ - $resolution = new ResolutionAPI($bugsys); - $resolution->set('resolution', $bugsys->in['resolution']); - $resolution->set('displayorder', $bugsys->in['displayorder']); - $resolution->insert(); - - $admin->redirect('resolution.php?do=modify'); -} - -// ################################################################### - -if ($_REQUEST['do'] == 'add') -{ - NavLinks::resolutionsAdd(); - $navigator->set_focus('link', 'resolutions-add', 'resolutions'); - - $admin->page_start(T('Add New Resolution')); - - $admin->form_start('resolution.php', 'insert'); - $admin->table_start(); - $admin->table_head(T('New Resolution')); - $admin->row_input(T('Resolution Title
The title of this resolution flag (eg: `Fixed` or `Bogus`)
'), 'resolution'); - $admin->row_input(T('Display Order
The order in which the resolutions are displayed. The higher the number, the lower down in the list it is.
'), 'displayorder'); - $admin->row_submit(); - $admin->table_end(); - $admin->form_end(); - - $admin->page_end(); -} - -// ################################################################### - -if ($_POST['do'] == 'update') -{ - $resolution = new ResolutionAPI($bugsys); - $resolution->set('resolutionid', $bugsys->in['resolutionid']); - $resolution->set_condition(); - $resolution->set('resolution', $bugsys->in['resolution']); - $resolution->set('displayorder', $bugsys->in['displayorder']); - $resolution->update(); - - $admin->redirect('resolution.php?do=modify'); -} - -// ################################################################### - -if ($_REQUEST['do'] == 'edit') -{ - NavLinks::resolutionsEdit($bugsys->in['resolutionid']); - $navigator->set_focus('link', 'fields-pages-resolutions', 'fields-pages'); - - $resolution = new ResolutionAPI($bugsys); - $resolution->set('resolutionid', $bugsys->in['resolutionid']); - $resolution->set_condition(); - $resolution->fetch(); - - $admin->page_start(T('Edit Resolution')); - - $admin->form_start('resolution.php', 'update'); - $admin->form_hidden_field('resolutionid', $resolution->objdata['resolutionid']); - $admin->table_start(); - $admin->table_head(sprintf(T('Edit Resolution - %1$s (id: %2$s)'), $resolution->objdata['resolution'], $resolution->objdata['resolutionid'])); - $admin->row_input(T('Resolution Title
The title of this resolution flag (eg: `Fixed` or `Bogus`)
'), 'resolution', $resolution->objdata['resolution']); - $admin->row_input(T('Display Order
The order in which the resolutions are displayed. The higher the number, the lower down in the list it is.
'), 'displayorder', $resolution->objdata['displayorder']); - $admin->row_submit(); - $admin->table_end(); - $admin->form_end(); - - $admin->page_end(); -} - -// ################################################################### - -if ($_REQUEST['do'] == 'modify') -{ - NavLinks::resolutionsAdd(); - $navigator->set_focus('link', 'fields-pages-resolutions', 'fields-pages'); - - $admin->page_start(T('Resolution Manager')); - - $resolutions = $db->query("SELECT * FROM " . TABLE_PREFIX . "resolution ORDER BY displayorder"); - - $admin->form_start('resolution.php', 'null'); - $admin->table_start(); - $admin->table_head(T('Resolution Manager')); - - while ($resolution = $db->fetch_array($resolutions)) - { - $admin->row_text("$resolution[displayorder]: $resolution[resolution]", "(resolutionid: $resolution[resolutionid]) [" . T('Edit') . "] [" . T('Delete') . "]"); - } - $db->free_result($resolutions); - - $admin->table_end(); - $admin->form_end(); - - $admin->page_end(); -} - diff --git a/admin/setting.php b/admin/setting.php index 1ffb789..86d286c 100644 --- a/admin/setting.php +++ b/admin/setting.php @@ -107,23 +107,7 @@ if ($_REQUEST['do'] == 'modify') // allowhtml $admin->row_span(T('Allow HTML in Bug Reports'), 'thead'); $admin->row_yesno(T('Set this to yes if you want to allow users to post raw HTML in their bug reports. This is very dangerous and it is not recommended.'), 'setting[allowhtml]', $bugsys->options['allowhtml']); - - // defaultseverity - $admin->row_span(T('Default Severity'), 'thead'); - $admin->row_text(T('The default severity that is selected when creating a new bug report.'), construct_option_select('setting[defaultseverity]', Bugdar::$datastore['severity'], $bugsys->options['defaultseverity'], 'severityid', 'severity')); - - // defaultpriority - $admin->row_span(T('Default Priority'), 'thead'); - $admin->row_text(T('The default priority that will be selected when creating a new bug report. Depending on your permission setup, the user may not be able to set this in a new report so this will act as the value.'), construct_option_select('setting[defaultpriority]', Bugdar::$datastore['priority'], $bugsys->options['defaultpriority'], 'priorityid', 'priority')); - - // defaultstatus - $admin->row_span(T('Default Status'), 'thead'); - $admin->row_text(T('The default default that is selected when creating a new bug report. If a user can not assign a status, this will be the one inserted into the database.'), construct_option_select('setting[defaultstatus]', Bugdar::$datastore['status'], $bugsys->options['defaultstatus'], 'statusid', 'status')); - - // defaultresolve - $admin->row_span(T('Default Resolution'), 'thead'); - $admin->row_text(T('This is the default bug resolution. If a user is not able to change this field, setting this will act as the default value.'), construct_option_select('setting[defaultresolve]', Bugdar::$datastore['resolution'], $bugsys->options['defaultresolve'], 'resolutionid', 'resolution')); - + // defaultassign $admin->row_span(T('Default Bug Assignment'), 'thead'); $admin->row_text(T('This is the default developer new bugs will be assigned to. If a user does not have permisssion to assign bugs, this will be the default. If you don\'t want any default assignment, leave this as Not Selected.'), construct_option_select('setting[defaultassign]', Bugdar::$datastore['assignto'], $bugsys->options['defaultassign'], 'userid', 'displayname', 0)); diff --git a/admin/severity.php b/admin/severity.php deleted file mode 100644 index 0a39dc0..0000000 --- a/admin/severity.php +++ /dev/null @@ -1,162 +0,0 @@ -set_focus('tab', 'fields', null); - -if (!can_perform('canadminfields')) -{ - admin_login(); -} - -// ################################################################### - -if (empty($_REQUEST['do'])) -{ - $_REQUEST['do'] = 'modify'; -} - -// ################################################################### - -if ($_REQUEST['do'] == 'kill') -{ - $severity = new SeverityAPI($bugsys); - $severity->set('severityid', $bugsys->in['severityid']); - $severity->set_condition(); - $severity->delete(); - - $admin->redirect('severity.php?do=modify'); -} - -// ################################################################### - -if ($_REQUEST['do'] == 'delete') -{ - $admin->page_confirm(T('Are you sure you want to delete this severity? Doing so will revert all bugs to the default severity (which is set in the options panel)?'), 'severity.php', 'kill', array('severityid' => $bugsys->input_clean('severityid', TYPE_UINT))); -} - -// ################################################################### - -if ($_POST['do'] == 'insert') -{ - $severity = new SeverityAPI($bugsys); - $severity->set('severity', $bugsys->in['severity']); - $severity->set('displayorder', $bugsys->in['displayorder']); - $severity->insert(); - - $admin->redirect('severity.php?do=modify'); -} - -// ################################################################### - -if ($_REQUEST['do'] == 'add') -{ - NavLinks::severitiesAdd(); - $navigator->set_focus('link', 'severities-add', 'severities'); - - $admin->page_start(T('Add New Severity')); - - $admin->form_start('severity.php', 'insert'); - $admin->table_start(); - $admin->table_head(T('New Severity')); - $admin->row_input(T('Severity Title
The title of this severity flag (eg: `Major` or `Critical`)
'), 'severity'); - $admin->row_input(T('Display Order
The order in which the severities are displayed. The higher the number, the lower down in the list it is.
'), 'displayorder'); - $admin->row_submit(); - $admin->table_end(); - $admin->form_end(); - - $admin->page_end(); -} - -// ################################################################### - -if ($_POST['do'] == 'update') -{ - $severity = new SeverityAPI($bugsys); - $severity->set('severityid', $bugsys->in['severityid']); - $severity->set_condition(); - $severity->set('severity', $bugsys->in['severity']); - $severity->set('displayorder', $bugsys->in['displayorder']); - $severity->update(); - - $admin->redirect('severity.php?do=modify'); -} - -// ################################################################### - -if ($_REQUEST['do'] == 'edit') -{ - NavLinks::severitiesEdit($bugsys->in['severityid']); - $navigator->set_focus('link', 'fields-pages-severities', 'fields-pages'); - - $severity = new SeverityAPI($bugsys); - $severity->set('severityid', $bugsys->in['severityid']); - $severity->set_condition(); - $severity->fetch(); - - $admin->page_start(T('Edit Severity')); - - $admin->form_start('severity.php', 'update'); - $admin->form_hidden_field('severityid', $severity->objdata['severityid']); - $admin->table_start(); - $admin->table_head(sprintf(T('Edit Severity - %1$s (id: %2$s)'), $severity->objdata['severity'], $severity->objdata['severityid'])); - $admin->row_input(T('Severity Title
The title of this severity flag (eg: `Major` or `Critical`)
'), 'severity', $severity->objdata['severity']); - $admin->row_input(T('Display Order
The order in which the severities are displayed. The higher the number, the lower down in the list it is.
'), 'displayorder', $severity->objdata['displayorder']); - $admin->row_submit(); - $admin->table_end(); - $admin->form_end(); - - $admin->page_end(); -} - -// ################################################################### - -if ($_REQUEST['do'] == 'modify') -{ - NavLinks::severitiesAdd(); - $navigator->set_focus('link', 'fields-pages-severities', 'fields-pages'); - - $admin->page_start(T('Severity Manager')); - - $severities = $db->query("SELECT * FROM " . TABLE_PREFIX . "severity ORDER BY displayorder"); - - $admin->form_start('severity.php', 'null'); - $admin->table_start(); - $admin->table_head(T('Severity Manager')); - - while ($severity = $db->fetch_array($severities)) - { - $admin->row_text("$severity[displayorder]: $severity[severity]", "(severityid: $severity[severityid]) [" . T('Edit') . "] [" . T('Delete') . "]"); - } - $db->free_result($severities); - - $admin->table_end(); - $admin->form_end(); - - $admin->page_end(); -} - diff --git a/admin/status.php b/admin/status.php deleted file mode 100644 index 5765d49..0000000 --- a/admin/status.php +++ /dev/null @@ -1,165 +0,0 @@ -set_focus('tab', 'fields', null); - -if (!can_perform('canadminfields')) -{ - admin_login(); -} - -// ################################################################### - -if (empty($_REQUEST['do'])) -{ - $_REQUEST['do'] = 'modify'; -} - -// ################################################################### - -if ($_REQUEST['do'] == 'kill') -{ - $status = new StatusAPI($bugsys); - $status->set('statusid', $bugsys->in['statusid']); - $status->set_condition(); - $status->delete(); - - $admin->redirect('status.php?do=modify'); -} - -// ################################################################### - -if ($_REQUEST['do'] == 'delete') -{ - $admin->page_confirm(T('Are you sure you want to delete this status? Doing so will revert all bugs to the default status (which is set in the options panel)?'), 'status.php', 'kill', array('statusid' => $bugsys->input_clean('statusid', TYPE_UINT))); -} - -// ################################################################### - -if ($_POST['do'] == 'insert') -{ - $status = new StatusAPI($bugsys); - $status->set('status', $bugsys->in['status']); - $status->set('color', $bugsys->in['color']); - $status->set('displayorder', $bugsys->in['displayorder']); - $status->insert(); - - $admin->redirect('status.php?do=modify'); -} - -// ################################################################### - -if ($_REQUEST['do'] == 'add') -{ - NavLinks::statusesAdd(); - $navigator->set_focus('link', 'statuses-add', 'statuses'); - - $admin->page_start(T('Add New Status')); - - $admin->form_start('status.php', 'insert'); - $admin->table_start(); - $admin->table_head(T('New Status')); - $admin->row_input(T('Status Title
The title of this status flag (eg: `Confirmed` or `Closed (Fixed)`)
'), 'status'); - $admin->row_input(T('Display Order
The order in which the statuses ar displayed.
'), 'displayorder'); - $admin->row_input(T('Status Color
The color of the status. This will be displayed on bug listings page to make viewing easier. Note: you must enter the # sign if you are using HEX values.
'), 'color'); - $admin->row_submit(); - $admin->table_end(); - $admin->form_end(); - - $admin->page_end(); -} - -// ################################################################### - -if ($_POST['do'] == 'update') -{ - $status = new StatusAPI($bugsys); - $status->set('statusid', $bugsys->in['statusid']); - $status->set_condition(); - $status->set('status', $bugsys->in['status']); - $status->set('color', $bugsys->in['color']); - $status->set('displayorder', $bugsys->in['displayorder']); - $status->update(); - - $admin->redirect('status.php?do=modify'); -} - -// ################################################################### - -if ($_REQUEST['do'] == 'edit') -{ - NavLinks::statusesEdit($bugsys->in['statusid']); - $navigator->set_focus('link', 'fields-pages-statuses', 'fields-pages'); - - $status = new StatusAPI($bugsys); - $status->set('statusid', $bugsys->in['statusid']); - $status->set_condition(); - $status->fetch(); - - $admin->page_start(T('Edit Status')); - - $admin->form_start('status.php', 'update'); - $admin->form_hidden_field('statusid', $status->objdata['statusid']); - $admin->table_start(); - $admin->table_head(sprintf(T('Edit Status - %1$s (id: %2$s)'), $status->objdata['status'], $status->objdata['statusid'])); - $admin->row_input(T('Status Title
The title of this status flag (eg: `Confirmed` or `Closed (Fixed)`)
'), 'status', $status->objdata['status']); - $admin->row_input(T('Display Order
The order in which the statuses ar displayed.
'), 'displayorder', $status->objdata['displayorder']); - $admin->row_input(T('Status Color
The color of the status. This will be displayed on bug listings page to make viewing easier. Note: you must enter the # sign if you are using HEX values.
'), 'color', $status->objdata['color']); - $admin->row_submit(); - $admin->table_end(); - $admin->form_end(); - - $admin->page_end(); -} - -// ################################################################### - -if ($_REQUEST['do'] == 'modify') -{ - NavLinks::statusesAdd(); - $navigator->set_focus('link', 'fields-pages-statuses', 'fields-pages'); - - $admin->page_start(T('Status Manager')); - - $statuses = $db->query("SELECT * FROM " . TABLE_PREFIX . "status"); - - $admin->table_start(); - $admin->table_head(T('Status Manager')); - - while ($status = $db->fetch_array($statuses)) - { - $colorblock = '
'; - $admin->row_text("$colorblock$status[displayorder]: $status[status]", "(statusid: $status[statusid]) [" . T('Edit') . "] [" . T('Delete') . "]"); - } - $db->free_result($statuses); - - $admin->table_end(); - - $admin->page_end(); -} - diff --git a/docs/migrate_to_fields2.php b/docs/migrate_to_fields2.php new file mode 100644 index 0000000..c141097 --- /dev/null +++ b/docs/migrate_to_fields2.php @@ -0,0 +1,94 @@ +Prepare("SELECT * FROM " . TABLE_PREFIX . "fieldhelp WHERE keystring = ?"); + $stmt->Execute([$do]); + $fieldhelp = $stmt->FetchObject(); + + // Find the default value. + $stmt = Bugdar::$db->Prepare("SELECT value FROM " . TABLE_PREFIX . "setting WHERE varname = ?"); + if ($do == 'resolution') + $stmt->Execute(['defaultresolve']); // Unclear why this ever was. + else + $stmt->Execute(['default' . $do]); + $default_setting = $stmt->FetchObject(); + + // Get all the values. + $stmt = Bugdar::$db->Query("SELECT * FROM " . TABLE_PREFIX . $do . " ORDER BY displayorder"); + $values = []; + $default_value = NULL; + while ($value = $stmt->Fetch()) { + $values[] = $value[$do]; + if ($value[$do . 'id'] == $default_setting->value) + $default_value = $value[$do]; + } + + // Create the new field. + $field = new bugdar\Field(); + $field->title = $fieldhelp->title; + $field->description = $fieldhelp->body; + $field->type = bugdar\Field::TYPE_LIST; + $field->validator_pattern = implode("\n", $values); + $field->required = TRUE; + $field->default_value = $default_value; + $field->can_search = TRUE; + var_dump($field); + $field->Insert(); + + // Migrate the data from field IDs in the bug table to the values in the new + // all-values table. + $stmt = Bugdar::$db->Prepare(" + INSERT INTO ". TABLE_PREFIX . "bugfield2 + (bugid, title, value) + SELECT bug.bugid, '" . $field->title . "', field." . $do . " + FROM " . TABLE_PREFIX . "bug AS bug + LEFT JOIN " . TABLE_PREFIX . $do . " AS field + ON (bug." . $do . " = field." . $do . "id) + "); + $stmt->Execute(); +} + +/////////////////////////////////////////////////////////////////////////////// + +if ($do === 'product') { +} + +print Bugdar::$db->ConstructHTMLDebugBlock(); diff --git a/docs/schema_changes.sql b/docs/schema_changes.sql index f4d844b..a4e0537 100644 --- a/docs/schema_changes.sql +++ b/docs/schema_changes.sql @@ -13,3 +13,11 @@ CREATE TABLE field color_background varchar(6) NOT NULL, PRIMARY KEY (title) ); + +CREATE TABLE bugfield2 +( + bugid int unsigned NOT NULL, + title varchar(255) NOT NULL, + value varchar(255) NOT NULL, + PRIMARY KEY (bugid, title) +); diff --git a/includes/api_priority.php b/includes/api_priority.php deleted file mode 100644 index 216f4f8..0000000 --- a/includes/api_priority.php +++ /dev/null @@ -1,96 +0,0 @@ -load('api', null); - -require_once('./includes/functions_datastore.php'); - -/** -* API: Priority -* -* @author Blue Static -* @copyright Copyright (c)2002 - 2007, Blue Static -* @version $Revision$ -* @package Bugdar -* -*/ -class PriorityAPI extends API -{ - /** - * Fields - * @var array - * @access private - */ - var $fields = array( - 'priorityid' => array(TYPE_UINT, REQ_AUTO, 'verify_nozero'), - 'priority' => array(TYPE_STR, REQ_YES, 'verify_noempty'), - 'displayorder' => array(TYPE_INT, REQ_NO) - ); - - /** - * Database table - * @var string - * @access private - */ - var $table = 'priority'; - - /** - * Table prefix - * @var string - * @access private - */ - var $prefix = TABLE_PREFIX; - - // ################################################################### - /** - * Post-insert - * - * @access protected - */ - function post_insert() - { - build_priorities(); - } - - // ################################################################### - /** - * Post-update - * - * @access protected - */ - function post_update() - { - build_priorities(); - } - - // ################################################################### - /** - * Post-delete - * - * @access protected - */ - function post_delete() - { - build_priorities(); - $this->registry->db->query("UPDATE " . TABLE_PREFIX . "bug SET priority = " . $this->registry->options['defaultpriority'] . " WHERE priority = " . $this->values['priorityid']); - } -} - diff --git a/includes/api_resolution.php b/includes/api_resolution.php deleted file mode 100644 index ada17fe..0000000 --- a/includes/api_resolution.php +++ /dev/null @@ -1,96 +0,0 @@ -load('api', null); - -require_once('./includes/functions_datastore.php'); - -/** -* API: Resolution -* -* @author Blue Static -* @copyright Copyright (c)2002 - 2007, Blue Static -* @version $Revision$ -* @package Bugdar -* -*/ -class ResolutionAPI extends API -{ - /** - * Fields - * @var array - * @access private - */ - var $fields = array( - 'resolutionid' => array(TYPE_UINT, REQ_AUTO, 'verify_nozero'), - 'resolution' => array(TYPE_STR, REQ_YES, 'verify_noempty'), - 'displayorder' => array(TYPE_INT, REQ_NO) - ); - - /** - * Database table - * @var string - * @access private - */ - var $table = 'resolution'; - - /** - * Table prefix - * @var string - * @access private - */ - var $prefix = TABLE_PREFIX; - - // ################################################################### - /** - * Post-insert - * - * @access protected - */ - function post_insert() - { - build_resolutions(); - } - - // ################################################################### - /** - * Post-update - * - * @access protected - */ - function post_update() - { - build_resolutions(); - } - - // ################################################################### - /** - * Post-delete - * - * @access protected - */ - function post_delete() - { - build_resolutions(); - $this->registry->db->query("UPDATE " . TABLE_PREFIX . "bug SET resolution = " . $this->registry->clean($this->registry->options['defaultresolve'], TYPE_UINT) . " WHERE resolution = " . $this->values['resolutionid']); - } -} - diff --git a/includes/api_severity.php b/includes/api_severity.php deleted file mode 100644 index 01a4a54..0000000 --- a/includes/api_severity.php +++ /dev/null @@ -1,96 +0,0 @@ -load('api', null); - -require_once('./includes/functions_datastore.php'); - -/** -* API: Severity -* -* @author Blue Static -* @copyright Copyright (c)2002 - 2007, Blue Static -* @version $Revision$ -* @package Bugdar -* -*/ -class SeverityAPI extends API -{ - /** - * Fields - * @var array - * @access private - */ - var $fields = array( - 'severityid' => array(TYPE_UINT, REQ_AUTO, 'verify_nozero'), - 'severity' => array(TYPE_STR, REQ_YES, 'verify_noempty'), - 'displayorder' => array(TYPE_INT, REQ_NO) - ); - - /** - * Database table - * @var string - * @access private - */ - var $table = 'severity'; - - /** - * Table prefix - * @var string - * @access private - */ - var $prefix = TABLE_PREFIX; - - // ################################################################### - /** - * Post-insert - * - * @access protected - */ - function post_insert() - { - build_severities(); - } - - // ################################################################### - /** - * Post-update - * - * @access protected - */ - function post_update() - { - build_severities(); - } - - // ################################################################### - /** - * Post-delete - * - * @access protected - */ - function post_delete() - { - build_severities(); - $this->registry->db->query("UPDATE " . TABLE_PREFIX . "bug SET severity = " . $this->registry->options['defaultseverity'] . " WHERE severity = " . $this->values['severityid']); - } -} - diff --git a/includes/api_status.php b/includes/api_status.php deleted file mode 100644 index 898f6dc..0000000 --- a/includes/api_status.php +++ /dev/null @@ -1,97 +0,0 @@ -load('api', null); - -require_once('./includes/functions_datastore.php'); - -/** -* API: Status -* -* @author Blue Static -* @copyright Copyright (c)2002 - 2007, Blue Static -* @version $Revision$ -* @package Bugdar -* -*/ -class StatusAPI extends API -{ - /** - * Fields - * @var array - * @access private - */ - var $fields = array( - 'statusid' => array(TYPE_UINT, REQ_AUTO, 'verify_nozero'), - 'status' => array(TYPE_STR, REQ_YES, 'verify_noempty'), - 'color' => array(TYPE_STR, REQ_NO), - 'displayorder' => array(TYPE_INT, REQ_NO) - ); - - /** - * Database table - * @var string - * @access private - */ - var $table = 'status'; - - /** - * Table prefix - * @var string - * @access private - */ - var $prefix = TABLE_PREFIX; - - // ################################################################### - /** - * Post-insert - * - * @access protected - */ - function post_insert() - { - build_statuses(); - } - - // ################################################################### - /** - * Post-update - * - * @access protected - */ - function post_update() - { - build_statuses(); - } - - // ################################################################### - /** - * Post-delete - * - * @access protected - */ - function post_delete() - { - build_statuses(); - $this->registry->db->query("UPDATE " . TABLE_PREFIX . "bug SET status = " . $this->registry->options['defaultstatus'] . " WHERE status = " . $this->values['statusid']); - } -} - diff --git a/includes/class_admin_navigation.php b/includes/class_admin_navigation.php index 9bd6f2a..3749206 100644 --- a/includes/class_admin_navigation.php +++ b/includes/class_admin_navigation.php @@ -141,14 +141,6 @@ class NavLinks $navigator->add_component('section', 'fields-pages', 'fields', T('Fields'), null); $navigator->add_component('link', 'fields-pages-fields', 'fields-pages', T('Custom Fields'), 'field.php'); - $navigator->add_component('link', 'fields-pages-priorities', 'fields-pages', T('Priorities'), 'priority.php'); - $navigator->add_component('link', 'fields-pages-resolutions', 'fields-pages', T('Resolutions'), 'resolution.php'); - $navigator->add_component('link', 'fields-pages-severities', 'fields-pages', T('Severities'), 'severity.php'); - $navigator->add_component('link', 'fields-pages-statuses', 'fields-pages', T('Statuses'), 'status.php'); - $navigator->add_component('link', 'fields-pages-automations', 'fields-pages', T('Automations'), 'automation.php'); - - // TODO(port): remove this. - $navigator->add_component('link', 'fields-pages-v2', 'fields-pages', 'FIELDS - V2', 'field2.php'); } // ################################################################### @@ -181,126 +173,6 @@ class NavLinks $navigator->add_component('link', 'fields-delete', 'fields', T('Delete'), 'field.php?do=delete&fieldid=' . $id); } - // ################################################################### - /** - * Adding an new priority - * - * @access public - */ - function prioritiesAdd() - { - global $navigator; - - $navigator->add_component('section', 'priorities', 'fields', T('Priorities'), null); - $navigator->add_component('link', 'priorities-add', 'priorities', T('Add New Priority'), 'priority.php?do=add'); - } - - // ################################################################### - /** - * Edit a priority - * - * @access public - * - * @param integer Priority ID - */ - function prioritiesEdit($id) - { - global $navigator; - - NavLinks::prioritiesAdd(); - $navigator->add_component('link', 'priorities-delete', 'priorities', T('Delete'), 'priority.php?do=delete&priorityid=' . $id); - } - - // ################################################################### - /** - * Adding an new resolution - * - * @access public - */ - function resolutionsAdd() - { - global $navigator; - - $navigator->add_component('section', 'resolutions', 'fields', T('Resolutions'), null); - $navigator->add_component('link', 'resolutions-add', 'resolutions', T('Add New Resolution'), 'resolution.php?do=add'); - } - - // ################################################################### - /** - * Edit a resolution - * - * @access public - * - * @param integer Resolution ID - */ - function resolutionsEdit($id) - { - global $navigator; - - NavLinks::resolutionsAdd(); - $navigator->add_component('link', 'resolutions-delete', 'resolutions', T('Delete'), 'resolution.php?do=delete&resolutionid=' . $id); - } - - // ################################################################### - /** - * Adding an new severity - * - * @access public - */ - function severitiesAdd() - { - global $navigator; - - $navigator->add_component('section', 'severities', 'fields', T('Severities'), null); - $navigator->add_component('link', 'severities-add', 'severities', T('Add New Severity'), 'severity.php?do=add'); - } - - // ################################################################### - /** - * Edit a severity - * - * @access public - * - * @param integer Severity ID - */ - function severitiesEdit($id) - { - global $navigator; - - NavLinks::severitiesAdd(); - $navigator->add_component('link', 'severities-delete', 'severities', T('Delete'), 'severity.php?do=delete&severityid=' . $id); - } - - // ################################################################### - /** - * Adding an new status - * - * @access public - */ - function statusesAdd() - { - global $navigator; - - $navigator->add_component('section', 'statuses', 'fields', T('Severities'), null); - $navigator->add_component('link', 'statuses-add', 'statuses', T('Add New Status'), 'status.php?do=add'); - } - - // ################################################################### - /** - * Edit a status - * - * @access public - * - * @param integer Status ID - */ - function statusesEdit($id) - { - global $navigator; - - NavLinks::statusesAdd(); - $navigator->add_component('link', 'statuses-delete', 'statuses', T('Delete'), 'status.php?do=delete&statusid=' . $id); - } - // ################################################################### /** * Adding an new automation diff --git a/includes/functions_datastore.php b/includes/functions_datastore.php index 0fea3d9..b997989 100644 --- a/includes/functions_datastore.php +++ b/includes/functions_datastore.php @@ -79,66 +79,6 @@ function build_usergroups() Bugdar::$datastore['usergroup'] = $groups; } -// ####################### Start build_statuses ###################### -function build_statuses() -{ - global $bugsys; - - $statuses = $bugsys->db->query("SELECT * FROM " . TABLE_PREFIX . "status ORDER BY displayorder ASC"); - while ($status = $bugsys->db->fetch_array($statuses)) - { - $tempstore["$status[statusid]"] = $status; - } - - $bugsys->db->query(" - ### replacing status cache ### - REPLACE INTO " . TABLE_PREFIX . "datastore (title, data) - VALUES ('status', '" . $bugsys->escape(serialize($tempstore)) . "')" - ); - - Bugdar::$datastore['status'] = $tempstore; -} - -// ###################### Start build_severities ##################### -function build_severities() -{ - global $bugsys; - - $severities = $bugsys->db->query("SELECT * FROM " . TABLE_PREFIX . "severity ORDER BY displayorder ASC"); - while ($severity = $bugsys->db->fetch_array($severities)) - { - $tempstore["$severity[severityid]"] = $severity; - } - - $bugsys->db->query(" - ### replacing severity cache ### - REPLACE INTO " . TABLE_PREFIX . "datastore (title, data) - VALUES ('severity', '" . $bugsys->escape(serialize($tempstore)) . "')" - ); - - Bugdar::$datastore['severity'] = $tempstore; -} - -// ###################### Start build_priorities ##################### -function build_priorities() -{ - global $bugsys; - - $priorities = $bugsys->db->query("SELECT * FROM " . TABLE_PREFIX . "priority ORDER BY displayorder ASC"); - while ($priority = $bugsys->db->fetch_array($priorities)) - { - $tempstore["$priority[priorityid]"] = $priority; - } - - $bugsys->db->query(" - ### replacing priority cache ### - REPLACE INTO " . TABLE_PREFIX . "datastore (title, data) - VALUES ('priority', '" . $bugsys->escape(serialize($tempstore)) . "')" - ); - - Bugdar::$datastore['priority'] = $tempstore; -} - // ###################### Start build_assignedto ##################### function build_assignedto() { @@ -176,26 +116,6 @@ function build_assignedto() Bugdar::$datastore['assignto'] = $devs; } -// ##################### Start build_resolutions ##################### -function build_resolutions() -{ - global $bugsys; - - $resolutions = $bugsys->db->query("SELECT * FROM " . TABLE_PREFIX . "resolution ORDER BY displayorder ASC"); - while ($resolution = $bugsys->db->fetch_array($resolutions)) - { - $tempstore["$resolution[resolutionid]"] = $resolution; - } - - $bugsys->db->query(" - ### replacing resolution cache ### - REPLACE INTO " . TABLE_PREFIX . "datastore (title, data) - VALUES ('resolution', '" . $bugsys->escape(serialize($tempstore)) . "')" - ); - - Bugdar::$datastore['resolution'] = $tempstore; -} - // ####################### Start build_versions ###################### function build_versions() { -- 2.43.5