fmsystem-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Fmsystem-commits] [6663] Frontend: categories in frontend tickets


From: Sigurd Nes
Subject: [Fmsystem-commits] [6663] Frontend: categories in frontend tickets
Date: Thu, 09 Dec 2010 10:45:29 +0000

Revision: 6663
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=6663
Author:   sigurdne
Date:     2010-12-09 10:45:28 +0000 (Thu, 09 Dec 2010)
Log Message:
-----------
Frontend: categories in frontend tickets

Modified Paths:
--------------
    trunk/frontend/inc/class.uihelpdesk.inc.php
    trunk/frontend/templates/base/helpdesk.xsl

Modified: trunk/frontend/inc/class.uihelpdesk.inc.php
===================================================================
--- trunk/frontend/inc/class.uihelpdesk.inc.php 2010-12-09 10:11:48 UTC (rev 
6662)
+++ trunk/frontend/inc/class.uihelpdesk.inc.php 2010-12-09 10:45:28 UTC (rev 
6663)
@@ -524,6 +524,17 @@
                        $missingfields  = false;
                        $msglog         = array();
 
+                       // Read default assign-to-group from config
+                       $config = CreateObject('phpgwapi.config', 'frontend');
+                       $config->read();
+                       $default_cat = $config->config_data['tts_default_cat'] 
? $config->config_data['tts_default_cat'] : 0;
+                                       
+                       if(!$default_cat)
+                       {
+                               throw new Exception('Default category is not 
set in config');
+                               $GLOBALS['phpgw']->common->phpgw_exit();
+                       }
+
                        if(isset($values['save']))
                        {
                                foreach($values as $key => $value)
@@ -536,17 +547,6 @@
 
                                if(!$missingfields && !phpgw::get_var('added'))
                                {
-                                       // Read default assign-to-group from 
config
-                                       $config = 
CreateObject('phpgwapi.config', 'frontend');
-                                       $config->read();
-                                       $default_cat = 
$config->config_data['tts_default_cat'] ? 
$config->config_data['tts_default_cat'] : 0;
-                                       
-                                       if(!$default_cat)
-                                       {
-                                               throw new Exception('Default 
category is not set in config');
-                                               
$GLOBALS['phpgw']->common->phpgw_exit();
-                                       }
-
                                        $location  = array
                                        (
                                                'loc1'  => 
$location_details['loc1'],
@@ -567,7 +567,7 @@
                                        $ticket = array(
                                                'origin'    => null,
                                                'origin_id' => null,
-                                               'cat_id'    => $default_cat,
+                                               'cat_id'    => 
$values['cat_id'],
                                                'group_id'  => ($default_group 
? $default_group : null),
                                                'assignedto'=> $assignedto,
                                                'priority'  => 3,
@@ -631,14 +631,36 @@
                                }
                        }
 
+
+                       $tts_frontend_cat_selected = 
$config->config_data['tts_frontend_cat'] ? 
$config->config_data['tts_frontend_cat'] : array();
+
+                       $cats   = CreateObject('phpgwapi.categories', -1, 
'property', '.ticket');
+                       $cats->supress_info = true;
+                       $categories = $cats->return_sorted_array(0, false, '', 
'', '', true, '', false);
+
+                       $category_list = array();
+                       foreach ( $categories as $category)
+                       {
+                               if ( in_array($category['id'], 
$tts_frontend_cat_selected))
+                               {
+                                       $category_list[] = array
+                                       (
+                                               'id'            => 
$category['id'],
+                                               'name'          => 
$category['name'],
+                                               'selected'      => 
$category['id'] == $default_cat ? 1 : 0
+                                       ); 
+                               }
+                       }
+
                        $data = array(
-                               'redirect'              => isset($redirect) ? 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'frontend.uihelpdesk.index')) : null,
-                               'msgbox_data'   => 
$GLOBALS['phpgw']->common->msgbox($GLOBALS['phpgw']->common->msgbox_data($msglog)),
-                               'form_action'   => 
$GLOBALS['phpgw']->link('/index.php',array('menuaction' => 
'frontend.uihelpdesk.add_ticket', 'noframework' => '1')),
-                               'title'         => $values['title'],
-                               'locationdesc'  => $values['locationdesc'],
-                               'description'   => $values['description'],
-                               'noform'        => $noform
+                               'redirect'                      => 
isset($redirect) ? $GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'frontend.uihelpdesk.index')) : null,
+                               'msgbox_data'           => 
$GLOBALS['phpgw']->common->msgbox($GLOBALS['phpgw']->common->msgbox_data($msglog)),
+                               'form_action'           => 
$GLOBALS['phpgw']->link('/index.php',array('menuaction' => 
'frontend.uihelpdesk.add_ticket', 'noframework' => '1')),
+                               'title'                 => $values['title'],
+                               'locationdesc'          => 
$values['locationdesc'],
+                               'description'           => 
$values['description'],
+                               'noform'                => $noform,
+                               'category_list'         => $category_list
                        );
 
                        
$GLOBALS['phpgw']->xslttpl->add_file(array('frontend','helpdesk'));

Modified: trunk/frontend/templates/base/helpdesk.xsl
===================================================================
--- trunk/frontend/templates/base/helpdesk.xsl  2010-12-09 10:11:48 UTC (rev 
6662)
+++ trunk/frontend/templates/base/helpdesk.xsl  2010-12-09 10:45:28 UTC (rev 
6663)
@@ -67,6 +67,19 @@
             <xsl:if test="noform != 1">
                 <tr>
                     <td class="th_text" valign="top">
+                        <xsl:value-of select="php:function('lang', 
'category')" />
+                    </td>
+                    <td class="th_text" valign="top">
+                                               <select name="values[cat_id]" >
+                                                       <xsl:attribute 
name="title">
+                                                               <xsl:value-of 
select="php:function('lang', 'category')" />
+                                                       </xsl:attribute>
+                                                       <xsl:apply-templates 
select="category_list"/>
+                                               </select>                       
+                    </td>
+                </tr>
+                <tr>
+                    <td class="th_text" valign="top">
                         <xsl:value-of select="php:function('lang', 'subject')" 
/>
                     </td>
                     <td class="th_text" valign="top">
@@ -118,4 +131,13 @@
     </form>
 </xsl:template>
 
+<xsl:template match="category_list">
+       <option value="{id}">
+               <xsl:if test="selected != 0">
+                       <xsl:attribute name="selected" value="selected" />
+               </xsl:if>
+               <xsl:value-of disable-output-escaping="yes" select="name"/>
+       </option>
+</xsl:template>
 
+




reply via email to

[Prev in Thread] Current Thread [Next in Thread]