fmsystem-commits
[Top][All Lists]
Advanced

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

[Fmsystem-commits] [12611] activate template, convert tables and tabs fr


From: Sigurd Nes
Subject: [Fmsystem-commits] [12611] activate template, convert tables and tabs from yui to jquery
Date: Fri, 16 Jan 2015 10:02:45 +0000

Revision: 12611
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=12611
Author:   sigurdne
Date:     2015-01-16 10:02:44 +0000 (Fri, 16 Jan 2015)
Log Message:
-----------
activate template, convert tables and tabs from yui to jquery

Modified Paths:
--------------
    branches/dev-syncromind/property/inc/class.uirequest.inc.php
    branches/dev-syncromind/property/templates/base/request.xsl

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

Modified: branches/dev-syncromind/property/inc/class.uirequest.inc.php
===================================================================
--- branches/dev-syncromind/property/inc/class.uirequest.inc.php        
2015-01-16 10:01:15 UTC (rev 12610)
+++ branches/dev-syncromind/property/inc/class.uirequest.inc.php        
2015-01-16 10:02:44 UTC (rev 12611)
@@ -2043,29 +2043,27 @@
                                
$values['files'][$i]['file_name']=urlencode($values['files'][$i]['name']);
                        }
 
-                       $datavalues[0] = array
-                               (
-                                       'name'                                  
=> "0",
-                                       'values'                                
=> json_encode($record_history),
-                                       'total_records'                 => 
count($record_history),
-                                       'edit_action'                   => "''",
-                                       'is_paginator'                  => 0,
-                                       'footer'                                
=> 0
-                               );
-
-                       $myColumnDefs[0] = array
-                               (
-                                       'name'          => "0",
-                                       'values'        =>      
json_encode(array(      array('key' => 
'value_date','label'=>lang('Date'),'sortable'=>true,'resizeable'=>true),
+                       $datatable_def = array();
+                       $datatable_def[] = array
+                       (
+                               'container'             => 
'datatable-container_0',
+                               '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),
+                               'config'                => array(
+                                       array('disableFilter' => true),
+                                       array('disablePagination' => true)
+                               )
+                       );
 
-
                        $link_view_file = 
$GLOBALS['phpgw']->link('/index.php',$link_file_data);
 
+                       $content_files = array();
+
                        for($z=0; $z<count($values['files']); $z++)
                        {
                                if ($link_to_files != '')
@@ -2079,24 +2077,19 @@
                                $content_files[$z]['delete_file'] = '<input 
type="checkbox" name="values[file_action][]" 
value="'.$values['files'][$z]['name'].'" title="'.lang('Check to delete 
file').'" >';
                        }
 
-                       $datavalues[1] = array
-                               (
-                                       'name'                                  
=> "1",
-                                       'values'                                
=> json_encode($content_files),
-                                       'total_records'                 => 
count($content_files),
-                                       'edit_action'                   => "''",
-                                       'is_paginator'                  => 0,
-                                       'footer'                                
=> 0
-                               );
+                       $datatable_def[] = array
+                       (
+                               'container'             => 
'datatable-container_1',
+                               'requestUrl'    => "''",
+                               'ColumnDefs'    => array(array('key' => 
'file_name','label'=>lang('Filename'),'sortable'=>false,'resizeable'=>true),
+                                                                               
array('key' => 'delete_file','label'=>lang('Delete 
file'),'sortable'=>false,'resizeable'=>true,'formatter'=>'FormatterCenter')),
+                               'data'                  => 
json_encode($content_files),
+                               'config'                => array(
+                                       array('disableFilter' => true),
+                                       array('disablePagination' => true)
+                               )
+                       );
 
-                       $myColumnDefs[1] = array
-                               (
-                                       'name'          => "1",
-                                       'values'        =>      
json_encode(array(      array('key' => 
'file_name','label'=>lang('Filename'),'sortable'=>false,'resizeable'=>true),
-                                                                               
                                array('key' => 
'delete_file','label'=>lang('Delete 
file'),'sortable'=>false,'resizeable'=>true,'formatter'=>'FormatterCenter')))
-                               );
-
-
                        $_consume_amount = 0;
                        $_planning_amount = 0;
                        if($this->acl_edit)
@@ -2127,30 +2120,24 @@
 
                        $related = $this->get_related($id);
 
-                       $datavalues[2] = array
-                               (
-                                       'name'                                  
=> "2",
-                                       'values'                                
=> json_encode($related),
-                                       'total_records'                 => 
count($related),
-                                       'edit_action'                   => "''",
-                                       'is_paginator'                  => 0,
-                                       'footer'                                
=> 0
-                               );
+                       $datatable_def[] = array
+                       (
+                               'container'             => 
'datatable-container_2',
+                               'requestUrl'    => "''",
+                               'ColumnDefs'    => array(array('key' => 
'id','label'=>lang('id'),'sortable'=>true,'resizeable'=>false),
+                                                                               
        array('key' => 
'type','label'=>lang('type'),'sortable'=>true,'resizeable'=>true),
+                                                                               
        array('key' => 
'status','label'=>lang('status'),'sortable'=>false,'resizeable'=>true),
+                                                                               
        array('key' => 
'title','label'=>lang('title'),'sortable'=>false,'resizeable'=>true),
+                                                                               
        array('key' => 'start_date','label'=>lang('start 
date'),'sortable'=>true,'resizeable'=>true),
+                                                                               
        array('key' => 'end_date','label'=>lang('end 
date'),'sortable'=>true,'resizeable'=>true),
+                                                                               
        array('key' => 
'budget','label'=>lang('budget'),'sortable'=>true,'resizeable'=>false, 
'formatter' => 'FormatterRight')),
+                               'data'                  => 
json_encode($related),
+                               'config'                => array(
+                                       array('disableFilter' => true),
+                                       array('disablePagination' => true)
+                               )
+                       );
 
-
-
-                       $myColumnDefs[2] = array
-                               (
-                                       'name'          => "2",
-                                       'values'        =>      
json_encode(array(      array('key' => 
'id','label'=>lang('id'),'sortable'=>true,'resizeable'=>false),
-                                                                               
                                array('key' => 
'type','label'=>lang('type'),'sortable'=>true,'resizeable'=>true),
-                                                                               
                                array('key' => 
'status','label'=>lang('status'),'sortable'=>false,'resizeable'=>true),
-                                                                               
                                array('key' => 
'title','label'=>lang('title'),'sortable'=>false,'resizeable'=>true),
-                                                                               
                                array('key' => 
'start_date','label'=>lang('start date'),'sortable'=>true,'resizeable'=>true),
-                                                                               
                                array('key' => 'end_date','label'=>lang('end 
date'),'sortable'=>true,'resizeable'=>true),
-                                                                               
                                array('key' => 
'budget','label'=>lang('budget'),'sortable'=>true,'resizeable'=>false, 
'formatter' => 'FormatterRight')))
-                               );
-
                        if (isset($values['attributes']) && 
is_array($values['attributes']))
                        {
                                foreach ($values['attributes'] as & $attribute)
@@ -2194,15 +2181,13 @@
 
                        $data = array
                                (
+                                       'datatable_def'                         
                => $datatable_def,
                                        'mode'                                  
                        => $mode,
                                        'ticket_link'                           
                => $GLOBALS['phpgw']->link('/index.php',$ticket_link_data),
                                        'value_authorities_demands'             
=> isset($this->config->config_data['authorities_demands']) &&  
$this->config->config_data['authorities_demands'] ? 
$this->config->config_data['authorities_demands'] : 0,
                                        'suppressmeter'                         
                => isset($this->config->config_data['project_suppressmeter']) 
&& $this->config->config_data['project_suppressmeter'] ? 1 : '',
                                        'show_dates'                            
                => $show_dates,
                                        'custom_attributes'                     
                => array('attributes' => $values['attributes']),
-                                       'property_js'                           
                => 
json_encode($GLOBALS['phpgw_info']['server']['webserver_url']."/property/js/yahoo/property2.js"),
-                                       'datatable'                             
                        => $datavalues,
-                                       'myColumnDefs'                          
                => $myColumnDefs,
                                        'tabs'                                  
                        => self::_generate_tabs(),
                                        'fileupload'                            
                => true,
                                        'link_view_file'                        
                => $GLOBALS['phpgw']->link('/index.php',$link_file_data),
@@ -2335,29 +2320,12 @@
                                        'value_multiplier'                      
                => $values['multiplier'],
                                        'value_total_cost_estimate'             
        => $values['multiplier'] ? number_format(($values['budget'] * 
$values['multiplier']) , 0, ',', ' ') : ''
                                );
-//_debug_array($data);die();
-                       phpgwapi_yui::load_widget('dragdrop');
-                       phpgwapi_yui::load_widget('datatable');
-                       phpgwapi_yui::load_widget('menu');
-                       phpgwapi_yui::load_widget('connection');
-                       phpgwapi_yui::load_widget('loader');
-                       phpgwapi_yui::load_widget('tabview');
-                       phpgwapi_yui::load_widget('paginator');
-                       phpgwapi_yui::load_widget('animation');
-
                        $appname        = lang('request');
 
                        $GLOBALS['phpgw_info']['flags']['app_header'] = 
lang('property') . ' - ' . $appname . ': ' . $function_msg;
 
-                       $GLOBALS['phpgw']->xslttpl->add_file(array('request', 
'files','attributes_form'));
-                       
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('edit' => $data));
-                       $GLOBALS['phpgw']->css->validate_file('datatable');
-                       $GLOBALS['phpgw']->css->validate_file('property');
-                       
$GLOBALS['phpgw']->css->add_external_file('property/templates/base/css/property.css');
-                       
$GLOBALS['phpgw']->css->add_external_file('phpgwapi/js/yahoo/datatable/assets/skins/sam/datatable.css');
-                       
$GLOBALS['phpgw']->css->add_external_file('phpgwapi/js/yahoo/paginator/assets/skins/sam/paginator.css');
-                       
$GLOBALS['phpgw']->css->add_external_file('phpgwapi/js/yahoo/container/assets/skins/sam/container.css');
-                       $GLOBALS['phpgw']->js->validate_file( 'yahoo', 
'request.edit', 'property' );
+                       self::add_javascript('property', 'portico', 
'request.edit.js');
+                       self::render_template_xsl(array('request', 
'datatable_inline', 'files','attributes_form'), array('edit' => $data));
                }
 
                function delete()
@@ -2517,16 +2485,14 @@
 
                protected function _generate_tabs()
                {
+                       $active_tab = 'general';
                        $tabs = array
                                (
                                        'general'               => 
array('label' => lang('general'), 'link' => '#general'),
                                        'budget'                => 
array('label' => lang('documents'), 'link' => '#documents'),
                                        'history'               => 
array('label' => lang('history'), 'link' => '#history')
                                );
-
-                       phpgwapi_yui::tabview_setup('project_tabview');
-
-                       return  phpgwapi_yui::tabview_generate($tabs, 
'general');
+                       return phpgwapi_jquery::tabview_generate($tabs, 
$active_tab,'request_tabview');
                }
        }
 

Added: branches/dev-syncromind/property/js/portico/request.edit.js
===================================================================
--- branches/dev-syncromind/property/js/portico/request.edit.js                 
        (rev 0)
+++ branches/dev-syncromind/property/js/portico/request.edit.js 2015-01-16 
10:02:44 UTC (rev 12611)
@@ -0,0 +1,41 @@
+
+this.local_DrawCallback2 = function()
+{
+       var api = oTable2.api();
+       // Remove the formatting to get integer data for summation
+       var intVal = function ( i )
+       {
+               return typeof i === 'string' ?
+                       i.replace(/[\$,]/g, '')*1 :
+                       typeof i === 'number' ?
+                               i : 0;
+       };
+
+       var columns = ["6"];
+
+       $(api.column(5).footer()).html("<div align=\"right\">Sum</div>");
+
+       columns.forEach(function(col)
+       {
+               data = api.column( col, { page: 'current'} ).data();
+               pageTotal = data.length ?
+                       data.reduce(function (a, b){
+                                       return intVal(a) + intVal(b);
+                       }) : 0;
+
+               $(api.column(col).footer()).html("<div 
align=\"right\">"+pageTotal+"</div>");
+       });
+
+};
+
+FormatterCenter = function(key, oData)
+{
+
+       return "<center>"+oData[key]+"</center>";
+};
+
+FormatterRight = function(key, oData)
+{
+       return "<div align=\"right\">"+oData[key]+"</div>";
+};
+       
\ No newline at end of file

Modified: branches/dev-syncromind/property/templates/base/request.xsl
===================================================================
--- branches/dev-syncromind/property/templates/base/request.xsl 2015-01-16 
10:01:15 UTC (rev 12610)
+++ branches/dev-syncromind/property/templates/base/request.xsl 2015-01-16 
10:02:44 UTC (rev 12611)
@@ -1,5 +1,5 @@
   <!-- $Id$ -->
-       <xsl:template name="app_data">
+       <xsl:template match="data">
                <xsl:choose>
                        <xsl:when test="edit">
                                <xsl:apply-templates select="edit"/>
@@ -11,6 +11,8 @@
                                <xsl:apply-templates select="priority_form"/>
                        </xsl:when>
                </xsl:choose>
+               <xsl:call-template name="jquery_phpgw_i18n"/>
+
        </xsl:template>
 
        <!-- New template-->
@@ -187,10 +189,9 @@
                        <xsl:value-of select="form_action"/>
                </xsl:variable>
                <form ENCTYPE="multipart/form-data" method="post" name="form" 
action="{$form_action}">
-                       <div class="yui-navset yui-navset-top" 
id="project_tabview">
-                               <xsl:value-of disable-output-escaping="yes" 
select="tabs"/>
-                               <div class="yui-content">
-                                       <div id="general" class="content-wrp 
requirement">
+               <div id="request_tabview">
+                       <xsl:value-of disable-output-escaping="yes" 
select="tabs"/>
+                               <div id="general">
                                                <div 
class="requirement-responsibility-left">
                                                        <h2><xsl:value-of 
select="php:function('lang', 'request')"/></h2>
                                                        <span class="messages">
@@ -605,7 +606,20 @@
                                                        <h3><!-- xsl:value-of 
select="php:function('lang', 'related')"/-->
                                                                <xsl:value-of 
select="php:function('lang', 'economy and progress')"/>
                                                        </h3>
-                                                       <div 
id="datatable-container_2"/>
+                                                       <!--div 
id="datatable-container_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="tabletools" select ='tabletools' />
+                                                                               
        <xsl:with-param name="config" select ='config' />
+                                                                               
  <xsl:with-param name="data" select ='data' />
+                                                                               
</xsl:call-template>
+                                                                       
</xsl:if>
+                                                       </xsl:for-each>
+
                                                </div>
                                        </div>
                                        <div id="documents">
@@ -618,7 +632,20 @@
                                                                                
        <xsl:value-of select="//lang_files"/>
                                                                                
</td>
                                                                                
<td>
-                                                                               
        <div id="datatable-container_1"/>
+                                                                               
        <!--div 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="tabletools" 
select ='tabletools' />
+                                                                               
                                        <xsl:with-param name="config" select 
='config' />
+                                                                               
                                  <xsl:with-param name="data" select ='data' />
+                                                                               
                                </xsl:call-template>
+                                                                               
                        </xsl:if>
+                                                                               
        </xsl:for-each>
+
                                                                                
</td>
                                                                        </tr>
                                                                </xsl:when>
@@ -631,9 +658,22 @@
                                                </table>
                                        </div>
                                        <div id="history">
-                                               <div id="paging_0"> </div>
+                                               <!--div id="paging_0"> </div>
                                                <div 
id="datatable-container_0"/>
-                                               <div id="contextmenu_0"/>
+                                               <div id="contextmenu_0"/-->
+                                                       <xsl:for-each 
select="datatable_def">
+                                                                       <xsl:if 
test="container = 'datatable-container_0'">
+                                                                               
<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="config" select ='config' />
+                                                                               
  <xsl:with-param name="data" select ='data' />
+                                                                               
</xsl:call-template>
+                                                                       
</xsl:if>
+                                                       </xsl:for-each>
+
                                                <script type="text/javascript">
                                                        var property_js = 
<xsl:value-of select="property_js"/>;
                                                        var datatable = new 
Array();
@@ -656,7 +696,6 @@
                                                        </xsl:for-each>
                                                </script>
                                        </div>
-                               </div>
                        </div>
                        <div class="controlButton">
                                <table>




reply via email to

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