fmsystem-commits
[Top][All Lists]
Advanced

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

[Fmsystem-commits] [12429] add tabletools for inline tables


From: Sigurd Nes
Subject: [Fmsystem-commits] [12429] add tabletools for inline tables
Date: Wed, 10 Dec 2014 10:42:17 +0000

Revision: 12429
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=12429
Author:   sigurdne
Date:     2014-12-10 10:42:16 +0000 (Wed, 10 Dec 2014)
Log Message:
-----------
add tabletools for inline tables

Modified Paths:
--------------
    branches/dev-syncromind/phpgwapi/js/jquery/common.js
    branches/dev-syncromind/property/inc/class.notify.inc.php
    branches/dev-syncromind/property/inc/class.uilookup.inc.php
    branches/dev-syncromind/property/inc/class.uitts.inc.php
    branches/dev-syncromind/property/js/portico/tts.view.js
    branches/dev-syncromind/property/templates/base/tts.xsl

Added Paths:
-----------
    branches/dev-syncromind/property/js/portico/notify.js

Modified: branches/dev-syncromind/phpgwapi/js/jquery/common.js
===================================================================
--- branches/dev-syncromind/phpgwapi/js/jquery/common.js        2014-12-10 
10:35:31 UTC (rev 12428)
+++ branches/dev-syncromind/phpgwapi/js/jquery/common.js        2014-12-10 
10:42:16 UTC (rev 12429)
@@ -131,10 +131,12 @@
        options = options || {};
        var disablePagination   = options['disablePagination'] || false;
        var disableFilter               = options['disableFilter'] || false;
-
+       var TableTools_def              = options['TableTools'] || false;
+//console.log(options);
        data = data || {};
 
-       if (Object.keys(data).length == 0)
+//     if (Object.keys(data).length == 0)
+       if(ajax_url)
        {
                var ajax_def = {url: ajax_url,type: 'GET'};
                var serverSide_def = true;
@@ -144,10 +146,17 @@
                var ajax_def = false;
                var serverSide_def = false;
        }
-
-       $(document).ready(function ()
+       if(TableTools_def)
        {
-               oTable = $("#" + container).DataTable({
+               var sDom_def = 'T<"clear">lfrtip';
+       }
+       else
+       {
+               var sDom_def = '<"clear">lfrtip';
+       }
+//     $(document).ready(function ()
+//     {
+               var oTable = $("#" + container).DataTable({
                        paginate:               disablePagination ? false : 
true,
                        filter:                 disableFilter ? false : true,
                        info:                   disableFilter ? false : true,
@@ -175,7 +184,7 @@
                        },
                //      lengthMenu:             JqueryPortico.i18n.lengthmenu(),
                //      language:               JqueryPortico.i18n.datatable(),
-                       columns: columns
+                       columns: columns,
                //      colVis: {
                //                                      exclude: exclude_colvis
                //      },
@@ -183,10 +192,19 @@
                //      stateSave:              true,
                //      stateDuration: -1, //sessionstorage
                //      tabIndex:               1,
-               //      oTableTools: JqueryPortico.TableTools
+                       fnDrawCallback: function () {
+                               if(typeof(local_DrawCallback) == 'function')
+                               {
+                                       DrawCallback(oTable);
+                               }
+                       },
+                       sDom: sDom_def,
+                       oTableTools: TableTools_def
                });
 
-       });
+
+//     });
+       return oTable;
 };
 
 JqueryPortico.updateinlineTableHelper = function(oTable, requestUrl)
@@ -263,3 +281,48 @@
                var strURL = phpGWLink('login.php', oArgs);
                TINY.box.show({iframe:strURL, 
boxid:'frameless',width:$(window).width(),height:400,fixed:false,maskid:'darkmask',maskopacity:40,
 mask:true, animate:true, close: false,closejs:false});
        }
+/*
+ *
+ * {
+                               sSwfPath: 
"phpgwapi/js/DataTables/extensions/TableTools/swf/copy_csv_xls_pdf.swf",
+                               sRowSelect: "multi",
+                               aButtons: [
+                                                               "select_all",
+                                                               "select_none",
+                                                               {
+                                                                       
sExtends: "select",
+                                                                       
sButtonText: "email",
+                                                                       
fnClick:        function (nButton, oConfig, oFlash) {
+
+                                                                           var 
oTT = TableTools.fnGetInstance( container );
+                                                                               
var selected = oTT.fnGetSelectedData();
+
+                                                                               
var numSelected =       selected.length;
+
+                                                                               
if (numSelected ==0){
+                                                                               
        alert('None selected');
+                                                                               
        return false;
+                                                                               
}
+                                                                               
for ( var n = 0; n < selected.length; ++n )
+                                                                               
{
+                                                                               
        var aData = selected[n];
+                                                                               
        console.log(aData);
+
+                                                                               
}
+                                                                               
oTable.fnDraw();
+
+                                                                  }
+                                                               },
+                                                               {
+                                                                       
sExtends: "select",
+                                                                       
sButtonText: "SMS",
+                                                                       
fnClick:        function (nButton, oConfig, oFlash) {}
+                                                               },
+                                                               {
+                                                                       
sExtends: "select",
+                                                                       
sButtonText: "delete",
+                                                                       
fnClick:        function (nButton, oConfig, oFlash) {}
+                                                               }
+                                                       ]
+                       }
+ */
\ No newline at end of file

