fmsystem-commits
[Top][All Lists]
Advanced

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

[Fmsystem-commits] [17415] controller - more on mobilefrontend


From: sigurdne
Subject: [Fmsystem-commits] [17415] controller - more on mobilefrontend
Date: Fri, 8 Dec 2017 10:36:11 -0500 (EST)

Revision: 17415
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=17415
Author:   sigurdne
Date:     2017-12-08 10:36:10 -0500 (Fri, 08 Dec 2017)
Log Message:
-----------
controller - more on mobilefrontend

Modified Paths:
--------------
    trunk/controller/inc/class.uicheck_list.inc.php
    trunk/controller/js/controller/component.index.js
    trunk/controller/templates/base/case/create_case_message.xsl
    trunk/controller/templates/base/case/view_case_message.xsl
    trunk/controller/templates/base/check_list/fragments/nav_control_plan.xsl
    trunk/controller/templates/mobilefrontend/case/create_case_message.xsl
    trunk/controller/templates/mobilefrontend/case/view_case_message.xsl
    
trunk/controller/templates/mobilefrontend/check_list/fragments/nav_control_plan.xsl

Modified: trunk/controller/inc/class.uicheck_list.inc.php
===================================================================
--- trunk/controller/inc/class.uicheck_list.inc.php     2017-12-08 13:20:25 UTC 
(rev 17414)
+++ trunk/controller/inc/class.uicheck_list.inc.php     2017-12-08 15:36:10 UTC 
(rev 17415)
@@ -968,9 +968,18 @@
                        $assigned_to = phpgw::get_var('assigned_to', 'int');
                        $billable_hours = phpgw::get_var('billable_hours', 
'float');
 
+
+                       //From direct url
+                       $deadline_ts = phpgw::get_var('deadline_ts', 'int');
+
+                       //From datefield in edit form
                        $deadline_date_ts = 
date_converter::date_to_timestamp($deadline_date);
-                       //$original_deadline_date_ts = 
date_converter::date_to_timestamp($original_deadline_date);
 
+                       if(!$deadline_date_ts)
+                       {
+                               $deadline_date_ts = $deadline_ts;
+                       }
+
                        $error = false;
 
                        if ($planned_date != '')
