fmsystem-commits
[Top][All Lists]
Advanced

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

[Fmsystem-commits] [12205] Delay execution of tab-rendering


From: Sigurd Nes
Subject: [Fmsystem-commits] [12205] Delay execution of tab-rendering
Date: Sun, 19 Oct 2014 14:05:19 +0000

Revision: 12205
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=12205
Author:   sigurdne
Date:     2014-10-19 14:05:18 +0000 (Sun, 19 Oct 2014)
Log Message:
-----------
Delay execution of tab-rendering

Modified Paths:
--------------
    branches/dev-syncromind/phpgwapi/inc/class.common.inc.php
    branches/dev-syncromind/phpgwapi/inc/class.jquery.inc.php
    branches/dev-syncromind/phpgwapi/inc/class.js.inc.php
    branches/dev-syncromind/phpgwapi/js/jquery/common.js
    branches/dev-syncromind/phpgwapi/templates/pure/footer.tpl
    branches/dev-syncromind/phpgwapi/templates/pure/head.inc.php
    branches/dev-syncromind/phpgwapi/templates/pure/head.tpl
    branches/dev-syncromind/phpgwapi/templates/pure/navbar.inc.php
    branches/dev-syncromind/property/templates/base/condition_survey.xsl

Modified: branches/dev-syncromind/phpgwapi/inc/class.common.inc.php
===================================================================
--- branches/dev-syncromind/phpgwapi/inc/class.common.inc.php   2014-10-17 
21:56:52 UTC (rev 12204)
+++ branches/dev-syncromind/phpgwapi/inc/class.common.inc.php   2014-10-19 
14:05:18 UTC (rev 12205)
@@ -1105,6 +1105,27 @@
                }
 
                /**
+               * Include JavaScript after </body>
+               *
+               * The method is included here to make it easier to change the 
js support
+               * in phpgw. One change then all templates will support it (as 
long as they
+               * include a call to this method).
+               *
+               * @author Sigurd Nes
+               * @return string The JavaScript code to include
+               */
+               public function get_javascript_end()
+               {
+                       $js = '';
+
+                       if 
(isset($GLOBALS['phpgw_info']['flags']['java_script_end']))
+                       {
+                               $js .= 
$GLOBALS['phpgw_info']['flags']['java_script_end'] . "\n";
+                       }
+                       return $js;
+               }
+
+               /**
                * Get window.on* events from javascript class
                *
                * @author Dave Hall skwashd at phpgroupware.org

Modified: branches/dev-syncromind/phpgwapi/inc/class.jquery.inc.php
===================================================================
--- branches/dev-syncromind/phpgwapi/inc/class.jquery.inc.php   2014-10-17 
21:56:52 UTC (rev 12204)
+++ branches/dev-syncromind/phpgwapi/inc/class.jquery.inc.php   2014-10-19 
14:05:18 UTC (rev 12205)
@@ -179,8 +179,17 @@
                                        </ul>
 HTML;
                $js = <<<JS
-                       $(document).ready(function () 
+               $(document).ready(function ()
+               {
+                       if(!JqueryPortico.inlineTablesDefined == 'undefined' || 
JqueryPortico.inlineTablesDefined == 0)
                        {
+                               JqueryPortico.render_tabs();
+                       }
+               });
+
+                       JqueryPortico.render_tabs = function ()
+                       {
+
                                $('#tab-content').responsiveTabs({
                                        startCollapsed: 'accordion',
                                        collapsible: 'accordion',
@@ -192,13 +201,14 @@
                                        activate: function(e, tab) {
                                                $('.info').html('Tab <strong>' 
+ tab.id + '</strong> activated!');
                                        }
-                                       
+
                                });
 
                                $('#tab-content').responsiveTabs('activate', 
$selected);
-                       });
+
+                       };
 JS;
-               $GLOBALS['phpgw']->js->add_code('', $js);
+               $GLOBALS['phpgw']->js->add_code('', $js, true);
                return $output;
        }
 

Modified: branches/dev-syncromind/phpgwapi/inc/class.js.inc.php
===================================================================
--- branches/dev-syncromind/phpgwapi/inc/class.js.inc.php       2014-10-17 
21:56:52 UTC (rev 12204)
+++ branches/dev-syncromind/phpgwapi/inc/class.js.inc.php       2014-10-19 
14:05:18 UTC (rev 12205)
@@ -302,9 +302,10 @@
                        }
                }
 
-               public function add_code($namespace, $code)
+               public function add_code($namespace, $code, $end_of_page = 
false)
                {
-                       $GLOBALS['phpgw_info']['flags']['java_script'] .= "\n"
+                       $key = $end_of_page ? 'java_script_end' : 'java_script';
+                       $GLOBALS['phpgw_info']['flags'][$key] .= "\n"
                                . '<script type="text/javascript">' ."\n"
                                . '//<[CDATA[' ."\n"
                                . $code ."\n"

Modified: branches/dev-syncromind/phpgwapi/js/jquery/common.js
===================================================================
--- branches/dev-syncromind/phpgwapi/js/jquery/common.js        2014-10-17 
21:56:52 UTC (rev 12204)
+++ branches/dev-syncromind/phpgwapi/js/jquery/common.js        2014-10-19 
14:05:18 UTC (rev 12205)
@@ -6,6 +6,10 @@
 //Namespacing
 ;var JqueryPortico = {};
 
+/* Sigurd: Need to delay tab-rendering to after all tables are finished*/
+JqueryPortico.inlineTablesDefined = 0;
+JqueryPortico.inlineTablesRendered = 0;
+
 JqueryPortico.formatLink = function(key, oData) {
        var name = oData[key];
        var link = oData['link'];
@@ -20,13 +24,7 @@
 };
 
 JqueryPortico.inlineTableHelper = function(container, ajax_url, columns, 
options, disablePagination) {
-//     var columns = [];
-//     for (i=0; i<colDefs.length; i++) {
-//             columns.push({"data":colDefs[i]['key']});
-//     }
 
-//     return {container:container, columns: columns, url: url};
-
        $(document).ready(function ()
        {
                oTable = $("#" + container).DataTable({
@@ -36,9 +34,24 @@
                        deferRender:    true,
                        ajax: {
                                url: ajax_url,
-//                             data: { cat_id: '' },
                                type: 'GET'
                        },
+                       fnInitComplete: function (oSettings, json)
+                       {
+                               JqueryPortico.inlineTablesRendered += 1;
+                               if(JqueryPortico.inlineTablesRendered == 
JqueryPortico.inlineTablesDefined)
+                               {
+                                       if(typeof(JqueryPortico.render_tabs) == 
'function')
+                                       {
+                                               var delay=15;//allow extra 15 
milliseconds to really finish
+                                               setTimeout(function()
+                                               {
+                                                       
JqueryPortico.render_tabs();
+
+                                               },delay);
+                                       }
+                               }
+                       },
                //      lengthMenu:             JqueryPortico.i18n.lengthmenu(),
                //      language:               JqueryPortico.i18n.datatable(),
                        columns: columns
@@ -51,6 +64,7 @@
                //      tabIndex:               1,
                //      oTableTools: JqueryPortico.TableTools
                });
+
        });
 };
 

