fmsystem-commits
[Top][All Lists]
Advanced

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

[Fmsystem-commits] [15244] Backport 15229:15243 from Syncromind


From: sigurdne
Subject: [Fmsystem-commits] [15244] Backport 15229:15243 from Syncromind
Date: Wed, 1 Jun 2016 09:44:14 +0000 (UTC)

Revision: 15244
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=15244
Author:   sigurdne
Date:     2016-06-01 09:44:13 +0000 (Wed, 01 Jun 2016)
Log Message:
-----------
Backport 15229:15243 from Syncromind

Modified Paths:
--------------
    trunk/phpgwapi/js/jquery/common.js
    trunk/phpgwapi/templates/base/datatable_inline.xsl
    trunk/property/inc/class.uientity.inc.php
    trunk/property/inc/class.uigeneric_document.inc.php
    trunk/property/inc/class.uilocation.inc.php
    trunk/property/js/portico/entity.edit.js
    trunk/property/js/portico/generic_document.edit.js
    trunk/property/js/portico/location.edit.js
    trunk/property/templates/base/generic_document.xsl
    trunk/property/templates/base/location.xsl

Property Changed:
----------------
    trunk/


Property changes on: trunk
___________________________________________________________________
Modified: svn:mergeinfo
   - /branches/dev-syncromind:13653
/branches/dev-syncromind-2:14937-15027,15165-15215,15223-15228
/branches/stavangerkommune:12743-12875,12986
   + /branches/dev-syncromind:13653
/branches/dev-syncromind-2:14937-15027,15165-15215,15223-15228,15230-15243
/branches/stavangerkommune:12743-12875,12986

Modified: trunk/phpgwapi/js/jquery/common.js
===================================================================
--- trunk/phpgwapi/js/jquery/common.js  2016-06-01 09:38:59 UTC (rev 15243)
+++ trunk/phpgwapi/js/jquery/common.js  2016-06-01 09:44:13 UTC (rev 15244)
@@ -381,11 +381,11 @@
                ajax: ajax_def,
                fnServerParams: function (aoData)
                {                       
-                       if (eval('paramsTable' + 
container.substr(container.length -1, 1)).length)
+                       if (!$.isEmptyObject(eval('paramsTable' + 
container.substr(container.length -1, 1))))
                        {       
                                $.each(eval('paramsTable' + 
container.substr(container.length -1, 1)), function (k, v)
                                {
-                                       aoData[v.name] = v.value;
+                                       aoData[k] = v;
                                });
                        }
 

Modified: trunk/phpgwapi/templates/base/datatable_inline.xsl
===================================================================
--- trunk/phpgwapi/templates/base/datatable_inline.xsl  2016-06-01 09:38:59 UTC 
(rev 15243)
+++ trunk/phpgwapi/templates/base/datatable_inline.xsl  2016-06-01 09:44:13 UTC 
(rev 15244)
@@ -385,7 +385,7 @@
                        </xsl:choose>
                </xsl:variable>
 //             $(document).ready(function() {
-               var paramsTable<xsl:number value="$num"/> = [];
+               var paramsTable<xsl:number value="$num"/> = {};
                oTable<xsl:number value="$num"/> = 
JqueryPortico.inlineTableHelper("<xsl:value-of select="$container"/>", 
<xsl:value-of select="$requestUrl"/>, columns<xsl:number value="$num"/>, 
options<xsl:number value="$num"/> , <xsl:value-of select="$dataset"/>);
 //     });
        </script>

Modified: trunk/property/inc/class.uientity.inc.php
===================================================================
--- trunk/property/inc/class.uientity.inc.php   2016-06-01 09:38:59 UTC (rev 
15243)
+++ trunk/property/inc/class.uientity.inc.php   2016-06-01 09:44:13 UTC (rev 
15244)
@@ -2051,6 +2051,23 @@
                                        }
                                        $doc_type_filter = 
$categories['cat_list'];
                                
