fmsystem-commits
[Top][All Lists]
Advanced

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

[Fmsystem-commits] [8843]


From: Torstein
Subject: [Fmsystem-commits] [8843]
Date: Mon, 13 Feb 2012 10:31:09 +0000

Revision: 8843
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=8843
Author:   vator
Date:     2012-02-13 10:31:09 +0000 (Mon, 13 Feb 2012)
Log Message:
-----------


Modified Paths:
--------------
    trunk/controller/inc/class.uicase.inc.php
    trunk/controller/inc/helper/class.status_checker.inc.php
    trunk/controller/js/controller/ajax.js
    trunk/controller/templates/base/check_list/view_open_cases.xsl
    
trunk/controller/templates/base/control_location/view_locations_for_control.xsl
    trunk/controller/templates/base/css/base.css

Modified: trunk/controller/inc/class.uicase.inc.php
===================================================================
--- trunk/controller/inc/class.uicase.inc.php   2012-02-13 09:19:27 UTC (rev 
8842)
+++ trunk/controller/inc/class.uicase.inc.php   2012-02-13 10:31:09 UTC (rev 
8843)
@@ -52,7 +52,8 @@
                                                                        
'register_case_message'         => true,
                                                                        
'register_measurement_case' => true,
                                                                        
'updateStatusForCases'          => true,
-                                                                       
'delete_case'                           => true
+                                                                       
'delete_case'                           => true,
+                                                                       
'close_case'                            => true
                                                                );
 
                function __construct()
@@ -399,5 +400,25 @@
                                return json_encode( array( "status" => 
"not_deleted" ) );
                }
                
+               public function close_case()
+               {
+                       $case_id = phpgw::get_var('case_id');
+                       $check_list_id = phpgw::get_var('check_list_id');
+                               
+                       $case = $this->so->get_single($case_id);
+                       $case->set_status(1);
+                       
+                       $case_id = $this->so->store($case);
+                                       
+                       if($case_id > 0){
+                               $status_checker = new status_checker();
+                               $status_checker->update_check_list_status( 
$check_list_id );
+                                               
+                               return json_encode( array( "status" => "closed" 
) );
+                       }
+                       else
+                               return json_encode( array( "status" => 
"not_closed" ) );
+               }
+               
                public function query(){}
        }

Modified: trunk/controller/inc/helper/class.status_checker.inc.php
===================================================================
--- trunk/controller/inc/helper/class.status_checker.inc.php    2012-02-13 
09:19:27 UTC (rev 8842)
+++ trunk/controller/inc/helper/class.status_checker.inc.php    2012-02-13 
10:31:09 UTC (rev 8843)
@@ -24,15 +24,16 @@
                
                $num_open_cases = 0;
                $num_pending_cases = 0;
