fmsystem-commits
[Top][All Lists]
Advanced

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

[Fmsystem-commits] [8829]


From: Torstein
Subject: [Fmsystem-commits] [8829]
Date: Fri, 10 Feb 2012 11:25:37 +0000

Revision: 8829
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=8829
Author:   vator
Date:     2012-02-10 11:25:36 +0000 (Fri, 10 Feb 2012)
Log Message:
-----------


Modified Paths:
--------------
    trunk/controller/inc/class.socase.inc.php
    trunk/controller/inc/class.socheck_item.inc.php
    trunk/controller/inc/class.uicase.inc.php
    trunk/controller/inc/class.uicheck_list.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/css/base.css

Modified: trunk/controller/inc/class.socase.inc.php
===================================================================
--- trunk/controller/inc/class.socase.inc.php   2012-02-09 19:23:52 UTC (rev 
8828)
+++ trunk/controller/inc/class.socase.inc.php   2012-02-10 11:25:36 UTC (rev 
8829)
@@ -72,6 +72,7 @@
                                
$case->set_entry_date($this->unmarshal($this->db->f('entry_date', true), 
'int'));
                                
$case->set_modified_date($this->unmarshal($this->db->f('modified_date', true), 
'int'));
                                
$case->set_modified_by($this->unmarshal($this->db->f('modified_by', true), 
'int'));
+                               
$case->set_measurement($this->unmarshal($this->db->f('measurement', true), 
'string'));
                                        
                                return $case;
                        }
@@ -98,7 +99,8 @@
                                
$case->set_entry_date($this->unmarshal($this->db->f('entry_date', true), 
'int'));
                                
$case->set_modified_date($this->unmarshal($this->db->f('modified_date', true), 
'int'));
                                
$case->set_modified_by($this->unmarshal($this->db->f('modified_by', true), 
'int'));
-
+                               
$case->set_measurement($this->unmarshal($this->db->f('measurement', true), 
'string'));
+                               
                                if($return_type == "return_object")
                                        $cases_array[] = $case;
                                else
@@ -134,7 +136,7 @@
                                $this->marshal($case->get_entry_date(), 'int'),
                                $this->marshal($case->get_modified_date(), 
'int'),
                                $this->marshal($case->get_modified_by(), 'int'),
-                               $this->marshal($case->get_measurement(), 'int')
+                               $this->marshal($case->get_measurement(), 
'string')
                        );
 
                        $result = $this->db->query('INSERT INTO 
controller_check_item_case (' . join(',', $cols) . ') VALUES (' . join(',', 
$values) . ')', __LINE__,__FILE__);
@@ -156,7 +158,7 @@
                                'entry_date = ' . 
$this->marshal($case->get_entry_date(), 'int'),
                                'modified_date = ' . 
$this->marshal($case->get_modified_date(), 'int'),
                                'modified_by = ' . 
$this->marshal($case->get_modified_by(), 'int'),
-                               'measurement = ' . 
$this->marshal($case->get_measurement(), 'int')
+                               'measurement = ' . 
$this->marshal($case->get_measurement(), 'string')
                        );
 
                        $result = $this->db->query('UPDATE 
controller_check_item_case SET ' . join(',', $values) . " WHERE id=$id", 
__LINE__,__FILE__);

Modified: trunk/controller/inc/class.socheck_item.inc.php
===================================================================
--- trunk/controller/inc/class.socheck_item.inc.php     2012-02-09 19:23:52 UTC 
(rev 8828)
+++ trunk/controller/inc/class.socheck_item.inc.php     2012-02-10 11:25:36 UTC 
(rev 8829)
@@ -289,8 +289,8 @@
                        return $check_items_array;
                }
                