+                                       $documents_tabletools = array
+                                               (
+                                               'my_name' => 'add',
+                                               'text' => lang('add new 
document'),
+                                               'type' => 'custom',
+                                               'className' => 'add',
+                                               'custom_code' => "
+                                                               var oArgs = " . 
json_encode(array(
+                                                                       
'menuaction' => 'property.uidocument.edit',                                     
                
+                                                                       
'p_entity_id' => $this->entity_id,
+                                                                       
'p_cat_id' => $this->cat_id,
+                                                                       'p_num' 
=> $values['num']
+                                               )) . ";
+                                                               
newDocument(oArgs);
+                                                       "
+                                       );
+                                       
                                        $documents_def = array
                                                (
                                                array('key' => 'document_name', 
'label' => lang('name'), 'sortable' => false, 'resizeable' => true),
@@ -2063,6 +2080,7 @@
                                                'requestUrl' => 
json_encode(self::link(array('menuaction' => 'property.uientity.get_documents', 
                                                        'location_id' => 
$location_id, 'entity_id' => $this->entity_id, 'cat_id' => $this->cat_id, 'num' 
=> $values['num'], 'phpgw_return_as' => 'json'))),
                                                'data' => "",
+                                               'tabletools' => 
$documents_tabletools,
                                                'ColumnDefs' => $documents_def,
                                                'config' => array(
                                                        array('disableFilter' 
=> true)

Modified: trunk/property/inc/class.uigeneric_document.inc.php
===================================================================
--- trunk/property/inc/class.uigeneric_document.inc.php 2016-06-01 09:38:59 UTC 
(rev 15243)
+++ trunk/property/inc/class.uigeneric_document.inc.php 2016-06-01 09:44:13 UTC 
(rev 15244)
@@ -274,6 +274,7 @@
                {
                        $type_id = phpgw::get_var('type_id', 'int');
                        $file_id = phpgw::get_var('id', 'int');
+                       $only_related = phpgw::get_var('only_related', 
'boolean');
 
                        if (!$type_id)
                        {
@@ -319,7 +320,12 @@
                        foreach($locations as $item)
                        {
                                $checked = in_array($item['id'], 
$values_location_item_id) ? 'checked="checked"' : '';
-
+                               
+                               if ($only_related && empty($checked))
+                               {
+                                       continue;
+                               }
+                               
                                $values[] = array(
                                        'location_code' => 
$item['location_code'],
                                        'loc1_name' => $item['loc1_name'],
@@ -329,7 +335,7 @@
 
                        $result_data = array('results' => $values);
 
-                       $result_data['total_records'] = 
$solocation->total_records;
+                       $result_data['total_records'] = ($only_related) ? 
count($values_location_item_id) : $solocation->total_records;
                        $result_data['draw'] = $draw;
 
                        return $this->jquery_results($result_data);
@@ -450,8 +456,7 @@
                                        'requestUrl' => 
json_encode(self::link(array('menuaction' => 
'property.uigeneric_document.get_componentes',
                                                        'id' => $id, 
'location_id' => $values_location[0]['id'], 'phpgw_return_as' => 'json'))),
                                        'ColumnDefs' => $related_def,
-                                       'tabletools' => ($mode == 'edit') ? 
$tabletools : array(),
-                                       'config' => array(array('disableFilter' 
=> true))
+                                       'tabletools' => ($mode == 'edit') ? 
$tabletools : array()
                                );
                                
                                $related_def2 = array
@@ -673,6 +678,7 @@
                        $location_id = phpgw::get_var('location_id', 'int');
                        $search = phpgw::get_var('search');
                        $draw = phpgw::get_var('draw', 'int');
+                       $only_related = phpgw::get_var('only_related', 
'boolean');
                        
             $soentity = CreateObject('property.soentity');
             $_components = $soentity->read( array(
@@ -703,15 +709,20 @@
                        {
                                $checked = in_array($item['id'], 
$values_location_item_id) ? 'checked="checked"' : '';
 
+                               if ($only_related && empty($checked))
+                               {
+                                       continue;
+                               }
+                               
                                $values[] = array(
                                        'name' => $item['benevnelse'],
                                        'relate' => '<input 
value="'.$item['id'].'" class="components mychecks" type="checkbox" 
'.$checked.'>',
-                               );                              
+                               );
                        }
                        
                        $result_data = array('results' => $values);
 
-                       $result_data['total_records'] = 
$soentity->total_records;
+                       $result_data['total_records'] = ($only_related) ? 
count($values_location_item_id) : $soentity->total_records;
                        $result_data['draw'] = $draw;
 
                        return $this->jquery_results($result_data);

Modified: trunk/property/inc/class.uilocation.inc.php
===================================================================
--- trunk/property/inc/class.uilocation.inc.php 2016-06-01 09:38:59 UTC (rev 
15243)
+++ trunk/property/inc/class.uilocation.inc.php 2016-06-01 09:44:13 UTC (rev 
15244)
@@ -2019,33 +2019,43 @@
                                }
 
                                $location_type_info = 
$this->soadmin_location->read_single($type_id);
-                               $documents = array();
-
-                               /*if ($location_type_info['list_documents'])
+                               $doc_type_filter = array();
+                               
+                               if ($location_type_info['list_documents'])
                                {
-                                       $objDocument = 
CreateObject('property.sodocument');
-                                       $documents = 
$objDocument->get_files_at_location(array('location_code' => $location_code));
-                               }*/
+                                       $documents = 1;
+                                       
+                                       $cats = 
CreateObject('phpgwapi.categories', -1, 'property', '.document');
+                                       $cats->supress_info = true;
+                                       $categories = 
$cats->formatted_xslt_list(array('format' => 'filter', 'selected' => 0,
+                                               'globals' => true, 'use_acl' => 
true));
+                                       $default_value = array('cat_id' => '', 
'name' => lang('no document type'));
+                                       array_unshift($categories['cat_list'], 
$default_value);
 
-                               $cats = CreateObject('phpgwapi.categories', -1, 
'property', '.document');
-                               $cats->supress_info = true;
-                               $categories = 
$cats->formatted_xslt_list(array('format' => 'filter', 'selected' => 0,
-                                       'globals' => true, 'use_acl' => true));
-                               $default_value = array('cat_id' => '', 'name' 
=> lang('no document type'));
-                               array_unshift($categories['cat_list'], 
$default_value);
+                                       foreach ($categories['cat_list'] as & 
$_category)
+                                       {
+                                               $_category['id'] = 
$_category['cat_id'];
+                                       }
 
-                               foreach ($categories['cat_list'] as & 
$_category)
-                               {
-                                       $_category['id'] = $_category['cat_id'];
-                               }
-
-                               $doc_type_filter = $categories['cat_list'];
-               
-                               //if (count($documents))
-                               //{
+                                       $doc_type_filter = 
$categories['cat_list'];
+                               
                                        $tabs['document'] = array('label' => 
lang('document'), 'link' => '#document');
-                                       //$documents = json_encode($documents);
                                        
+                                       $documents_tabletools = array
+                                               (
+                                               'my_name' => 'add',
+                                               'text' => lang('add new 
document'),
+                                               'type' => 'custom',
+                                               'className' => 'add',
+                                               'custom_code' => "
+                                                               var oArgs = " . 
json_encode(array(
+                                                                       
'menuaction' => 'property.uidocument.edit',                                     
                
+                                                                       
'location_code' => $location_code
+                                               )) . ";
+                                                               
newDocument(oArgs);
+                                                       "
+                                       );
+                                       
                                        $documents_def = array
                                                (
                                                array('key' => 'document_name', 
'label' => lang('name'), 'sortable' => false, 'resizeable' => true),
@@ -2057,12 +2067,13 @@
                                                'container' => 
'datatable-container_0',
                                                'requestUrl' => 
json_encode(self::link(array('menuaction' => 
'property.uilocation.get_documents', 'location_code' => $location_code, 
'phpgw_return_as' => 'json'))),
                                                'data' => "",
+                                               'tabletools' => 
$documents_tabletools,
                                                'ColumnDefs' => $documents_def,
                                                'config' => array(
                                                        array('disableFilter' 
=> true)
                                                )
                                        );                              
-                               //}
+                               }
 
                                /*$_dirname = '';
 
@@ -2419,7 +2430,7 @@
                                'textareacols' => 
isset($GLOBALS['phpgw_info']['user']['preferences']['property']['textareacols'])
 && $GLOBALS['phpgw_info']['user']['preferences']['property']['textareacols'] ? 
$GLOBALS['phpgw_info']['user']['preferences']['property']['textareacols'] : 40,
                                'textarearows' => 
isset($GLOBALS['phpgw_info']['user']['preferences']['property']['textarearows'])
 && $GLOBALS['phpgw_info']['user']['preferences']['property']['textarearows'] ? 
$GLOBALS['phpgw_info']['user']['preferences']['property']['textarearows'] : 6,
                                'tabs' => 
phpgwapi_jquery::tabview_generate($tabs, 'general'),
-                               //'documents' => $documents,
+                               'documents' => $documents,
                                //'file_tree' => $file_tree,
                                'lang_expand_all' => lang('expand all'),
                                'lang_collapse_all' => lang('collapse all'),

Modified: trunk/property/js/portico/entity.edit.js
===================================================================
--- trunk/property/js/portico/entity.edit.js    2016-06-01 09:38:59 UTC (rev 
15243)
+++ trunk/property/js/portico/entity.edit.js    2016-06-01 09:44:13 UTC (rev 
15244)
@@ -225,18 +225,8 @@
 {
        $('#doc_type').change( function()
        {
-               //oTable7.dataTableSettings[6]['ajax']['data']['doc_type'] = 
$(this).val();
-               paramsTable7.push( { "name": 'doc_type', "value": $(this).val() 
} );
+               paramsTable7['doc_type'] = $(this).val();
                oTable7.fnDraw();                               
-
-               /*var oTable = $("#datatable-container_7").dataTable();
-               var api = oTable.api();
-               var requestUrl = api.ajax.url();
-               Url = JqueryPortico.parseURL(requestUrl);
-               oArgs = Url.searchObject;
-               oArgs.doc_type = $(this).val();
-               requestUrl = phpGWLink('index.php', oArgs, true);
-               api.ajax.url(requestUrl).load();*/
        });
 
        $("#workorder_cancel").on("submit", function (e)
@@ -250,11 +240,6 @@
 //             parent.hide_popupBox();
        });
 
-});
-
-
-$(document).ready(function ()
-{
        var click_action_on_table = false;
        $("#check_lst_time_span").change(function ()
        {
@@ -303,3 +288,12 @@
        var requestUrl = phpGWLink('index.php', oArgs, true);
        JqueryPortico.updateinlineTableHelper('datatable-container_6', 
requestUrl);
 }
+
+function newDocument(oArgs)
+{
+       oArgs['doc_type'] = $('#doc_type').val();
+
+       var requestUrl = phpGWLink('index.php', oArgs);
+
+       window.open(requestUrl, '_self');
+};
\ No newline at end of file

Modified: trunk/property/js/portico/generic_document.edit.js
===================================================================
--- trunk/property/js/portico/generic_document.edit.js  2016-06-01 09:38:59 UTC 
(rev 15243)
+++ trunk/property/js/portico/generic_document.edit.js  2016-06-01 09:44:13 UTC 
(rev 15244)
@@ -13,22 +13,18 @@
                                $.each(result, function(key, value) {
                                  
$el.append($("<option></option>").attr("value", value.id).text(value.name));
                                });
-                               $( "#location_id" ).change();
+                               getComponents();
                        }, data, "GET", "json"
                );      
        });
        
        $('#location_id').change(function ()
        {
-               var oArgs1 = {menuaction: 
'property.uigeneric_document.get_componentes', location_id: 
$('#location_id').val(), id: $('#id').val()};
-               var requestUrl = phpGWLink('index.php', oArgs1, true);
-               JqueryPortico.updateinlineTableHelper(oTable0, requestUrl);
+               getComponents();
        });
        
        $('select#type_id').change( function()
        {
-               filterData({'type_id': $(this).val(), 'cat_id': ''});
-               
                var oArgs1 = {menuaction: 
'property.uigeneric_document.get_categories_for_type'};
                var requestUrl = phpGWLink('index.php', oArgs1, true);          
                var data = {"type_id": $(this).val()};
@@ -39,19 +35,18 @@
                                $.each(result, function(key, value) {
                                        
$el.append($("<option></option>").attr("value", value.id).text(value.name));
                                });
+                               getLocations();
                        }, data, "GET", "json"
                );                      
        });
        
        $('select#cat_location_id').change( function()
-       {
-               filterData({'cat_id': $(this).val()});                          
+       {       
+               getLocations();
        });
 
        $('select#district_id').change( function()
        {
-               filterData({'district_id': $(this).val(), 'part_of_town_id': 
''});
-               
                var oArgs1 = {menuaction: 
'property.uigeneric_document.get_part_of_town'};
                var requestUrl = phpGWLink('index.php', oArgs1, true);          
                var data = {"district_id": $(this).val()};
@@ -62,28 +57,50 @@
                                $.each(result, function(key, value) {
                                        
$el.append($("<option></option>").attr("value", value.id).text(value.name));
                                });
+                               getLocations();
                        }, data, "GET", "json"
                );                              
        });
 
        $('select#part_of_town_id').change( function()
        {
-               filterData({'part_of_town_id': $(this).val()});                 
        
+               getLocations();
        });
        
        $('select#part_of_town_id').prop('selectedIndex', 0);
 });
 
