fmsystem-commits
[Top][All Lists]
Advanced

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

[Fmsystem-commits] [11264] more on logistic


From: Sigurd Nes
Subject: [Fmsystem-commits] [11264] more on logistic
Date: Tue, 13 Aug 2013 11:21:08 +0000

Revision: 11264
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=11264
Author:   sigurdne
Date:     2013-08-13 11:21:08 +0000 (Tue, 13 Aug 2013)
Log Message:
-----------
more on logistic

Modified Paths:
--------------
    trunk/logistic/inc/class.uiactivity.inc.php
    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/requirement_overview.js

Modified: trunk/logistic/inc/class.uiactivity.inc.php
===================================================================
--- trunk/logistic/inc/class.uiactivity.inc.php 2013-08-12 13:30:30 UTC (rev 
11263)
+++ trunk/logistic/inc/class.uiactivity.inc.php 2013-08-13 11:21:08 UTC (rev 
11264)
@@ -738,6 +738,8 @@
                        $data['breadcrumb'] = $this->_get_breadcrumb( 
$activity_id, 'logistic.uiactivity.view_resource_allocation', 'activity_id');
 
                        self::add_javascript('logistic', 'logistic', 
'resource_allocation.js');
+                       self::add_javascript('logistic', 'logistic', 
'requirement_overview.js');
+
                        self::add_javascript('logistic', 'logistic', 
'requirement.js');
                        self::add_javascript('phpgwapi', 'tinybox2', 
'packed.js');
                        
$GLOBALS['phpgw']->css->add_external_file('phpgwapi/js/tinybox2/style.css');

Modified: trunk/logistic/inc/class.uirequirement.inc.php
===================================================================
--- trunk/logistic/inc/class.uirequirement.inc.php      2013-08-12 13:30:30 UTC 
(rev 11263)
+++ trunk/logistic/inc/class.uirequirement.inc.php      2013-08-13 11:21:08 UTC 
(rev 11264)
@@ -57,18 +57,20 @@
            private $delete;
            private $manage;
 
-               public $public_functions = array(
-                       'query'                                                 
                        => true,
-                       'index'                                                 
                        => true,
-                       'add'                                                   
                        => true,
-                       'edit'                                                  
                        => true,
-                       'delete'                                                
                        => true,
-                       'view'                                                  
                        => true,
-                       'save'                                                  
                        => true,
-                       'add_requirement_values'        => true,
-                       'view_requirement_values' => true,
-                       'save_requirement_values' => true,
-                       'get_custom_attributes'         => true
+               public $public_functions = array
+               (
+                       'query'                                                 
=> true,
+                       'index'                                                 
=> true,
+                       'add'                                                   
=> true,
+                       'edit'                                                  
=> true,
+                       'delete'                                                
=> true,
+                       'view'                                                  
=> true,
+                       'save'                                                  
=> true,
+                       'add_requirement_values'                => true,
+                       'view_requirement_values'               => true,
+                       'save_requirement_values'               => true,
+                       'get_custom_attributes'                 => true,
+                       'assign_job'                                    => true
                );
 
                public function __construct()
@@ -859,48 +861,54 @@
                                $GLOBALS['phpgw']->redirect_link('/index.php', 
array('menuaction' => 'logistic.uirequirement.view_requirement_values', 
'requirement_id' => $requirement_id, 'nonavbar' => $this->nonavbar));
                }               
                
