fmsystem-commits
[Top][All Lists]
Advanced

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

[Fmsystem-commits] [13008] more on logistic


From: Sigurd Nes
Subject: [Fmsystem-commits] [13008] more on logistic
Date: Tue, 14 Apr 2015 14:17:26 +0000

Revision: 13008
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=13008
Author:   sigurdne
Date:     2015-04-14 14:17:25 +0000 (Tue, 14 Apr 2015)
Log Message:
-----------
more on logistic

Modified Paths:
--------------
    branches/dev-syncromind/logistic/inc/class.uiactivity.inc.php
    branches/dev-syncromind/logistic/inc/class.uirequirement.inc.php
    
branches/dev-syncromind/logistic/inc/class.uirequirement_resource_allocation.inc.php
    branches/dev-syncromind/logistic/js/logistic/requirement_overview.js
    branches/dev-syncromind/logistic/js/logistic/resource_allocation.js
    
branches/dev-syncromind/logistic/templates/base/requirement/requirement_item.xsl
    
branches/dev-syncromind/logistic/templates/base/requirement/requirement_overview.xsl

Modified: branches/dev-syncromind/logistic/inc/class.uiactivity.inc.php
===================================================================
--- branches/dev-syncromind/logistic/inc/class.uiactivity.inc.php       
2015-04-14 14:16:32 UTC (rev 13007)
+++ branches/dev-syncromind/logistic/inc/class.uiactivity.inc.php       
2015-04-14 14:17:25 UTC (rev 13008)
@@ -669,7 +669,7 @@
 
                        $datatable_def[] = array
                        (
-                               'container'             => 
'datatable-container_0',
+                               'container'             => 
'requirement-container',
                                'requestUrl'    => 
json_encode(self::link(array('menuaction' => 'logistic.uirequirement.index', 
'activity_id' => $activity_id, 'phpgw_return_as' => 'json'))),
                                'ColumnDefs'    => $ColumnDefs0,
                                'data'                  => json_encode(array()),
@@ -695,7 +695,7 @@
 
                        $datatable_def[] = array
                        (
-                               'container'             => 
'datatable-container_1',
+                               'container'             => 
'allocation-container',
                                'requestUrl'    => 
"''",//json_encode(self::link(array('menuaction' => 
'logistic.uirequirement_resource_allocation.index', 'requirement_id' => 
$requirement_id, 'type' => "requirement_id", 'phpgw_return_as' => 'json'))),
                                'ColumnDefs'    => $ColumnDefs1,
                                'data'                  => json_encode(array()),
@@ -774,11 +774,16 @@
                                (
                                        'details'=>   array
                                        (
-                                               'label' => "1: " . 
lang('Activity details')
+                                               'label' => "1: " . 
lang('Activity details'),
+                                               'link' => '#details',
+                                               'disable' => 0
+
                                        ),
                                        'allocation' => array
                                        (
-                                               'label' => "2: " . 
lang('Requirement allocation')
+                                               'label' => "2: " . 
lang('Requirement allocation'),
+                                               'link' => '#allocation',
+                                               'disable' => 1
                                        )
                                );
                        }

