fmsystem-commits
[Top][All Lists]
Advanced

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

[Fmsystem-commits] [9815]


From: Torstein
Subject: [Fmsystem-commits] [9815]
Date: Sun, 29 Jul 2012 09:55:50 +0000

Revision: 9815
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=9815
Author:   vator
Date:     2012-07-29 09:55:49 +0000 (Sun, 29 Jul 2012)
Log Message:
-----------


Modified Paths:
--------------
    trunk/controller/inc/class.uicheck_list.inc.php
    trunk/controller/inc/model/class.check_list.inc.php
    trunk/controller/js/controller/ajax.js
    trunk/controller/setup/phpgw_no.lang
    trunk/controller/templates/base/calendar/nav_calendar_month.xsl
    trunk/controller/templates/base/check_list/add_check_list.xsl
    trunk/controller/templates/base/check_list/edit_check_list.xsl
    trunk/controller/templates/base/css/base.css

Modified: trunk/controller/inc/class.uicheck_list.inc.php
===================================================================
--- trunk/controller/inc/class.uicheck_list.inc.php     2012-07-28 13:05:59 UTC 
(rev 9814)
+++ trunk/controller/inc/class.uicheck_list.inc.php     2012-07-29 09:55:49 UTC 
(rev 9815)
@@ -196,6 +196,17 @@
                                $check_list->set_control_id($control_id);
                                $check_list->set_deadline($deadline_ts);
                        }