@@ -1011,6 +1020,23 @@
                        {
                                $check_list = 
$this->so->get_single($check_list_id);
 
+                               if(!$planned_date_ts)
+                               {
+                                       $planned_date_ts = 
$check_list->get_planned_date();
+                               }
+                               if(!$original_deadline_date_ts)
+                               {
+                                       $original_deadline_date_ts = 
$check_list->get_original_deadline();
+                               }
+                               if(!$deadline_date_ts)
+                               {
+                                       $deadline_date_ts = 
$check_list->get_deadline();
+                               }
+                               if(!$comment)
+                               {
+                                       $comment = $check_list->get_comment();
+                               }
+
                                if ($status == 
controller_check_list::STATUS_DONE && !$submit_ok)
                                {
                                        if 
(!$this->_check_for_required($check_list))
@@ -1022,6 +1048,11 @@
                        }
                        else
                        {
+                               if(!$original_deadline_date_ts)
+                               {
+                                       $original_deadline_date_ts = 
$deadline_date_ts;
+                               }
+
                                if ($status == 
controller_check_list::STATUS_DONE && !$submit_ok)
                                {
                                        $status = 
controller_check_list::STATUS_NOT_DONE;
@@ -1193,8 +1224,12 @@
 
                                if ($check_list_id > 0)
                                {
-                                       if($submit_deviation)
+                                       if (phpgw::get_var('phpgw_return_as') 
== 'json')
                                        {
+                                               return 
json_encode(array("status" => 'ok', 'message' => lang('Ok')));
+                                       }
+                                       else if($submit_deviation)
+                                       {
                                                
$this->redirect(array('menuaction' => 'controller.uicase.add_case',
                                                        'check_list_id' => 
$check_list_id));
                                        }
@@ -1206,13 +1241,21 @@
                                }
                                else
                                {
+                                       if (phpgw::get_var('phpgw_return_as') 
== 'json')
+                                       {
+                                               return 
json_encode(array("status" => 'error', 'message' => lang('Error')));
+                                       }
                                        $this->edit_check_list($check_list);
                                }
                        }
                        else
                        {
-                               if ($check_list->get_id() > 0)
+                               if (phpgw::get_var('phpgw_return_as') == 'json')
                                {
+                                       return json_encode(array("status" => 
'error', 'message' => lang('Error')));
+                               }
+                               else if ($check_list->get_id() > 0)
+                               {
                                        $this->edit_check_list($check_list);
                                }
                                else

Modified: trunk/controller/js/controller/component.index.js
===================================================================
--- trunk/controller/js/controller/component.index.js   2017-12-08 13:20:25 UTC 
(rev 17414)
+++ trunk/controller/js/controller/component.index.js   2017-12-08 15:36:10 UTC 
(rev 17415)
@@ -389,35 +389,56 @@
 perform_action = function(name, oArgs)
 {
 
-               if(name == 'save_check_list')
-               {
-                       //nothing
-                       location.assign(phpGWLink('index.php', oArgs));
-                       return
-               }
-               else if (name == 'submit_ok')
-               {
-                       oArgs.menuaction = 
'controller.uicheck_list.save_check_list';
-                       oArgs.submit_ok = 1;
+       if(name === 'save_check_list')
+       {
+               //nothing
+               location.assign(phpGWLink('index.php', oArgs));
+               return;
+       }
+       else if (name === 'submit_ok')
+       {
+               oArgs.menuaction = 'controller.uicheck_list.save_check_list';
 
-               }
-               else if (name == 'submit_deviation')
-               {
-                       oArgs.menuaction = 
'controller.uicheck_list.save_check_list';
-                       oArgs.submit_deviation = 1;
-               }
+               var confirm_msg = "Godkjenner du denne uten avvik?";
 
-console.log(oArgs);
-
-               var requestUrl = phpGWLink('index.php', oArgs);
-               var confirm_msg = requestUrl;
-               var r = confirm(confirm_msg);
-               if (r !== true)
+               if (confirm(confirm_msg) !== true)
                {
                        return false;
                }
 
+               var requestUrl = phpGWLink('index.php', oArgs, true);
+
+               $.ajax({
+                       type: 'POST',
+                       data: {submit_ok: 1},
+                       dataType: 'json',
+                       url: requestUrl,
+                       success: function (data)
+                       {
+                               if (data !== null)
+                               {
+                                       var message = data.message;
+
+                                       if (data.status === 'error')
+                                       {
+                                               alert(message);
+                                       }
+                                       else
+                                       {
+                                               alert('Ok');
+                                               update_table();
+                                       }
+                               }
+                       }
+               });
+       }
+       else if (name === 'submit_deviation')
+       {
+               oArgs.menuaction = 'controller.uicheck_list.save_check_list';
+               oArgs.submit_deviation = 1;
                location.assign(phpGWLink('index.php', oArgs));
+       }
+
 };
 
 

Modified: trunk/controller/templates/base/case/create_case_message.xsl
===================================================================
--- trunk/controller/templates/base/case/create_case_message.xsl        
2017-12-08 13:20:25 UTC (rev 17414)
+++ trunk/controller/templates/base/case/create_case_message.xsl        
2017-12-08 15:36:10 UTC (rev 17415)
@@ -32,6 +32,8 @@
                                                                <xsl:value-of 
select="php:function('get_phpgw_link', '/index.php', 
'menuaction:controller.uicomponent.index' )" />
                                                                
<xsl:text>&amp;year=</xsl:text>
                                                                <xsl:value-of 
select="current_year"/>
+                                                               
<xsl:text>&amp;month=</xsl:text>
+                                                               <xsl:value-of 
select="current_month_nr"/>
                                                                
<xsl:text>&amp;location_id=</xsl:text>
                                                                <xsl:value-of 
select="component_array/location_id"/>
                                                                
<xsl:text>&amp;component_id=</xsl:text>

Modified: trunk/controller/templates/base/case/view_case_message.xsl
===================================================================
--- trunk/controller/templates/base/case/view_case_message.xsl  2017-12-08 
13:20:25 UTC (rev 17414)
+++ trunk/controller/templates/base/case/view_case_message.xsl  2017-12-08 
15:36:10 UTC (rev 17415)
@@ -33,6 +33,8 @@
                                                                <xsl:value-of 
select="php:function('get_phpgw_link', '/index.php', 
'menuaction:controller.uicomponent.index' )" />
                                                                
<xsl:text>&amp;year=</xsl:text>
                                                                <xsl:value-of 
select="current_year"/>
+                                                               
<xsl:text>&amp;month=</xsl:text>
+                                                               <xsl:value-of 
select="current_month_nr"/>
                                                                
<xsl:text>&amp;location_id=</xsl:text>
                                                                <xsl:value-of 
select="component_array/location_id"/>
                                                                
<xsl:text>&amp;component_id=</xsl:text>

Modified: 
trunk/controller/templates/base/check_list/fragments/nav_control_plan.xsl
===================================================================
--- trunk/controller/templates/base/check_list/fragments/nav_control_plan.xsl   
2017-12-08 13:20:25 UTC (rev 17414)
+++ trunk/controller/templates/base/check_list/fragments/nav_control_plan.xsl   
2017-12-08 15:36:10 UTC (rev 17415)
@@ -10,6 +10,8 @@
                                        <xsl:value-of 
select="php:function('get_phpgw_link', '/index.php', 
'menuaction:controller.uicomponent.index' )" />
                                        <xsl:text>&amp;year=</xsl:text>
                                        <xsl:value-of select="current_year"/>
