From eaf79776c7e185a976502f07494cc63a0b343de1 Mon Sep 17 00:00:00 2001 From: Mike Koch Date: Thu, 4 Jun 2015 22:00:27 -0400 Subject: [PATCH] Still need to setup security, though --- admin/manage_categories.php | 45 ++++++++++++++++++++++++++++++++++++- language/en/text.php | 2 ++ 2 files changed, 46 insertions(+), 1 deletion(-) diff --git a/admin/manage_categories.php b/admin/manage_categories.php index 70980ba5..e0b267f1 100644 --- a/admin/manage_categories.php +++ b/admin/manage_categories.php @@ -57,6 +57,7 @@ $priorities = array( ); /* What should we do? */ +//TODO if ( $action = hesk_REQUEST('a') ) { if ($action == 'linkcode') {generate_link_code();} @@ -68,6 +69,7 @@ if ( $action = hesk_REQUEST('a') ) elseif ($action == 'autoassign') {toggle_autoassign();} elseif ($action == 'type') {toggle_type();} elseif ($action == 'priority') {change_priority();} + elseif ($action == 'manager') {change_manager();} } /* Print header */ @@ -238,7 +240,6 @@ else {return false;} }) -
+ @@ -275,6 +277,11 @@ else {return false;} /* Get list of categories */ $res = hesk_dbQuery("SELECT * FROM `".hesk_dbEscape($hesk_settings['db_pfix'])."categories` ORDER BY `cat_order` ASC"); + $usersRes = hesk_dbQuery("SELECT * FROM `".hesk_dbEscape($hesk_settings['db_pfix'])."users` ORDER BY `name` ASC"); + $users = array(); + while ($userRow = hesk_dbFetchAssoc($usersRes)) { + array_push($users, $userRow); + } $i=1; $j=0; @@ -356,6 +363,7 @@ else {return false;}
+ '.output_user_dropdown($mycat['id'], $mycat['manager'], $users).' ' . $autoassign_code . ' @@ -702,4 +710,39 @@ function toggle_type() hesk_process_messages($tmp,'./manage_categories.php','SUCCESS'); } // End toggle_type() + +function output_user_dropdown($catId, $selectId, $userArray) { + global $hesklang; + + //TODO + $dropdownMarkup = ''; + + + return '
+ + + '.$dropdownMarkup.' +
'; +} + +function change_manager() { + global $hesklang, $hesk_settings; + + $catid = hesk_POST('catid'); + $newManagerId = hesk_POST('managerid'); + + hesk_dbQuery('UPDATE `'.hesk_dbEscape($hesk_settings['db_pfix']).'categories` SET `manager` = '.intval($newManagerId).' WHERE `id` = '.intval($catid)); + if (hesk_dbAffectedRows() != 1) + { + hesk_process_messages($hesklang['int_error'].': '.$hesklang['cat_not_found'],'./manage_categories.php'); + } + + hesk_process_messages($hesklang['manager_updated'],'./manage_categories.php','SUCCESS'); +} ?> diff --git a/language/en/text.php b/language/en/text.php index 10a2aee3..d901463f 100644 --- a/language/en/text.php +++ b/language/en/text.php @@ -66,6 +66,8 @@ $hesklang['your_current_location'] = 'Your location'; $hesklang['requesting_location_ellipsis'] = 'Requesting location...'; $hesklang['unable_to_determine_location'] = 'Unable to determine your location, or you declined to share it.'; $hesklang['save_to_see_updated_address'] = 'Save the new location to see the updated address'; +$hesklang['manager'] = 'Manager'; +$hesklang['manager_updated'] = 'Category manager has been updated.'; // ADDED OR MODIFIED IN Mods for HESK 2.2.1 $hesklang['popart_no_colon']='Top Knowledgebase Articles'; // same as $hesklang['popart'] but without a colon (:)