-               public function get_custom_attributes($location_id, 
$activity_id){
+               public function get_custom_attributes($location_id, 
$activity_id)
+               {
+                       if($location_id == "")
+                       {
+                               $location_id = phpgw::get_var('location_id');
+                       }
 
-                               if($location_id == "")
-                               {
-                                       $location_id = 
phpgw::get_var('location_id');
-                               }
+                       if($activity_id == "")
+                       {
+                               $activity_id = phpgw::get_var('activity_id');
+                       }
 
-                               if($activity_id == "")
-                               {
-                                       $activity_id = 
phpgw::get_var('activity_id');
-                               }
+                       $activity = $this->so_activity->get_single( 
$activity_id );
+                       $project = $this->so_project->get_single( 
$activity->get_project_id() );
+                       $project_type_id = $project->get_project_type_id();
 
-                               $activity = $this->so_activity->get_single( 
$activity_id );
-                               $project = $this->so_project->get_single( 
$activity->get_project_id() );
-                               $project_type_id = 
$project->get_project_type_id();
+                       $filters = array('location_id' => $location_id, 
'project_type_id' => $project_type_id);
+                       $requirement_custom_attributes_array = 
$this->so_resource_type_requirement->get($start_index, $num_of_objects, 
$sort_field, $sort_ascending, $search_for, $search_type, $filters);
 
-                               $filters = array('location_id' => $location_id, 
'project_type_id' => $project_type_id);
-                               $requirement_custom_attributes_array = 
$this->so_resource_type_requirement->get($start_index, $num_of_objects, 
$sort_field, $sort_ascending, $search_for, $search_type, $filters);
+                       $custom = createObject('phpgwapi.custom_fields');
 
-                               $custom = 
createObject('phpgwapi.custom_fields');
+                       $attribute_requirement_array = array();
 
-                               $attribute_requirement_array = array();
+                       foreach($requirement_custom_attributes_array as 
$attribute_requirement)
+                       {
+                               $location_id = 
$attribute_requirement->get_location_id();
+                               $cust_attribute_id = 
$attribute_requirement->get_cust_attribute_id();
 
-                               foreach($requirement_custom_attributes_array as 
$attribute_requirement){
-                                       $location_id = 
$attribute_requirement->get_location_id();
-                                       $cust_attribute_id = 
$attribute_requirement->get_cust_attribute_id();
+                               $loc_arr = 
$GLOBALS['phpgw']->locations->get_name($location_id);
+                               $entity_arr = explode('.',$loc_arr['location']);
 
-                                       $loc_arr = 
$GLOBALS['phpgw']->locations->get_name($location_id);
-                                       $entity_arr = 
explode('.',$loc_arr['location']);
+                               $entity_id = $entity_arr[2];
+                               $cat_id = $entity_arr[3];
 
-                                       $entity_id = $entity_arr[2];
-                                       $cat_id = $entity_arr[3];
+                               $attrib_data = $custom->get('property', 
".entity.{$entity_id}.{$cat_id}", $cust_attribute_id);
 
-                                       $attrib_data = $custom->get('property', 
".entity.{$entity_id}.{$cat_id}", $cust_attribute_id);
+                               $attribute_requirement_array[] = $attrib_data;
+                       }
 
-                                       $attribute_requirement_array[] = 
$attrib_data;
-                               }
+                       return $attribute_requirement_array;
+               }
 
-                               return $attribute_requirement_array;
+               public function assign_job()
+               {
+               
                }
 
-               function make_tab_menu($requirement_id)
+               private function make_tab_menu($requirement_id)
                {
                        $tabs = array();
 

Modified: trunk/logistic/inc/class.uirequirement_resource_allocation.inc.php
===================================================================
--- trunk/logistic/inc/class.uirequirement_resource_allocation.inc.php  
2013-08-12 13:30:30 UTC (rev 11263)
+++ trunk/logistic/inc/class.uirequirement_resource_allocation.inc.php  
2013-08-13 11:21:08 UTC (rev 11264)
@@ -226,6 +226,8 @@
                        }
 
                        $rows = array();
+                       $lang_delete = lang('delete');
+                       $lang_assign = lang('assign');
                        foreach ($result_objects as $result)
                        {
                                if (isset($result))
@@ -274,7 +276,13 @@
                                                                                
                                                        'id' => 
$requirement['id'],
                                                                                
                                                        'phpgw_return_as' => 
'json')
                                                                                
                                                );
-                                       $requirement['delete_link'] = "<a 
class=\"btn-sm delete\" href=\"{$delete_href}\">Slett</a>";
+
+                                       $requirement['delete_link'] = "<a 
class=\"btn-sm delete\" href=\"{$delete_href}\">{$lang_delete}</a>";
+
+                                       $assign_href = 
"javascript:load_assign_task(document.assign_task, {$requirement['id']});";
+
+                                       $requirement['assign_job'] = "<input 
name='assign_requirement' type='checkbox' 
value='{$requirement['id']}_{$requirement['location_id']}_{$requirement['resource_id']}'
 /><a class=\"btn-sm assign\" href=\"{$assign_href}\">{$lang_assign}</a>";
+
                                        $rows[] = $requirement;
                                }
                        }

