fmsystem-commits
[Top][All Lists]
Advanced

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

[Fmsystem-commits] [14848] Merge 14846:14847 from trunk


From: Sigurd Nes
Subject: [Fmsystem-commits] [14848] Merge 14846:14847 from trunk
Date: Wed, 16 Mar 2016 20:40:30 +0000

Revision: 14848
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=14848
Author:   sigurdne
Date:     2016-03-16 20:40:29 +0000 (Wed, 16 Mar 2016)
Log Message:
-----------
Merge 14846:14847 from trunk

Modified Paths:
--------------
    branches/Version-2_0-branch/phpgwapi/js/jquery/common.js
    branches/Version-2_0-branch/phpgwapi/templates/base/datatable_jquery.xsl

Property Changed:
----------------
    branches/Version-2_0-branch/


Property changes on: branches/Version-2_0-branch
___________________________________________________________________
Modified: svn:mergeinfo
   - /branches/dev-syncromind:13653
/branches/stavangerkommune:12743-12875,12986
/trunk:14721-14732,14734-14735,14737,14739,14741,14743-14744,14746-14749,14751,14753,14755-14757,14759,14761-14764,14766-14768,14770-14783,14785-14792,14794-14813,14815-14816,14818,14820-14822,14824-14825,14827-14829,14831-14834,14836,14838,14840-14842,14844-14845
   + /branches/dev-syncromind:13653
/branches/stavangerkommune:12743-12875,12986
/trunk:14721-14732,14734-14735,14737,14739,14741,14743-14744,14746-14749,14751,14753,14755-14757,14759,14761-14764,14766-14768,14770-14783,14785-14792,14794-14813,14815-14816,14818,14820-14822,14824-14825,14827-14829,14831-14834,14836,14838,14840-14842,14844-14845,14847

Modified: branches/Version-2_0-branch/phpgwapi/js/jquery/common.js
===================================================================
--- branches/Version-2_0-branch/phpgwapi/js/jquery/common.js    2016-03-16 
20:38:45 UTC (rev 14847)
+++ branches/Version-2_0-branch/phpgwapi/js/jquery/common.js    2016-03-16 
20:40:29 UTC (rev 14848)
@@ -12,6 +12,32 @@
 JqueryPortico.inlineTablesDefined = 0;
 JqueryPortico.inlineTablesRendered = 0;
 
+JqueryPortico.parseURL = function(url)
+{
+       var parser = document.createElement('a'),
+               searchObject = {},
+               queries, split, i;
+       // Let the browser do the work
+       parser.href = url;
+       // Convert query string to object
+       queries = parser.search.replace(/^\?/, '').split('&');
+       for (i = 0; i < queries.length; i++)
+       {
+               split = queries[i].split('=');
+               searchObject[split[0]] = split[1];
+       }
+       return {
+               protocol: parser.protocol,
+               host: parser.host,
+               hostname: parser.hostname,
+               port: parser.port,
+               pathname: parser.pathname,
+               search: parser.search,
+               searchObject: searchObject,
+               hash: parser.hash
+       };
+}
+
 JqueryPortico.formatLink = function (key, oData)
 {
 

Modified: 
branches/Version-2_0-branch/phpgwapi/templates/base/datatable_jquery.xsl
===================================================================
--- branches/Version-2_0-branch/phpgwapi/templates/base/datatable_jquery.xsl    
2016-03-16 20:38:45 UTC (rev 14847)
+++ branches/Version-2_0-branch/phpgwapi/templates/base/datatable_jquery.xsl    
2016-03-16 20:40:29 UTC (rev 14848)
@@ -94,7 +94,7 @@
                <xsl:value-of select="php:function('lang', 'toolbar')"/>
        </label>
 
-       <div id="toolbar">
+       <div id="toolbar" class='dtable_custom_controls'>
                <!--xsl:if test="item/text and normalize-space(item/text)"-->
                <xsl:if test="item">
                        <table id="toolbar_table" class="pure-table 
pure-table-horizontal">
@@ -903,6 +903,17 @@
                        }
 
                $(document).ready(function() {
+
+                       /*
+                       * For namespacing the state
+                       */
+                       var table_url = 
JqueryPortico.parseURL(window.location.href);
+                       var menuaction = 
table_url.searchObject.menuaction.replace(/\./g, '_');
+                       /*
+                        * Find and assign actions to filters
+                        */
+                       var oControls = 
$('.dtable_custom_controls:first').find(':input[name]');
+
                        oTable = $('#datatable-container').dataTable({
                                paginate:               disablePagination ? 
false : true,
                                processing:             true,
@@ -927,6 +938,51 @@
                                          },
                                        type: 'POST'
                                },
+                               fnStateSaveParams:      function ( oSettings, 
sValue ) {
+                                       //Save custom filters
+                                       var temp = {};
+                                       temp[menuaction] = {}
+                                       oControls.each(function() {
+                                               if ( $(this).attr('name') )
+                                               {
+                                                       sValue[ 
$(this).attr('name') ] = $(this).val().replace('"', '"');
+                                                       temp[ 
$(this).attr('name') ] = $(this).val().replace('"', '"');
+                                               }
+                                       });
+                                       for (var attrname in sValue)
+                                       {
+                                               temp[attrname] = 
sValue[attrname];
+                                       }
+                                       localStorage.setItem('state_' + 
menuaction, JSON.stringify(temp));
+                                       return sValue;
+                               },
+                               fnStateLoadParams: function ( oSettings, oData 
) {
+                                       //Load custom filters
+                                       var retrievedObject = 
localStorage.getItem('state_' + menuaction);
+                                       if(typeof(retrievedObject) != 
'undefined')
+                                       {
+                                               try
+                                               {
+                                                       var params = 
JSON.parse(retrievedObject);
+                                               }
+                                               catch(err)
+                                               {
+                                                       params = {}
+                                               }
+                                       }
+                                       console.log(oData);
+                                       console.log(params);
+                                       oControls.each(function() {
+                                               var oControl = $(this);
+                                               $.each(params, function(index, 
value) {
+                                                       if ( index == 
oControl.attr('name') )
+                                                       {
+                                                               oControl.val( 
value );
+                                                       }
+                                               });
+                                       });
+                                       return true;
+                               },
                                fnServerParams: function ( aoData ) {
                                        if(typeof(aoData.order[0]) != 
'undefined')
                                        {




reply via email to

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