Modified: branches/dev-syncromind/logistic/inc/class.uirequirement.inc.php
===================================================================
--- branches/dev-syncromind/logistic/inc/class.uirequirement.inc.php    
2015-04-14 14:16:32 UTC (rev 13007)
+++ branches/dev-syncromind/logistic/inc/class.uirequirement.inc.php    
2015-04-14 14:17:25 UTC (rev 13008)
@@ -1218,11 +1218,15 @@
                                (
                                        'details'=> array
                                        (
-                                               'label' => "1: " . 
lang('Requirement details')
+                                               'label' => "1: " . 
lang('Requirement details'),
+                                               'link' => '#details',
+                                               'disable' => 0
                                        ),
                                        'constraints'=> array
                                        (
-                                               'label' => "2: " . lang('Add 
constraints')
+                                               'label' => "2: " . lang('Add 
constraints'),
+                                               'link' => '#constraints',
+                                               'disable' => 1
                                        )
                                );
                        }

Modified: 
branches/dev-syncromind/logistic/inc/class.uirequirement_resource_allocation.inc.php
===================================================================
--- 
branches/dev-syncromind/logistic/inc/class.uirequirement_resource_allocation.inc.php
        2015-04-14 14:16:32 UTC (rev 13007)
+++ 
branches/dev-syncromind/logistic/inc/class.uirequirement_resource_allocation.inc.php
        2015-04-14 14:17:25 UTC (rev 13008)
@@ -283,7 +283,7 @@
                                                                                
                                                        'phpgw_return_as' => 
'json')
                                                                                
                                                );
 
-                                       $delete_href = 
"javascript:load_delete_allocation({$allocation['id']});";
+                                       $delete_href = 
"javascript:load_delete_allocation({$allocation['requirement_id']},{$allocation['id']});";
 
                                        $allocation['delete_link'] = "<a 
class=\"btn-sm \" href=\"{$delete_href}\">{$lang_delete}</a>";
 
@@ -606,11 +606,11 @@
 
                        if($status)
                        {
-                               return json_encode( array( "status" => 
"deleted" ) );
+                               return array( "status" => "deleted" );
                        }
                        else
                        {
-                               return json_encode( array( "status" => 
"not_deleted" ) );
+                               return array( "status" => "not_deleted" );
                        }
                } 
 

Modified: branches/dev-syncromind/logistic/js/logistic/requirement_overview.js
===================================================================
--- branches/dev-syncromind/logistic/js/logistic/requirement_overview.js        
2015-04-14 14:16:32 UTC (rev 13007)
+++ branches/dev-syncromind/logistic/js/logistic/requirement_overview.js        
2015-04-14 14:17:25 UTC (rev 13008)
@@ -2,7 +2,7 @@
                var oArgs = {menuaction: 'logistic.uirequirement.edit', 
activity_id:activity_id, nonavbar: true, lean: true};
                var requestUrl = phpGWLink('index.php', oArgs);
 
-               TINY.box.show({iframe:requestUrl, 
boxid:'frameless',width:750,height:450,fixed:false,maskid:'darkmask',maskopacity:40,
 mask:true, animate:true, close: true,closejs:function(){closeJS_local()}});
+               TINY.box.show({iframe:requestUrl, 
boxid:'frameless',width:750,height:450,fixed:false,maskid:'darkmask',maskopacity:40,
 mask:true, animate:true, close: 
true,closejs:function(){closeJS_local(activity_id)}});
        }
 
        function load_requirement_edit_id( id , activity_id){
@@ -19,36 +19,48 @@
                        var oArgs = {menuaction: 
'logistic.uirequirement.delete', id:id};
                        var requestUrl = phpGWLink('index.php', oArgs, true);
 
-                       var callback =  {       success: function(o){
-                                                               //      var 
message_delete = o.responseText.toString().replace("\"","").replace("\"","");
-                                                                       var 
reqUrl = datatable_source;
-                                                                       
YAHOO.portico.inlineTableHelper('requirement-container', reqUrl, 
YAHOO.portico.columnDefs);
-                                                                       },
-                                                       failure: 
function(o){window.alert('failed')},
-                                                       timeout: 10000
-                                               };
-                       var request = YAHOO.util.Connect.asyncRequest('POST', 
requestUrl, callback);
+                       var callback =  function(result)
+                               {
+                                       
JqueryPortico.updateinlineTableHelper('requirement-container');
+                               };
+                       JqueryPortico.execute_ajax(requestUrl, callback, 
{},'POST', 'json');
                }
        }
 
 
