From 752a7d70e3756d2237b48aec226d067efb31411f Mon Sep 17 00:00:00 2001 From: Robert Sesek Date: Thu, 20 Jul 2006 21:37:29 +0000 Subject: [PATCH] r908: Implementing new navigation system for the entire "Fields" tab --- admin/autoaction.php | 17 ++- admin/field.php | 18 ++- admin/global.php | 10 -- admin/priority.php | 13 +- admin/resolution.php | 13 +- admin/severity.php | 13 +- admin/status.php | 13 +- includes/class_admin_navigation.php | 199 ++++++++++++++++++++++++++++ 8 files changed, 279 insertions(+), 17 deletions(-) diff --git a/admin/autoaction.php b/admin/autoaction.php index 638c434..07d9a15 100644 --- a/admin/autoaction.php +++ b/admin/autoaction.php @@ -22,6 +22,9 @@ require_once('./global.php'); require_once('./includes/functions_datastore.php'); +NavLinks::fieldsPages(); +$navigator->set_focus('tab', 'fields', null); + if (!can_perform('canadminbugs')) { admin_login(); @@ -122,7 +125,7 @@ if ($_POST['do'] == 'insert' OR $_POST['do'] == 'update') description = '" . $bugsys->in['description'] . "', fieldchanges = '" . $bugsys->escape(serialize($deltas)) . "', comment = '" . $bugsys->in['comment'] . "' - WHERE actionid = " . $bugsys->input_clean('actionid', TYPE_UINT)) + WHERE actionid = " . $bugsys->input_clean('actionid', TYPE_UINT) ); build_auto_actions(); @@ -140,6 +143,9 @@ if ($_REQUEST['do'] == 'add' OR $_REQUEST['do'] == 'edit') if ($edit) { + NavLinks::autoactionsEdit($bugsys->in['actionid']); + $navigator->set_focus('link', 'fields-pages-autoactions', 'fields-pages'); + $action = $db->query_first("SELECT * FROM " . TABLE_PREFIX . "autoaction WHERE actionid = " . $bugsys->input_clean('actionid', TYPE_UINT)); if (!$action) { @@ -147,6 +153,11 @@ if ($_REQUEST['do'] == 'add' OR $_REQUEST['do'] == 'edit') } $action['fields'] = unserialize($action['fieldchanges']); } + else + { + NavLinks::autoactionsAdd(); + $navigator->set_focus('link', 'autoactions-add', 'autoactions'); + } $admin->page_start(($add ? $lang->string('New Automatic Action') : $lang->string('Edit Automatic Action'))); @@ -234,6 +245,9 @@ if ($_REQUEST['do'] == 'add' OR $_REQUEST['do'] == 'edit') if ($_REQUEST['do'] == 'modify') { + NavLinks::autoactionsAdd(); + $navigator->set_focus('link', 'fields-pages-autoactions', 'fields-pages'); + $admin->page_start($lang->string('Automatic Actions')); $admin->table_start(); @@ -245,7 +259,6 @@ if ($_REQUEST['do'] == 'modify') $admin->row_text($action['name'] . "\n
$action[description]
", "[" . $lang->string('Edit') . "] [" . $lang->string('Delete') . "]"); } - $admin->row_span('[' . $lang->string('New Automatic Action') . ']', 'tfoot', 'center', 3); $admin->table_end(); $admin->page_end(); diff --git a/admin/field.php b/admin/field.php index b265a62..2f72117 100644 --- a/admin/field.php +++ b/admin/field.php @@ -22,6 +22,9 @@ require_once('./global.php'); require_once('./includes/api_field.php'); +NavLinks::fieldsPages(); +$navigator->set_focus('tab', 'fields', null); + if (!can_perform('canadminfields')) { admin_login(); @@ -142,6 +145,17 @@ if ($_REQUEST['do'] == 'add' OR $_REQUEST['do'] == 'edit') $typeselect = (($add AND empty($bugsys->in['step'])) ? true : false); $edit = (($add) ? false : true); + if ($add) + { + NavLinks::fieldsAdd(); + $navigator->set_focus('link', 'fields-add', 'fields'); + } + else + { + NavLinks::fieldsEdit($bugsys->in['fieldid']); + $navigator->set_focus('link', 'fields-pages-fields', 'fields-pages'); + } + $admin->page_start(($add ? $lang->string('Add New Custom Field') : $lang->string('Edit Custom Field'))); $admin->form_start('field.php', ($typeselect ? 'add' : 'update')); if ($add AND !$typeselect) @@ -261,6 +275,9 @@ if ($_REQUEST['do'] == 'add' OR $_REQUEST['do'] == 'edit') if ($_REQUEST['do'] == 'modify') { + NavLinks::fieldsAdd(); + $navigator->set_focus('link', 'fields-pages-fields', 'fields-pages'); + $admin->page_start($lang->string('Additional Bug Fields')); $admin->table_start(); @@ -279,7 +296,6 @@ if ($_REQUEST['do'] == 'modify') ); } - $admin->row_span('[' . $lang->string('Add New Bug Field') . ']', 'tfoot', 'center', 3); $admin->table_end(); $admin->page_end(); diff --git a/admin/global.php b/admin/global.php index b1e36e2..7fff2ea 100755 --- a/admin/global.php +++ b/admin/global.php @@ -39,16 +39,6 @@ $navigator->add_component('tab', 'users', null, $lang->string('Users and Permiss require_once('./includes/class_admin_navigation.php'); $globalnav = array( - $lang->string('Bug Fields') => array( - $lang->string('Products / Versions / Components') => 'product.php', - $lang->string('Priorities') => 'priority.php', - $lang->string('Resolutions') => 'resolution.php', - $lang->string('Severities') => 'severity.php', - $lang->string('Statuses') => 'status.php', - $lang->string('Custom Bug Fields') => 'field.php', - $lang->string('Automatic Actions') => 'autoaction.php' - ), - $lang->string('User Management') => array( $lang->string('Users') => 'user.php', $lang->string('Usergroups') => 'usergroup.php', diff --git a/admin/priority.php b/admin/priority.php index 683605c..ddafdaf 100755 --- a/admin/priority.php +++ b/admin/priority.php @@ -22,6 +22,9 @@ require_once('./global.php'); require_once('./includes/api_priority.php'); +NavLinks::fieldsPages(); +$navigator->set_focus('tab', 'fields', null); + if (!can_perform('canadminfields')) { admin_login(); @@ -69,6 +72,9 @@ if ($_POST['do'] == 'insert') if ($_REQUEST['do'] == 'add') { + NavLinks::prioritiesAdd(); + $navigator->set_focus('link', 'priorities-add', 'priorities'); + $admin->page_start($lang->string('Add New Priority')); $admin->form_start('priority.php', 'insert'); @@ -101,6 +107,9 @@ if ($_POST['do'] == 'update') 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(); @@ -125,6 +134,9 @@ if ($_REQUEST['do'] == 'edit') if ($_REQUEST['do'] == 'modify') { + NavLinks::prioritiesAdd(); + $navigator->set_focus('link', 'fields-pages-priorities', 'fields-pages'); + $admin->page_start($lang->string('Priority Manager')); $priorities = $db->query("SELECT * FROM " . TABLE_PREFIX . "priority ORDER BY displayorder"); @@ -139,7 +151,6 @@ if ($_REQUEST['do'] == 'modify') } $db->free_result($priorities); - $admin->row_span('[' . $lang->string('Add New Priority') . ']', 'tfoot', 'center', 3); $admin->table_end(); $admin->form_end(); diff --git a/admin/resolution.php b/admin/resolution.php index 690ee72..4d771da 100755 --- a/admin/resolution.php +++ b/admin/resolution.php @@ -22,6 +22,9 @@ require_once('./global.php'); require_once('./includes/api_resolution.php'); +NavLinks::fieldsPages(); +$navigator->set_focus('tab', 'fields', null); + if (!can_perform('canadminfields')) { admin_login(); @@ -69,6 +72,9 @@ if ($_POST['do'] == 'insert') if ($_REQUEST['do'] == 'add') { + NavLinks::resolutionsAdd(); + $navigator->set_focus('link', 'resolutions-add', 'resolutions'); + $admin->page_start($lang->string('Add New Resolution')); $admin->form_start('resolution.php', 'insert'); @@ -101,6 +107,9 @@ if ($_POST['do'] == 'update') 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(); @@ -125,6 +134,9 @@ if ($_REQUEST['do'] == 'edit') if ($_REQUEST['do'] == 'modify') { + NavLinks::resolutionsAdd(); + $navigator->set_focus('link', 'fields-pages-resolutions', 'fields-pages'); + $admin->page_start($lang->string('Resolution Manager')); $resolutions = $db->query("SELECT * FROM " . TABLE_PREFIX . "resolution ORDER BY displayorder"); @@ -139,7 +151,6 @@ if ($_REQUEST['do'] == 'modify') } $db->free_result($resolutiones); - $admin->row_span('[' . $lang->string('Add New Resolution') . ']', 'tfoot', 'center', 3); $admin->table_end(); $admin->form_end(); diff --git a/admin/severity.php b/admin/severity.php index ca487f5..abc19b0 100755 --- a/admin/severity.php +++ b/admin/severity.php @@ -22,6 +22,9 @@ require_once('./global.php'); require_once('./includes/api_severity.php'); +NavLinks::fieldsPages(); +$navigator->set_focus('tab', 'fields', null); + if (!can_perform('canadminfields')) { admin_login(); @@ -69,6 +72,9 @@ if ($_POST['do'] == 'insert') if ($_REQUEST['do'] == 'add') { + NavLinks::severitiesAdd(); + $navigator->set_focus('link', 'severities-add', 'severities'); + $admin->page_start($lang->string('Add New Severity')); $admin->form_start('severity.php', 'insert'); @@ -101,6 +107,9 @@ if ($_POST['do'] == 'update') 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(); @@ -125,6 +134,9 @@ if ($_REQUEST['do'] == 'edit') if ($_REQUEST['do'] == 'modify') { + NavLinks::severitiesAdd(); + $navigator->set_focus('link', 'fields-pages-severities', 'fields-pages'); + $admin->page_start($lang->string('Severity Manager')); $severities = $db->query("SELECT * FROM " . TABLE_PREFIX . "severity ORDER BY displayorder"); @@ -139,7 +151,6 @@ if ($_REQUEST['do'] == 'modify') } $db->free_result($severityes); - $admin->row_span('[' . $lang->string('Add New Severity') . ']', 'tfoot', 'center', 3); $admin->table_end(); $admin->form_end(); diff --git a/admin/status.php b/admin/status.php index 222e3d3..d976fee 100755 --- a/admin/status.php +++ b/admin/status.php @@ -22,6 +22,9 @@ require_once('./global.php'); require_once('./includes/api_status.php'); +NavLinks::fieldsPages(); +$navigator->set_focus('tab', 'fields', null); + if (!can_perform('canadminfields')) { admin_login(); @@ -70,6 +73,9 @@ if ($_POST['do'] == 'insert') if ($_REQUEST['do'] == 'add') { + NavLinks::statusesAdd(); + $navigator->set_focus('link', 'statuses-add', 'statuses'); + $admin->page_start($lang->string('Add New Status')); $admin->form_start('status.php', 'insert'); @@ -104,6 +110,9 @@ if ($_POST['do'] == 'update') 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(); @@ -129,6 +138,9 @@ if ($_REQUEST['do'] == 'edit') if ($_REQUEST['do'] == 'modify') { + NavLinks::statusesAdd(); + $navigator->set_focus('link', 'fields-pages-statuses', 'fields-pages'); + $admin->page_start($lang->string('Status Manager')); $statuses = $db->query("SELECT * FROM " . TABLE_PREFIX . "status"); @@ -143,7 +155,6 @@ if ($_REQUEST['do'] == 'modify') } $db->free_result($statuses); - $admin->row_span('[' . $lang->string('Add New Status') . ']', 'tfoot', 'center', 3); $admin->table_end(); $admin->page_end(); diff --git a/includes/class_admin_navigation.php b/includes/class_admin_navigation.php index a44425b..f5b6d98 100644 --- a/includes/class_admin_navigation.php +++ b/includes/class_admin_navigation.php @@ -129,6 +129,205 @@ class NavLinks $navigator->add_component('link', 'products-edit-version', 'products-edit', $lang->string('Add New Version'), 'product.php?do=addversion&productid=' . $id); $navigator->add_component('link', 'products-edit-delete', 'products-edit', $lang->string('Delete Product'), 'product.php?do=deleteproduct&productid=' . $id); } + + // ################################################################### + /** + * Fields tab pages + * + * @access public + */ + function fieldsPages() + { + global $navigator, $lang; + + $navigator->add_component('section', 'fields-pages', 'fields', $lang->string('Fields'), null); + $navigator->add_component('link', 'fields-pages-fields', 'fields-pages', $lang->string('Custom Fields'), 'field.php'); + $navigator->add_component('link', 'fields-pages-priorities', 'fields-pages', $lang->string('Priorities'), 'priority.php'); + $navigator->add_component('link', 'fields-pages-resolutions', 'fields-pages', $lang->string('Resolutions'), 'resolution.php'); + $navigator->add_component('link', 'fields-pages-severities', 'fields-pages', $lang->string('Severities'), 'severity.php'); + $navigator->add_component('link', 'fields-pages-statuses', 'fields-pages', $lang->string('Statuses'), 'status.php'); + $navigator->add_component('link', 'fields-pages-autoactions', 'fields-pages', $lang->string('Automatic Actions'), 'autoaction.php'); + } + + // ################################################################### + /** + * Adding an new custom field + * + * @access public + */ + function fieldsAdd() + { + global $navigator, $lang; + + $navigator->add_component('section', 'fields', 'fields', $lang->string('Custom Fields'), null); + $navigator->add_component('link', 'fields-add', 'fields', $lang->string('Add New Custom Field'), 'field.php?do=add'); + } + + // ################################################################### + /** + * Edit a custom field + * + * @access public + * + * @param integer Field ID + */ + function fieldsEdit($id) + { + global $navigator, $lang; + + NavLinks::fieldsAdd(); + $navigator->add_component('link', 'fields-delete', 'fields', $lang->string('Delete'), 'field.php?do=delete&fieldid=' . $id); + } + + // ################################################################### + /** + * Adding an new priority + * + * @access public + */ + function prioritiesAdd() + { + global $navigator, $lang; + + $navigator->add_component('section', 'priorities', 'fields', $lang->string('Priorities'), null); + $navigator->add_component('link', 'priorities-add', 'priorities', $lang->string('Add New Priority'), 'priority.php?do=add'); + } + + // ################################################################### + /** + * Edit a priority + * + * @access public + * + * @param integer Priority ID + */ + function prioritiesEdit($id) + { + global $navigator, $lang; + + NavLinks::prioritiesAdd(); + $navigator->add_component('link', 'priorities-delete', 'priorities', $lang->string('Delete'), 'priority.php?do=delete&priorityid=' . $id); + } + + // ################################################################### + /** + * Adding an new resolution + * + * @access public + */ + function resolutionsAdd() + { + global $navigator, $lang; + + $navigator->add_component('section', 'resolutions', 'fields', $lang->string('Resolutions'), null); + $navigator->add_component('link', 'resolutions-add', 'resolutions', $lang->string('Add New Resolution'), 'resolution.php?do=add'); + } + + // ################################################################### + /** + * Edit a resolution + * + * @access public + * + * @param integer Resolution ID + */ + function resolutionsEdit($id) + { + global $navigator, $lang; + + NavLinks::resolutionsAdd(); + $navigator->add_component('link', 'resolutions-delete', 'resolutions', $lang->string('Delete'), 'resolution.php?do=delete&resolutionid=' . $id); + } + + // ################################################################### + /** + * Adding an new severity + * + * @access public + */ + function severitiesAdd() + { + global $navigator, $lang; + + $navigator->add_component('section', 'severities', 'fields', $lang->string('Severities'), null); + $navigator->add_component('link', 'severities-add', 'severities', $lang->string('Add New Severity'), 'severity.php?do=add'); + } + + // ################################################################### + /** + * Edit a severity + * + * @access public + * + * @param integer Severity ID + */ + function severitiesEdit($id) + { + global $navigator, $lang; + + NavLinks::severitiesAdd(); + $navigator->add_component('link', 'severities-delete', 'severities', $lang->string('Delete'), 'severity.php?do=delete&severityid=' . $id); + } + + // ################################################################### + /** + * Adding an new status + * + * @access public + */ + function statusesAdd() + { + global $navigator, $lang; + + $navigator->add_component('section', 'statuses', 'fields', $lang->string('Severities'), null); + $navigator->add_component('link', 'statuses-add', 'statuses', $lang->string('Add New Status'), 'status.php?do=add'); + } + + // ################################################################### + /** + * Edit a status + * + * @access public + * + * @param integer Status ID + */ + function statusesEdit($id) + { + global $navigator, $lang; + + NavLinks::statusesAdd(); + $navigator->add_component('link', 'statuses-delete', 'statuses', $lang->string('Delete'), 'status.php?do=delete&statusid=' . $id); + } + + // ################################################################### + /** + * Adding an new auto action + * + * @access public + */ + function autoactionsAdd() + { + global $navigator, $lang; + + $navigator->add_component('section', 'autoactions', 'fields', $lang->string('Automatic Actions'), null); + $navigator->add_component('link', 'autoactions-add', 'autoactions', $lang->string('Add New Automatic Action'), 'autoaction.php?do=add'); + } + + // ################################################################### + /** + * Edit an auto action + * + * @access public + * + * @param integer Action ID + */ + function autoactionsEdit($id) + { + global $navigator, $lang; + + NavLinks::autoactionsAdd(); + $navigator->add_component('link', 'autoactions-delete', 'autoactions', $lang->string('Delete'), 'autoaction.php?do=delete&actionid=' . $id); + } } /*=====================================================================*\ -- 2.43.5