fmsystem-commits
[Top][All Lists]
Advanced

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

[Fmsystem-commits] [6664] merge 6660:6663 from trunk


From: Sigurd Nes
Subject: [Fmsystem-commits] [6664] merge 6660:6663 from trunk
Date: Thu, 09 Dec 2010 10:53:31 +0000

Revision: 6664
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=6664
Author:   sigurdne
Date:     2010-12-09 10:53:30 +0000 (Thu, 09 Dec 2010)
Log Message:
-----------
merge 6660:6663 from trunk

Modified Paths:
--------------
    branches/Version-1_0-branch/admin/inc/class.uiasyncservice.inc.php
    branches/Version-1_0-branch/frontend/inc/class.uihelpdesk.inc.php
    branches/Version-1_0-branch/frontend/templates/base/helpdesk.xsl
    branches/Version-1_0-branch/phpgwapi/inc/class.asyncservice.inc.php
    branches/Version-1_0-branch/phpgwapi/inc/class.sessions.inc.php

Property Changed:
----------------
    branches/Version-1_0-branch/


Property changes on: branches/Version-1_0-branch
___________________________________________________________________
Modified: svn:mergeinfo
   - 
/trunk:6439-6441,6443,6445-6447,6449-6464,6466-6468,6470-6474,6476-6477,6479-6480,6483-6488,6490-6491,6493-6494,6496-6501,6503-6504,6506,6508,6510-6511,6513,6515-6516,6518,6520-6524,6526-6528,6533-6534,6536-6541,6543-6565,6567,6569,6571-6576,6578,6580-6586,6588-6596,6598-6600,6602-6604,6606-6607,6609-6611,6613-6625,6629-6639,6641-6643,6645-6646,6648,6650-6654,6656-6659
   + 
/trunk:6439-6441,6443,6445-6447,6449-6464,6466-6468,6470-6474,6476-6477,6479-6480,6483-6488,6490-6491,6493-6494,6496-6501,6503-6504,6506,6508,6510-6511,6513,6515-6516,6518,6520-6524,6526-6528,6533-6534,6536-6541,6543-6565,6567,6569,6571-6576,6578,6580-6586,6588-6596,6598-6600,6602-6604,6606-6607,6609-6611,6613-6625,6629-6639,6641-6643,6645-6646,6648,6650-6654,6656-6659,6661-6663

Modified: branches/Version-1_0-branch/admin/inc/class.uiasyncservice.inc.php
===================================================================
--- branches/Version-1_0-branch/admin/inc/class.uiasyncservice.inc.php  
2010-12-09 10:45:28 UTC (rev 6663)
+++ branches/Version-1_0-branch/admin/inc/class.uiasyncservice.inc.php  
2010-12-09 10:53:30 UTC (rev 6664)
@@ -47,6 +47,8 @@
                        $GLOBALS['phpgw_info']['flags']['app_header'] = 
lang('Admin').' - '.lang('Asynchronous timed services');
                        $GLOBALS['phpgw']->common->phpgw_header(true);
 
+                       $manual_run = phpgw::get_var('manual_run', 'bool', 
'POST');
+
                        $async = clone($GLOBALS['phpgw']->asyncservice);        
// use an own instance, as we might set debug=True
 
                        $async->debug = phpgw::get_var('debug', 'bool', 'POST');
@@ -70,8 +72,20 @@
                        $update         = phpgw::get_var('update', 'bool', 
'POST');
                        $asyncservice = phpgw::get_var('asyncservice', 
'string', 'POST');
 