Added: trunk/logistic/js/logistic/requirement_overview.js
===================================================================
--- trunk/logistic/js/logistic/requirement_overview.js                          
(rev 0)
+++ trunk/logistic/js/logistic/requirement_overview.js  2013-08-13 11:21:08 UTC 
(rev 11264)
@@ -0,0 +1,86 @@
+       function load_requirement_edit( activity_id ){
+               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()}});
+       }
+
+       function load_requirement_edit_id( id ){
+               var oArgs = {menuaction: 'logistic.uirequirement.edit', id: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()}});
+       }
+
+       function load_requirement_delete_id( id ){
+               confirm_msg = 'Slette behov?';
+               if(confirm(confirm_msg))
+               {
+                       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);
+               }
+       }
+
+
+       function load_assign_task(frm, id ){
+
+               var assign_requirement = new Array();
+               var message = "";
+
+               //For each checkbox see if it has been checked, record the 
value.
+               for (i = 0; i < frm.assign_requirement.length; i++)
+               {
+                       if (!frm.assign_requirement[i].disabled)
+                       {
+                               if (frm.assign_requirement[i].checked)
+                               {
+                               
assign_requirement.push(frm.assign_requirement[i].value)
+                       }
+               }
+       }
+
+//console.log(assign_requirement);
+
+               assign_requirement = 
encodeURI(YAHOO.lang.JSON.stringify(assign_requirement));
+
+//alert(assign_requirement);
+
+               var oArgs = {menuaction: 'logistic.uirequirement.assign_job', 
id:id, assign_requirement: assign_requirement};
+               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_allocation(id)}});
+       }
+
+
+       function closeJS_local()
+       {
+               var reqUrl = datatable_source;
+               YAHOO.portico.inlineTableHelper('requirement-container', 
reqUrl, YAHOO.portico.columnDefs);
+       }
+
+
+       function closeJS_local_allocation(requirement_id)
+       {
+
+                       
YAHOO.portico.updateinlineTableHelper('allocation-container');
+/*
+                       var oArgs = {
+                                       
menuaction:'logistic.uirequirement_resource_allocation.index',
+                                       requirement_id: requirement_id,
+                                       type: "requirement_id"
+                               };
+                               
+                               var requestUrl = phpGWLink('index.php', oArgs, 
true);
+*/
+       }

Modified: trunk/logistic/templates/base/requirement/requirement_overview.xsl
===================================================================
--- trunk/logistic/templates/base/requirement/requirement_overview.xsl  
2013-08-12 13:30:30 UTC (rev 11263)
+++ trunk/logistic/templates/base/requirement/requirement_overview.xsl  
2013-08-13 11:21:08 UTC (rev 11264)
@@ -35,7 +35,12 @@
                        <div style="margin-bottom: 40px;" 
id="requirement-container"></div>
                                
                        <h2 style="clear:both;"><xsl:value-of 
select="php:function('lang', 'Allocated resouces')" /><span 
style="margin-left:470px;font-size:14px;">(<xsl:value-of 
select="php:function('lang', 'Click on table above to get allocations')" 
/>)</span></h2>
-                       <div id="allocation-container"></div>
+                       <form name='assign_task'>
+                               
+                               <!-- // Needed for case of only one checkbox in 
datatable-->
+                               <input type='hidden' name='assign_requirement' 
value = '0'/>
+                               <div id="allocation-container"></div>
+                       </form>
        </div>
        <xsl:call-template name="datasource-def" />
 </xsl:template>
@@ -44,45 +49,8 @@
 
        <script>
 
-       function load_requirement_edit( activity_id ){
-               var oArgs = {menuaction: 'logistic.uirequirement.edit', 
activity_id:activity_id, nonavbar: true, lean: true};
-               var requestUrl = phpGWLink('index.php', oArgs);
+       var datatable_source = '<xsl:value-of select="//datatable/source"/>';
 
-               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()}});
-       }
-
-       function load_requirement_edit_id( id ){
-               var oArgs = {menuaction: 'logistic.uirequirement.edit', id: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()}});
-       }
-
-       function load_requirement_delete_id( id ){
-               confirm_msg = 'Slette behov?';
-               if(confirm(confirm_msg))
-               {
-                       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 = '<xsl:value-of select="//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);
-               }
-       }
-
-       function closeJS_local()
-       {
-               var reqUrl = '<xsl:value-of select="//datatable/source"/>';
-               YAHOO.portico.inlineTableHelper('requirement-container', 
reqUrl, YAHOO.portico.columnDefs);
-       }
-
        YAHOO.util.Event.onDOMReady(function(){
         
        YAHOO.portico.columnDefs = [
@@ -123,23 +91,25 @@
                        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 = [ 
+                               YAHOO.portico.columnDefs_allocation = [ 
                                {key:"id", label:'Id', sortable:true},
                                {key:"fm_bim_item_name", label:'Navn på 
ressurs', sortable:true},
                                {key:"resource_type_descr", 
label:'Ressurstype', sortable:true}, 
                                {key:"allocated_amount", label:'Antall', 
sortable:false},
                                {key:"location_code", label:'Lokasjonskode', 
sortable:true},
                                {key:"fm_bim_item_address", label:'Adresse', 
sortable:true},
-                               {key:"delete_link", label:'Slett bestilling', 
sortable:true}
+                               {key:"delete_link", label:'Slett bestilling', 
sortable:true},
+                               {key:"assign_job", label:'Tildel oppdrag', 
sortable:false},
+                               {key:"related", label:'Link til oppdrag', 
sortable:false},
+                               {key:"status", label:'status', sortable:true}
                            ]; 
                        
-                               
YAHOO.portico.inlineTableHelper('allocation-container', requestUrl, 
myColumnDefs);
+                               
YAHOO.portico.inlineTableHelper('allocation-container', requestUrl, 
YAHOO.portico.columnDefs_allocation);
                }
   </script>
 </xsl:template>




reply via email to

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