Modified: branches/dev-syncromind/phpgwapi/templates/pure/footer.tpl
===================================================================
--- branches/dev-syncromind/phpgwapi/templates/pure/footer.tpl  2014-10-17 
21:56:52 UTC (rev 12204)
+++ branches/dev-syncromind/phpgwapi/templates/pure/footer.tpl  2014-10-19 
14:05:18 UTC (rev 12205)
@@ -12,5 +12,6 @@
                </div>
                <div id="popupBox"></div>       
                <div id="curtain"></div>
-       </body>
+               {javascript_end}
+                               </body>
 </html>

Modified: branches/dev-syncromind/phpgwapi/templates/pure/head.inc.php
===================================================================
--- branches/dev-syncromind/phpgwapi/templates/pure/head.inc.php        
2014-10-17 21:56:52 UTC (rev 12204)
+++ branches/dev-syncromind/phpgwapi/templates/pure/head.inc.php        
2014-10-19 14:05:18 UTC (rev 12205)
@@ -26,7 +26,6 @@
        $GLOBALS['phpgw']->template->set_block('head', 'stylesheet', 
'stylesheets');
        $GLOBALS['phpgw']->template->set_block('head', 'javascript', 
'javascripts');
 
-
        if( !$GLOBALS['phpgw_info']['flags']['noframework'] && 
!$GLOBALS['phpgw_info']['flags']['nonavbar'] )
        {
                if 
(isset($GLOBALS['phpgw_info']['user']['preferences']['common']['sidecontent']) 
&& $GLOBALS['phpgw_info']['user']['preferences']['common']['sidecontent'] == 
'ajax_menu')
@@ -44,7 +43,18 @@
                }
        }
 
+       $stylesheets[] = "/phpgwapi/templates/pure/css/pure-min.css";
+       $stylesheets[] = 
"/phpgwapi/templates/pure/css/grids-responsive-min.css";
+       $stylesheets[] = "/phpgwapi/templates/pure/css/side-menu.css";
+       $stylesheets[] = "/phpgwapi/templates/pure/css/baby-blue.css";
 
