[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, 09 Jan 2007 01:21:53 +0000 |
CVSROOT: /cvsroot/phpgroupware
Module name: tts
Changes by: Dave Hall <skwashd> 07/01/09 01:21:53
Modified files:
inc : class.botts.inc.php class.uitts.inc.php
js/base : index.js
templates/base : app_data.xsl search_results.xsl
Added files:
templates/base : index.xsl
Log message:
make the lists use xsl and improve the search results
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/tts/inc/class.botts.inc.php?cvsroot=phpgroupware&r1=1.9&r2=1.10
http://cvs.savannah.gnu.org/viewcvs/tts/inc/class.uitts.inc.php?cvsroot=phpgroupware&r1=1.10&r2=1.11
http://cvs.savannah.gnu.org/viewcvs/tts/js/base/index.js?cvsroot=phpgroupware&r1=1.1&r2=1.2
http://cvs.savannah.gnu.org/viewcvs/tts/templates/base/app_data.xsl?cvsroot=phpgroupware&r1=1.1&r2=1.2
http://cvs.savannah.gnu.org/viewcvs/tts/templates/base/search_results.xsl?cvsroot=phpgroupware&r1=1.1&r2=1.2
http://cvs.savannah.gnu.org/viewcvs/tts/templates/base/index.xsl?cvsroot=phpgroupware&rev=1.1
Patches:
Index: inc/class.botts.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/tts/inc/class.botts.inc.php,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -b -r1.9 -r1.10
--- inc/class.botts.inc.php 8 Jan 2007 00:37:32 -0000 1.9
+++ inc/class.botts.inc.php 9 Jan 2007 01:21:53 -0000 1.10
@@ -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.9 2007/01/08 00:37:32 skwashd
Exp $
+ * @version $Id: class.botts.inc.php,v 1.10 2007/01/09 01:21:53 skwashd
Exp $
*/
@@ -504,7 +504,8 @@
$fields[] = array
(
'id' => 'ticket_owner',
- 'label' => lang('ticket owner'),
+ 'label' => lang('reported by'),
+ 'options' =>
$this->_get_users($cat_id),
'type' => 'hidden',
'search' => true,
'list' => true,
@@ -965,14 +966,9 @@
$fields = $this->get_fields($ttype);
- $where = array();
- foreach ( $args['value'] as $key => $val )
- {
- $where[] =
$this->_criteria2sql($args['field'][$key], $args['stype'][$key], $val, $fields);
- }
-
$show_fields = array();
$headings = array();
+ $search_fields = array();
foreach ( $fields as $id => $field )
{
if ( $field['list'] )
@@ -980,6 +976,23 @@
$show_fields[$id] = $field['id'];
$headings[$id] = $field['label'];
}
+ if ( $field['search'] )
+ {
+ $search_fields[$field['id']] = true;
+ }
+ // this is a needed hack
+ if ( $field['id'] == 'ticket_owner' )
+ {
+ $fields[$id]['type'] = 'select';
+ }
+ }
+
+ $where = array();
+ foreach ( $args['value'] as $key => $val )
+ {
+ if (
isset($search_fields[$args['field'][$key]])
+ && $search_fields[$args['field'][$key]]
)
+ $where[] =
$this->_criteria2sql($args['field'][$key], $args['stype'][$key], $val, $fields);
}
$defaults = array('date' => lang('not specified'),
'lookup' => lang('invalid') );
@@ -987,7 +1000,7 @@
$concat = ($args['search_type'] == 'AND' ? ' AND ' : '
OR ');
$sql = 'SELECT ' . implode(',', $show_fields) . " FROM
{$from_tbls} WHERE (" . implode($concat, $where) . ") AND {$ttype_filter}";
- trigger_error("SQL: $sql", E_USER_NOTICE);
+ //trigger_error("SQL: $sql", E_USER_NOTICE);
$this->db->query($sql, __LINE__, __FILE__);
@@ -995,6 +1008,7 @@
while ( $this->db->next_record() )
{
$id = (int) $this->db->f('ticket_id');
+ $results[$id]['view_action'] =
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 'tts.uitts.view',
'ticket_id' => $id));
foreach ( $show_fields as $key => $field )
{
$results[$id][$field] =
$this->db->f($field, true);
@@ -1294,8 +1308,18 @@
* @param int $cat_id the category to check
* @return array list of users
*/
- function _get_users($cat_id)
+ function _get_users($cat_id = -1)
{
+ if ( $cat_id = -1 )
+ {
+ $accounts = array();
+ foreach (
$GLOBALS['phpgw']->accounts->get_list() as $acct )
+ {
+ $accounts[] = array('id' =>
$acct['account_id'], 'value' =>
$GLOBALS['phpgw']->common->display_fullname($acct['account_lid'],
$acct['account_firstname'], $acct['account_lastname']) );
+ }
+ return $accounts;
+ }
+
if ( $cat_id == 0 )
{
$loc = '.';
Index: inc/class.uitts.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/tts/inc/class.uitts.inc.php,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -b -r1.10 -r1.11
--- inc/class.uitts.inc.php 8 Jan 2007 00:37:32 -0000 1.10
+++ inc/class.uitts.inc.php 9 Jan 2007 01:21:53 -0000 1.11
@@ -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.10 2007/01/08 00:37:32 skwashd
Exp $
+ * @version $Id: class.uitts.inc.php,v 1.11 2007/01/09 01:21:53 skwashd
Exp $
*/
class tts_uitts
@@ -174,43 +174,65 @@
}
$GLOBALS['phpgw_info']['flags']['css'] = "@import
url('rostering/templates/base/css/base.css');\n";
- $this->t->set_file('index','index.tpl');
- $this->t->set_block('index', 'tts_search',
'tts_search');
- //$this->t->set_block('index', 'tts_col_ifviewall',
'tts_col_ifviewall');
- //$this->t->set_block('index', 'tts_ticket_id_read',
'tts_ticket_id_read');
- //$this->t->set_block('index', 'tts_ticket_id_unread',
'tts_ticket_id_unread');
-
- $this->t->set_file('list', 'list.tpl');
- $this->t->set_block('list', 'tts_row', 'tts_rows');
+ $GLOBALS['phpgw_info']['flags']['xslt_app'] = true;
+ $GLOBALS['phpgw']->xslttpl->add_file('index');
- $this->t->set_var(
- array
+ $values = array
+ (
+ 'img' => array
(
- 'img_goto' =>
$GLOBALS['phpgw']->common->image('phpgwapi', 'stock_jump_to', '.png', false),
- 'img_new' =>
$GLOBALS['phpgw']->common->image('phpgwapi', 'stock_new', '.png', false),
- 'img_prefs' =>
$GLOBALS['phpgw']->common->image('phpgwapi', 'settings', '.png', false),
- 'img_search' =>
$GLOBALS['phpgw']->common->image('phpgwapi', 'stock_search', '.png', false),
- 'lang_clear' => lang('clear'),
- 'lang_close_ticket' => lang('close
ticket'),
- 'lang_filter' => lang('filter'),
- 'lang_find' => lang('find'),
- 'lang_goto' => lang('go
to'),
- 'lang_invalid' => lang('invalid ticket
id, please try again'),
- 'lang_new' => lang('new'),
- 'lang_open' => lang('open'),
- 'lang_overdue' => lang('overdue'),
- 'lang_preferences' =>
lang('preferences'),
- 'lang_search' => lang('search'),
- 'lang_ticket_no'=> lang('ticket
number'),
- 'url_new_ticket'=>
$GLOBALS['phpgw']->link('/index.php', array('menuaction' =>
'tts.uitts.add_ticket')),
- 'url_prefs' =>
$GLOBALS['phpgw']->link('/preferences/preferences.php', array('appname' =>
'tts')),
- 'url_search' =>
$GLOBALS['phpgw']->link('/index.php', array('menuaction' =>
'tts.uitts.search')),
- 'url_view' =>
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 'tts.uitts.view') ),
+ 'goto' =>
$GLOBALS['phpgw']->common->image('phpgwapi', 'stock_jump_to', '.png', false),
+ 'new' =>
$GLOBALS['phpgw']->common->image('phpgwapi', 'stock_new', '.png', false),
+ 'prefs' =>
$GLOBALS['phpgw']->common->image('phpgwapi', 'settings', '.png', false),
+ 'search' =>
$GLOBALS['phpgw']->common->image('phpgwapi', 'stock_search', '.png', false),
+ ),
+ 'lang' => array
+ (
+ 'clear' =>
lang('clear'),
+ 'close_ticket' => lang('close
ticket'),
+ 'filter' =>
lang('filter'),
+ 'find' => lang('find'),
+ 'goto' => lang('go
to'),
+ 'invalid' =>
lang('invalid ticket id, please try again'),
+ 'new' => lang('new'),
+ 'open' => lang('open'),
+ 'overdue' =>
lang('overdue'),
+ 'preferences' => lang('preferences'),
+ 'search' =>
lang('search'),
+ 'ticket_no' => lang('ticket
number')
+ ),
+ 'url' => array
+ (
+ 'new_ticket' =>
$GLOBALS['phpgw']->link('/index.php', array('menuaction' =>
'tts.uitts.add_ticket')),
+ 'prefs' =>
$GLOBALS['phpgw']->link('/preferences/preferences.php', array('appname' =>
'tts')),
+ 'search' =>
$GLOBALS['phpgw']->link('/index.php', array('menuaction' =>
'tts.uitts.search')),
+ 'view' =>
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 'tts.uitts.view') ),
'goto_action' =>
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 'tts.uitts.view') )
- ));
+ ),
+ 'open' => $this->bo->search(array
+ (
+ 'field' =>
array('ticket_status'),
+ 'stype' => array('is'),
+ 'value' => array('O'),
+ 'search_type' => 'AND'
+ )),
+ 'overdue' => $this->bo->search(array
+ (
+ 'field' =>
array('ticket_status', 'ticket_deadline', 'ticket_deadline'),
+ 'stype' => array('is',
'before', 'is_not'),
+ 'value' => array('O',
time(), 0),
+ 'search_type' => 'AND'
+ ))
+ );
+
+ $GLOBALS['phpgw']->xslttpl->set_var('phpgw',
array('index' => $values));
+ $GLOBALS['phpgw']->common->phpgw_exit(true);
- $this->t->set_var('tts_searchfilter',
isset($_REQUEST['searchfilter']) ? $_REQUEST['searchfilter'] : '');
+
+
+
+ //$this->t->set_var('tts_searchfilter',
isset($_REQUEST['searchfilter']) ? $_REQUEST['searchfilter'] : '');
//$this->t->set_var('tts_numfound',lang('Tickets found %1',$numfound));
//$this->t->set_var('tts_ticketstotal',
lang('Tickets total %1',$numtotal));
@@ -372,6 +394,7 @@
{
$results = array();
}
+
$GLOBALS['phpgw_info']['flags']['xslt_app'] =
true;
$GLOBALS['phpgw']->xslttpl->add_file('search_results');
Index: js/base/index.js
===================================================================
RCS file: /cvsroot/phpgroupware/tts/js/base/index.js,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2
--- js/base/index.js 14 Oct 2006 05:39:41 -0000 1.1
+++ js/base/index.js 9 Jan 2007 01:21:53 -0000 1.2
@@ -15,11 +15,13 @@
oTabs = new Tabs(2,'activetab','inactivetab','tab','tabcontent');
oTabs.display(1);
+ /*
sortOpen = new SortableTable(document.getElementById('tickets_open'),
['None', 'Number', 'CaseInsensitiveString', 'Date',
'CaseInsensitiveString', 'CaseInsensitiveString', 'CaseInsensitiveString',
'CaseInsensitiveString']);
sortOverdue = new
SortableTable(document.getElementById('tickets_overdue'),
['None', 'Number', 'CaseInsensitiveString', 'Date',
'CaseInsensitiveString', 'CaseInsensitiveString', 'CaseInsensitiveString',
'CaseInsensitiveString']);
+ */
var handleCancel = function()
{
@@ -42,7 +44,6 @@
dlg.cfg.queueProperty("buttons", [ { text : 'Cancel', handler :
handleCancel },
{ text: 'Go', handler : handleSubmit, isDefault : true } ]);
-
dlg.render();
}
Index: templates/base/app_data.xsl
===================================================================
RCS file: /cvsroot/phpgroupware/tts/templates/base/app_data.xsl,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2
--- templates/base/app_data.xsl 15 Oct 2006 15:14:08 -0000 1.1
+++ templates/base/app_data.xsl 9 Jan 2007 01:21:53 -0000 1.2
@@ -0,0 +1,32 @@
+ <xsl:template name="ticket_list">
+ <table>
+ <thead>
+ <tr>
+ <xsl:for-each select="headings">
+ <th><xsl:value-of
select="." /></th>
+ </xsl:for-each>
+ </tr>
+ </thead>
+ <tbody>
+ <xsl:for-each select="results">
+ <tr id="record_{ticket_id}"
onclick="window.location='{view_action}';">
+ <xsl:attribute
name="class">
+
<xsl:choose>
+
<xsl:when test="position() mod 2 = 0">
+
<xsl:text>row_off</xsl:text>
+
</xsl:when>
+
<xsl:otherwise>
+
<xsl:text>row_on</xsl:text>
+
</xsl:otherwise>
+
</xsl:choose>
+ </xsl:attribute>
+ <xsl:for-each
select="*">
+ <xsl:if
test="name() != 'view_action'">
+
<td><xsl:value-of select="." /></td>
+ </xsl:if>
+ </xsl:for-each>
+ </tr>
+ </xsl:for-each>
+ </tbody>
+ </table>
+ </xsl:template>
Index: templates/base/search_results.xsl
===================================================================
RCS file: /cvsroot/phpgroupware/tts/templates/base/search_results.xsl,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2
--- templates/base/search_results.xsl 21 Dec 2006 00:06:14 -0000 1.1
+++ templates/base/search_results.xsl 9 Jan 2007 01:21:53 -0000 1.2
@@ -1,33 +1,6 @@
<xsl:template match="search_results">
<div id="tts_search_results">
<h1><xsl:value-of select="lang/search_results" /></h1>
- <table>
- <thead>
- <tr>
- <xsl:for-each select="headings">
- <th><xsl:value-of
select="." /></th>
- </xsl:for-each>
- </tr>
- </thead>
- <tbody>
- <xsl:for-each select="results">
- <tr id="record_{ticket_id}">
- <xsl:attribute
name="class">
-
<xsl:choose>
-
<xsl:when test="position() mod 2 = 0">
-
<xsl:text>row_off</xsl:text>
-
</xsl:when>
-
<xsl:otherwise>
-
<xsl:text>row_on</xsl:text>
-
</xsl:otherwise>
-
</xsl:choose>
- </xsl:attribute>
- <xsl:for-each
select="*">
-
<td><xsl:value-of select="." /></td>
- </xsl:for-each>
- </tr>
- </xsl:for-each>
- </tbody>
- </table>
+ <xsl:call-template name="ticket_list" />
</div>
</xsl:template>
Index: templates/base/index.xsl
===================================================================
RCS file: templates/base/index.xsl
diff -N templates/base/index.xsl
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ templates/base/index.xsl 9 Jan 2007 01:21:53 -0000 1.1
@@ -0,0 +1,59 @@
+<xsl:template match="index">
+ <script type="text/javascript">
+ var lang =
+ {
+ invalid : '{lang_invalid}',
+ ticket_no : '{lang_ticket_no}'
+ };
+
+ </script>
+ <ul class="app_buttons">
+ <li onclick="window.location='{url/new_ticket}';">
+ <img src="{img/new}" alt="{lang/new}" /><br />
+ <a href="{url/new_ticket}"><xsl:value-of
select="lang/new" /></a>
+ </li>
+ <li onclick="window.location='{url/search}';">
+ <img src="{img/search}" alt="{lang/search}" /><br />
+ <a href="{url/search}"><xsl:value-of
select="lang/search" /></a>
+ </li>
+ <!--
+ <li onclick="window.location='{url/prefs}';">
+ <img src="{img/prefs}" alt="{lang/preferences}" /><br />
+ <a href="{url/prefs}"><xsl:value-of
select="lang/preferences" /></a>
+ </li>
+ -->
+ <li onclick="goToPopup()">
+ <img src="{img/goto}" alt="{lang/goto}" /><br />
+ <a href="#" onclick="goToPopup();"><xsl:value-of
select="lang/goto" /></a>
+ </li>
+ </ul>
+
+ <div class="tabsholder">
+ <ul class="tabs">
+ <li id="tab1"><a href="#"
onclick="oTabs.display(1);"><span><xsl:value-of select="lang/overdue"
/></span></a></li>
+ <li id="tab2"><a href="#"
onclick="oTabs.display(2);"><span><xsl:value-of select="lang/open"
/></span></a></li>
+ </ul><br />
+ </div>
+ <xsl:for-each select="//overdue">
+ <div id="tabcontent1">
+ <xsl:call-template name="ticket_list" />
+ </div>
+ </xsl:for-each>
+ <xsl:for-each select="//open">
+ <div id="tabcontent2">
+ <xsl:call-template name="ticket_list" />
+ </div>
+ </xsl:for-each>
+
+ <div id="tts_goto_dialog" class="panel">
+ <div class="hd"><div class="lt"></div><span><xsl:value-of
select="lang/goto" /></span><div class="rt"></div></div>
+ <div class="bd">
+ <form method="post" action="{url/goto_action}"
id="tts_goto_form" name="tts_goto_form">
+ <div> <!-- STFU validator -->
+ <label for="ticket_id"><xsl:value-of
select="lang/ticket_no" /></label>
+ <input type="text" name="ticket_id"
id="ticket_id" /><br />
+ </div>
+ </form>
+ </div>
+ </div>
+</xsl:template>
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Phpgroupware-cvs] tts inc/class.botts.inc.php inc/class.uitts.inc...,
Dave Hall <=