Modified: branches/dev-syncromind/property/inc/class.notify.inc.php
===================================================================
--- branches/dev-syncromind/property/inc/class.notify.inc.php   2014-12-10 
10:35:31 UTC (rev 12428)
+++ branches/dev-syncromind/property/inc/class.notify.inc.php   2014-12-10 
10:42:16 UTC (rev 12429)
@@ -148,14 +148,14 @@
                        if(!isset($data['count']))
                        {
                                throw new 
Exception("property_notify::get_yui_table_def() - Missing count in input");
-                       }       
+                       }
 
                        $content = array();
 
                        if(isset($data['location_id']) && 
isset($data['location_item_id']))
                        {
                                $content = $this->read($data);
-                       }       
+                       }
 
                        $count = (int)$data['count'];
                        $datavalues = array
@@ -258,6 +258,160 @@
                        return array('datavalues' => $datavalues, 'column_defs' 
=> $column_defs, 'buttons' => $buttons);
                }
 
+               /**
+                * Get definition for an inline jquery table
+                *
+                * @param array $data location and the number of preceding 
tables in the same page
+                * @return array table def data and prepared content.
+                */
+
+               public function get_jquery_table_def($data = array())
+               {
+                       if(!isset($data['count']))
+                       {
+                               throw new 
Exception("property_notify::get_yui_table_def() - Missing count in input");
+                       }
+
+                       if(!isset($data['requestUrl']) || !$requestUrl = 
$data['requestUrl'])
+                       {
+                               throw new 
Exception("property_notify::get_yui_table_def() - Missing requestUrl in input");
+                       }
+
+                       $requestUrl = str_replace('&amp;', '&', $requestUrl);
+
+                       $content = array();
+
+                       if(isset($data['location_id']) && 
isset($data['location_item_id']))
+                       {
+                               $content = $this->read($data);
+                       }
+
+                       $count = (int)$data['count'];
+                       $datavalues = array
+                       (
+                               'name'                                  => 
"{$count}",
+                               'values'                                => 
json_encode($content),
+                               'total_records'                 => 
count($content),
+                               'edit_action'                   => 
json_encode($GLOBALS['phpgw']->link('/index.php',array('menuaction'=> 
'addressbook.uiaddressbook.view_person'))),
+                               'is_paginator'                  => 1,
+                               'footer'                                => 0
+                       );
+
+                       $column_defs = array
+                       (
+                               'name'          => "{$count}",
+                               'values'        =>      array(  array('key' => 
'id','hidden' => true),
+                                                                               
                        array('key' => 
'contact_id','label'=>lang('id'),'sortable'=>false,'resizeable'=>true,'formatter'=>'formatLink_notify'),
+                                                                               
                        array('key' => 'first_name','label'=>lang('first 
name'),'sortable'=>true,'resizeable'=>true),
+                                                                               
                        array('key' => 'last_name','label'=>lang('last 
name'),'sortable'=>true,'resizeable'=>true),
+                                                                               
                        array('key' => 
'email','label'=>lang('email'),'sortable'=>false,'resizeable'=>true),
+                                                                               
                        array('key' => 
'sms','label'=>'SMS','sortable'=>false,'resizeable'=>true),
+                                                                               
                        array('key' => 
'notification_method','label'=>lang('method'),'sortable'=>true,'resizeable'=>true),
+                                                                               
                        array('key' => 
'is_active_text','label'=>lang('active'),'sortable'=>true,'resizeable'=>true),
+                                                                               
                        array('key' => 
'entry_date','label'=>lang('entry_date'),'sortable'=>true,'resizeable'=>true)
+                                                                               
                        )
+                       );
+
+                       $buttons = array
+                       (
+                               array('id' =>'email','type'=>'buttons', 
'value'=>'email', 'label'=> lang('email'), 'funct'=> 'onActionsClick_notify' , 
'classname'=> 'actionButton', 'value_hidden'=>""),
+                               array('id' =>'sms','type'=>'buttons', 
'value'=>'sms', 'label'=> 'SMS', 'funct'=> 'onActionsClick_notify' , 
'classname'=> 'actionButton', 'value_hidden'=>""),
+                               array('id' =>'enable','type'=>'buttons', 
'value'=>'enable', 'label'=> lang('enable'), 'funct'=> 'onActionsClick_notify' 
, 'classname'=> 'actionButton', 'value_hidden'=>""),
+                               array('id' =>'disable','type'=>'buttons', 
'value'=>'disable', 'label'=>lang('disable'), 'funct'=> 'onActionsClick_notify' 
, 'classname'=> 'actionButton', 'value_hidden'=>""),
+                               array('id' =>'delete','type'=>'buttons', 
'value'=>'delete', 'label'=> lang('Delete'), 'funct'=> 'onActionsClick_notify' 
, 'classname'=> 'actionButton', 'value_hidden'=>""),
+                       );
+                       $tabletools = <<<JS
+
+                       {
+                               sSwfPath: 
"phpgwapi/js/DataTables/extensions/TableTools/swf/copy_csv_xls_pdf.swf",
+                               sRowSelect: "multi",
+                               aButtons: [
+                                                               "select_all",
+                                                               "select_none"
+JS;
+
+                       foreach($buttons as $entry)
+                       {
+                       $tabletools .= <<<JS
+                       ,
+                       {
+                               sExtends: "select",
+                               sButtonText: "{$entry['value']}",
+                               fnClick:        function (nButton, oConfig, 
oFlash) {
+
+                                       var oTT = TableTools.fnGetInstance( 
'datatable-container_{$count}' );
+                                       var selected = oTT.fnGetSelectedData();
+
+                                       var numSelected =       selected.length;
+
+                                       if (numSelected ==0){
+                                               alert('None selected');
+                                               return false;
+                                       }
+                                       var ids = [];
+                                       for ( var n = 0; n < selected.length; 
++n )
+                                       {
+                                               var aData = selected[n];
+                                               ids.push(aData['id']);
+                                       }
+                                       {$entry['funct']}('{$entry['id']}', 
ids);
+                                       
JqueryPortico.updateinlineTableHelper(oTable{$count}, {$requestUrl});
+                          }
+                       }
+
+JS;
+                       }
+
+                       $tabletools .= <<<JS
+
+                               ]
+                       }
+JS;
+
+                       $GLOBALS['phpgw']->js->validate_file( 'portico', 
'notify', 'property' );
+
+                       $lang_view = lang('view');
+                       $code = <<<JS
+
+       var notify_lang_view = "{$lang_view}";
+       var notify_lang_alert = "Posten må lagres før kontakter kan tilordnes";
+
+       this.refresh_notify_contact=function(contact_id)
+       {
+               requestUrl = $requestUrl + '&contact_id='+ contact_id + 
'&action=refresh_notify_contact';
+               JqueryPortico.updateinlineTableHelper(oTable{$count}, 
requestUrl);
+
+               if(document.getElementById('notify_contact').value != 
notify_contact)
+               {
+                       notify_contact = 
document.getElementById('notify_contact').value;
+               }
+       }
+
+       this.onActionsClick_notify=function(type, ids)
+       {
+//             console.log(ids);
+
+               $.ajax({
+                       type: 'POST',
+                       dataType: 'json',
+                       url: $requestUrl,
+                       data:{ids:ids,type:type,notify:true},
+                       success: function(data) {
+                               if( data != null)
+                               {
+
+                               }
+                       }
+                       });
+
+       }
+JS;
+                       $GLOBALS['phpgw']->js->add_code($namespace, $code);
+
+                       return array('datavalues' => $datavalues, 'column_defs' 
=> $column_defs, 'tabletools' => $tabletools);
+               }
+
+
                public function update_data()
                {
                        $action = phpgw::get_var('action', 'string', 'GET');
@@ -284,37 +438,41 @@
                        }
 
                        $update = false;
+                       $type = phpgw::get_var('type');
                        if($notify = phpgw::get_var('notify'))
                        {
                                $ids = $notify['ids'];
+                               $ids = phpgw::get_var('ids');
+//                             _debug_array($ids);
                                if($ids)
                                {
                                        $value_set = array();
 
-                                       if($notify['email'])
+                                       switch($type)
                                        {
-                                               
$value_set['notification_method'] = 'email';
-                                       }       
-                                       else if($notify['sms'])
-                                       {
-                                               
$value_set['notification_method'] = 'sms';
-                                       }       
-                                       else if($notify['enable'])
-                                       {
-                                               $value_set['is_active'] = 1;
-                                       }       
-                                       else if($notify['disable'])
-                                       {
-                                               $value_set['is_active'] = '';
-                                       }       
-                                       else if($notify['delete'])
-                                       {
-                                               $sql = "DELETE FROM 
phpgw_notification WHERE id IN (". implode(',', $ids) . ')';
-                                       }       
-                                       
+                                               case 'email':
+                                                       
$value_set['notification_method'] = 'email';
+                                                       break;
+                                               case 'sms':
+                                                       
$value_set['notification_method'] = 'sms';
+                                                       break;
+                                               case 'enable':
+                                                       $value_set['is_active'] 
= 1;
+                                                       break;
+                                               case 'disable':
+                                                       $value_set['is_active'] 
= '';
+                                                       break;
+                                               case 'delete':
+                                                       $sql = "DELETE FROM 
phpgw_notification WHERE id IN (". implode(',', $ids) . ')';
+                                                       break;
+                                               default:
+                                                       break;
+                                       }
+
                                        if($value_set)
                                        {
                                                $value_set      = 
$this->_db->validate_update($value_set);
+//                                             _debug_array("UPDATE 
phpgw_notification SET {$value_set} WHERE id IN (". implode(',', $ids) . ')');
                                                $sql = "UPDATE 
phpgw_notification SET {$value_set} WHERE id IN (". implode(',', $ids) . ')';
                                        }
                                        
$this->_db->query($sql,__LINE__,__FILE__);                      
@@ -348,15 +506,16 @@
 
                        if( phpgw::get_var('phpgw_return_as') == 'json' )
                        {
+                               $result_data = array
+                               (
+                                       'data'                          => 
$content,
+                                       'total_records'         => 
$total_records,
+                                       'draw'                          => 
phpgw::get_var('draw', 'int'),
+                                       'recordsTotal'          => 
$total_records,
+                                       'recordsFiltered'       =>$total_records
+                               );
 
-                               if(count($content))
-                               {
-                                       return json_encode($content);
-                               }
-                               else
-                               {
-                                       return "";
-                               }
+                               return $result_data;
                        }
                        return $content;
                }

Modified: branches/dev-syncromind/property/inc/class.uilookup.inc.php
===================================================================
--- branches/dev-syncromind/property/inc/class.uilookup.inc.php 2014-12-10 
10:35:31 UTC (rev 12428)
+++ branches/dev-syncromind/property/inc/class.uilookup.inc.php 2014-12-10 
10:42:16 UTC (rev 12429)
@@ -318,7 +318,7 @@
                        //trigger ajax-call
                        $function_exchange_values .= 
"opener.document.getElementsByName('{$contact_id}')[0].setAttribute('{$contact_id}','{$contact_id}',0);\r\n";
                        //Reset - waiting for next change
-                       $function_exchange_values .= 
"opener.document.getElementsByName('{$contact_id}')[0].removeAttribute('{$contact_id}');\r\n";
+//                     $function_exchange_values .= 
"opener.document.getElementsByName('{$contact_id}')[0].removeAttribute('{$contact_id}');\r\n";
 
                        $function_exchange_values .= 'window.close()';
 

Modified: branches/dev-syncromind/property/inc/class.uitts.inc.php
===================================================================
--- branches/dev-syncromind/property/inc/class.uitts.inc.php    2014-12-10 
10:35:31 UTC (rev 12428)
+++ branches/dev-syncromind/property/inc/class.uitts.inc.php    2014-12-10 
10:42:16 UTC (rev 12429)
@@ -3206,47 +3206,26 @@
                        $datatable_def[] = array
                        (
                                'container'             => 
'datatable-container_0',
-                               'requestUrl'    => 
json_encode(self::link(array('menuaction' => 'property.uitts.get_note', 'id' => 
$id,'phpgw_return_as'=>'json'))),
+                               'requestUrl'    => "''",
                                'ColumnDefs'    => $note_def,
                                'data'                  => 
json_encode($additional_notes)
                        );
 
                        //_debug_Array($additional_notes);die();
-                       //---datatable 
settings---------------------------------------------------      
-                       $datavalues[0] = array
-                               (
-                                       'name'                                  
=> "0",
-                                       'values'                                
=> json_encode($additional_notes),
-                                       'total_records'                 => 
count($additional_notes),
-                                       'is_paginator'                  => 0,
-                                       'edit_action'                   => "''",
-                                       'footer'                                
=> 0
-                               );                                      
-                       $myColumnDefs[0] = array
-                               (
-                                       'name'          => "0",
-                                       'values'        =>      
json_encode($note_def)
-                               );              
-                       $datavalues[1] = array
-                               (
-                                       'name'                                  
=> "1",
-                                       'values'                                
=> json_encode($record_history),
-                                       'total_records'                 => 
count($record_history),
-                                       'is_paginator'                  => 0,
-                                       'edit_action'                   => "''",
-                                       'footer'                                
=> 0
-                               );                                      
-                       $myColumnDefs[1] = array
-                               (
-                                       'name'          => "1",
-                                       'values'        =>      
json_encode(array(      array('key' => 'value_date',    'label'=>lang('Date'),  
'sortable'=>true,'resizeable'=>true),
+                       //---datatable 
settings---------------------------------------------------
+
+                       $datatable_def[] = array
+                       (
+                               'container'             => 
'datatable-container_1',
+                               'requestUrl'    => "''",
+                               'ColumnDefs'    => array(array('key' => 
'value_date',   'label'=>lang('Date'),  'sortable'=>true,'resizeable'=>true),
                                                                                
                                array('key' => 'value_user',    
'label'=>lang('User'),  'sortable'=>true,'resizeable'=>true),
                                                                                
                                array('key' => 'value_action',  
'label'=>lang('Action'),        'sortable'=>true,'resizeable'=>true),
                                                                                
                                array('key' => 
'value_old_value','label'=>lang('old value'),    
'sortable'=>true,'resizeable'=>true),
-                                                                               
                                array('key' => 
'value_new_value','label'=>lang('New 
value'),'sortable'=>true,'resizeable'=>true)))
-                               );      
+                                                                               
                                array('key' => 
'value_new_value','label'=>lang('New 
value'),'sortable'=>true,'resizeable'=>true)),
+                               'data'                  => 
json_encode($record_history)
+                       );
 
-
                        $link_to_files = 
(isset($this->bo->config->config_data['files_url'])?$this->bo->config->config_data['files_url']:'');
 
                        $link_view_file = 
$GLOBALS['phpgw']->link('/index.php',$link_file_data);
@@ -3265,16 +3244,6 @@
                                $content_files[$z]['attach_file'] = '<input 
type="checkbox" name="values[file_attach][]" 
value="'.$ticket['files'][$z]['name'].'" title="'.lang('Check to attach 
file').'">';
                        }                                                       
 
-                       $datavalues[2] = array
-                               (
-                                       'name'                                  
=> "2",
-                                       'values'                                
=> json_encode($content_files),
-                                       'total_records'                 => 
count($content_files),
-                                       'permission'                    => "''",
-                                       'is_paginator'                  => 0,
-                                       'edit_action'                   => "''",
-                                       'footer'                                
=> 0
-                               );
 
                        $attach_file_def = array
                                (
@@ -3287,70 +3256,57 @@
                                $attach_file_def[] = array('key' => 
'attach_file','label'=>lang('attach 
file'),'sortable'=>false,'resizeable'=>true,'formatter'=>'FormatterCenter');
                        }
 
-                       $myColumnDefs[2] = array
-                               (
-                                       'name'          => "2",
-                                       'values'        =>      
json_encode($attach_file_def)
-                               );
+                       $datatable_def[] = array
+                       (
+                               'container'             => 
'datatable-container_2',
+                               'requestUrl'    => "''",
+                               'ColumnDefs'    => $attach_file_def,
+                               'data'                  => 
json_encode($content_files)
+                       );
 
 
-                       $myColumnDefs[3] = array
-                               (
-                                       'name'          => "3",
-                                       'values'        =>      
json_encode(array(      array('key' => 'value_email',   'label'=>lang('email'), 
'sortable'=>true,'resizeable'=>true),
-                                                                               
                                array('key' => 
'value_select','label'=>lang('select'),'sortable'=>false,'resizeable'=>true)))
-                               );      
-
-
                        $content_email = 
$this->bocommon->get_vendor_email(isset($ticket['vendor_id'])?$ticket['vendor_id']:0);
 
-                       $datavalues[3] = array
-                               (
-                                       'name'                                  
=> "3",
-                                       'values'                                
=> json_encode($content_email),
-                                       'total_records'                 => 
count($content_email),
-                                       'permission'                    => "''",
-                                       'is_paginator'                  => 0,
-                                       'edit_action'                   => "''",
-                                       'footer'                                
=> 0
-                               );
+                       $datatable_def[] = array
+                       (
+                               'container'             => 
'datatable-container_3',
+                               'requestUrl'    => "''",
+                               'ColumnDefs'    => array(array('key' => 
'value_email',  'label'=>lang('email'), 'sortable'=>true,'resizeable'=>true),
+                                                                               
array('key' => 
'value_select','label'=>lang('select'),'sortable'=>false,'resizeable'=>true)),
+                               'data'                  => 
json_encode($content_email)
+                       );
 
-                       $myColumnDefs[4] = array
-                               (
-                                       'name'          => "4",
-                                       'values'        =>      
json_encode(array(      array('key' => 
'period','label'=>lang('period'),'sortable'=>true,'resizeable'=>true),
-                                                                               
                                array('key' => 
'amount','label'=>lang('amount'),'sortable'=>true,'resizeable'=>true, 
'formatter'=> 'FormatterAmount2'),
-                                                                               
                                array('key' => 
'remark','label'=>lang('remark'),'sortable'=>false,'resizeable'=>true)))
-                               );
-
                        $payments = $this->bo->get_payments($id);
 
-                       $datavalues[4] = array
-                               (
-                                       'name'                                  
=> "4",
-                                       'values'                                
=> json_encode($payments),
-                                       'total_records'                 => 
count($payments),
-                                       'permission'                    => "''",
-                                       'is_paginator'                  => 1,
-                                       'edit_action'                   => "''",
-                                       'footer'                                
=> 0
-                               );
+                       $datatable_def[] = array
+                       (
+                               'container'             => 
'datatable-container_4',
+                               'requestUrl'    => "''",
+                               'ColumnDefs'    => array(array('key' => 
'period','label'=>lang('period'),'sortable'=>true,'resizeable'=>true),
+                                                                               
                                array('key' => 
'amount','label'=>lang('amount'),'sortable'=>true,'resizeable'=>true, 
'formatter'=> 'FormatterAmount2'),
+                                                                               
                                array('key' => 
'remark','label'=>lang('remark'),'sortable'=>false,'resizeable'=>true)),
+                               'data'                  => 
json_encode($payments)
+                       );
 
-
                        $location_id    = 
$GLOBALS['phpgw']->locations->get_id('property', $this->acl_location);
-                       $notify_info = 
execMethod('property.notify.get_yui_table_def',array
+                       $notify_info = 
execMethod('property.notify.get_jquery_table_def',array
                                                                (
                                                                        
'location_id'           => $location_id,
                                                                        
'location_item_id'      => $id,
-                                                                       'count' 
                        => count($myColumnDefs)
+                                                                       'count' 
                        => count($datatable_def),
+                                                                       
'requestUrl'            => json_encode(self::link(array('menuaction' => 
'property.notify.update_data', 'location_id'=>$location_id, 
'location_item_id'=>$id,'action' 
=>'refresh_notify_contact','phpgw_return_as'=>'json'))),
                                                                )
                                                        );
-                       
-                       $datavalues[]   = $notify_info['datavalues'];
-                       $myColumnDefs[] = $notify_info['column_defs'];
-                       $myButtons              = array();
-                       $myButtons[]    = $notify_info['buttons'];
 
+                       $datatable_def[] = array
+                       (
+                               'container'             => 
'datatable-container_5',
+                               'requestUrl'    => 
json_encode(self::link(array('menuaction' => 'property.notify.update_data', 
'location_id'=>$location_id, 'location_item_id'=>$id,'action' 
=>'refresh_notify_contact','phpgw_return_as'=>'json'))),
+                               'ColumnDefs'    => 
$notify_info['column_defs']['values'],
+                               'data'                  => json_encode(array()),
+                               'tabletools'    => $notify_info['tabletools']
+                       );
+
                        $_filter_buildingpart = array();
                        $filter_buildingpart = 
isset($this->bo->config->config_data['filter_buildingpart']) ? 
$this->bo->config->config_data['filter_buildingpart'] : array();
                        
@@ -3452,9 +3408,6 @@
                                        'base_java_url'                         
        => "{menuaction:'property.uitts.update_data',id:{$id}}",
                                        'base_java_notify_url'                  
=> 
"{menuaction:'property.notify.update_data',location_id:{$location_id},location_item_id:'{$id}'}",
                                        'property_js'                           
        => json_encode($GLOBALS['phpgw_info']['server']['webserver_url'] . 
$property_js),
-                                       'datatable'                             
                => $datavalues,
-                                       'myColumnDefs'                          
        => $myColumnDefs,
-                                       'myButtons'                             
                => $myButtons,
                                        'value_origin'                          
        => $ticket['origin'],
                                        'value_target'                          
        => $ticket['target'],
                                        'value_finnish_date'                    
=> $ticket['finnish_date'],

Added: branches/dev-syncromind/property/js/portico/notify.js
===================================================================
--- branches/dev-syncromind/property/js/portico/notify.js                       
        (rev 0)
+++ branches/dev-syncromind/property/js/portico/notify.js       2014-12-10 
10:42:16 UTC (rev 12429)
@@ -0,0 +1,40 @@
+
+var notify_contact = 0;
+
+       formatLink_notify = function(key, oData)
+       {
+               var oArgs = 
{menuaction:'addressbook.uiaddressbook.view_person',ab_id:oData[key]};
+               var strURL = phpGWLink('index.php', oArgs);
+               return "<a href="+strURL+" 
title='"+oData[key]+"'>"+notify_lang_view+"</a>";
+       };
+
+/*     var FormatterRight_notify = function(elCell, oRecord, oColumn, oData)
+       {
+               elCell.innerHTML = "<div align=\"right\">"+oData+"</div>";
+       }       */
+       
+       this.notify_contact_lookup = function()
+       {
+               if(!base_java_notify_url['location_item_id'])
+               {
+                       alert(notify_lang_alert); // notify_lang_alert is 
defined in php-class property_notify::get_yui_table_def()
+                       return;
+               }       
+               var oArgs = 
{menuaction:'property.uilookup.addressbook',column:'notify_contact'};
+               var strURL = phpGWLink('index.php', oArgs);
+               
Window1=window.open(strURL,"Search","left=50,top=100,width=800,height=700,toolbar=no,scrollbars=yes,resizable=yes");
+       }               
+
+/* This one is added dynamically from php-class 
property_notify::get_jquery_table_def()
+       this.refresh_notify_contact=function()
+       {
+       }
+*/
+
+$(document).ready(function(){
+
+       $("#notify_contact").bind('DOMAttrModified propertychange', 
function(evt)
+       {
+               refresh_notify_contact($(this).val());
+       });
+});

Modified: branches/dev-syncromind/property/js/portico/tts.view.js
===================================================================
--- branches/dev-syncromind/property/js/portico/tts.view.js     2014-12-10 
10:35:31 UTC (rev 12428)
+++ branches/dev-syncromind/property/js/portico/tts.view.js     2014-12-10 
10:42:16 UTC (rev 12429)
@@ -20,7 +20,7 @@
 
        if(typeof(tableYUI)=='undefined')
        {
-               tableYUI = 
YAHOO.util.Dom.getElementsByClassName("yui-dt-data","tbody")[2].parentNode;
+               tableYUI = 
YAHOO.util.Dom.getElementsByClassName("yui-dt-data","tbody")[1].parentNode;
                tableYUI.setAttribute("id","tableYUI");
        }
        else

Modified: branches/dev-syncromind/property/templates/base/tts.xsl
===================================================================
--- branches/dev-syncromind/property/templates/base/tts.xsl     2014-12-10 
10:35:31 UTC (rev 12428)
+++ branches/dev-syncromind/property/templates/base/tts.xsl     2014-12-10 
10:42:16 UTC (rev 12429)
@@ -386,8 +386,8 @@
                                                                <div class = 
'pure-u-md-1-2'>
                                                                        <!--  
DATATABLE 0-->
                                                                        <td>
-                                                                               
<div id="paging_0"/>
-                                                                               
<!--div class="pure-table" id="datatable-container_0"/-->
+                                                                               
<!--div id="paging_0"/>
+                                                                               
<div class="pure-table" id="datatable-container_0"/-->
                                                                        </td>
                                                                                
<xsl:for-each select="datatable_def">
                                                                                
                <xsl:if test="container = 'datatable-container_0'">
@@ -543,7 +543,18 @@
                                                                <label>
                                                                        
<xsl:value-of select="php:function('lang', 'files')"/>
                                                                </label>
-                                                               <div 
class="pure-table pure-u-md-1-2" id="datatable-container_2"/>
+                                                               <div 
class="pure-table pure-u-md-1-2" >
+                                                                       
<xsl:for-each select="datatable_def">
+                                                                               
<xsl:if test="container = 'datatable-container_2'">
+                                                                               
        <xsl:call-template name="table_setup">
+                                                                               
          <xsl:with-param name="container" select ='container'/>
+                                                                               
          <xsl:with-param name="requestUrl" select ='requestUrl' />
+                                                                               
          <xsl:with-param name="ColumnDefs" select ='ColumnDefs' />
+                                                                               
          <xsl:with-param name="data" select ='data' />
+                                                                               
        </xsl:call-template>
+                                                                               
</xsl:if>
+                                                                       
</xsl:for-each>
+                                                               </div>
                                                        </div>
                                                </xsl:when>
                                        </xsl:choose>
@@ -561,7 +572,7 @@
                                                                <label>
                                                                        
<xsl:value-of select="php:function('lang', 'notify client by sms')"/>
                                                                </label>
-                                                               <table>
+                                                                       <table 
class="pure-table pure-u-md-1-2">
                                                                        <tr>
                                                                                
<td>
                                                                                
        <input type="checkbox" name="notify_client_by_sms" value="true">
@@ -593,7 +604,6 @@
                                                                        
<xsl:attribute name="title">
                                                                                
<xsl:value-of select="php:function('lang', 'response')"/>
                                                                        
</xsl:attribute>
-                                                                       
<xsl:value-of select="value_order_descr"/>
                                                                </textarea>
                                                        </div>
                                                        <div 
class="pure-control-group">
@@ -752,8 +762,19 @@
                                                                                
</label>
                                                                                
                
                                                                                
<div class = 'pure-u-md-1-3'>
-                                                                               
        <div  id="paging_4"> </div>
-                                                                               
        <div class="pure-table" id="datatable-container_4"/>
+                                                                               
        <!--div  id="paging_4"> </div>
+                                                                               
        <div class="pure-table" id="datatable-container_4"/-->
+                                                                               
        <xsl:for-each select="datatable_def">
+                                                                               
                <xsl:if test="container = 'datatable-container_4'">
+                                                                               
                        <xsl:call-template name="table_setup">
+                                                                               
                          <xsl:with-param name="container" select ='container'/>
+                                                                               
                          <xsl:with-param name="requestUrl" select 
='requestUrl' />
+                                                                               
                          <xsl:with-param name="ColumnDefs" select 
='ColumnDefs' />
+                                                                               
                          <xsl:with-param name="data" select ='data' />
+                                                                               
                        </xsl:call-template>
+                                                                               
                </xsl:if>
+                                                                               
        </xsl:for-each>
+
                                                                                
</div>
                                                                        </div>
                                                                        <div 
class="pure-control-group">
@@ -830,8 +851,18 @@
                                                                                
                        </select>
                                                                                
                </td>
                                                                                
                <td>
-                                                                               
                        <div id="paging_3"/>
-                                                                               
                        <div class="pure-table" id="datatable-container_3"/>
+                                                                               
                        <!--div id="paging_3"/>
+                                                                               
                        <div class="pure-table" id="datatable-container_3"/-->
+                                                                               
                        <xsl:for-each select="datatable_def">
+                                                                               
                                <xsl:if test="container = 
'datatable-container_3'">
+                                                                               
                                        <xsl:call-template name="table_setup">
+                                                                               
                                          <xsl:with-param name="container" 
select ='container'/>
+                                                                               
                                          <xsl:with-param name="requestUrl" 
select ='requestUrl' />
+                                                                               
                                          <xsl:with-param name="ColumnDefs" 
select ='ColumnDefs' />
+                                                                               
                                          <xsl:with-param name="data" select 
='data' />
+                                                                               
                                        </xsl:call-template>
+                                                                               
                                </xsl:if>
+                                                                               
                        </xsl:for-each>
                                                                                
                </td>
                                                                                
        </tr>
                                                                                
        <tr>
@@ -903,15 +934,37 @@
                                                        <xsl:value-of 
select="php:function('lang', 'notify')"/>
                                                </label>
                                        
-                                               <div id="paging_5"> </div>
+                                               <!--div id="paging_5"> </div>
                                                <div class="pure-table" 
id="datatable-container_5"/>
-                                               <div id="datatable-buttons_5"/>
+                                               <div 
id="datatable-buttons_5"/-->
+                                               <xsl:for-each 
select="datatable_def">
+                                                       <xsl:if test="container 
= 'datatable-container_5'">
+                                                               
<xsl:call-template name="table_setup">
+                                                                 
<xsl:with-param name="container" select ='container'/>
+                                                                 
<xsl:with-param name="requestUrl" select ='requestUrl' />
+                                                                 
<xsl:with-param name="ColumnDefs" select ='ColumnDefs' />
+                                                                 
<xsl:with-param name="data" select ='data' />
+                                                                 
<xsl:with-param name="tabletools" select ='tabletools' />
+                                                               
</xsl:call-template>
+                                                       </xsl:if>
+                                               </xsl:for-each>
                                        </div>
                                </fieldset>
                        </div>
                        <div id="history">
-                               <div id="paging_1"/>
-                               <div class="pure-table" 
id="datatable-container_1"/>
+                               <!--div id="paging_1"/>
+                               <div class="pure-table" 
id="datatable-container_1"/-->
+                               <xsl:for-each select="datatable_def">
+                                               <xsl:if test="container = 
'datatable-container_1'">
+                                                       <xsl:call-template 
name="table_setup">
+                                                         <xsl:with-param 
name="container" select ='container'/>
+                                                         <xsl:with-param 
name="requestUrl" select ='requestUrl' />
+                                                         <xsl:with-param 
name="ColumnDefs" select ='ColumnDefs' />
+                                                         <xsl:with-param 
name="data" select ='data' />
+                                                       </xsl:call-template>
+                                               </xsl:if>
+                               </xsl:for-each>
+
                        </div>
                        <table cellpadding="2" cellspacing="2" width="80%" 
align="center">
                                <tr height="50">
@@ -1044,25 +1097,6 @@
                var myColumnDefs = new Array();
                var myButtons = new Array();
                var td_count = <xsl:value-of select="td_count"/>;
-
-               <xsl:for-each select="datatable">
-                       datatable[<xsl:value-of select="name"/>] = [
-                       {
-                       values:<xsl:value-of select="values"/>,
-                       total_records: <xsl:value-of select="total_records"/>,
-                       is_paginator:  <xsl:value-of select="is_paginator"/>,
-                       edit_action:  <xsl:value-of select="edit_action"/>,
-                       <!--permission:<xsl:value-of select="permission"/>, -->
-                       footer:<xsl:value-of select="footer"/>
-                       }
-                       ]
-               </xsl:for-each>
-               <xsl:for-each select="myColumnDefs">
-                       myColumnDefs[<xsl:value-of select="name"/>] = 
<xsl:value-of select="values"/>
-               </xsl:for-each>
-               <xsl:for-each select="myButtons">
-                       myButtons[<xsl:value-of select="name"/>] = 
<xsl:value-of select="values"/>
-               </xsl:for-each>
        </script>
 </xsl:template>
 
@@ -1196,6 +1230,7 @@
                <xsl:param name="requestUrl" />
                <xsl:param name="ColumnDefs" />
                <xsl:param name="data" />
+               <xsl:param name="tabletools" />
                <table id="{$container}" class="display cell-border compact 
responsive no-wrap" width="100%">
                        <thead>
                                <tr>
@@ -1268,9 +1303,15 @@
                        }
        ]]>
                        var options = {disablePagination:true, 
disableFilter:true};
+                       <xsl:if test="$tabletools != ''">
+                               options.TableTools = <xsl:value-of 
disable-output-escaping="yes" select="$tabletools"/>;
+                       </xsl:if>
 
-                       JqueryPortico.inlineTableHelper("<xsl:value-of 
select="$container"/>", <xsl:value-of select="$requestUrl"/>, columns, options, 
<xsl:value-of select="$data"/>);
-
+                       <xsl:variable name="num">
+                               <xsl:number count="*"/>
+                       </xsl:variable>
+                       var oTable<xsl:number value="($num - 1)"/> = 
JqueryPortico.inlineTableHelper("<xsl:value-of select="$container"/>", 
<xsl:value-of select="$requestUrl"/>, columns, options, <xsl:value-of 
select="$data"/>);
+ 
                </script>
 
        </xsl:template>
\ No newline at end of file




reply via email to

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