+                                       <xsl:text>&amp;month=</xsl:text>
+                                       <xsl:value-of 
select="current_month_nr"/>
                                        <xsl:text>&amp;location_id=</xsl:text>
                                        <xsl:value-of 
select="component_array/location_id"/>
                                        <xsl:text>&amp;component_id=</xsl:text>

Modified: trunk/controller/templates/mobilefrontend/case/create_case_message.xsl
===================================================================
--- trunk/controller/templates/mobilefrontend/case/create_case_message.xsl      
2017-12-08 13:20:25 UTC (rev 17414)
+++ trunk/controller/templates/mobilefrontend/case/create_case_message.xsl      
2017-12-08 15:36:10 UTC (rev 17415)
@@ -39,6 +39,8 @@
                                                                                
<xsl:value-of select="php:function('get_phpgw_link', '/index.php', 
'menuaction:controller.uicomponent.index' )" />
                                                                                
<xsl:text>&amp;year=</xsl:text>
                                                                                
<xsl:value-of select="current_year"/>
+                                                                               
<xsl:text>&amp;month=</xsl:text>
+                                                                               
<xsl:value-of select="current_month_nr"/>
                                                                                
<xsl:text>&amp;location_id=</xsl:text>
                                                                                
<xsl:value-of select="component_array/location_id"/>
                                                                                
<xsl:text>&amp;component_id=</xsl:text>

Modified: trunk/controller/templates/mobilefrontend/case/view_case_message.xsl
===================================================================
--- trunk/controller/templates/mobilefrontend/case/view_case_message.xsl        
2017-12-08 13:20:25 UTC (rev 17414)
+++ trunk/controller/templates/mobilefrontend/case/view_case_message.xsl        
2017-12-08 15:36:10 UTC (rev 17415)
@@ -37,6 +37,8 @@
                                                                                
<xsl:value-of select="php:function('get_phpgw_link', '/index.php', 
'menuaction:controller.uicomponent.index' )" />
                                                                                
<xsl:text>&amp;year=</xsl:text>
                                                                                
<xsl:value-of select="current_year"/>
+                                                                               
<xsl:text>&amp;month=</xsl:text>
+                                                                               
<xsl:value-of select="current_month_nr"/>
                                                                                
<xsl:text>&amp;location_id=</xsl:text>
                                                                                
<xsl:value-of select="component_array/location_id"/>
                                                                                
<xsl:text>&amp;component_id=</xsl:text>

Modified: 
trunk/controller/templates/mobilefrontend/check_list/fragments/nav_control_plan.xsl
===================================================================
--- 
trunk/controller/templates/mobilefrontend/check_list/fragments/nav_control_plan.xsl
 2017-12-08 13:20:25 UTC (rev 17414)
+++ 
trunk/controller/templates/mobilefrontend/check_list/fragments/nav_control_plan.xsl
 2017-12-08 15:36:10 UTC (rev 17415)
@@ -13,6 +13,8 @@
                                                <xsl:value-of 
select="php:function('get_phpgw_link', '/index.php', 
'menuaction:controller.uicomponent.index' )" />
                                                <xsl:text>&amp;year=</xsl:text>
                                                <xsl:value-of 
select="current_year"/>
+                                               <xsl:text>&amp;month=</xsl:text>
+                                               <xsl:value-of 
select="current_month_nr"/>
                                                
<xsl:text>&amp;location_id=</xsl:text>
                                                <xsl:value-of 
select="component_array/location_id"/>
                                                
<xsl:text>&amp;component_id=</xsl:text>




reply via email to

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