-       function load_delete_allocation( id ){
+       function load_delete_allocation( requirement_id, id )
+       {
                confirm_msg = 'Slette allokering?';
                if(confirm(confirm_msg))
                {
                        var oArgs = {menuaction: 
'logistic.uirequirement_resource_allocation.delete', id:id};
                        var requestUrl = phpGWLink('index.php', oArgs, true);
 
-                       var callback =  {       success: function(o){
-                                                                       
//message_delete = YAHOO.lang.JSON.parse(o.responseText);
-                                                                       
//console.log(message_delete);
-                                                                       
YAHOO.portico.updateinlineTableHelper('requirement-container');
-                                                                       
YAHOO.portico.updateinlineTableHelper('allocation-container');
-                                                                       },
-                                                       failure: 
function(o){window.alert('failed')},
-                                                       timeout: 10000
-                                               };
-                       var request = YAHOO.util.Connect.asyncRequest('POST', 
requestUrl, callback);
+                       $.ajax({
+                                 type: 'POST',
+                                 url: requestUrl,
+                                 success: function(data) {
+                                         var obj = data;
+                                         if(obj.status == "deleted")
+                                         {
+                                               var oArgs2 = {
+                                                               
menuaction:'logistic.uirequirement_resource_allocation.index',
+                                                               requirement_id: 
requirement_id,
+                                                               type: 
"requirement_id"
+                                                       };
+
+                                               var requestUrl2 = 
phpGWLink('index.php', oArgs2, true);
+
+                                                
JqueryPortico.updateinlineTableHelper('allocation-container', requestUrl2);
+                                                
JqueryPortico.updateinlineTableHelper('requirement-container');
+                                         }
+                                 },
+                                 error: function(XMLHttpRequest, textStatus, 
errorThrown) {
+                                       if (XMLHttpRequest.status === 401) {
+                                         window.alert('failed');
+                                       }
+                                 }
+                       });
                }
        }
 
@@ -97,8 +109,7 @@
 
                var requestUrl = phpGWLink('index.php', oArgs, true);
 
-               JqueryPortico.updateinlineTableHelper(oTable0, requestUrl);
-
+               JqueryPortico.updateinlineTableHelper('requirement-container', 
requestUrl);
        }
 
 