-function filterData(objParams)
+function getLocations()
 {
-       $.each(objParams, function(key, value) {
-               //oTable1.dataTableSettings[1]['ajax']['data'][key] = value;
-               paramsTable1.push( { "name": key, "value": value } );
-       });
+       paramsTable1['type_id'] = $('#type_id').val();
+       paramsTable1['cat_id'] = $('#cat_location_id').val();
+       paramsTable1['district_id'] = $('#district_id').val();
+       paramsTable1['part_of_town_id'] = $('#part_of_town_id').val();
        
+       if ($('#check_locations_related').is(':checked')) {
+               paramsTable1['only_related'] = 1;
+       } else {
+               paramsTable1['only_related'] = 0;
+       }
+       console.log(paramsTable1);
+       
        oTable1.fnDraw();
 }
-                       
+               
+function getComponents()
+{
+       paramsTable0['location_id'] = $('#location_id').val();
+       paramsTable0['id'] = $('#id').val();
+       
+       if ($('#check_components_related').is(':checked')) {
+               paramsTable0['only_related'] = 1;
+       } else {
+               paramsTable0['only_related'] = 0;
+       }
+       console.log(paramsTable0);
+       oTable0.fnDraw();
+}
+
 function setRelationsComponents(oArgs)
 {
        var values = {};
@@ -136,6 +153,14 @@
        }, data, "POST", "JSON");
 }
 