+                       else
+                       {
+                               if( $check_list->get_component_id() > 0)
+                               {
+                                       $type = "component";
+                               }
+                               else
+                               {
+                                       $type = "location";
+                               }
+                       }
                        
                        if($type == "component")
                        {
@@ -220,12 +231,11 @@
                        }
                        else
                        {
-                               if($check_list != null)
+                               if($check_list->get_location_code() == '')
                                {
                                        $location_code = 
phpgw::get_var('location_code');
                                        
$check_list->set_location_code($location_code); 
                                }
-                                       
                                $location_array = 
execMethod('property.bolocation.read_single', array('location_code' => 
$check_list->get_location_code()));
                                $level = 
$this->get_location_level($location_code);
                                $type = "location";
@@ -256,8 +266,7 @@
                        self::add_javascript('controller', 'controller', 
'jquery-ui.custom.min.js');
                        
self::add_stylesheet('controller/templates/base/css/jquery-ui.custom.css');
                        
-                       
//self::render_template_xsl('check_list/edit_check_list', $data);
-                       
self::render_template_xsl(array('check_list/check_list_tab_menu','check_list/edit_check_list'),
 $data);
+                       self::render_template_xsl('check_list/add_check_list', 
$data);
                }
                
                /**
@@ -392,7 +401,8 @@
                                $location_code = 
phpgw::get_var('location_code');
                                $check_list->set_location_code( $location_code 
);
                        }
-                       
+                       echo " SAVE ";
+                       print_r($check_list);
                        if( $check_list->validate() )
                        {
                                $check_list_id = $this->so->store($check_list);
@@ -412,6 +422,8 @@
                        }
                        else
                        {
+                               echo "i validate failed";
+                               
                                if($check_list->get_id() > 0)
                                {
                                        $this->edit_check_list($check_list);    

Modified: trunk/controller/inc/model/class.check_list.inc.php
===================================================================
--- trunk/controller/inc/model/class.check_list.inc.php 2012-07-28 13:05:59 UTC 
(rev 9814)
+++ trunk/controller/inc/model/class.check_list.inc.php 2012-07-29 09:55:49 UTC 
(rev 9815)
@@ -203,13 +203,20 @@
                        $status = false;
                        $this->error_msg_array['control_id'] = "error_msg_4";
                  }
-                 
+                
                  // Validate STATUS                              
-                       if( empty( $this->status ) )
-                 {
+                       if( $this->status != 0 and $this->status != 1 )
+                 { 
                        $status = false;
                        $this->error_msg_array['status'] = "error_msg_2";
                  }
+                 
+                       // Validate STATUS ON PLANNED DATE                      
          
+                       if( $this->status == 0 and ( $this->planned_date == '' 
or $this->planned_date == 0) )
+                 { 
+                       $status = false;
+                       $this->error_msg_array['status'] = "error_msg_7";
+                 }
 
                  // Validate COMPLETED DATE when STATUS:DONE                   
          
                        if( ($this->status == 
controller_check_list::STATUS_DONE) && empty($this->completed_date) )

Modified: trunk/controller/js/controller/ajax.js
===================================================================
--- trunk/controller/js/controller/ajax.js      2012-07-28 13:05:59 UTC (rev 
9814)
+++ trunk/controller/js/controller/ajax.js      2012-07-29 09:55:49 UTC (rev 
9815)
@@ -525,7 +525,7 @@
        //=====================================  CHECK LIST  
================================
        
        // ADD CHECKLIST
-       $("#frm_add_check_list_").live("submit", function(e){
+       $("#frm_add_check_list").live("submit", function(e){
                var thisForm = $(this);
                var statusFieldVal = $("#status").val();
                var statusRow = $("#status").closest(".row");
@@ -568,45 +568,49 @@
        
        // UPDATE CHECKLIST DETAILS     
        $("#frm_update_check_list").live("submit", function(e){
-               e.preventDefault();
-
                var thisForm = $(this);
                var submitBnt = $(thisForm).find("input[type='submit']");
                var requestUrl = $(thisForm).attr("action");
                
-               var statusFieldVal = $("#status").val();
-               var completedDateVal = $("#completed_date").val();
-               var completedDateRow = $("#completed_date").closest(".row");
+               var check_list_id = $("#check_list_id").val();
                
-               // Checks that COMPLETE DATE is set if status is set to DONE 
-               if(statusFieldVal == 1 & completedDateVal == ''){
-                       // Displays error message above completed date
-                       $(completedDateRow).before("<div 
class='input_error_msg'>Vennligst angi når kontrollen ble utført</div>");
-       }else{
-               
-               $(".input_error_msg").hide();
-               
-                       $.ajax({
-                                 type: 'POST',
-                                 url: requestUrl + "&phpgw_return_as=json&" + 
$(thisForm).serialize(),
-                                 success: function(data) {
-                                         if(data){
-                                         var obj = jQuery.parseJSON(data);
-                                       
-                                         if(obj.status == "updated"){
-                                                 var submitBnt = 
$(thisForm).find("input[type='submit']");
-                                                 $(submitBnt).val("Lagret");   
-                                                         
-                                                 // Changes text on save 
button back to original
-                                                 window.setTimeout(function() {
-                                                               
$(submitBnt).val('Lagre detaljer');
-                                                               
$(submitBnt).addClass("not_active");
-                                                 }, 1000);
+               if(check_list_id > 0){
+                       e.preventDefault();
+                       
+                       var statusFieldVal = $("#status").val();
+                       var completedDateVal = $("#completed_date").val();
+                       var completedDateRow = 
$("#completed_date").closest(".row");
+                       
+                       // Checks that COMPLETE DATE is set if status is set to 
DONE 
+                       if(statusFieldVal == 1 & completedDateVal == ''){
+                               // Displays error message above completed date
+                               $(completedDateRow).before("<div 
class='input_error_msg'>Vennligst angi når kontrollen ble utført</div>");
+               }else{
+                       
+                       $(".input_error_msg").hide();
+                       
+                               $.ajax({
+                                         type: 'POST',
+                                         url: requestUrl + 
"&phpgw_return_as=json&" + $(thisForm).serialize(),
+                                         success: function(data) {
+                                                 if(data){
+                                                 var obj = 
jQuery.parseJSON(data);
+                                               
+                                                 if(obj.status == "updated"){
+                                                         var submitBnt = 
$(thisForm).find("input[type='submit']");
+                                                         
$(submitBnt).val("Lagret");   
+                                                                 
+                                                         // Changes text on 
save button back to original
+                                                         
window.setTimeout(function() {
+                                                                       
$(submitBnt).val('Lagre detaljer');
+                                                                       
$(submitBnt).addClass("not_active");
+                                                         }, 1000);
+                                                         }
                                                  }
-                                         }
-                                       }
-                       });
-       }
+                                               }
+                               });
+               }
+               }
        });
        
        // Display submit button on click

Modified: trunk/controller/setup/phpgw_no.lang
===================================================================
--- trunk/controller/setup/phpgw_no.lang        2012-07-28 13:05:59 UTC (rev 
9814)
+++ trunk/controller/setup/phpgw_no.lang        2012-07-29 09:55:49 UTC (rev 
9815)
@@ -353,8 +353,9 @@
 error_msg_1    controller      no      Vennligst fyll inn dette feltet
 error_msg_2    controller      no      Vennligst velg en verdi i listen
 error_msg_3    controller      no      Vennligst angi sluttdato etter startdato
-error_msg_4    controller      no      Sjekklisten må være knyttet mot en 
kontroll
+error_msg_4    controller      no      Sjekklisten må være tilknyttet en 
kontroll
 error_msg_5    controller      no      Vennligst angi når kontrollen ble utført
 error_msg_6    controller      no      Kontrollen må være knyttet mot en 
komponent/lokasjon
+error_msg_7    controller      no      Vennligst endre status for kontroll 
eller angi planlagtdato
 error_msg_no_controls_in_period        controller      no      Ingen 
kontroller for bygg i denne perioden
 error_msg_no_controls_for_component    controller      no      Ingen 
kontroller for komponent i denne perioden
\ No newline at end of file

Modified: trunk/controller/templates/base/calendar/nav_calendar_month.xsl
===================================================================
--- trunk/controller/templates/base/calendar/nav_calendar_month.xsl     
2012-07-28 13:05:59 UTC (rev 9814)
+++ trunk/controller/templates/base/calendar/nav_calendar_month.xsl     
2012-07-29 09:55:49 UTC (rev 9815)
@@ -96,7 +96,7 @@
                                                                        
<xsl:text>&amp;control_id=</xsl:text>
                                                                        
<xsl:value-of select="control/id" />
                                                        </xsl:when>
-                                                       <xsl:when test="$ = 
'VIEW_CONTROLS_FOR_LOCATION'">
+                                                       <xsl:when test="$view = 
'VIEW_CONTROLS_FOR_LOCATION'">
                                                                
<xsl:text>index.php?menuaction=controller.uicalendar.view_calendar_for_month</xsl:text>
                                                                
<xsl:text>&amp;location_code=</xsl:text>
                                                                <xsl:value-of 
select="//current_location/location_code"/>

Modified: trunk/controller/templates/base/check_list/add_check_list.xsl
===================================================================
--- trunk/controller/templates/base/check_list/add_check_list.xsl       
2012-07-28 13:05:59 UTC (rev 9814)
+++ trunk/controller/templates/base/check_list/add_check_list.xsl       
2012-07-29 09:55:49 UTC (rev 9815)
@@ -137,6 +137,10 @@
                                                                <option 
value="1" SELECTED="SELECTED">Utført</option>
                                                                <option 
value="0">Ikke utført</option>
                                                        </xsl:when>
+                                                       <xsl:otherwise>
+                                                               <option 
value="0">Ikke utført</option>
+                                                               <option 
value="1">Utført</option>
+                                                       </xsl:otherwise>
                                                </xsl:choose>
                                        </select>
                                </div>
@@ -155,7 +159,7 @@
                                <div class="row">
                                        <label>Planlagt dato</label>
                                        <input type="text" id="planned_date" 
name="planned_date" class="date">
-                                       <xsl:if test="check_list/planned_date 
!= 0">
+                                       <xsl:if test="check_list/planned_date 
!= 0 and check_list/planned_date != ''">
                                        <xsl:attribute name="value">
                                                <xsl:value-of 
select="php:function('date', $date_format, number(check_list/planned_date))"/>
                                        </xsl:attribute>
@@ -170,7 +174,7 @@
                                  </xsl:if>
                                  <label>Utført dato</label>
                                  <input type="text" id="completed_date" 
name="completed_date" class="date">
-                                       <xsl:if test="check_list/completed_date 
!= 0">
+                                       <xsl:if test="check_list/completed_date 
!= 0 and check_list/completed_date != ''">
                                        <xsl:attribute name="value">
                                                <xsl:value-of 
select="php:function('date', $date_format, number(check_list/completed_date))"/>
                                        </xsl:attribute>

Modified: trunk/controller/templates/base/check_list/edit_check_list.xsl
===================================================================
--- trunk/controller/templates/base/check_list/edit_check_list.xsl      
2012-07-28 13:05:59 UTC (rev 9814)
+++ trunk/controller/templates/base/check_list/edit_check_list.xsl      
2012-07-29 09:55:49 UTC (rev 9815)
@@ -120,6 +120,10 @@
                                                        <option value="1" 
SELECTED="SELECTED">Utført</option>
                                                        <option value="0">Ikke 
utført</option>
                                                </xsl:when>
+                                               <xsl:otherwise>
+                                                       <option 
value="1">Utført</option>
+                                                       <option value="0">Ikke 
utført</option>
+                                               </xsl:otherwise>
                                        </xsl:choose>
                                </select>
                        </div>
@@ -129,7 +133,7 @@
                              <xsl:attribute 
name="id">deadline_date</xsl:attribute>
                              <xsl:attribute 
name="name">deadline_date</xsl:attribute>
                              <xsl:attribute name="type">text</xsl:attribute>
-                             <xsl:if test="check_list/deadline != 0">
+                             <xsl:if test="check_list/deadline != 0 or 
check_list/deadline != ''">
                                <xsl:attribute name="value"><xsl:value-of 
select="php:function('date', $date_format, 
number(check_list/deadline))"/></xsl:attribute>
                                  </xsl:if>
                            </input>
@@ -140,7 +144,7 @@
                              <xsl:attribute 
name="id">planned_date</xsl:attribute>
                              <xsl:attribute 
name="name">planned_date</xsl:attribute>
                              <xsl:attribute name="type">text</xsl:attribute>
-                             <xsl:if test="check_list/planned_date != 0">
+                             <xsl:if test="check_list/planned_date != 0 and 
check_list/planned_date != ''">
                                <xsl:attribute name="value"><xsl:value-of 
select="php:function('date', $date_format, 
number(check_list/planned_date))"/></xsl:attribute>
                              </xsl:if>
                            </input>
@@ -151,7 +155,7 @@
                              <xsl:attribute 
name="id">completed_date</xsl:attribute>
                              <xsl:attribute 
name="name">completed_date</xsl:attribute>
                              <xsl:attribute name="type">text</xsl:attribute>
-                                 <xsl:if test="check_list/completed_date != 0">
+                                 <xsl:if test="check_list/completed_date != 0 
and check_list/completed_date != ''">
                                <xsl:attribute name="value"><xsl:value-of 
select="php:function('date', $date_format, 
number(check_list/completed_date))"/></xsl:attribute>
                              </xsl:if>
                            </input>

Modified: trunk/controller/templates/base/css/base.css
===================================================================
--- trunk/controller/templates/base/css/base.css        2012-07-28 13:05:59 UTC 
(rev 9814)
+++ trunk/controller/templates/base/css/base.css        2012-07-29 09:55:49 UTC 
(rev 9815)
@@ -966,10 +966,6 @@
     margin:0;
 }
 
-#check_list_details fieldset{
-    width: 65%;
-}
-
 #check_list_details form .row {
     padding: 0.1em 0;
 }
@@ -1000,9 +996,8 @@
     vertical-align: top;
 }
 
-#check_list_details .col_2 {
-    margin-left: 15%;
-    width: 19%;
+#check_list_details .col_1 {
+    width: 46%;
 }
 
 /* =======================================  TAB CHECK LIST DETAILS 
========================================= */




reply via email to

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