[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Fmsystem-commits] [10894] Deleted function view_cases_for_check_list
From: |
Torstein |
Subject: |
[Fmsystem-commits] [10894] Deleted function view_cases_for_check_list |
Date: |
Sun, 17 Feb 2013 15:05:09 +0000 |
Revision: 10894
http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=10894
Author: vator
Date: 2013-02-17 15:05:05 +0000 (Sun, 17 Feb 2013)
Log Message:
-----------
Deleted function view_cases_for_check_list
Modified Paths:
--------------
trunk/controller/inc/class.uicheck_list.inc.php
trunk/controller/js/controller/ajax.js
trunk/controller/js/controller/check_list.js
trunk/controller/templates/mobilefrontend/check_list/fragments/check_list_top_section.xsl
Modified: trunk/controller/inc/class.uicheck_list.inc.php
===================================================================
--- trunk/controller/inc/class.uicheck_list.inc.php 2013-02-17 14:36:55 UTC
(rev 10893)
+++ trunk/controller/inc/class.uicheck_list.inc.php 2013-02-17 15:05:05 UTC
(rev 10894)
@@ -65,12 +65,13 @@
'add_check_list' => true,
'save_check_list' => true,
'edit_check_list' => true,
-
'view_control_info' => true,
'print_check_list' => true,
+ 'view_control_info' => true,
'view_control_details' => true,
'view_control_items' => true,
'get_check_list_info' => true,
-
'get_cases_for_check_list' => true
+
'get_cases_for_check_list' => true,
+ 'update_status' => true
);
function __construct()
@@ -611,8 +612,39 @@
return json_encode( $check_items_with_cases );
}
+
+ /**
+ * Public function for updateing status for a check list
+ *
+ * @return json encoded array with status saved or not saved
+ */
+ public function update_status()
+ {
+ $check_list_id = phpgw::get_var('check_list_id');
+ $check_list_status = phpgw::get_var('status');
+
+ $check_list = $this->so->get_single($check_list_id);
+
+ $check_list->set_status( $check_list_status );
+
+ if($check_list->validate())
+ {
+ $save_status = $this->so->store($check_list);
+
+ if($save_status > 0)
+ {
+ return json_encode( array( "status" => "saved") );
+ }
+ else
+ {
+ return json_encode( array( "status" => "not_saved") );
+ }
+ }
+ else
+ {
+ return json_encode( array( "status" => "not_saved") );
+ }
+ }
-
-
public function query(){}
}
\ No newline at end of file
Modified: trunk/controller/js/controller/ajax.js
===================================================================
--- trunk/controller/js/controller/ajax.js 2013-02-17 14:36:55 UTC (rev
10893)
+++ trunk/controller/js/controller/ajax.js 2013-02-17 15:05:05 UTC (rev
10894)
@@ -110,7 +110,6 @@
/* ================================ COMPONENT
================================== */
- // file: uicheck_list.xsl
// When control area is selected, controls are fetched from db and
control select list is populated
$("#control_group_area_list").change(function () {
var control_area_id = $(this).val();
@@ -395,33 +394,7 @@
}
});
- /* Virker som at denne ikke er i bruk. Torstein: 11.07.12
- $(".frm_save_control_item").live("click", function(e){
- e.preventDefault();
- var thisForm = $(this);
- var liWrp = $(this).parent();
- var submitBnt = $(thisForm).find("input[type='submit']");
- var requestUrl = $(thisForm).attr("action");
-
- $.ajax({
- type: 'POST',
- url: requestUrl + "&phpgw_return_as=json&" +
$(thisForm).serialize(),
- success: function(data) {
- if(data){
- var obj = jQuery.parseJSON(data);
-
- if(obj.status == "saved"){
- $(liWrp).fadeOut('3000', function() {
- $(liWrp).addClass("hidden");
- });
- }
- }
- }
- });
- });
- */
-
/* ========================= CONTROL ===================== */
// SAVE CONTROL DETAILS
@@ -501,90 +474,7 @@
var control_id = $(this).val();
$("#hidden_control_id").val( control_id );
});
-
- //===================================== CHECK LIST
================================
-
- // ADD CHECKLIST
- $("#frm_add_check_list").live("submit", function(e){
- var thisForm = $(this);
- var statusFieldVal = $("#status").val();
- var statusRow = $("#status").closest(".row");
- var plannedDateVal = $("#planned_date").val();
- var plannedDateRow = $("#planned_date").closest(".row");
- var completedDateVal = $("#completed_date").val();
- var completedDateRow = $("#completed_date").closest(".row");
- $(thisForm).find(".input_error_msg").remove();
-
- // Is COMPLETED DATE assigned when STATUS is done
- if(statusFieldVal == 1 && completedDateVal == ''){
- e.preventDefault();
- // Displays error message above completed date
- $(completedDateRow).before("<div
class='input_error_msg'>Vennligst angi når kontrollen ble utført</div>");
- }
- // Is COMPLETED DATE assigned when STATUS is not done
- else if(statusFieldVal == 0 && completedDateVal != ''){
- e.preventDefault();
- // Displays error message above completed date
- $(statusRow).before("<div class='input_error_msg'>Du
har angitt utførtdato, men status er Ikke utført. Vennligst endre status til
utført</div>");
- }
- });
-
- // Display submit button on click
- $("#frm_add_check_list").live("click", function(e){
- var thisForm = $(this);
- var submitBnt = $(thisForm).find("input[type='submit']");
$(submitBnt).removeClass("not_active");
- });
-
-
-
- // UPDATE CHECKLIST DETAILS
- $("#frm_update_check_list").live("submit", function(e){
- var thisForm = $(this);
- var submitBnt = $(thisForm).find("input[type='submit']");
- var requestUrl = $(thisForm).attr("action");
-
- var check_list_id = $("#check_list_id").val();
-
- var statusFieldVal = $("#status").val();
- var statusRow = $("#status").closest(".row");
- var plannedDateVal = $("#planned_date").val();
- var plannedDateRow = $("#planned_date").closest(".row");
- var completedDateVal = $("#completed_date").val();
- var completedDateRow = $("#completed_date").closest(".row");
-
- $(thisForm).find('.input_error_msg').remove();
-
- // Checks that COMPLETE DATE is set if status is set to DONE
- if(statusFieldVal == 1 & completedDateVal == ''){
- e.preventDefault();
- // Displays error message above completed date
- $(completedDateRow).before("<div
class='input_error_msg'>Vennligst angi når kontrollen ble utført</div>");
- }
- else if(statusFieldVal == 0 && completedDateVal != ''){
- e.preventDefault();
- // Displays error message above completed date
- $(statusRow).before("<div
class='input_error_msg'>Vennligst endre status til utført eller slett
utførtdato</div>");
- }
- else if(statusFieldVal == 0 & plannedDateVal == ''){
- e.preventDefault();
- // Displays error message above planned date
- if(
!$(plannedDateRow).prev().hasClass("input_error_msg") )
- {
- $(plannedDateRow).before("<div
class='input_error_msg'>Vennligst endre status for kontroll eller angi
planlagtdato</div>");
- }
- }
- });
-
- // Display submit button on click
- /*
- $("#frm_update_check_list").live("click", function(e){
- var thisForm = $(this);
- var submitBnt = $(thisForm).find("input[type='submit']");
- $(submitBnt).removeClass("not_active");
- });
- */
-
//============================= MESSAGE ===========================
// REGISTER MESSAGE
Modified: trunk/controller/js/controller/check_list.js
===================================================================
--- trunk/controller/js/controller/check_list.js 2013-02-17 14:36:55 UTC
(rev 10893)
+++ trunk/controller/js/controller/check_list.js 2013-02-17 15:05:05 UTC
(rev 10894)
@@ -73,40 +73,43 @@
});
// UPDATE CHECKLIST STATUS
- $("#frm-update-check-list-status").live("click", function(e){
+ $("#update-check-list-status").live("submit", function(e){
+ e.preventDefault();
+
var thisForm = $(this);
var submitBnt = $(thisForm).find("input[type='submit']");
var requestUrl = $(thisForm).attr("action");
- var check_list_id = $("#check_list_id").val();
+ $.ajax({
+ type: 'POST',
+ url: requestUrl + "&" + $(thisForm).serialize(),
+ success: function(data) {
+ if(data){
+ var jsonObj = jQuery.parseJSON(data);
+
+ if(jsonObj.status == "saved"){
+ var submitBnt =
$(thisForm).find("input[type='submit']");
+ $(submitBnt).val("Lagret");
+
+ clear_form( thisForm );
+
+ // Changes text on save button back
to original
+ window.setTimeout(function() {
+ if( type ==
"control_item_type_2")
+
$(submitBnt).val('Lagre måling');
+ else
+
$(submitBnt).val('Lagre sak');
+
+
$(submitBnt).addClass("not_active");
+ }, 1000);
+
+ $(thisForm).delay(1500).slideUp(500,
function(){
+
$(thisForm).parents("ul.expand_list").find("h4 img").attr("src",
"controller/images/arrow_right.png");
+ });
+ }
+ }
+ }
+ });
- var statusFieldVal = $("#status").val();
- var statusRow = $("#status").closest(".row");
- var plannedDateVal = $("#planned_date").val();
- var plannedDateRow = $("#planned_date").closest(".row");
- var completedDateVal = $("#completed_date").val();
- var completedDateRow = $("#completed_date").closest(".row");
-
- $(thisForm).find('.input_error_msg').remove();
-
- // Checks that COMPLETE DATE is set if status is set to DONE
- if(statusFieldVal == 1 & completedDateVal == ''){
- e.preventDefault();
- // Displays error message above completed date
- $(completedDateRow).before("<div
class='input_error_msg'>Vennligst angi når kontrollen ble utført</div>");
- }
- else if(statusFieldVal == 0 && completedDateVal != ''){
- e.preventDefault();
- // Displays error message above completed date
- $(statusRow).before("<div
class='input_error_msg'>Vennligst endre status til utført eller slett
utførtdato</div>");
- }
- else if(statusFieldVal == 0 & plannedDateVal == ''){
- e.preventDefault();
- // Displays error message above planned date
- if(
!$(plannedDateRow).prev().hasClass("input_error_msg") )
- {
- $(plannedDateRow).before("<div
class='input_error_msg'>Vennligst endre status for kontroll eller angi
planlagtdato</div>");
- }
- }
});
});
\ No newline at end of file
Modified:
trunk/controller/templates/mobilefrontend/check_list/fragments/check_list_top_section.xsl
===================================================================
---
trunk/controller/templates/mobilefrontend/check_list/fragments/check_list_top_section.xsl
2013-02-17 14:36:55 UTC (rev 10893)
+++
trunk/controller/templates/mobilefrontend/check_list/fragments/check_list_top_section.xsl
2013-02-17 15:05:05 UTC (rev 10894)
@@ -24,21 +24,17 @@
</div>
<!-- ================== CHANGE STATUS FOR CHECKLIST
===================== -->
-
+ <xsl:variable name="action_url"><xsl:value-of
select="php:function('get_phpgw_link', '/index.php',
'menuaction:controller.uicheck_list.update_status,phpgw_return_as:json')"
/></xsl:variable>
<form id="update-check-list-status" action="{$action_url}" method="post">
- <xsl:variable name="control_item_id"><xsl:value-of
select="id"/></xsl:variable>
- <input type="hidden" name="control_item_id" value="{$control_item_id}"
/>
- <input type="hidden" name="check_list_id"><xsl:attribute
name="value"><xsl:value-of select="//check_list/id"/></xsl:attribute></input>
+ <input type="hidden" name="check_list_id"
value="{check_list/id}" />
<input type="hidden" name="status" value="0" />
- <input type="hidden" name="type" value="control_item_type_1" />
- <input type="hidden" name="location_code" value="" class="required" />
- <span class="btn"><xsl:value-of select="php:function('lang', 'Status
not done')" /></span>
- <div class="icon">
- <img src="/pe/controller/images/red_ring.png" />
- </div>
-
- <input type="submit" class="btn" name="save_control" value="Lagre sak"
/>
+ <input type="submit" class="btn">
+ <xsl:value-of select="php:function('lang', 'Status not done')" />
+ </input>
+ <div class="icon">
+ <img src="/pe/controller/images/red_ring.png" />
+ </div>
</form>
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Fmsystem-commits] [10894] Deleted function view_cases_for_check_list,
Torstein <=