-               public function get_check_items_with_cases($check_list_id, 
$status = "open", $messageStatus = null, $return_type = "return_object"){
-                       $sql  = "SELECT ci.id as ci_id, ci.status as ci_status, 
control_item_id, ci.comment, ci.measurement, check_list_id, ";
+               public function get_check_items_with_cases($check_list_id, 
$type = "control_item_type_1", $status = "open", $messageStatus = null, 
$return_type = "return_object"){
+                       $sql  = "SELECT ci.id as ci_id, ci.status as ci_status, 
control_item_id, ci.comment, check_list_id, ";
                        $sql .= "cic.id as cic_id, cic.status as cic_status, 
cic.*, ";
                        $sql .= "coi.id as coi_id, coi.* ";
                        $sql .= "FROM controller_check_item ci "; 
@@ -307,6 +307,11 @@
                        else if($status == 'open_or_waiting')
                                $sql .= "AND cic.status = 0 OR cic.status = 2";
                                
+                       if($type == 'control_item_type_1')
+                               $sql .= "AND coi.type = 'control_item_type_1' ";
+                       else if($type == 'control_item_type_2')
+                               $sql .= "AND coi.type = 'control_item_type_2' ";
+                                                       
                        if($messageStatus != null & $messageStatus == 
'no_message_registered')
                                $sql .= "AND cic.location_item_id IS NULL ";
                        else if($messageStatus != null &  $messageStatus == 
'message_registered')
@@ -363,8 +368,8 @@
                                        
$case->set_entry_date($this->unmarshal($this->db->f('entry_date', true), 
'int'));
                                        
$case->set_modified_date($this->unmarshal($this->db->f('modified_date', true), 
'int'));
                                        
$case->set_modified_by($this->unmarshal($this->db->f('modified_by', true), 
'int'));
-                               
-                               
+                                       
$case->set_measurement($this->unmarshal($this->db->f('measurement', true), 
'string'));
+                                                               
                                        if($return_type == "return_array")
                                                $cases_array[] = 
$case->toArray();
                                        else

Modified: trunk/controller/inc/class.uicase.inc.php
===================================================================
--- trunk/controller/inc/class.uicase.inc.php   2012-02-09 19:23:52 UTC (rev 
8828)
+++ trunk/controller/inc/class.uicase.inc.php   2012-02-10 11:25:36 UTC (rev 
8829)
@@ -46,6 +46,7 @@
                
                var $public_functions = array(
                                                                        
'register_case'                         => true,
+                                                                       
'save_case'                             => true,
                                                                        
'create_case_message'           => true,
                                                                        
'view_case_message'             => true,
                                                                        
'register_case_message'         => true,
@@ -130,11 +131,39 @@
                                return json_encode( array( "status" => 
"not_saved" ) ); 
                }
                
+               function save_case(){
+                       $case_id = phpgw::get_var('case_id');
+                       $case_descr = phpgw::get_var('case_descr');
+                       $case_status = phpgw::get_var('case_status');
+                       $measurement = phpgw::get_var('measurement');
+                       $check_list_id = phpgw::get_var('check_list_id');
+                       
+                       $todays_date_ts = mktime(0,0,0,date("m"), date("d"), 
date("Y"));
+                       
+                       $case = $this->so->get_single($case_id);
+                       $case->set_descr($case_descr);
+                       $case->set_modified_date($todays_date_ts);
+                       $case->set_measurement($measurement);
+                       $case->set_status($case_status);
+                       
+                       $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" => "saved" 
) );
+                       }
+                       else
+                               return json_encode( array( "status" => 
"not_saved" ) );
+                       
+               }
+               
                function create_case_message(){
                        $check_list_id = phpgw::get_var('check_list_id');
                        $check_list = 
$this->so_check_list->get_single($check_list_id);
                                                
-                       $check_items_and_cases = 
$this->so_check_item->get_check_items_with_cases($check_list_id, "open", 
"no_message_registered", "return_array");
+                       $check_items_and_cases = 
$this->so_check_item->get_check_items_with_cases($check_list_id, null, "open", 
"no_message_registered", "return_array");
 
                        $control_id = $check_list->get_control_id();
                        $control = $this->so_control->get_single( $control_id );

Modified: trunk/controller/inc/class.uicheck_list.inc.php
===================================================================
--- trunk/controller/inc/class.uicheck_list.inc.php     2012-02-09 19:23:52 UTC 
(rev 8828)
+++ trunk/controller/inc/class.uicheck_list.inc.php     2012-02-10 11:25:36 UTC 
(rev 8829)
@@ -553,8 +553,8 @@
                        
                        $check_list = $this->so->get_single($check_list_id);
                        
-                       $open_check_items_and_cases = 
$this->so_check_item->get_check_items_with_cases($check_list_id, 'open', null, 
'return_array');
-                       $open_check_items_and_measurements = 
$this->so_check_item->get_check_items_with_cases($check_list_id, 'waiting', 
null, 'return_array');
+                       $open_check_items_and_cases = 
$this->so_check_item->get_check_items_with_cases($check_list_id, 
"control_item_type_1", 'open', null, 'return_array');
+                       $open_check_items_and_measurements = 
$this->so_check_item->get_check_items_with_cases($check_list_id, 
"control_item_type_2", 'open_or_waiting', null, 'return_array');
                        
                        $data = array
                        (
@@ -571,7 +571,7 @@
                        
                        $check_list = $this->so->get_single($check_list_id);
                        
-                       $closed_check_items_and_cases = 
$this->so_check_item->get_check_items_with_cases($check_list_id, 'closed', 
null, 'return_array');
+                       $closed_check_items_and_cases = 
$this->so_check_item->get_check_items_with_cases($check_list_id, null, 
'closed', null, 'return_array');
                                                        
                        $data = array
                        (
@@ -582,23 +582,6 @@
                        self::render_template_xsl( 
array('check_list/cases_tab_menu', 'check_list/view_closed_cases'), $data );
                }
                
-               function view_measurements(){
-                       $check_list_id = phpgw::get_var('check_list_id');
-                       
-                       $check_list = $this->so->get_single($check_list_id);
-                                               
-                       // Fetches check items that registeres measurement
-                       $measurement_check_items = 
$this->so_check_item->get_check_items($check_list_id, null, 
'control_item_type_2', "return_array");
-                       
-                       $data = array
-                       (
-                               'measurement_check_items'       => 
$measurement_check_items,
-                               'check_list'                            => 
$check_list->toArray()
-                       );
-                       
-                       self::render_template_xsl( 
array('check_list/cases_tab_menu', 'check_list/view_measurements'), $data );
-               }
-               
                function view_control_items(){
                        $check_list_id = phpgw::get_var('check_list_id');
                        $check_list = $this->so->get_single($check_list_id);
@@ -716,7 +699,7 @@
                {
                        $check_list_id = phpgw::get_var('check_list_id');
 
-                       $check_items_with_cases = 
$this->so_check_item->get_check_items_with_cases($check_list_id, "open", null, 
"return_array");
+                       $check_items_with_cases = 
$this->so_check_item->get_check_items_with_cases($check_list_id, null, "open", 
null, "return_array");
                        
                        return json_encode( $check_items_with_cases );
                }

Modified: trunk/controller/inc/helper/class.status_checker.inc.php
===================================================================
--- trunk/controller/inc/helper/class.status_checker.inc.php    2012-02-09 
19:23:52 UTC (rev 8828)
+++ trunk/controller/inc/helper/class.status_checker.inc.php    2012-02-10 
11:25:36 UTC (rev 8829)
@@ -19,7 +19,8 @@
        
                $status = null;
                $control_item_type = null;
-               $check_items = 
$this->so_check_item->get_check_items_with_cases($check_list_id, $status, 
$control_item_type, "return_object");
+               $messageStatus = null;
+               $check_items = 
$this->so_check_item->get_check_items_with_cases($check_list_id, 
$control_item_type, $status, $messageStatus, "return_object");
                
                $num_open_cases = 0;
                

Modified: trunk/controller/js/controller/ajax.js
===================================================================
--- trunk/controller/js/controller/ajax.js      2012-02-09 19:23:52 UTC (rev 
8828)
+++ trunk/controller/js/controller/ajax.js      2012-02-10 11:25:36 UTC (rev 
8829)
@@ -159,7 +159,7 @@
                          }  
                        });     
     });
