fmsystem-commits
[Top][All Lists]
Advanced

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

[Fmsystem-commits] [10384]


From: Torstein
Subject: [Fmsystem-commits] [10384]
Date: Tue, 30 Oct 2012 11:05:54 +0000

Revision: 10384
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=10384
Author:   vator
Date:     2012-10-30 11:05:53 +0000 (Tue, 30 Oct 2012)
Log Message:
-----------


Modified Paths:
--------------
    trunk/logistic/inc/class.uirequirement.inc.php
    trunk/logistic/inc/class.uirequirement_resource_allocation.inc.php
    trunk/logistic/templates/base/requirement/requirement_overview.xsl

Added Paths:
-----------
    trunk/logistic/js/logistic/resource_allocation.js

Removed Paths:
-------------
    trunk/logistic/js/logistic/allocation.js

Modified: trunk/logistic/inc/class.uirequirement.inc.php
===================================================================
--- trunk/logistic/inc/class.uirequirement.inc.php      2012-10-30 10:12:35 UTC 
(rev 10383)
+++ trunk/logistic/inc/class.uirequirement.inc.php      2012-10-30 11:05:53 UTC 
(rev 10384)
@@ -174,8 +174,11 @@
                        phpgwapi_yui::load_widget('paginator');
                        $activity_id = phpgw::get_var('activity_id');
 
+                       $activity = 
$this->so_activity->get_single($activity_id);
+                       
                        $data = array(
                                'datatable_name'        => lang('requirement'),
+                               'activity'      => $activity,
                                'form' => array(
                                        'toolbar' => array(
                                                'item' => array(
@@ -224,52 +227,17 @@
                                                        'hidden' => true
                                                ),
                                                array(
-                                                       'key' => 'activity_id',
+                                                       'key' => 'id',
+                                                       'className' => 
'requirement_id',
                                                        'hidden' => true
                                                )
                                        )
                                ),
                        );
 
-                       $parameters = array
-                               (
-                                       'parameter' => array
-                                       (
-                                               array
-                                               (
-                                                       'name'          => 
'requirement_id',
-                                                       'source'        => 'id'
-                                               ),
-                                               array
-                                               (
-                                                       'name'          => 
'activity_id',
-                                                       'source'        => 
'activity_id'
-                                               ),
-                                       )
-                               );
+                       phpgwapi_jquery::load_widget('core');
 
-                       $data['datatable']['actions'][] = array
-                                       (
-                                               'my_name'               => 
'allocate_booking',
-                                               'text'                  => 
lang('t_new_booking_allocation'),
-                                               'action'                => 
$GLOBALS['phpgw']->link('/index.php',array
-                                               (
-                                                       'menuaction'    => 
'logistic.uirequirement_resource_allocation.edit'
-                                               )),
-                                               'parameters'    => 
json_encode($parameters)
-                                       );
-
-                       $data['datatable']['actions'][] = array
-                                       (
-                                               'my_name'               => 
'view_booking_allocations',
-                                               'text'                  => 
lang('t_view_booking_allocations'),
-                                               'action'                => 
$GLOBALS['phpgw']->link('/index.php',array
-                                               (
-                                                       'menuaction'    => 
'logistic.uirequirement_resource_allocation.index'
-                                               )),
-                                               'parameters'    => 
json_encode($parameters)
-                                       );
-
+                       self::add_javascript('logistic', 'logistic', 
'resource_allocation.js');
                        self::render_template_xsl( 
'requirement/requirement_overview', $data);
                }
 

Modified: trunk/logistic/inc/class.uirequirement_resource_allocation.inc.php
===================================================================
--- trunk/logistic/inc/class.uirequirement_resource_allocation.inc.php  
2012-10-30 10:12:35 UTC (rev 10383)
+++ trunk/logistic/inc/class.uirequirement_resource_allocation.inc.php  
2012-10-30 11:05:53 UTC (rev 10384)
@@ -203,6 +203,12 @@
 
                        switch ($query_type)
                        {
+                               case 'requirement_id':
+                                       $requirement_id = 
phpgw::get_var('requirement_id');
+                                       $filters = array('requirement_id' => 
$requirement_id);
+                                       $result_objects = 
$this->so->get($start_index, $num_of_objects, $sort_field, $sort_ascending, 
$search_for, $search_type, $filters);
+                                       $object_count = 
$this->so->get_count($search_for, $search_type, $filters);
+                                       break;
                                default: // ... all composites, filters (active 
and vacant)
                                        $result_objects = 
$this->so->get($start_index, $num_of_objects, $sort_field, $sort_ascending, 
$search_for, $search_type, $filters);
                                        $object_count = 
$this->so->get_count($search_for, $search_type, $filters);

Deleted: trunk/logistic/js/logistic/allocation.js
===================================================================
--- trunk/logistic/js/logistic/allocation.js    2012-10-30 10:12:35 UTC (rev 
10383)
+++ trunk/logistic/js/logistic/allocation.js    2012-10-30 11:05:53 UTC (rev 
10384)
@@ -1,4 +0,0 @@
-$(document).ready(function(){
-
-       
-});
\ No newline at end of file