-                       if ( $send || $test || $cancel || $install || $update 
|| $asyncservice )
+                       if ( $send || $test || $cancel || $install || $update 
|| $asyncservice || $manual_run)
                        {
+
+                               if($manual_run)
+                               {
+                                       $account_id = 
$GLOBALS['phpgw_info']['user']['account_id'];
+                                       $num = $async->check_run('crontab');
+                                       echo "<p><b>{$num} jobs 
found</b></p>\n";
+                                       //reset your environment
+                                       
$GLOBALS['phpgw']->session->set_account_id($account_id);
+                                       
$GLOBALS['phpgw']->session->read_repositories(False,False);
+                                       $GLOBALS['phpgw_info']['user']  = 
$GLOBALS['phpgw']->session->get_user();
+                               }
+
                                $times = array();
                                foreach ( array_keys($units) as $u )
                                {
@@ -93,7 +107,7 @@
                                        $validator = 
CreateObject('phpgwapi.EmailAddressValidator');
                                        
if(!$validator->check_email_address($email))
                                        {
-                                               echo '<p><b>'.lang("Not a not 
valid email address")."</b></p>\n";                                       
+                                               echo '<p><b>'.lang("Not a not 
valid email address")."</b></p>\n";       
                                        }
                                        else if 
(!$async->set_timer($times,'test','admin.uiasyncservice.test',array('to' => 
$email)))
                                        {
@@ -221,11 +235,11 @@
                                echo "<table 
border=1>\n<tr>\n<th>Id</th><th>".lang('Next 
run').'</th><th>'.lang('Times').'</th><th>'.lang('Method').'</th><th>'.lang('Data')."</th><th>".lang('LoginID')."</th></tr>\n";
                                foreach($jobs as $job)
                                {
-                                       echo 
"<tr>\n<td>$job[id]</td><td>".$GLOBALS['phpgw']->common->show_date($job['next'])."</td><td>";
+                                       echo 
"<tr>\n<td>{$job['id']}</td><td>".$GLOBALS['phpgw']->common->show_date($job['next'])."</td><td>";
                                        print_r($job['times']); 
-                                       echo "</td><td>$job[method]</td><td>"; 
+                                       echo 
"</td><td>{$job['method']}</td><td>"; 
                                        print_r($job['data']); 
-                                       echo "</td><td 
align=\"center\">".$GLOBALS['phpgw']->accounts->id2name($job[account_id])."</td></tr>\n";
 
+                                       echo "</td><td 
align=\"center\">".$GLOBALS['phpgw']->accounts->id2name($job['account_id'])."</td></tr>\n";
 
                                }
                                echo "</table>\n";
                        }
@@ -233,11 +247,12 @@
                        {
                                echo lang('No jobs in the database 
!!!')."</p>\n";
                        }
-                       echo '<p><input type="submit" name="update" 
value="'.lang('Update').'"></p>'."\n";
+                       echo '<p><input type="submit" name="update" 
value="'.lang('Update').'">'."\n";
+                       echo '<input type="submit" name="manual_run" 
value="'.lang('manual run').'"></p>'."\n";
                        echo "</form>\n";
-                       
+
                }
-               
+
                public function test($data)
                {
                        $to = $data['to'];

Modified: branches/Version-1_0-branch/frontend/inc/class.uihelpdesk.inc.php
===================================================================
--- branches/Version-1_0-branch/frontend/inc/class.uihelpdesk.inc.php   
2010-12-09 10:45:28 UTC (rev 6663)
+++ branches/Version-1_0-branch/frontend/inc/class.uihelpdesk.inc.php   
2010-12-09 10:53:30 UTC (rev 6664)
@@ -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: branches/Version-1_0-branch/frontend/templates/base/helpdesk.xsl
===================================================================
--- branches/Version-1_0-branch/frontend/templates/base/helpdesk.xsl    
2010-12-09 10:45:28 UTC (rev 6663)
+++ branches/Version-1_0-branch/frontend/templates/base/helpdesk.xsl    
2010-12-09 10:53:30 UTC (rev 6664)
@@ -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>
 
+

Modified: branches/Version-1_0-branch/phpgwapi/inc/class.asyncservice.inc.php
===================================================================
--- branches/Version-1_0-branch/phpgwapi/inc/class.asyncservice.inc.php 
2010-12-09 10:45:28 UTC (rev 6663)
+++ branches/Version-1_0-branch/phpgwapi/inc/class.asyncservice.inc.php 
2010-12-09 10:53:30 UTC (rev 6664)
@@ -403,10 +403,9 @@
                                                if ($job['account_id'])
                                                {
                                                        
$GLOBALS['phpgw']->session->set_account_id($job['account_id']);
-                                                       
$GLOBALS['phpgw']->session->account_lid = 
$GLOBALS['phpgw']->accounts->id2lid($job['account_id']);
-                                                       
$GLOBALS['phpgw']->session->account_domain = $domain;
+                               //                      
$GLOBALS['phpgw']->session->account_domain = $domain;
                                                        
$GLOBALS['phpgw']->session->read_repositories(False,False);
-                                                       
$GLOBALS['phpgw_info']['user']  = $GLOBALS['phpgw']->session->user;
+                                                       
$GLOBALS['phpgw_info']['user']  = $GLOBALS['phpgw']->session->get_user();
 
                                                        if ($lang != 
$GLOBALS['phpgw_info']['user']['preferences']['common']['lang'])
                                                        {

Modified: branches/Version-1_0-branch/phpgwapi/inc/class.sessions.inc.php
===================================================================
--- branches/Version-1_0-branch/phpgwapi/inc/class.sessions.inc.php     
2010-12-09 10:45:28 UTC (rev 6663)
+++ branches/Version-1_0-branch/phpgwapi/inc/class.sessions.inc.php     
2010-12-09 10:53:30 UTC (rev 6664)
@@ -832,6 +832,7 @@
                public function set_account_id($account_id = 0)
                {
                        $this->_account_id = get_account_id($account_id);
+                       $this->_account_lid = 
$GLOBALS['phpgw']->accounts->id2lid($this->_account_id);
                }
 
                /**
@@ -1312,6 +1313,16 @@
                }
 
                /**
+               * Get userinfo to pass into $GLOBALS['phpgw_info']['user'] for 
asyncservice
+               *
+               * @return array user
+               */
+               public function get_user()
+               {
+                       return $this->_data;
+               }
+
+               /**
                 * Get a list of currently logged in sessions
                 *
                 * @return array list of sessions




reply via email to

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