-       
+                       
        // file: sort_check_list.xsl
        // Saves order of control items for a group
        $(".frm_save_order").submit(function(e){
@@ -429,9 +429,7 @@
                                          $(submitBnt).val("Lagret");   
                                          
                                          clear_form( thisForm );
-                                         
-                                        
-                                                 
+                                                         
                                          // Changes text on save button back 
to original
                                          window.setTimeout(function() {
                                                        
$(submitBnt).val('Registrer sak');
@@ -443,6 +441,66 @@
                });
        });
        
+       $(".frm_update_case").live("submit", function(e){
+               e.preventDefault();
+
+               var thisForm = $(this);
+               //var submitBnt = $(thisForm).find("input[type='submit']");
+               var requestUrl = $(thisForm).attr("action");
+               
+               $.ajax({
+                         type: 'POST',
+                         url: requestUrl + "&" + $(thisForm).serialize(),
+                         success: function(data) {
+                                 if(data){
+                                 var jsonObj = jQuery.parseJSON(data);
+                               
+                                 if(jsonObj.status == "saved"){
+                                         
+                                         alert("SAVED");
+                                         }
+                                 }
+                               }
+               });
+       });
+       
+       $("a.quick_edit").live("click", function(e){
+               var clickElem = $(this);
+               var clickRow = $(this).closest("li");
+                               
+               var case_info = $(clickRow).find(".case_info");
+               var case_id = $(clickRow).find(".case_id").text();
+               var case_descr = $(clickRow).find(".case_descr").text();
+               var case_status = $(clickRow).find(".case_status").text();
+               var case_measurement = 
$(clickRow).find(".case_measurement").text();
+               var requestUrl = $(clickElem).attr('href');
+               
+               $(clickRow).hide();
+               
+               
+               var quickEditRowTagStr = "<li 
class='quick_edit'><h3>Hurtigendring</h3><fieldset><form 
class='frm_update_case' action='" + requestUrl + "'>";
+                               
+               if(case_status == 1)
+                       quickEditRowTagStr += "<label>Status</label><select 
name='case_status'><option SELECTED='SELECTED' value='1'>Utført</option><option 
value='2'>Venter på tilbakemelding</option></select>";
+               else if(case_status == 2)
+                       quickEditRowTagStr += "<label>Status</label><select 
name='case_status'><option value='1'>Utført</option><option SELECTED='SELECTED' 
value='2'>Venter på tilbakemelding</option></select>";
+               
+               quickEditRowTagStr += "<label>Beskrivelse</label><textarea 
name='case_descr'>" + case_descr + "</textarea>";
+               quickEditRowTagStr += "<label>Måleverdi</label><input 
type='text' name='case_measurement'>" + case_measurement + "</input>";
+               
+               quickEditRowTagStr += "<input type='submit' value='Oppdater' 
/>";
+               
+               quickEditRowTagStr += "</fieldset></form></li>";
+               
+               $quickEditRow = $(clickRow).before(quickEditRowTagStr);
+               
+               return false;   
+       });
+       
+       
+       
+       
+       
        // Delete a case item from list
        $(".delete_case").live("click", function(){
                var clickElem = $(this);
@@ -508,11 +566,6 @@
                $(submitBnt).removeClass("not_active");
        });
        