Copied: trunk/logistic/js/logistic/resource_allocation.js (from rev 10206, 
trunk/logistic/js/logistic/allocation.js)
===================================================================
--- trunk/logistic/js/logistic/resource_allocation.js                           
(rev 0)
+++ trunk/logistic/js/logistic/resource_allocation.js   2012-10-30 11:05:53 UTC 
(rev 10384)
@@ -0,0 +1,34 @@
+$(document).ready(function(){
+
+       $("#requirement-container table tr").live("click", function(e){
+               var thisRow = $(this);
+               
+               var requirement_id = 
$(thisRow).find("td.requirement_id").find("div").text();
+               
+               updateAllocationTable( requirement_id );
+    });
+       
+});
+
+
+function updateAllocationTable( requirement_id ){
+
+       var oArgs = {
+                       
menuaction:'logistic.uirequirement_resource_allocation.index',
+                       requirement_id: requirement_id,
+                       type: 'requirement_id',
+                       phpgw_return_as: 'json'
+               };
+               
+               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);
+}
+


Property changes on: trunk/logistic/js/logistic/resource_allocation.js
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Modified: trunk/logistic/templates/base/requirement/requirement_overview.xsl
===================================================================
--- trunk/logistic/templates/base/requirement/requirement_overview.xsl  
2012-10-30 10:12:35 UTC (rev 10383)
+++ trunk/logistic/templates/base/requirement/requirement_overview.xsl  
2012-10-30 11:05:53 UTC (rev 10384)
@@ -22,9 +22,18 @@
                  <form action="" name="acl_form" id="acl_form" method="post">
                                <div id="paging"></div>
        
-                               <div id="requirement-container"></div>
-
-                               <div id="allocation-container"></div>
+                               <div style="margin-bottom: 40px;" 
id="requirement-container"></div>
+                               
+                               <xsl:variable name="params">
+                                       
<xsl:text>menuaction:logistic.uirequirement.edit, activity_id:</xsl:text>
+                                       <xsl:value-of select="activity/id" />
+                               </xsl:variable>
+                               <xsl:variable name="edit_url">
+                                       <xsl:value-of 
select="php:function('get_phpgw_link', '/index.php', $params )" />
+                               </xsl:variable>
+                               <a class="btn" href="{$edit_url}"><xsl:value-of 
select="php:function('lang', 'Add requirement')" /></a>
+                               
+                               <div style="margin-top: 40px;" 
id="allocation-container"></div>
                        </form>
        </div>
        <xsl:call-template name="datasource-definition" />
@@ -35,26 +44,6 @@
        <script>
        YAHOO.util.Event.onDOMReady(function(){
         
-               <xsl:choose>
-                       <xsl:when test="//datatable/actions">
-                               YAHOO.portico.actions = [
-                                       <xsl:for-each 
select="//datatable/actions">
-                                               {
-                                                       my_name: "<xsl:value-of 
select="my_name"/>",
-                                                       text: "<xsl:value-of 
select="text"/>",
-                                                       <xsl:if 
test="parameters">
-                                                               parameters: 
<xsl:value-of select="parameters"/>,
-                                                   </xsl:if>
-                                                       action: "<xsl:value-of 
select="action"/>"
-                                               }<xsl:value-of 
select="phpgw:conditional(not(position() = last()), ',', '')"/>
-                                       </xsl:for-each>
-                               ];
-                       </xsl:when>
-                       <xsl:otherwise>
-                               YAHOO.portico.actions = [];
-                       </xsl:otherwise>
-               </xsl:choose>
-        
        YAHOO.portico.columnDefs = [
                                <xsl:for-each select="//datatable/field">
                                        {
@@ -79,25 +68,38 @@
                        ];
                        
                        var reqUrl = '<xsl:value-of 
select="//datatable/source"/>';
-       
+                       
                        
YAHOO.portico.inlineTableHelper('requirement-container', reqUrl, 
YAHOO.portico.columnDefs);
-                       
+       });
+       
+       $(document).ready(function(){
+
+                       var requirement_id = $("#requirement-container 
table").find("tr:first").find("td.requirement_id").find("div").text();
+                               alert(requirement_id);
+                       updateAllocationTable( requirement_id );
+               });
+               
+               
+               function updateAllocationTable(requirement_id){
+               
                        var oArgs = {
-                               
menuaction:'logistic.uirequirement_resource_allocation.index',
-                               requirement_id: '2',
-                               phpgw_return_as: 'json'
-                       };
+                                       
menuaction:'logistic.uirequirement_resource_allocation.index',
+                                       requirement_id: requirement_id,
+                                       type: "requirement_id",
+                                       phpgw_return_as: 'json'
+                               };
+                               
+                               var requestUrl = phpGWLink('index.php', oArgs, 
true);
                        
-                       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);
-       }); 
+                               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);
+               }
+       
   </script>
 </xsl:template>
\ No newline at end of file




reply via email to

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