[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Fmsystem-commits] [12346] uitts: custom footer, translate status and re
From: |
Sigurd Nes |
Subject: |
[Fmsystem-commits] [12346] uitts: custom footer, translate status and related items |
Date: |
Thu, 20 Nov 2014 19:46:42 +0000 |
Revision: 12346
http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=12346
Author: sigurdne
Date: 2014-11-20 19:46:41 +0000 (Thu, 20 Nov 2014)
Log Message:
-----------
uitts: custom footer, translate status and related items
Modified Paths:
--------------
branches/dev-syncromind/phpgwapi/inc/class.uicommon_jquery.inc.php
branches/dev-syncromind/phpgwapi/templates/base/datatable_jquery.xsl
branches/dev-syncromind/property/inc/class.botts.inc.php
branches/dev-syncromind/property/inc/class.sotts.inc.php
branches/dev-syncromind/property/inc/class.uitts.inc.php
Added Paths:
-----------
branches/dev-syncromind/property/js/portico/tts.index.js
Modified: branches/dev-syncromind/phpgwapi/inc/class.uicommon_jquery.inc.php
===================================================================
--- branches/dev-syncromind/phpgwapi/inc/class.uicommon_jquery.inc.php
2014-11-20 17:15:47 UTC (rev 12345)
+++ branches/dev-syncromind/phpgwapi/inc/class.uicommon_jquery.inc.php
2014-11-20 19:46:41 UTC (rev 12346)
@@ -482,21 +482,22 @@
}
// Build a jquery result style array
- public function jquery_results($results)
+ public function jquery_results($result=array())
{
- if (!$results)
+ if (!$result)
{
- $results['total_records'] = 0;
- $results['recordsFiltered'] = 0;
- $result['data'] = array();
+ $result['recordsTotal'] = 0;
+ $result['recordsFiltered'] = 0;
+ $result['data'] =
array();
}
- // _debug_array($result);
- return array(
- 'recordsTotal' =>
$results['total_records'],
- 'recordsFiltered' =>
$results['total_records'],
- 'draw' =>
$results['draw'],
- 'data' =>
$results['results']
- );
+
+ $result['recordsTotal'] =
$result['total_records'];
+ $result['recordsFiltered'] =
$result['recordsTotal'];
+ $result['data'] =
$result['results'];
+ unset($result['results']);
+ unset($result['total_records']);
+
+ return $result;
}
public function use_yui_editor($targets)
Modified: branches/dev-syncromind/phpgwapi/templates/base/datatable_jquery.xsl
===================================================================
--- branches/dev-syncromind/phpgwapi/templates/base/datatable_jquery.xsl
2014-11-20 17:15:47 UTC (rev 12345)
+++ branches/dev-syncromind/phpgwapi/templates/base/datatable_jquery.xsl
2014-11-20 19:46:41 UTC (rev 12346)
@@ -322,6 +322,24 @@
</xsl:choose>
</xsl:for-each>
</thead>
+ <tfoot>
+ <tr>
+ <xsl:for-each select="//datatable/field">
+ <xsl:choose>
+ <xsl:when test="hidden">
+ <xsl:if test="hidden
=0">
+ <th>
+ </th>
+ </xsl:if>
+ </xsl:when>
+ <xsl:otherwise>
+ <th>
+ </th>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:for-each>
+ </tr>
+ </tfoot>
</table>
<script>
@@ -329,16 +347,6 @@
<xsl:for-each select="//datatable/field">
{
data: "<xsl:value-of
select="key"/>",
-//Sigurd: move the addclass to the entire row (fnRowCallback).
-// fnCreatedCell: function(nTd, sData,
oData, iRow, iCol){
-// if(typeof(oData['priority']) !=
undefined)
-// {
-// if(iCol == 0)
-// {
-//
$(nTd).addClass('priority' + oData['priority']);
-// }
-// }
-// },
class: "<xsl:value-of
select="className"/>",
orderable: <xsl:value-of
select="phpgw:conditional(not(sortable = 0), 'true', 'false')"/>,
<xsl:choose>
@@ -627,6 +635,8 @@
editor_cols.push(null);
}
}
+
+ $(document).ready(function() {
oTable = $('#datatable-container').dataTable( {
processing: true,
@@ -665,7 +675,17 @@
sSuccessResponse: "IGNORE",
fnShowError:
function(){ return; }
});
+ if(typeof(addFooterDatatable) ==
'function')
+ {
+ addFooterDatatable(oTable);
+ }
},
+ fnFooterCallback: function ( nRow, aaData,
iStart, iEnd, aiDisplay ) {
+ if(typeof(addFooterDatatable2) ==
'function')
+ {
+ addFooterDatatable2(nRow,
aaData, iStart, iEnd, aiDisplay,oTable);
+ }
+ },//alternative
lengthMenu:
JqueryPortico.i18n.lengthmenu(),
language:
JqueryPortico.i18n.datatable(),
columns: JqueryPortico.columns,
@@ -679,6 +699,8 @@
oTableTools: JqueryPortico.TableTools
} );
+});
+
]]>
/**
Modified: branches/dev-syncromind/property/inc/class.botts.inc.php
===================================================================
--- branches/dev-syncromind/property/inc/class.botts.inc.php 2014-11-20
17:15:47 UTC (rev 12345)
+++ branches/dev-syncromind/property/inc/class.botts.inc.php 2014-11-20
19:46:41 UTC (rev 12346)
@@ -537,6 +537,8 @@
else
{
$entity[0]['type']='.project';
+ $entity[0]['name']='project';
+
$this->uicols_related = array('project');
}
@@ -633,15 +635,16 @@
{
$ticket['new_ticket'] = '*';
}
-
+// _debug_array($this->uicols_related);
+// _debug_array($entity);
if(isset($entity) && is_array($entity))
{
for ($j=0;$j<count($entity);$j++)
{
- $ticket['child_date'][$j] =
$interlink->get_child_date('property', '.ticket', $entity[$j]['type'],
$ticket['id'],
isset($entity[$j]['entity_id'])?$entity[$j]['entity_id']:'',isset($entity[$j]['cat_id'])?$entity[$j]['cat_id']:'');
-
if($ticket['child_date'][$j]['date_info'] && !$download)
+
$ticket['child_date'][$entity[$j]['name']] =
$interlink->get_child_date('property', '.ticket', $entity[$j]['type'],
$ticket['id'],
isset($entity[$j]['entity_id'])?$entity[$j]['entity_id']:'',isset($entity[$j]['cat_id'])?$entity[$j]['cat_id']:'');
+
if($ticket['child_date'][$entity[$j]['name']]['date_info'] && !$download)
{
-
$ticket['child_date'][$j]['statustext'] =
$interlink->get_relation_info(array('location' => $entity[$j]['type']),
$ticket['child_date'][$j]['date_info'][0]['target_id']);
+
$ticket['child_date'][$entity[$j]['name']]['statustext'] =
$interlink->get_relation_info(array('location' => $entity[$j]['type']),
$ticket['child_date'][$entity[$j]['name']]['date_info'][0]['target_id']);
}
}
}
Modified: branches/dev-syncromind/property/inc/class.sotts.inc.php
===================================================================
--- branches/dev-syncromind/property/inc/class.sotts.inc.php 2014-11-20
17:15:47 UTC (rev 12345)
+++ branches/dev-syncromind/property/inc/class.sotts.inc.php 2014-11-20
19:46:41 UTC (rev 12346)
@@ -660,15 +660,20 @@
$entity[$i]['entity_id']=$this->db->f('entity_id');
$entity[$i]['cat_id']=$this->db->f('cat_id');
$entity[$i]['type']=".entity.{$this->db->f('entity_id')}.{$this->db->f('cat_id')}";
- $uicols[] = str_replace(' ', '_',
$this->db->f('name',true));
+
+ $name = str_replace(' ', '_',
$this->db->f('name',true));
+ $entity[$i]['name'] = $name;
+ $uicols[] = $name;
$i++;
}
$entity[$i]['type']='.project';
+ $entity[$i]['name']='project';
$uicols[] = 'project';
$i++;
$entity[$i]['type']='.project.workorder';
+ $entity[$i]['name']='workorder';
$uicols[] = 'workorder';
Modified: branches/dev-syncromind/property/inc/class.uitts.inc.php
===================================================================
--- branches/dev-syncromind/property/inc/class.uitts.inc.php 2014-11-20
17:15:47 UTC (rev 12345)
+++ branches/dev-syncromind/property/inc/class.uitts.inc.php 2014-11-20
19:46:41 UTC (rev 12346)
@@ -160,6 +160,28 @@
//$values = $this->bo->read($params);
//fill data
$values = $this->bo->read($params);
+
+ if($values)
+ {
+ $status = array();
+ $status['X'] =lang('closed');
+ $status['O'] =
isset($this->bo->config->config_data['tts_lang_open']) &&
$this->bo->config->config_data['tts_lang_open'] ?
$this->bo->config->config_data['tts_lang_open'] : lang('Open');
+ $status['C'] = lang('closed');
+
+ $custom_status =
$this->bo->get_custom_status();
+
+ foreach($custom_status as $custom)
+ {
+ $status["C{$custom['id']}"] =
$custom['name'];
+ }
+
+ foreach($values as &$entry)
+ {
+ $entry['status'] =
$status[$entry['status']];
+ }
+
+ }
+
if ( phpgw::get_var('export', 'bool'))
{
return $values;
@@ -167,8 +189,11 @@
$result_data = array('results' => $values);
- $result_data['total_records'] =
$this->bo->total_records;
- $result_data['draw'] = $draw;
+ $result_data['total_records'] =
$this->bo->total_records;
+ $result_data['sum_budget'] =
$this->bo->sum_budget;
+ $result_data['sum_actual_cost'] =
$this->bo->sum_actual_cost;
+ $result_data['sum_difference'] =
$this->bo->sum_difference;
+ $result_data['draw'] = $draw;
$link_data = array
(
@@ -517,9 +542,6 @@
$uicols['descr'][] =
$columns[$col]['name'];
}
-
- $uicols['name'][] = 'child_date';
- $uicols['descr'][] = lang('child date');
$uicols['name'][] = 'link_view';
$uicols['descr'][] = lang('link view');
$uicols['name'][] = 'lang_view_statustext';
@@ -539,6 +561,11 @@
'hidden' => ($uicols['input_type'][$k] == 'hidden') ? true : false
);
+ if(isset($uicols_related) &&
in_array($uicols['name'][$k], $uicols_related))
+ {
+ $params['formatter'] =
'JqueryPortico.formatLinkRelated';
+ }
+
if ($uicols['datatype'][$k] == 'link')
{
$params['formatter'] =
'JqueryPortico.formatLinkGeneric';
@@ -553,15 +580,15 @@
{
$params['sortable'] = true;
}
- if($uicols['name'][$i]=='priority' ||
$uicols['name'][$i]=='id' || $uicols['name'][$i]=='assignedto'
- ||
$uicols['name'][$i]=='finnish_date'|| $uicols['name'][$i]=='user'||
$uicols['name'][$i]=='entry_date'
- || $uicols['name'][$i]=='order_id'||
$uicols['name'][$i]=='modified_date')
+ if($uicols['name'][$k]=='priority' ||
$uicols['name'][$k]=='id' || $uicols['name'][$k]=='assignedto'
+ ||
$uicols['name'][$k]=='finnish_date'|| $uicols['name'][$k]=='user'||
$uicols['name'][$k]=='entry_date'
+ || $uicols['name'][$k]=='order_id'||
$uicols['name'][$k]=='modified_date')
{
$params['sortable'] = true;
}
- if($uicols['name'][$i]=='text_view' ||
$uicols['name'][$i]=='bgcolor' || $uicols['name'][$i]=='child_date' ||
$uicols['name'][$i]== 'link_view' ||
$uicols['name'][$i]=='lang_view_statustext' || $uicols['name'][$i]=='hidden_id')
+ if($uicols['name'][$k]=='text_view' ||
$uicols['name'][$k]=='bgcolor' || $uicols['name'][$k]== 'link_view' ||
$uicols['name'][$k]=='lang_view_statustext' || $uicols['name'][$k]=='hidden_id')
{
- $params['hidden'] = false;
+ $params['hidden'] = true;
}
$fields[] = $params;
@@ -740,6 +767,7 @@
// phpgwapi_yui::load_widget('paginator');
self::add_javascript('phpgwapi', 'jquery',
'editable/jquery.jeditable.js');
self::add_javascript('phpgwapi', 'jquery',
'editable/jquery.dataTables.editable.js');
+ self::add_javascript('property', 'portico',
'tts.index.js');
$data = array(
'datatable_name' => lang('condition
survey'),
Added: branches/dev-syncromind/property/js/portico/tts.index.js
===================================================================
--- branches/dev-syncromind/property/js/portico/tts.index.js
(rev 0)
+++ branches/dev-syncromind/property/js/portico/tts.index.js 2014-11-20
19:46:41 UTC (rev 12346)
@@ -0,0 +1,95 @@
+
+ this.addFooterDatatable2 = function(nRow, aaData, iStart, iEnd,
aiDisplay, oTable)
+ {
+ var api = oTable.api();
+ var json = api.ajax.json();
+
+ var columns = JqueryPortico.columns;
+
+ tmp_sum_budget = json.sum_budget;
+ tmp_sum_actual_cost =json.sum_actual_cost;
+ tmp_sum_difference = json.sum_difference;
+
+ var j = 0;
+
+ for(i=0;i<columns.length;i++)
+ {
+ if(columns[i].visible = true)
+ {
+ if (columns[i].data == 'estimate')
+ {
+
if(typeof(nRow.getElementsByTagName('th')[j]) != 'undefined')
+ {
+
nRow.getElementsByTagName('th')[j].innerHTML = tmp_sum_budget;
+ }
+ break;
+ }
+ j++;
+ }
+ }
+
+ var show_actual_cost = false;
+
+ j = 0;
+ for(i=0;i<columns.length;i++)
+ {
+ if(columns[i].visible = true)
+ {
+ if (columns[i].data == 'actual_cost')
+ {
+
if(typeof(nRow.getElementsByTagName('th')[j]) != 'undefined')
+ {
+
nRow.getElementsByTagName('th')[j].innerHTML = tmp_sum_actual_cost;
+ }
+
+ show_actual_cost = true;
+ break;
+ }
+ j++;
+ }
+ }
+
+ if(show_actual_cost)
+ {
+ j++;
+ nRow.getElementsByTagName('th')[0].innerHTML = "Sum:";
+ if(typeof(nRow.getElementsByTagName('th')[j]) !=
'undefined')
+ {
+ nRow.getElementsByTagName('th')[j].innerHTML =
tmp_sum_difference;
+ }
+ }
+ }
+
+$(document).ready(function() {
+
+ $("#datatable-container").on("click", "tr", function() {
+
+ $('td', this).removeClass('priority1');
+ $('td', this).removeClass('priority2');
+ $('td', this).removeClass('priority3');
+
+ });
+
+});
+
+JqueryPortico.formatLinkRelated = function(key, oData) {
+
+ if(!oData['child_date'])
+ {
+ return '';
+ }
+
+ var child_date = oData['child_date'][key];
+ var date_info = child_date.date_info;
+ if(!date_info.length)
+ {
+ return '';
+ }
+
+ var name = date_info[0]['entry_date'];
+ var link = date_info[0]['link'];
+ var title = child_date['statustext']['statustext'] || '';
+
+
+ return '<a href="' + link + '" title="' + title + '">' + name + '</a>';
+};
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Fmsystem-commits] [12346] uitts: custom footer, translate status and related items,
Sigurd Nes <=