Modified: branches/dev-syncromind/logistic/js/logistic/resource_allocation.js
===================================================================
--- branches/dev-syncromind/logistic/js/logistic/resource_allocation.js 
2015-04-14 14:16:32 UTC (rev 13007)
+++ branches/dev-syncromind/logistic/js/logistic/resource_allocation.js 
2015-04-14 14:17:25 UTC (rev 13008)
@@ -1,17 +1,15 @@
 $(document).ready(function(){
 
-       $("#requirement-container table tr").on("click", function(e){
-               var thisRow = $(this);
-               
-               var requirement_id = 
$(thisRow).find("td.requirement_id").find("div").text();
-               
+       $("#requirement-container").on("click", function(e){
+               var requirement_id = $('td', this).eq(0).text();
                updateAllocationTable( requirement_id );
     });
-       
+/*
        $("#allocation-container table .btn-sm.delete").on("click", function(e){
                var thisRow = $(this).parents("tr");
                
                var requestUrl = $(this).attr("href");
+               alert(requestUrl);
                
                $.ajax({
                          type: 'POST',
@@ -33,27 +31,23 @@
                
                return false;
     });
+       */
 });
 
+function updateAllocationTable(requirement_id)
+{
+       if(!requirement_id)
+       {
+               return;
+       }
 
-function updateAllocationTable( requirement_id ){
-
        var oArgs = {
                        
menuaction:'logistic.uirequirement_resource_allocation.index',
                        requirement_id: requirement_id,
-                       type: 'requirement_id',
-                       phpgw_return_as: 'json'
+                       type: "requirement_id"
                };
-               
+
                var requestUrl = phpGWLink('index.php', oArgs, true);
-       
-               var myColumnDefs = [ 
-               {key:"id", sortable:true}, 
-               {key:"requirement_id", sortable:true}, 
-               {key:"location_id", sortable:true}, 
-               {key:"resource_id", sortable:true} 
-           ]; 
-       
-               YAHOO.portico.inlineTableHelper('allocation-container', 
requestUrl, myColumnDefs);
-}
 
+               JqueryPortico.updateinlineTableHelper('allocation-container', 
requestUrl);
+}

Modified: 
branches/dev-syncromind/logistic/templates/base/requirement/requirement_item.xsl
===================================================================
--- 
branches/dev-syncromind/logistic/templates/base/requirement/requirement_item.xsl
    2015-04-14 14:16:32 UTC (rev 13007)
+++ 
branches/dev-syncromind/logistic/templates/base/requirement/requirement_item.xsl
    2015-04-14 14:17:25 UTC (rev 13008)
@@ -11,7 +11,6 @@
        <xsl:value-of select="php:function('get_phpgw_link', '/index.php', 
$action_params )" />
 </xsl:variable>
 
-
        <div id="details">
                <form action="{$action_url}" method="post">
                        <input type="hidden" name="id" value = 
"{requirement/id}" />

Modified: 
branches/dev-syncromind/logistic/templates/base/requirement/requirement_overview.xsl
===================================================================
--- 
branches/dev-syncromind/logistic/templates/base/requirement/requirement_overview.xsl
        2015-04-14 14:16:32 UTC (rev 13007)
+++ 
branches/dev-syncromind/logistic/templates/base/requirement/requirement_overview.xsl
        2015-04-14 14:17:25 UTC (rev 13008)
@@ -25,9 +25,9 @@
                        </xsl:if>
 
                        <div style="clear:both;" id="paging"></div>
-                       <div style="margin-bottom: 40px;" 
id="requirement-container">
+                       <div style="margin-bottom: 40px;">
                                <xsl:for-each select="datatable_def">
-                                               <xsl:if test="container = 
'datatable-container_0'">
+                                               <xsl:if test="container = 
'requirement-container'">
                                                        <xsl:call-template 
name="table_setup">
                                                                <xsl:with-param 
name="container" select ='container'/>
                                                                <xsl:with-param 
name="requestUrl" select ='requestUrl' />
@@ -46,7 +46,7 @@
                                <!-- // Needed for case of only one checkbox in 
datatable-->
                                <input type='hidden' name='assign_requirement' 
value = '0'/>
                                <xsl:for-each select="datatable_def">
-                                               <xsl:if test="container = 
'datatable-container_1'">
+                                               <xsl:if test="container = 
'allocation-container'">
                                                        <xsl:call-template 
name="table_setup">
                                                                <xsl:with-param 
name="container" select ='container'/>
                                                                <xsl:with-param 
name="requestUrl" select ='requestUrl' />
@@ -59,39 +59,6 @@
                                </xsl:for-each>
                        </form>
        </div>
-       <xsl:call-template name="datasource-def" />
        </div>
 
-</xsl:template>
-
-<xsl:template name="datasource-def">
-
-       <script>
-       
-               $(document).ready(function()
-               {
-                       $('#datatable-container_0 tbody').on('click', 'tr', 
function () {
-                               var requirement_id = $('td', this).eq(0).text();
-                               updateAllocationTable( requirement_id );
-                       } );
-
-               });
-               
-               function updateAllocationTable(requirement_id)
-               {
-                       if(!requirement_id)
-                       {
-                               return;
-                       }
-
-                       var oArgs = {
-                                       
menuaction:'logistic.uirequirement_resource_allocation.index',
-                                       requirement_id: requirement_id,
-                                       type: "requirement_id"
-                               };
-                               
-                               var requestUrl = phpGWLink('index.php', oArgs, 
true);
-                               JqueryPortico.updateinlineTableHelper(oTable1, 
requestUrl);                     
-               }
-  </script>
-</xsl:template>
+</xsl:template>
\ No newline at end of file




reply via email to

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