From 44dae880b5ee574a19966d8c0e9a7a1694380148 Mon Sep 17 00:00:00 2001
From: Jared Hancock <jared@osticket.com>
Date: Wed, 6 May 2015 17:10:22 -0500
Subject: [PATCH] settings: Collapse alerts and autoresponder to ticket
 settings

---
 include/class.config.php                |  9 +++------
 include/class.nav.php                   |  2 --
 include/staff/settings-alerts.inc.php   | 10 ----------
 include/staff/settings-autoresp.inc.php |  9 ---------
 include/staff/settings-tickets.inc.php  | 21 +++++++++++++++++++++
 5 files changed, 24 insertions(+), 27 deletions(-)

diff --git a/include/class.config.php b/include/class.config.php
index a85fc6962..cb1f15d5c 100644
--- a/include/class.config.php
+++ b/include/class.config.php
@@ -999,12 +999,6 @@ class OsticketConfig extends Config {
             case 'access':
                 return $this->updateAccessSettings($vars, $errors);
                 break;
-            case 'autoresp':
-                return $this->updateAutoresponderSettings($vars, $errors);
-                break;
-            case 'alerts':
-                return $this->updateAlertsSettings($vars, $errors);
-                break;
             case 'kb':
                 return $this->updateKBSettings($vars, $errors);
                 break;
@@ -1114,6 +1108,9 @@ class OsticketConfig extends Config {
         if (!preg_match('`(?!<\\\)#`', $vars['ticket_number_format']))
             $errors['ticket_number_format'] = 'Ticket number format requires at least one hash character (#)';
 
+        $this->updateAutoresponderSettings($vars, $errors);
+        $this->updateAlertsSettings($vars, $errors);
+
         if(!Validator::process($f, $vars, $errors) || $errors)
             return false;
 
diff --git a/include/class.nav.php b/include/class.nav.php
index 7d3c119b7..e6df1e897 100644
--- a/include/class.nav.php
+++ b/include/class.nav.php
@@ -249,8 +249,6 @@ class AdminNav extends StaffNav{
                     $subnav[]=array('desc'=>__('Tasks'),'href'=>'settings.php?t=tasks','iconclass'=>'lists');
                     $subnav[]=array('desc'=>__('Access'),'href'=>'settings.php?t=access','iconclass'=>'users');
                     $subnav[]=array('desc'=>__('Knowledgebase'),'href'=>'settings.php?t=kb','iconclass'=>'kb-settings');
-                    $subnav[]=array('desc'=>__('Autoresponder'),'href'=>'settings.php?t=autoresp','iconclass'=>'email-autoresponders');
-                    $subnav[]=array('desc'=>__('Alerts and Notices'),'href'=>'settings.php?t=alerts','iconclass'=>'alert-settings');
                     break;
                 case 'manage':
                     $subnav[]=array('desc'=>__('Help Topics'),'href'=>'helptopics.php','iconclass'=>'helpTopics');
diff --git a/include/staff/settings-alerts.inc.php b/include/staff/settings-alerts.inc.php
index 3a9326bc4..03168d557 100644
--- a/include/staff/settings-alerts.inc.php
+++ b/include/staff/settings-alerts.inc.php
@@ -1,8 +1,3 @@
-<h2><?php echo __('Alerts and Notices'); ?>
-    <i class="help-tip icon-question-sign" href="#page_title"></i></h2>
-<form action="settings.php?t=alerts" method="post" id="save">
-<?php csrf_token(); ?>
-<input type="hidden" name="t" value="alerts" >
 <table class="form_table settings_table" width="940" border="0" cellspacing="0" cellpadding="2">
     <thead>
         <tr>
@@ -233,8 +228,3 @@
         </tr>
     </tbody>
 </table>
-<p style="text-align:center;">
-    <input class="button" type="submit" name="submit" value="<?php echo __('Save Changes'); ?>">
-    <input class="button" type="reset" name="reset" value="<?php echo __('Reset Changes'); ?>">
-</p>
-</form>
diff --git a/include/staff/settings-autoresp.inc.php b/include/staff/settings-autoresp.inc.php
index 0a59f4b9d..42a52de40 100644
--- a/include/staff/settings-autoresp.inc.php
+++ b/include/staff/settings-autoresp.inc.php
@@ -1,7 +1,3 @@
-<h2><?php echo __('Autoresponder Settings'); ?></h2>
-<form action="settings.php?t=autoresp" method="post" id="save">
-<?php csrf_token(); ?>
-<input type="hidden" name="t" value="autoresp" >
 <table class="form_table settings_table" width="940" border="0" cellspacing="0" cellpadding="2">
     <thead>
         <tr>
@@ -60,8 +56,3 @@ echo $config['overlimit_notice_active'] ? 'checked="checked"' : ''; ?>/>
         </tr>
     </tbody>
 </table>
-<p style="padding-left:200px;">
-    <input class="button" type="submit" name="submit" value="<?php echo __('Save Changes'); ?>">
-    <input class="button" type="reset" name="reset" value="<?php echo __('Reset Changes'); ?>">
-</p>
-</form>
diff --git a/include/staff/settings-tickets.inc.php b/include/staff/settings-tickets.inc.php
index 8e1c23723..c2cf0f200 100644
--- a/include/staff/settings-tickets.inc.php
+++ b/include/staff/settings-tickets.inc.php
@@ -7,6 +7,17 @@ if(!($maxfileuploads=ini_get('max_file_uploads')))
 <form action="settings.php?t=tickets" method="post" id="save">
 <?php csrf_token(); ?>
 <input type="hidden" name="t" value="tickets" >
+
+<ul class="clean tabs">
+    <li class="active"><a href="#settings"><i class="icon-asterisk"></i>
+        <?php echo __('Settings'); ?></a></li>
+    <li><a href="#autoresp"><i class="icon-mail-reply-all"></i>
+        <?php echo __('Autoresponder'); ?></a></li>
+    <li><a href="#alerts"><i class="icon-bell-alt"></i>
+        <?php echo __('Alerts and Notices'); ?></a></li>
+</ul>
+
+<div class="tab_content" id="settings">
 <table class="form_table settings_table" width="940" border="0" cellspacing="0" cellpadding="2">
     <thead>
         <tr>
@@ -279,6 +290,16 @@ if(!($maxfileuploads=ini_get('max_file_uploads')))
         <?php } ?>
     </tbody>
 </table>
+</div>
+<div class="hidden tab_content" id="autoresp"
+    data-tip-namespace="settings.autoresponder">
+    <?php include STAFFINC_DIR . 'settings-autoresp.inc.php'; ?>
+</div>
+<div class="hidden tab_content" id="alerts"
+    data-tip-namespace="settings.alerts">
+    <?php include STAFFINC_DIR . 'settings-alerts.inc.php'; ?>
+</div>
+
 <p style="padding-left:250px;">
     <input class="button" type="submit" name="submit" value="<?php echo __('Save Changes');?>">
     <input class="button" type="reset" name="reset" value="<?php echo __('Reset Changes');?>">
-- 
GitLab