+//     $stylesheets[] = 
"/phpgwapi/js/DataTables/media/css/jquery.dataTables.css";
+//     $stylesheets[] = 
"/phpgwapi/js/DataTables/extensions/Responsive/css/dataTables.responsive.css";
+//     $stylesheets[] = 
"/phpgwapi/js/DataTables/extensions/ColVis/css/dataTables.colVis.min.css";
+//     $stylesheets[] = 
"/phpgwapi/js/DataTables/extensions/ColVis/css/dataTables.colvis.jqueryui.css";
+//     $stylesheets[] = 
"/phpgwapi/js/DataTables/extensions/TableTools/css/dataTables.tableTools.css";
+
+
        if( !isset($GLOBALS['phpgw_info']['flags']['no_reset_fonts']) )
        {
 //             $stylesheets[] = 
'/phpgwapi/js/yahoo/reset-fonts-grids/reset-fonts-grids.css';
@@ -110,7 +120,7 @@
 
        flush();
 
-       echo '<body class="yui-skin-sam">';
+       echo '<body>';
 
        if( isset($GLOBALS['phpgw_info']['flags']['noframework']) )
        {

Modified: branches/dev-syncromind/phpgwapi/templates/pure/head.tpl
===================================================================
--- branches/dev-syncromind/phpgwapi/templates/pure/head.tpl    2014-10-17 
21:56:52 UTC (rev 12204)
+++ branches/dev-syncromind/phpgwapi/templates/pure/head.tpl    2014-10-19 
14:05:18 UTC (rev 12205)
@@ -10,22 +10,6 @@
                <meta name="robots" content="none">
                <title>{site_title}</title>
 
-               <link rel="stylesheet" 
href="{webserver_url}/phpgwapi/templates/pure/css/pure-min.css">
-               <!--[if lte IE 8]>
-                       <link rel="stylesheet" 
href="{webserver_url}/phpgwapi/templates/pure/css/grids-responsive-old-ie-min.css">
-                       <link rel="stylesheet" 
href="{webserver_url}/phpgwapi/templates/pure/css/side-menu-old-ie.css">
-                       <link rel="stylesheet" 
href="{webserver_url}/phpgwapi/templates/pure/css/baby-blue-old-ie.css">
-               <![endif]-->
-               <!--[if gt IE 8]><!-->
-                       <link rel="stylesheet" 
href="{webserver_url}/phpgwapi/templates/pure/css/grids-responsive-min.css">
-                   <link rel="stylesheet" 
href="phpgwapi/templates/pure/css/side-menu.css">
-                   <link rel="stylesheet" 
href="phpgwapi/templates/pure/css/baby-blue.css">
-               <!--<![endif]-->
-
-               <!--[if lt IE 9]>
-                       <script 
src="{webserver_url}/phpgwapi/templates/pure/js/html5shiv.js"></script>
-               <![endif]-->
-
                <!-- BEGIN stylesheet -->
                <link href="{stylesheet_uri}" type="text/css" rel="StyleSheet">
         <!-- END stylesheet -->

Modified: branches/dev-syncromind/phpgwapi/templates/pure/navbar.inc.php
===================================================================
--- branches/dev-syncromind/phpgwapi/templates/pure/navbar.inc.php      
2014-10-17 21:56:52 UTC (rev 12204)
+++ branches/dev-syncromind/phpgwapi/templates/pure/navbar.inc.php      
2014-10-19 14:05:18 UTC (rev 12205)
@@ -375,7 +375,8 @@
                (
        //              'user_fullname' => $GLOBALS['phpgw']->accounts->get( 
$GLOBALS['phpgw_info']['user']['id'] )->__toString(),
                        'powered_by'    => $powered_by,
-                       'lang_login'    => lang('login')
+                       'lang_login'    => lang('login'),
+                       'javascript_end'=> 
$GLOBALS['phpgw']->common->get_javascript_end()
                );
 
                $GLOBALS['phpgw']->template->set_var($var);

Modified: branches/dev-syncromind/property/templates/base/condition_survey.xsl
===================================================================
--- branches/dev-syncromind/property/templates/base/condition_survey.xsl        
2014-10-17 21:56:52 UTC (rev 12204)
+++ branches/dev-syncromind/property/templates/base/condition_survey.xsl        
2014-10-19 14:05:18 UTC (rev 12205)
@@ -546,6 +546,7 @@
                </thead>
        </table>
        <script>
+               JqueryPortico.inlineTablesDefined += 1;
                var PreColumns = [
                                <xsl:for-each select="$ColumnDefs">
                                {




reply via email to

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