-               
+                               
                foreach($check_items as $check_item){
                        
                        foreach($check_item->get_cases_array() as $case){
                                
-                               if($case->get_status() == 0 | 
$case->get_status() == 2){
+                               if($case->get_status() == 0){
                                        $num_open_cases++;
                                }
-                               else if($case->get_status() == 2){
+                               
+                               if($case->get_status() == 2){
                                        $num_pending_cases++;
                                }
                        }       

Modified: trunk/controller/js/controller/ajax.js
===================================================================
--- trunk/controller/js/controller/ajax.js      2012-02-13 09:19:27 UTC (rev 
8842)
+++ trunk/controller/js/controller/ajax.js      2012-02-13 10:31:09 UTC (rev 
8843)
@@ -1,7 +1,7 @@
 $(document).ready(function(){
                
        // file: uicalendar.xsl
-       $("#choose_my_location option").click(function () {
+       $("#choose_my_location").change(function () {
                 var location_code = $(this).val();
                 var thisForm = $(this).parents("form");
                 
@@ -29,8 +29,8 @@
        
        // file: uicheck_list.xsl
        // When control area is selected, controls are fetched from db and 
control select list is populated
-       $("#control_area_list option").click(function () {
-                var control_area_id = $(this).val();
+       $("#control_area_list").change(function () {
+               var control_area_id = $(this).val();
                 var oArgs = 
{menuaction:'controller.uicontrol.get_controls_by_control_area', 
phpgw_return_as:'json'};
                 var requestUrl = phpGWLink('index.php', oArgs, true);
          //var requestUrl = 
"index.php?menuaction=controller.uicontrol.get_controls_by_control_area&phpgw_return_as=json"
@@ -61,7 +61,7 @@
 
        // file: uicheck_list.xsl
        // When control area is selected, controls are fetched from db and 
control select list is populated
-       $("#control_group_area_list option").click(function () {
+       $("#control_group_area_list").change(function () {
                 var control_area_id = $(this).val();
             var oArgs = 
{menuaction:'controller.uicontrol_group.get_control_groups_by_control_area', 
phpgw_return_as:'json'};
                 var requestUrl = phpGWLink('index.php', oArgs, true);
@@ -95,7 +95,7 @@
        
        // file: add_component_to_control.xsl
        // When component category is selected, corresponding component types 
are fetched from db and component type select list is populated
-       $("#ifc option").click(function () {
+       $("#ifc").change(function () {
                 var ifc_id = $(this).val();
                 
                 var oArgs = 
{menuaction:'controller.uicheck_list_for_component.get_component_types_by_category',
 phpgw_return_as:'json'};
@@ -128,7 +128,7 @@
        
        // file: control.xsl 
        // When control area is selected, procedures are fetched from db and 
procedure select list is populated
-       $("#control_area_id option").click(function () {
+       $("#control_area_id").change(function () {
                 var control_area_id = $(this).val();
                 
                 var oArgs = 
{menuaction:'controller.uiprocedure.get_procedures'};
@@ -453,18 +453,19 @@
                          success: function(data) {
                                  if(data){
                                  var jsonObj = jQuery.parseJSON(data);
-                               
+                
                                  if(jsonObj.status == "saved"){
-                                         var case_id = "#case_" + 
jsonObj.case.id; 
-                                         var case_descr = jsonObj.case.descr;
+                                       //  var case_id = "#case_" + 
jsonObj.case.id; 
+                                       //  var case_descr = jsonObj.case.descr;
                                          
                                          $(case_id).show();
                                          
$(case_id).find(".case_descr").text(case_descr);
-                                         $(thisForm).parents("li").remove();   
  
+                                         
$(thisForm).parents("li.quick_edit").remove();          
                                          }
                                  }
-                               }
+                         }
                });
+               
        });
        
        $("a.quick_edit").live("click", function(e){
@@ -546,6 +547,47 @@
                return false;
        });
        
+       // Close a case item from list
+       $(".close_case").live("click", function(){
+               var clickElem = $(this);
+               var clickRow = $(this).closest("li");
+               var clickItem = $(this).closest("ul");
+               var checkItemRow = $(this).parents("li.check_item_case");
+               
+               var url = $(clickElem).attr("href");
+       
+               // Sending request for deleting a control item list
+               $.ajax({
+                       type: 'POST',
+                       url: url,
+                       success: function(data) {
+                               var obj = jQuery.parseJSON(data);
+                               
+                               if(obj.status == "closed"){
+                                       if( $(clickItem).children("li").length 
> 1){
+                                               $(clickRow).fadeOut(300, 
function(){
+                                                       $(clickRow).remove();
+                                               });
+                                               
+                                               var next_row = 
$(clickRow).next();
+                                               
+                                               // Updating order numbers for 
rows below deleted row  
+                                               while( $(next_row).length > 0){
+                                                       
update_order_nr_for_row(next_row, "-");
+                                                       next_row = 
$(next_row).next();
+                                               }
+                                       }else{
+                                               $(checkItemRow).fadeOut(300, 
function(){
+                                                       
$(checkItemRow).remove();
+                                               });
+                                       }
+                               }
+                       }
+               });
+
+               return false;
+       });
+       
        $("#frm_update_check_list").live("click", function(e){
                var thisForm = $(this);
                var submitBnt = $(thisForm).find("input[type='submit']");

Modified: trunk/controller/templates/base/check_list/view_open_cases.xsl
===================================================================
--- trunk/controller/templates/base/check_list/view_open_cases.xsl      
2012-02-13 09:19:27 UTC (rev 8842)
+++ trunk/controller/templates/base/check_list/view_open_cases.xsl      
2012-02-13 10:31:09 UTC (rev 8843)
@@ -59,6 +59,17 @@
                                                                                
                        </xsl:attribute>
                                                                                
                        endre
                                                                                
                </a>
+                                                                               
                <a class="close_case">
+                                                                               
                        <xsl:attribute name="href">
+                                                                               
                                
<xsl:text>index.php?menuaction=controller.uicase.close_case</xsl:text>
+                                                                               
                                <xsl:text>&amp;case_id=</xsl:text>
+                                                                               
                                <xsl:value-of select="id"/>
+                                                                               
                                <xsl:text>&amp;check_list_id=</xsl:text>
+                                                                               
                                <xsl:value-of select="//check_list/id"/>
+                                                                               
                                <xsl:text>&amp;phpgw_return_as=json</xsl:text>
+                                                                               
                        </xsl:attribute>
+                                                                               
                        lukk
+                                                                               
                </a>
                                                                                
                <xsl:choose>
                                                                                
                        <xsl:when test="location_item_id = 0">
                                                                                
                                <a class="delete_case">
@@ -139,6 +150,17 @@
                                                                                
                        </xsl:attribute>
                                                                                
                        endre
                                                                                
                </a>
+                                                                               
                <a class="close_case">
+                                                                               
                        <xsl:attribute name="href">
+                                                                               
                                
<xsl:text>index.php?menuaction=controller.uicase.close_case</xsl:text>
+                                                                               
                                <xsl:text>&amp;case_id=</xsl:text>
+                                                                               
                                <xsl:value-of select="id"/>
+                                                                               
                                <xsl:text>&amp;check_list_id=</xsl:text>
+                                                                               
                                <xsl:value-of select="//check_list/id"/>
+                                                                               
                                <xsl:text>&amp;phpgw_return_as=json</xsl:text>
+                                                                               
                        </xsl:attribute>
+                                                                               
                        lukk
+                                                                               
                </a>
                                                                                
                <xsl:choose>
                                                                                
                        <xsl:when test="location_item_id = 0">
                                                                                
                                <a class="delete_case">

Modified: 
trunk/controller/templates/base/control_location/view_locations_for_control.xsl
===================================================================
--- 
trunk/controller/templates/base/control_location/view_locations_for_control.xsl 
    2012-02-13 09:19:27 UTC (rev 8842)
+++ 
trunk/controller/templates/base/control_location/view_locations_for_control.xsl 
    2012-02-13 10:31:09 UTC (rev 8843)
@@ -39,24 +39,22 @@
                                  </select>
                                 
                                 <form id="loc_form" action="" method="GET">
-                       
                                        <select id="control_id" 
name="control_id">
-                                       <xsl:choose>
-                                               <xsl:when 
test="control_array/child::node()">
-                                                       <xsl:for-each 
select="control_array">
-                                                               <xsl:variable 
name="control_id"><xsl:value-of select="id"/></xsl:variable>
-                                                               <option 
value="{$control_id}">
-                                                                       
<xsl:value-of select="title"/>
-                                                               </option>       
                        
-                                                       </xsl:for-each>
-                                               </xsl:when>
-                                               <xsl:otherwise>
-                                                       <option>
-                                                               Ingen kontroller
-                                                       </option>
-                                               </xsl:otherwise>
-                                       </xsl:choose>
-                                               
+                                               <xsl:choose>
+                                                       <xsl:when 
test="control_array/child::node()">
+                                                               <xsl:for-each 
select="control_array">
+                                                                       
<xsl:variable name="control_id"><xsl:value-of select="id"/></xsl:variable>
+                                                                       <option 
value="{$control_id}">
+                                                                               
<xsl:value-of select="title"/>
+                                                                       
</option>
+                                                               </xsl:for-each>
+                                                       </xsl:when>
+                                                       <xsl:otherwise>
+                                                               <option>
+                                                                       Ingen 
kontroller
+                                                               </option>
+                                                       </xsl:otherwise>
+                                               </xsl:choose>
                                        </select>
                                </form>
                        </div>
@@ -78,6 +76,7 @@
                        
                        <xsl:apply-templates select="locations_table"/>
                        <xsl:call-template name="yui_booking_i18n"/>
+                       
                </div>
        </div>
 </xsl:template>
@@ -123,4 +122,4 @@
                
        </script>
         
-</xsl:template>
+</xsl:template>
\ No newline at end of file

Modified: trunk/controller/templates/base/css/base.css
===================================================================
--- trunk/controller/templates/base/css/base.css        2012-02-13 09:19:27 UTC 
(rev 8842)
+++ trunk/controller/templates/base/css/base.css        2012-02-13 10:31:09 UTC 
(rev 8843)
@@ -829,7 +829,7 @@
     font-size:16px;
 }
 ul.calendar {
-    clear: right;
+    clear: both;
     float: left;
     margin-top: 30px;
     width: 100%;




reply via email to

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