+function showRelatedComponentes() {
+       getComponents();
+}
+
+function showRelatedLocations() {
+       getLocations();
+}
+
 //     call to AutoCompleteHelper JQUERY
 var oArgs = {menuaction: 'property.uigeneric_document.get_users'};
 var strURL = phpGWLink('index.php', oArgs, true);

Modified: trunk/property/js/portico/location.edit.js
===================================================================
--- trunk/property/js/portico/location.edit.js  2016-06-01 09:38:59 UTC (rev 
15243)
+++ trunk/property/js/portico/location.edit.js  2016-06-01 09:44:13 UTC (rev 
15244)
@@ -6,7 +6,7 @@
 {
        $('#doc_type').change( function()
        {
-               oTable0.dataTableSettings[0]['ajax']['data']['doc_type'] = 
$(this).val();
+               paramsTable0['doc_type'] = $(this).val();
                oTable0.fnDraw();                               
        });
 
@@ -19,3 +19,12 @@
                }
        };
 });
+
+function newDocument(oArgs)
+{
+       oArgs['doc_type'] = $('#doc_type').val();
+
+       var requestUrl = phpGWLink('index.php', oArgs);
+
+       window.open(requestUrl, '_self');
+};
\ No newline at end of file

Modified: trunk/property/templates/base/generic_document.xsl
===================================================================
--- trunk/property/templates/base/generic_document.xsl  2016-06-01 09:38:59 UTC 
(rev 15243)
+++ trunk/property/templates/base/generic_document.xsl  2016-06-01 09:44:13 UTC 
(rev 15244)
@@ -224,6 +224,10 @@
                                                                <select 
