[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Phpgroupware-cvs] tts inc/class.botts.inc.php inc/class.uitts.inc...
From: |
Dave Hall |
Subject: |
[Phpgroupware-cvs] tts inc/class.botts.inc.php inc/class.uitts.inc... |
Date: |
Tue, 28 Nov 2006 10:09:32 +0000 |
CVSROOT: /cvsroot/phpgroupware
Module name: tts
Changes by: Dave Hall <skwashd> 06/11/28 10:09:32
Modified files:
inc : class.botts.inc.php class.uitts.inc.php
hook_settings.inc.php
templates/base/css: base.css
Log message:
fixes and minor improvements
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/tts/inc/class.botts.inc.php?cvsroot=phpgroupware&r1=1.1&r2=1.2
http://cvs.savannah.gnu.org/viewcvs/tts/inc/class.uitts.inc.php?cvsroot=phpgroupware&r1=1.1&r2=1.2
http://cvs.savannah.gnu.org/viewcvs/tts/inc/hook_settings.inc.php?cvsroot=phpgroupware&r1=1.2&r2=1.3
http://cvs.savannah.gnu.org/viewcvs/tts/templates/base/css/base.css?cvsroot=phpgroupware&r1=1.1&r2=1.2
Patches:
Index: inc/class.botts.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/tts/inc/class.botts.inc.php,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2
--- inc/class.botts.inc.php 14 Oct 2006 05:39:41 -0000 1.1
+++ inc/class.botts.inc.php 28 Nov 2006 10:09:32 -0000 1.2
@@ -5,7 +5,7 @@
* @copyright Copyright (C) 2000-2005 Free Software Foundation, Inc.
http://www.fsf.org/
* @license http://www.gnu.org/licenses/gpl.html GNU General Public
License
* @package tts
- * @version $Id: class.botts.inc.php,v 1.1 2006/10/14 05:39:41 skwashd
Exp $
+ * @version $Id: class.botts.inc.php,v 1.2 2006/11/28 10:09:32 skwashd
Exp $
*/
@@ -27,6 +27,9 @@
'list_methods' => true
);
+ /**
+ * @constructor
+ */
function botts()
{
$this->db =& $GLOBALS['phpgw']->db;
@@ -191,8 +194,8 @@
$ticket['type'] = $this->cats->id2name($ttype);
- $ticket['deadline'] = $this->db->f('ticket_deadline');
- if ($this->db->f('ticket_deadline') == '0000-00-00')
+ $ticket['deadline'] = $ticket['ticket_deadline'];
+ if ( !$ticket['ticket_deadline'] )
{
$ticket['deadline'] = '';
}
@@ -216,6 +219,12 @@
return $ticket;
}
+ /**
+ * List tickets
+ *
+ * @param array $param the search criteria
+ * @return array the tickets found - empty array for none found
+ */
function list_tickets($params)
{
$order = isset($param['order']) ?
$this->db->db_addslashes($params['order']) : '';
@@ -263,7 +272,7 @@
if ( isset($params['filter_due_before']) &&
$params['filter_due_before'] > 0 )
{
- $filter[] = 'ticket_deadline <= ' .
(int)$params['filter_due_before'];
+ $filter[] = 'ticket_deadline <= ' .
(int)$params['filter_due_before'] . ' AND ticket_deadline > 0';
}
$cats = $this->get_user_cat_list(PHPGW_ACL_READ);
@@ -305,6 +314,12 @@
return $tickets;
}
+ /**
+ * Does a ticket ID already exist?
+ *
+ * @param int $id the ticket ID
+ * @return bool does the ticket ID exist?
+ */
function exists($id)
{
$myid = (int)$id;
@@ -336,18 +351,24 @@
return $ret_cats;
}
- function getIDList($lastmod = -1) {
- $sel = "SELECT ticket_id FROM phpgw_tts_tickets";
- $mylastmod = (int) $lastmod;
- if ($mylastmod >= 0) {
- $sel .= " WHERE ticket_lastmod>='" . $mylastmod
. "'";
+ function getIDList($lastmod = -1)
+ {
+ $mylastmod = (int)$lastmod;
+ $sel = 'SELECT ticket_id FROM phpgw_tts_tickets';
+ if ($mylastmod >= 0)
+ {
+ $sel .= " WHERE ticket_lastmod >= $mylastmod";
}
$this->db->query($sel, __LINE__, __FILE__);
$ret = array();
- while ($this->db->next_record()) {
+
+ while ($this->db->next_record())
+ {
$ret[] = $this->db->f("ticket_id");
}
+
error_log("bo_tts:getIDList: ".print_r($ret, true));
+
return $ret;
}
@@ -553,12 +574,12 @@
'priority' =>
$this->db->f('ticket_priority'),
'owner' => $owner,
'assignedto' => $assignedto,
- 'subject' =>
$this->db->f('ticket_subject'),
+ 'subject' =>
$this->db->f('ticket_subject', true),
'category' =>
$cat->id2name($this->db->f('ticket_category')),
'billable_hours' =>
$this->db->f('ticket_billable_hours'),
'billable_rate' =>
$this->db->f('ticket_billable_rate'),
'status' =>
$this->db->f('ticket_status'),
- 'details' =>
$this->db->f('ticket_details'),
+ 'details' =>
$this->db->f('ticket_details', true),
'odate' =>
$GLOBALS['phpgw']->common->show_date($history_values[0]['datetime'],$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat']),
'odate_epoch' =>
(int)$history_values[0]['datetime'],
'view' => $this->db->f('ticket_view'),
Index: inc/class.uitts.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/tts/inc/class.uitts.inc.php,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2
--- inc/class.uitts.inc.php 14 Oct 2006 05:39:41 -0000 1.1
+++ inc/class.uitts.inc.php 28 Nov 2006 10:09:32 -0000 1.2
@@ -5,7 +5,7 @@
* @copyright Copyright (C) 2000-2006 Free Software Foundation, Inc.
http://www.fsf.org/
* @license http://www.gnu.org/licenses/gpl.html GNU General Public
License
* @package tts
- * @version $Id: class.uitts.inc.php,v 1.1 2006/10/14 05:39:41 skwashd
Exp $
+ * @version $Id: class.uitts.inc.php,v 1.2 2006/11/28 10:09:32 skwashd
Exp $
*/
class uitts
@@ -59,8 +59,10 @@
if ( $_SERVER['REQUEST_METHOD'] == 'GET' )
{
//FIXME switch to XSLT here
- $this->t->set_file('type_select',
'type_select.tpl');
- $this->t->set_block('type_select',
'type_options', 'options');
+ $GLOBALS['phpgw_info']['flags']['xslt_app'] =
true;
+
$GLOBALS['phpgw']->xslttpl->add_file('select_ticket');
+
+ $elements = array('lang' => array(),
'ticket_type' => array() );
$cats = createObject('phpgwapi.categories',
$GLOBALS['phpgw_info']['user']['account_id'], 'tts');
$cat_list = $cats->return_array('all', 0,
false, '', 'ASC', 'cat_name', false);
@@ -68,21 +70,24 @@
{
if ( $GLOBALS['phpgw']->acl->check('C'
. $cat['id'], PHPGW_ACL_ADD, 'tts') )
{
- $this->t->set_var($cat);
- $this->t->parse('options',
'type_options', true);
+ $elements['ticket_type'][] =
array
+ (
+ 'id' => $cat['id'],
+ 'value' => $cat['name']
+ );
}
}
- $GLOBALS['phpgw']->common->phpgw_header(true);
- $this->t->set_var(array
+ $elements['lang'] = array
(
- 'lang_cancel' =>
lang('cancel'),
- 'lang_next' =>
htmlspecialchars(lang('next >')),
- 'lang_ticket_type' => lang('ticket
type'),
- 'url_form_action' =>
$GLOBALS['phpgw']->link('/index.php', array('menuaction' =>
'tts.uitts.add_ticket', 'id' => 0))
- ));
+ 'cancel' =>
lang('cancel'),
+ 'next' => lang('next
>'),
+ 'ticket_type' => lang('ticket_type')
+ );
+
+ $elements['url_form_action'] =
$GLOBALS['phpgw']->link('/index.php', array('menuaction' =>
'tts.uitts.add_ticket', 'id' => 0));
- $this->t->pfp('out','type_select');
+
$GLOBALS['phpgw']->xslttpl->set_var('select_ticket', $elements);
$GLOBALS['phpgw']->common->phpgw_exit(true);
}
@@ -277,6 +282,10 @@
{
$values['edit'] = true;
}
+ $js->add_event('load', "oTabs = new Tabs(" .
($values['edit'] ? 4 : 3) .", 'activetab', 'inactivetab', 'tab',
'tabcontent');\n\toTabs.display(1);");
+
+
$GLOBALS['phpgw']->xslttpl->add_file('viewticket_details');
+ $ui = createObject('phpgwapi.ui_tools');
$fields =
$this->bo->get_fields($values['ticket']['ticket_type']);
foreach ( $fields as $key => $field )
@@ -286,6 +295,7 @@
case 'hidden':
$fields[$key]['value']
= $values['ticket'][$field['id']];
continue; //ignore it
+
case 'select':
$values['view'][] =
array
(
@@ -294,6 +304,16 @@
);
$fields[$key]['selected'] = $values['ticket'][$field['id']];
break;
+
+ case 'date':
+ $values['view'][] =
array
+ (
+ 'label' =>
$field['label'],
+ 'value' =>
date($GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'],
$values['ticket'][$field['id']])
+ );
+ $fields[$key] =
$ui->date($field['id'], $field['label'], $values['ticket'][$field['id']]);
+ break;
+
default:
$values['view'][] =
array
(
@@ -310,10 +330,6 @@
}
unset($fields);
-
$GLOBALS['phpgw']->xslttpl->add_file('viewticket_details');
- $ui = createObject('phpgwapi.ui_tools');
-
-
$values['form_action'] =
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 'tts.uitts.view'));
$values['lang'] = array
(
@@ -337,676 +353,6 @@
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',
array('view_ticket' => $values));
$GLOBALS['phpgw']->common->phpgw_exit(true);
-
-
$this->t->set_file('viewticket','viewticket_details.tpl');
-
$this->t->set_block('viewticket','options_select');
-
$this->t->set_block('viewticket','additional_notes_row');
-
$this->t->set_block('viewticket','additional_notes_row_empty');
- $this->t->set_block('viewticket','row_history');
-
$this->t->set_block('viewticket','row_history_empty');
- $this->t->set_block('viewticket','form');
-
- $messages =
$GLOBALS['phpgw']->session->appsession('messages','tts');
- if ( strlen($messages) )
- {
- $this->t->set_var('messages',$messages);
-
$GLOBALS['phpgw']->session->appsession('messages','tts','');
- }
-
- if ( $ticket['ticket_status'] == 'C')
- {
- $this->t->set_var('t_status','FIX ME!
time closed ' . __LINE__);
- }
- else
- {
- $this->t->set_var('t_status', lang('In
progress'));
- }
-
- // Choose the correct priority to display
- $priority_selected[$ticket['ticket_priority']]
= '';
- $priority_comment = array
- (
- '',
- ' - ' . lang('Lowest'),
- '',
- '',
- '',
- ' - '.lang('Medium'),
- '',
- '',
- '',
- '',
- ' - '.lang('Highest')
- );
-
- for ( $i = 1; $i <= 10; ++$i )
- {
- $this->t->set_var('optionname',
"{$i}{$priority_comment[$i]}");
- $this->t->set_var('optionvalue', $i);
- $this->t->set_var('optionselected',
isset($priority_selected[$i]) ? ' selected' : '');
-
$this->t->parse('options_priority','options_select',true);
- }
-
- // assigned to
- $accounts = CreateObject('phpgwapi.accounts');
- $account_list = $accounts->get_list('accounts');
- $this->t->set_var('optionname',lang('None'));
- $this->t->set_var('optionvalue','0');
- $this->t->set_var('optionselected','');
-
$this->t->parse('options_assignedto','options_select',true);
-
- while(list($key,$entry) = each($account_list))
- {
- $lid = $fname = $lname = '';
-
$GLOBALS['phpgw']->accounts->get_account_name($entry['account_id'], $lid,
$fname, $lname);
-
- if(!$fname && !$lname)
- {
- continue;
- }
-
- $employees_list[$entry['account_id']] =
$GLOBALS['phpgw']->common->display_fullname($lid,$fname,$lname);
-
- if(count($employees_list))
- {
- asort($employees_list);
- reset($employees_list);
- }
- }
-
- while (list($account_id,$account_name) =
each($employees_list))
- {
- $selected = '';
- if ($account_id ==
$ticket['ticket_assignedto'])
- {
- $selected = 'selected';
- }
- $this->t->set_var('optionname',
$account_name);
- $this->t->set_var('optionvalue',
$account_id);
- $this->t->set_var('optionselected',
$selected);
-
$this->t->parse('options_assignedto','options_select',True);
- }
-
-
- // Figure out when it was opened and last closed
- $history_array =
$this->bo->historylog->return_array(array(),array('X','O'),'','',$_REQUEST['ticket_id']);
-
- while(is_array($history_array) && list(,$value)
= each($history_array))
- {
- if($value['status'] == 'O')
- {
- $ticket['opened'] =
$GLOBALS['phpgw']->common->show_date($value['datetime'] - ((60*60) *
$GLOBALS['phpgw_info']['user']['preferences']['common']['tz_offset']));
- }
-
- if($value['status'] == 'X')
- {
- $ticket['closed'] =
$GLOBALS['phpgw']->common->show_date($value['datetime'] - ((60*60) *
$GLOBALS['phpgw_info']['user']['preferences']['common']['tz_offset']));
- }
- }
-
- // group
-
- $group_list = array();
- $group_list =
$GLOBALS['phpgw']->accounts->membership($GLOBALS['phpgw_info']['user']['account_id']);
-
- while(list($key,$entry) = each($group_list))
- {
- $tag = '';
- if($entry['account_id'] ==
$ticket['ticket_group'])
- {
- $tag = 'selected';
- }
- $this->t->set_var('optionname',
$entry['account_name']);
- $this->t->set_var('optionvalue',
$entry['account_id']);
- $this->t->set_var('optionselected',
$tag);
-
$this->t->parse('options_group','options_select',true);
- }
-
- $this->t->set_var('options_category',
$this->bo->cats->formated_list('select','',$ticket['category'],False));
-
- $ticket_status[$ticket['status']] = ' selected';
- $s = '<option value="O"' . $ticket_status['O']
. '>' . lang('Open') . '</option>';
- $s .= '<option value="X"' . $ticket_status['X']
. '>' . lang('Closed') . '</option>';
-
- $this->t->set_var('options_status',$s);
- $this->t->set_var('lang_status',lang('Status'));
-
-
/**************************************************************\
- * Display additional notes
*
-
\**************************************************************/
- $history_array =
$this->bo->historylog->return_array(array(),array('C'),'','',$ticket_id);
- while(is_array($history_array) && list(,$value)
= each($history_array))
- {
-
$this->t->set_var('lang_date',lang('Date'));
-
$this->t->set_var('lang_user',lang('User'));
-
-
$this->t->set_var('value_date',$GLOBALS['phpgw']->common->show_date($value['datetime']
- ((60*60) *
$GLOBALS['phpgw_info']['user']['preferences']['common']['tz_offset'])));
-
$this->t->set_var('value_user',$value['owner']);
-
-
$this->t->set_var('value_note',nl2br(htmlspecialchars($value['new_value'])));
-
$this->t->fp('rows_notes','additional_notes_row',True);
- }
-
- if(!count($history_array))
- {
-
$this->t->set_var('lang_no_additional_notes',lang('No additional notes'));
-
$this->t->fp('rows_notes','additional_notes_row_empty',True);
- }
-
-
/**************************************************************\
- * Display record history
*
-
\**************************************************************/
- $this->t->set_var('lang_user',lang('User'));
- $this->t->set_var('lang_date',lang('Date'));
- $this->t->set_var('lang_action',lang('Action'));
- $this->t->set_var('lang_new_value',lang('New
Value'));
- $this->t->set_var('lang_old_value',lang('Old
Value'));
-
- $history_array =
$this->historylog->return_array(array('C'),array(),'','',$ticket_id);
- while(is_array($history_array) && list(,$value)
= each($history_array))
- {
-
$GLOBALS['phpgw']->nextmatchs->template_alternate_row_color($GLOBALS['phpgw']->template);
-
-
$this->t->set_var('value_date',$GLOBALS['phpgw']->common->show_date($value['datetime']
- ((60*60) *
$GLOBALS['phpgw_info']['user']['preferences']['common']['tz_offset'])));
-
$this->t->set_var('value_user',$value['owner']);
- $this->t->set_var('value_action',
$this->historylog->types[$value['status']]);
-
- if($value['status'] == 'A')
- {
- if(!$value['new_value'])
- {
-
$this->t->set_var('value_new_value',lang('None'));
- }
- else
- {
-
$this->t->set_var('value_new_value',$GLOBALS['phpgw']->accounts->id2name($value['new_value']));
- }
-
- if(!$value['old_value'])
- {
-
$this->t->set_var('value_old_value',lang('None'));
- }
- else
- {
-
$this->t->set_var('value_old_value',$GLOBALS['phpgw']->accounts->id2name($value['old_value']));
- }
- }
- elseif($value['status'] == 'T')
- {
-
$this->t->set_var('value_new_value',$GLOBALS['phpgw']->categories->id2name($value['new_value']));
-
$this->t->set_var('value_old_value',$GLOBALS['phpgw']->categories->id2name($value['old_value']));
- }
- elseif($value['status'] == 'L')
- {
-
$this->t->set_var('value_new_value',$GLOBALS['phpgw']->categories->id2name($value['new_value']));
-
$this->t->set_var('value_old_value',$GLOBALS['phpgw']->categories->id2name($value['old_value']));
- }
- elseif($value['status'] == 'G')
- {
- $s =
$GLOBALS['phpgw']->accounts->id2name($value['new_value']);
- $s = ($s ? $s : '--');
-
$this->t->set_var('value_new_value',$s);
-
- $s =
$GLOBALS['phpgw']->accounts->id2name($value['old_value']);
- $s = ($s ? $s : '--');
-
$this->t->set_var('value_old_value',$s);
- }
- elseif($value['status'] != 'O' &&
$value['new_value'])
- {
-
$this->t->set_var('value_new_value',$value['new_value']);
-
$this->t->set_var('value_old_value',$value['old_value']);
- }
- else
- {
-
$this->t->set_var('value_new_value',' ');
-
$this->t->set_var('value_old_value',' ');
- }
-
-
$this->t->fp('rows_history','row_history',True);
- }
-
- if(!count($history_array))
- {
-
$this->t->set_var('lang_no_history',lang('No history for this record'));
-
$this->t->fp('rows_history','row_history_empty',True);
- }
-
- for($i=0; $i <= $x-1; $i++)
- {
- $file =
$GLOBALS['phpgw']->link('/index.php', array('menuaction' =>
'tts.attachedFiles.show_file',
-
'file' =>
$ticket['attachment'][$i]
-
));
- $attLink .= "<a href=\"" . $file . "\"
target=\"_NEW\">" . basename($ticket['attachment'][$i]) . " </a><br>";
- }
-
$this->t->set_var('lang_attachment',lang('Attachment'));
- $this->t->set_var('value_attachment',$attLink);
-
-
$this->t->set_var('lang_billable_hours_total',lang('Total billable'));
-
$this->t->set_var('value_billable_hours_total',sprintf('%01.2f',($ticket['billable_hours']
* $ticket['billable_rate'])));
-
-
$this->t->set_var('lang_assignedto',lang('Assigned to'));
- if($ticket['ticket_assignedto'])
- {
- $assignedto =
$GLOBALS['phpgw']->accounts->id2name($ticket['assignedto']);
- }
- else
- {
- $assignedto = lang('None');
- }
-
$this->t->set_var('value_assignedto',$assignedto);
-
- $s =
$GLOBALS['phpgw']->accounts->id2name($ticket['group']);
- $s = ($s ? $s : '--');
- $this->t->set_var('value_group',$s);
-
- $this->t->set_var(array
- (
- 'currency' =>
$GLOBALS['phpgw_info']['user']['preferences']['common']['currency'],
- 'lang_additional_notes' =>
lang('additional notes'),
- 'lang_assignedfrom' =>
lang('assigned from'),
- 'lang_billable_hours'=> lang('billable
hours'),
- 'lang_billable_hours_rate' =>
lang('billable rate'),
- 'lang_category' =>
lang('category'),
- 'lang_close' =>
lang('close'),
- 'lang_deadline' =>
lang('deadline'),
- 'lang_details' =>
lang('details'),
- 'lang_effort' =>
lang('effort'),
- 'lang_group' =>
lang('group'),
- 'lang_history' =>
lang('history'),
- 'lang_notes' =>
lang('notes'),
- 'lang_opendate' => lang('open
date'),
- 'lang_priority' =>
lang('priority'),
- 'lang_type' =>
lang('type'),
- 'lang_save' =>
lang('save'),
- 'lang_subject' =>
lang('subject'),
- 'lang_summary' =>
lang('summary'),
- 'lang_update' =>
lang('update'),
- 'ticket_id' =>
$ticket['ticket_id'],
- 'url_close' =>
$GLOBALS['phpgw']->link('/tts/index.php'),
- 'url_viewdetails' =>
$GLOBALS['phpgw']->link('/tts/viewticket_details.php'),
- 'value_category' =>
$this->bo->cats->id2name($ticket['category']),
- 'value_details' =>
nl2br(htmlspecialchars($ticket['details'])),
- 'value_billable_hours_rate' =>
$ticket['billable_rate'],
- 'value_billable_hours' =>
$ticket['billable_hours'],
- 'value_deadline' =>
$ticket['deadline'],
- 'value_effort' =>
$ticket['effort'],
- 'value_opendate' =>
$ticket['opened'],
- 'value_owner' =>
$GLOBALS['phpgw']->accounts->id2name($ticket['owner']),
- 'value_platform' =>
$ticket['platform'],
- 'value_priority' =>
$ticket['priority'],
- 'value_subject' =>
htmlspecialchars($ticket['subject']),
- 'value_type' =>
$ticket['type']
- ));
-
- $this->t->set_var('options_select','');
-
- $GLOBALS['phpgw_info']['flags']['app_header'] =
" #{$ticket['ticket_id']} {$ticket['subject']}";
-
- $GLOBALS['phpgw']->common->phpgw_header(true);
-
- $this->t->pfp('out','form');
- $GLOBALS['phpgw']->common->phpgw_footer();
- }
-
- function old_view()
- {
- if ( !isset($_REQUEST['ticket_id'])
- || (isset($_POST['cancel']) &&
$_POST['cancel']) )
- {
- $GLOBALS['phpgw']->redirect_link('/index.php',
array('menuaction' => 'tts.uitts.index'));
- }
-
- $config = createObject('phpgwapi.config');
- $config->read_repository();
- if ( !( isset($_POST['submit']) && $_POST['submit']) )
- {
- if ( !isset($GLOBALS['phpgw']->js) ||
!is_object($GLOBALS['phpgw']->js) )
- {
- $GLOBALS['phpgw']->js =
createObject('phpgwapi.javascript');
- }
- $js =& $GLOBALS['phpgw']->js;
- $js->validate_file('tabs', 'tabs');
- $js->validate_file('base', 'view', 'tts');
-
- $ticket =
$this->bo->get_ticket($_REQUEST['ticket_id']);
-
- $edit = false;
- if ( !$GLOBALS['phpgw']->acl->check('C' . (int)
$ticket['ticket_type'], PHPGW_ACL_EDIT, 'tts') )
- {
- $edit = true;
- }
-
- $fields =
$this->bo->get_fields($ticket['ticket_type']);
-
-
$this->t->set_file('viewticket','viewticket_details.tpl');
-
$this->t->set_block('viewticket','options_select');
-
$this->t->set_block('viewticket','additional_notes_row');
-
$this->t->set_block('viewticket','additional_notes_row_empty');
- $this->t->set_block('viewticket','row_history');
-
$this->t->set_block('viewticket','row_history_empty');
- $this->t->set_block('viewticket','form');
-
- $messages =
$GLOBALS['phpgw']->session->appsession('messages','tts');
- if ( strlen($messages) )
- {
- $this->t->set_var('messages',$messages);
-
$GLOBALS['phpgw']->session->appsession('messages','tts','');
- }
-
- if ( $ticket['ticket_status'] == 'C')
- {
- $this->t->set_var('t_status','FIX ME!
time closed ' . __LINE__);
- }
- else
- {
- $this->t->set_var('t_status', lang('In
progress'));
- }
-
- // Choose the correct priority to display
- $priority_selected[$ticket['ticket_priority']]
= '';
- $priority_comment = array
- (
- '',
- ' - ' . lang('Lowest'),
- '',
- '',
- '',
- ' - '.lang('Medium'),
- '',
- '',
- '',
- '',
- ' - '.lang('Highest')
- );
-
- for ( $i = 1; $i <= 10; ++$i )
- {
- $this->t->set_var('optionname',
"{$i}{$priority_comment[$i]}");
- $this->t->set_var('optionvalue', $i);
- $this->t->set_var('optionselected',
isset($priority_selected[$i]) ? ' selected' : '');
-
$this->t->parse('options_priority','options_select',true);
- }
-
- // assigned to
- $accounts = CreateObject('phpgwapi.accounts');
- $account_list = $accounts->get_list('accounts');
- $this->t->set_var('optionname',lang('None'));
- $this->t->set_var('optionvalue','0');
- $this->t->set_var('optionselected','');
-
$this->t->parse('options_assignedto','options_select',true);
-
- while(list($key,$entry) = each($account_list))
- {
- $lid = $fname = $lname = '';
-
$GLOBALS['phpgw']->accounts->get_account_name($entry['account_id'], $lid,
$fname, $lname);
-
- if(!$fname && !$lname)
- {
- continue;
- }
-
- $employees_list[$entry['account_id']] =
$GLOBALS['phpgw']->common->display_fullname($lid,$fname,$lname);
-
- if(count($employees_list))
- {
- asort($employees_list);
- reset($employees_list);
- }
- }
-
- while (list($account_id,$account_name) =
each($employees_list))
- {
- $selected = '';
- if ($account_id ==
$ticket['ticket_assignedto'])
- {
- $selected = 'selected';
- }
- $this->t->set_var('optionname',
$account_name);
- $this->t->set_var('optionvalue',
$account_id);
- $this->t->set_var('optionselected',
$selected);
-
$this->t->parse('options_assignedto','options_select',True);
- }
-
-
- // Figure out when it was opened and last closed
- $history_array =
$this->bo->historylog->return_array(array(),array('X','O'),'','',$_REQUEST['ticket_id']);
-
- while(is_array($history_array) && list(,$value)
= each($history_array))
- {
- if($value['status'] == 'O')
- {
- $ticket['opened'] =
$GLOBALS['phpgw']->common->show_date($value['datetime'] - ((60*60) *
$GLOBALS['phpgw_info']['user']['preferences']['common']['tz_offset']));
- }
-
- if($value['status'] == 'X')
- {
- $ticket['closed'] =
$GLOBALS['phpgw']->common->show_date($value['datetime'] - ((60*60) *
$GLOBALS['phpgw_info']['user']['preferences']['common']['tz_offset']));
- }
- }
-
- // group
-
- $group_list = array();
- $group_list =
$GLOBALS['phpgw']->accounts->membership($GLOBALS['phpgw_info']['user']['account_id']);
-
- while(list($key,$entry) = each($group_list))
- {
- $tag = '';
- if($entry['account_id'] ==
$ticket['ticket_group'])
- {
- $tag = 'selected';
- }
- $this->t->set_var('optionname',
$entry['account_name']);
- $this->t->set_var('optionvalue',
$entry['account_id']);
- $this->t->set_var('optionselected',
$tag);
-
$this->t->parse('options_group','options_select',true);
- }
-
- $this->t->set_var('options_category',
$this->bo->cats->formated_list('select','',$ticket['category'],False));
-
- $ticket_status[$ticket['status']] = ' selected';
- $s = '<option value="O"' . $ticket_status['O']
. '>' . lang('Open') . '</option>';
- $s .= '<option value="X"' . $ticket_status['X']
. '>' . lang('Closed') . '</option>';
-
- $this->t->set_var('options_status',$s);
- $this->t->set_var('lang_status',lang('Status'));
-
-
/**************************************************************\
- * Display additional notes
*
-
\**************************************************************/
- $history_array =
$this->bo->historylog->return_array(array(),array('C'),'','',$ticket_id);
- while(is_array($history_array) && list(,$value)
= each($history_array))
- {
-
$this->t->set_var('lang_date',lang('Date'));
-
$this->t->set_var('lang_user',lang('User'));
-
-
$this->t->set_var('value_date',$GLOBALS['phpgw']->common->show_date($value['datetime']
- ((60*60) *
$GLOBALS['phpgw_info']['user']['preferences']['common']['tz_offset'])));
-
$this->t->set_var('value_user',$value['owner']);
-
-
$this->t->set_var('value_note',nl2br(htmlspecialchars($value['new_value'])));
-
$this->t->fp('rows_notes','additional_notes_row',True);
- }
-
- if(!count($history_array))
- {
-
$this->t->set_var('lang_no_additional_notes',lang('No additional notes'));
-
$this->t->fp('rows_notes','additional_notes_row_empty',True);
- }
-
-
/**************************************************************\
- * Display record history
*
-
\**************************************************************/
- $this->t->set_var('lang_user',lang('User'));
- $this->t->set_var('lang_date',lang('Date'));
- $this->t->set_var('lang_action',lang('Action'));
- $this->t->set_var('lang_new_value',lang('New
Value'));
- $this->t->set_var('lang_old_value',lang('Old
Value'));
-
- $history_array =
$this->historylog->return_array(array('C'),array(),'','',$ticket_id);
- while(is_array($history_array) && list(,$value)
= each($history_array))
- {
-
$GLOBALS['phpgw']->nextmatchs->template_alternate_row_color($GLOBALS['phpgw']->template);
-
-
$this->t->set_var('value_date',$GLOBALS['phpgw']->common->show_date($value['datetime']
- ((60*60) *
$GLOBALS['phpgw_info']['user']['preferences']['common']['tz_offset'])));
-
$this->t->set_var('value_user',$value['owner']);
- $this->t->set_var('value_action',
$this->historylog->types[$value['status']]);
-
- if($value['status'] == 'A')
- {
- if(!$value['new_value'])
- {
-
$this->t->set_var('value_new_value',lang('None'));
- }
- else
- {
-
$this->t->set_var('value_new_value',$GLOBALS['phpgw']->accounts->id2name($value['new_value']));
- }
-
- if(!$value['old_value'])
- {
-
$this->t->set_var('value_old_value',lang('None'));
- }
- else
- {
-
$this->t->set_var('value_old_value',$GLOBALS['phpgw']->accounts->id2name($value['old_value']));
- }
- }
- elseif($value['status'] == 'T')
- {
-
$this->t->set_var('value_new_value',$GLOBALS['phpgw']->categories->id2name($value['new_value']));
-
$this->t->set_var('value_old_value',$GLOBALS['phpgw']->categories->id2name($value['old_value']));
- }
- elseif($value['status'] == 'L')
- {
-
$this->t->set_var('value_new_value',$GLOBALS['phpgw']->categories->id2name($value['new_value']));
-
$this->t->set_var('value_old_value',$GLOBALS['phpgw']->categories->id2name($value['old_value']));
- }
- elseif($value['status'] == 'G')
- {
- $s =
$GLOBALS['phpgw']->accounts->id2name($value['new_value']);
- $s = ($s ? $s : '--');
-
$this->t->set_var('value_new_value',$s);
-
- $s =
$GLOBALS['phpgw']->accounts->id2name($value['old_value']);
- $s = ($s ? $s : '--');
-
$this->t->set_var('value_old_value',$s);
- }
- elseif($value['status'] != 'O' &&
$value['new_value'])
- {
-
$this->t->set_var('value_new_value',$value['new_value']);
-
$this->t->set_var('value_old_value',$value['old_value']);
- }
- else
- {
-
$this->t->set_var('value_new_value',' ');
-
$this->t->set_var('value_old_value',' ');
- }
-
-
$this->t->fp('rows_history','row_history',True);
- }
-
- if(!count($history_array))
- {
-
$this->t->set_var('lang_no_history',lang('No history for this record'));
-
$this->t->fp('rows_history','row_history_empty',True);
- }
-
- for($i=0; $i <= $x-1; $i++)
- {
- $file =
$GLOBALS['phpgw']->link('/index.php', array('menuaction' =>
'tts.attachedFiles.show_file',
-
'file' =>
$ticket['attachment'][$i]
-
));
- $attLink .= "<a href=\"" . $file . "\"
target=\"_NEW\">" . basename($ticket['attachment'][$i]) . " </a><br>";
- }
-
$this->t->set_var('lang_attachment',lang('Attachment'));
- $this->t->set_var('value_attachment',$attLink);
-
-
$this->t->set_var('lang_billable_hours_total',lang('Total billable'));
-
$this->t->set_var('value_billable_hours_total',sprintf('%01.2f',($ticket['billable_hours']
* $ticket['billable_rate'])));
-
-
$this->t->set_var('lang_assignedto',lang('Assigned to'));
- if($ticket['ticket_assignedto'])
- {
- $assignedto =
$GLOBALS['phpgw']->accounts->id2name($ticket['assignedto']);
- }
- else
- {
- $assignedto = lang('None');
- }
-
$this->t->set_var('value_assignedto',$assignedto);
-
- $s =
$GLOBALS['phpgw']->accounts->id2name($ticket['group']);
- $s = ($s ? $s : '--');
- $this->t->set_var('value_group',$s);
-
- $this->t->set_var(array
- (
- 'currency' =>
$GLOBALS['phpgw_info']['user']['preferences']['common']['currency'],
- 'lang_additional_notes' =>
lang('additional notes'),
- 'lang_assignedfrom' =>
lang('assigned from'),
- 'lang_billable_hours'=> lang('billable
hours'),
- 'lang_billable_hours_rate' =>
lang('billable rate'),
- 'lang_category' =>
lang('category'),
- 'lang_close' =>
lang('close'),
- 'lang_deadline' =>
lang('deadline'),
- 'lang_details' =>
lang('details'),
- 'lang_effort' =>
lang('effort'),
- 'lang_group' =>
lang('group'),
- 'lang_history' =>
lang('history'),
- 'lang_notes' =>
lang('notes'),
- 'lang_opendate' => lang('open
date'),
- 'lang_priority' =>
lang('priority'),
- 'lang_type' =>
lang('type'),
- 'lang_save' =>
lang('save'),
- 'lang_subject' =>
lang('subject'),
- 'lang_summary' =>
lang('summary'),
- 'lang_update' =>
lang('update'),
- 'ticket_id' =>
$ticket['ticket_id'],
- 'url_close' =>
$GLOBALS['phpgw']->link('/tts/index.php'),
- 'url_viewdetails' =>
$GLOBALS['phpgw']->link('/tts/viewticket_details.php'),
- 'value_category' =>
$this->bo->cats->id2name($ticket['category']),
- 'value_details' =>
nl2br(htmlspecialchars($ticket['details'])),
- 'value_billable_hours_rate' =>
$ticket['billable_rate'],
- 'value_billable_hours' =>
$ticket['billable_hours'],
- 'value_deadline' =>
$ticket['deadline'],
- 'value_effort' =>
$ticket['effort'],
- 'value_opendate' =>
$ticket['opened'],
- 'value_owner' =>
$GLOBALS['phpgw']->accounts->id2name($ticket['owner']),
- 'value_platform' =>
$ticket['platform'],
- 'value_priority' =>
$ticket['priority'],
- 'value_subject' =>
htmlspecialchars($ticket['subject']),
- 'value_type' =>
$ticket['type']
- ));
-
- $this->t->set_var('options_select','');
-
- $GLOBALS['phpgw_info']['flags']['app_header'] =
" #{$ticket['ticket_id']} {$ticket['subject']}";
-
- $GLOBALS['phpgw']->common->phpgw_header(true);
-
- $this->t->pfp('out','form');
- $GLOBALS['phpgw']->common->phpgw_footer();
- }
- else
- {
- $ticket['billable_hours'] =
$_POST['ticket']['billable_hours'];
- $ticket['billable_rate'] =
$_POST['ticket']['billable_rate'];
- $ticket['assignedto'] =
$_POST['ticket']['assignedto'];
- $ticket['category'] =
$_POST['ticket']['category'];
- $ticket['note'] =
$_POST['ticket']['note'];
- $ticket['priority'] =
$_POST['ticket']['priority'];
- $ticket['group'] =
$_POST['ticket']['group'];
- $ticket['status'] =
$_POST['ticket']['status'];
- $ticket['type'] =
$_POST['ticket']['type'];
- $ticket['deadline'] =
$_POST['ticket']['deadline'];
- $ticket['effort'] =
$_POST['ticket']['effort'];
- $ticket['platform'] =
$_POST['ticket']['platform'];
- $ticket['attachment'] =
$_POST['ticket']['attachment'];
-
- $this->bo->update_ticket($_POST['ticket_id'],
$ticket);
-
-
$GLOBALS['phpgw']->redirect_link('/tts/viewticket_details.php',
array('ticket_id' => $_POST['ticket_id']));
- }
}
/**
@@ -1027,6 +373,13 @@
}
}
+
+ $fields[] = array
+ (
+ 'id' => 'br',
+ 'type' => 'break'
+ );
+
$fields[] = array
(
'id' => 'cancel',
@@ -1041,6 +394,13 @@
'value' => lang('save')
);
+
+ $fields[] = array
+ (
+ 'id' => 'br',
+ 'type' => 'break'
+ );
+
return array('form_elm' => $fields);
}
Index: inc/hook_settings.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/tts/inc/hook_settings.inc.php,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -b -r1.2 -r1.3
--- inc/hook_settings.inc.php 10 May 2005 16:12:38 -0000 1.2
+++ inc/hook_settings.inc.php 28 Nov 2006 10:09:32 -0000 1.3
@@ -3,42 +3,52 @@
* Trouble Ticket System
*
* @author Joseph Engo <address@hidden>
- * @copyright Copyright (C) 2001,2005 Free Software Foundation, Inc.
http://www.fsf.org/
+ * @author Dave Hall <address@hidden>
+ * @copyright Copyright (C) 2001-2006 Free Software Foundation, Inc.
http://www.fsf.org/
* @license http://www.gnu.org/licenses/gpl.html GNU General Public
License
* @package tts
* @subpackage hooks
- * @version $Id: hook_settings.inc.php,v 1.2 2005/05/10 16:12:38
powerstat Exp $
+ * @version $Id: hook_settings.inc.php,v 1.3 2006/11/28 10:09:32 skwashd
Exp $
*/
- $yes_and_no = array(
+ $yes_and_no = array
+ (
'True' => 'Yes',
'' => 'No'
);
- create_select_box('show new/updated tickets on main
screen','mainscreen_show_new_updated',$yes_and_no);
+ create_select_box('show new/updated tickets on main
screen','mainscreen_show_new_updated', $yes_and_no);
$acc = CreateObject('phpgwapi.accounts');
$group_list = $acc->get_list('groups');
- while (list($key,$entry) = each($group_list))
+ $groups = array();
+ foreach ( $group_list as $entry )
{
- $_groups[$entry['account_id']] = $entry['account_lid'];
+ $groups[$entry['account_id']] =
$GLOBALS['phpgw']->common->display_fullname($entry['account_lid'],
$entry['account_firstname'], $entry['account_lastname']);;
}
- create_select_box('Default group','groupdefault',$_groups);
+ create_select_box('Default group','groupdefault', $groups);
$account_list = $acc->get_list('accounts');
- while (list($key,$entry) = each($account_list))
+ $accounts = array();
+ foreach ( $account_list as $entry )
{
- $_accounts[$entry['account_id']] = $entry['account_lid'];
+ $accounts[$entry['account_id']] =
$GLOBALS['phpgw']->common->display_fullname($entry['account_lid'],
$entry['account_firstname'], $entry['account_lastname']);
}
- create_select_box('Default assign to','assigntodefault',$_accounts);
+ create_select_box('Default assign to','assigntodefault', $accounts);
// Choose the correct priority to display
- $priority_comment[1] = ' - ' . lang('Lowest');
- $priority_comment[5] = ' - ' . lang('Medium');
- $priority_comment[10] = ' - ' . lang('Highest');
- for ($i=1; $i<=10; $i++)
- {
- $priority[$i] = $i . $priority_comment[$i];
- }
- create_select_box('Default Priority','prioritydefault',$priority);
+ $priority = array
+ (
+ 1 => '1 - ' . lang('Lowest'),
+ 2 => 2,
+ 3 => 3,
+ 4 => 4,
+ 5 => '5 - ' . lang('Medium'),
+ 6 => 6,
+ 7 => 7,
+ 8 => 8,
+ 9 => 9,
+ 10 => '10 - ' . lang('Highest')
+ );
- create_input_box('Refresh every (seconds)','refreshinterval');
+ create_select_box('Default Priority','prioritydefault',$priority);
+ //create_input_box('Refresh every (seconds)','refreshinterval');
Index: templates/base/css/base.css
===================================================================
RCS file: /cvsroot/phpgroupware/tts/templates/base/css/base.css,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2
--- templates/base/css/base.css 14 Oct 2006 11:35:37 -0000 1.1
+++ templates/base/css/base.css 28 Nov 2006 10:09:32 -0000 1.2
@@ -372,3 +372,15 @@
{
clear: both;
}
+
+
+.date_select img
+{
+ float: left;
+ margin: 0px 0px 0px 5px;
+}
+
+.date_select input[type=text]
+{
+ width: 220px;
+}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Phpgroupware-cvs] tts inc/class.botts.inc.php inc/class.uitts.inc...,
Dave Hall <=