-       $(".frm_register_measurement_case").live("click", function(e){
-               var thisForm = $(this);
-               var submitBnt = $(thisForm).find("input[type='submit']");
-               $(submitBnt).removeClass("not_active");
-       });
 });
 
 function clear_form( form ){
@@ -534,7 +587,6 @@
     });
 }
 
-
 //Updates order number for hidden field and number in front of row
 function update_order_nr_for_row(element, sign){
        

Modified: trunk/controller/templates/base/check_list/view_open_cases.xsl
===================================================================
--- trunk/controller/templates/base/check_list/view_open_cases.xsl      
2012-02-09 19:23:52 UTC (rev 8828)
+++ trunk/controller/templates/base/check_list/view_open_cases.xsl      
2012-02-10 11:25:36 UTC (rev 8829)
@@ -23,7 +23,13 @@
                                                                        
<xsl:for-each select="cases_array">
                                                                                
<xsl:variable name="cases_id"><xsl:value-of select="id"/></xsl:variable>
                                                                                
<li><span class="order_nr"><xsl:number /></span>. <xsl:value-of select="descr"/>
+                                                                               
        Status: 
                                                                                
        <xsl:choose>
+                                                                               
                <xsl:when test="status = 1">Utført</xsl:when>
+                                                                               
                <xsl:when test="status = 2">Venter på tilbakemelding</xsl:when>
+                                                                               
        </xsl:choose>
+                                                                               
        
+                                                                               
        <xsl:choose>
                                                                                
                <xsl:when test="location_item_id > 0">
                                                                                
                        <div style="float:right;">
                                                                                
                                <a target="_blank">
@@ -40,10 +46,11 @@
                                                                                
                        <div style="float:right;"><span style="color:red">Ingen 
melding registrert</span></div>
                                                                                
                </xsl:otherwise>
                                                                                
        </xsl:choose>
+                                                                               
        
                                                                                
        <div class="quick_menu">
-                                                                               
                <a>
+                                                                               
                <a class="quick_edit">
                                                                                
                        <xsl:attribute name="href">
-                                                                               
                                
<xsl:text>index.php?menuaction=controller.uicase.edit_case</xsl:text>
+                                                                               
                                
<xsl:text>index.php?menuaction=controller.uicase.save_case</xsl:text>
                                                                                
                                <xsl:text>&amp;case_id=</xsl:text>
                                                                                
                                <xsl:value-of select="id"/>
                                                                                
                                <xsl:text>&amp;check_list_id=</xsl:text>
@@ -68,6 +75,12 @@
                                                                                
                        </xsl:when>
                                                                                
                </xsl:choose>
                                                                                
        </div>
+                                                                               
        <div style="display:none;" class="case_info">
+                                                                               
                <div class="case_id"><xsl:value-of select="id"/></div>
+                                                                               
                <div class="case_descr"><xsl:value-of select="descr"/></div>
+                                                                               
                <div class="case_status"><xsl:value-of select="status"/></div>
+                                                                               
                <div class="case_measurement"><xsl:value-of 
select="measurement"/></div>
+                                                                               
        </div>
                                                                                
</li>
                                                                        
</xsl:for-each>
                                                                </ul>

Modified: trunk/controller/templates/base/css/base.css
===================================================================
--- trunk/controller/templates/base/css/base.css        2012-02-09 19:23:52 UTC 
(rev 8828)
+++ trunk/controller/templates/base/css/base.css        2012-02-10 11:25:36 UTC 
(rev 8829)
@@ -904,6 +904,13 @@
 ul.calendar div.frequency, ul.calendar.info div.frequency {
        width: 100px;   
 }
+.months a.view_check_list {
+    width: 30px;
+}
+.cal_info_msg{
+       font-size: 16px;
+    padding: 40px 20px;        
+}
 
 #info_box {
     background: none repeat scroll 0 0 #EDF5FF;
@@ -1055,10 +1062,6 @@
 .frm_save_check_item input[type='submit']{
        width: 165px;
 }
-ul.check_items {
-    width: 625px;
-}
-
 ul.check_items h5{
        margin:10px;
        font-size: 13px;
@@ -1262,14 +1265,16 @@
     text-align: left;
     width: 815px;
 }
+
+/* ======================== VIEW CASES ============================= */
+
 li.check_item_case h4{
        margin:5px 0;           
 }
-li.check_item_case ul{
-       margin:10px;            
-}
 li.check_item_case ul li {
-    margin: 5px 0 0 0;
+    border: 1px solid #AAAAAA;
+    margin: 5px 0 0;
+    padding: 5px;
 }
 a.view_check_list{
        color: #FFFFFF;
@@ -1280,12 +1285,13 @@
     text-decoration: none;
     width: 24px;       
 }
-.months a.view_check_list {
-    width: 30px;
+li.quick_edit label{
+       font-weight:bold;
+       vertical-align:top;
 }
-.cal_info_msg{
-       font-size: 16px;
-    padding: 40px 20px;        
+li.quick_edit textarea, li.quick_edit select{
+       display: inline-block;
+       vertical-align:top;
 }
 .quick_menu {
     font-size: 12px;




reply via email to

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