id="entity_group_id" name="entity_group_id">
                                                                        
<xsl:apply-templates select="entity_group_filter/options"/>
                                                                </select>
+                                                               <label>
+                                                                       
<xsl:value-of select="php:function('lang', 'Only Related')" />
+                                                               </label>
+                                                               <input 
type="checkbox" id="check_components_related" name="check_components_related" 
value="1" onchange="showRelatedComponentes()"></input>
                                                        </div>                  
                                
                                                        <div 
class="pure-control-group">
                                                                <label 
for="vendor">
@@ -279,6 +283,10 @@
                                                                <select 
id="part_of_town_id" name="part_of_town_id">
                                                                        
<xsl:apply-templates select="part_of_town_filter/options"/>
                                                                </select>
+                                                               <label>
+                                                                       
<xsl:value-of select="php:function('lang', 'Only Related')" />
+                                                               </label>
+                                                               <input 
type="checkbox" id="check_locations_related" name="check_locations_related" 
value="1" onchange="showRelatedLocations()"></input>
                                                        </div>                  
                                        
                                                                        
                                                        <xsl:for-each 
select="datatable_def">

Modified: trunk/property/templates/base/location.xsl
===================================================================
--- trunk/property/templates/base/location.xsl  2016-06-01 09:38:59 UTC (rev 
15243)
+++ trunk/property/templates/base/location.xsl  2016-06-01 09:44:13 UTC (rev 
15244)
@@ -506,18 +506,17 @@
                                                        </div>
                                                </xsl:when>
                                        </xsl:choose>
-
-                                                       <div id="document">
-                                                               
-                                                       <div 
class="pure-control-group">
-                                                               <label>
-                                                                       
<xsl:value-of select="php:function('lang', 'Doc type')" />
-                                                               </label>
-                                                               <select 
id="doc_type" name="doc_type">
-                                                                       
<xsl:apply-templates select="doc_type_filter/options"/>
-                                                               </select>
-                                                       </div>
-                                                                       
+                                       <xsl:choose>
+                                               <xsl:when test="documents != 
''">
+                                                       <div id="document">     
                                                        
+                                                               <div 
class="pure-control-group">
+                                                                       <label>
+                                                                               
<xsl:value-of select="php:function('lang', 'Doc type')" />
+                                                                       </label>
+                                                                       <select 
id="doc_type" name="doc_type">
+                                                                               
<xsl:apply-templates select="doc_type_filter/options"/>
+                                                                       
</select>
+                                                               </div>          
                                                        
                                                                <xsl:for-each 
select="datatable_def">
                                                                        <xsl:if 
test="container = 'datatable-container_0'">
                                                                                
<xsl:call-template name="table_setup">
@@ -531,20 +530,22 @@
                                                                        
</xsl:if>
                                                                </xsl:for-each>
                                                        </div>
-                                               <div id="related">
-                                       <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="tabletools" select ='tabletools' />
-                                                               <xsl:with-param 
name="data" select ='data' />
-                                                               <xsl:with-param 
name="config" select ='config' />
-                                                       </xsl:call-template>
-                                               </xsl:if>
-                                       </xsl:for-each>
-                                               </div>
+                                               </xsl:when>
+                                       </xsl:choose>
+                                       <div id="related">
+                                               <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="tabletools" select ='tabletools' />
+                                                                       
<xsl:with-param name="data" select ='data' />
+                                                                       
<xsl:with-param name="config" select ='config' />
+                                                               
</xsl:call-template>
+                                                       </xsl:if>
+                                               </xsl:for-each>
+                                       </div>
                                <xsl:choose>
                                        <xsl:when test="check_history != ''">
                                                <script type="text/javascript">




reply via email to

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