fmsystem-commits
[Top][All Lists]
Advanced

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

[Fmsystem-commits] [9639]


From: Torstein
Subject: [Fmsystem-commits] [9639]
Date: Thu, 21 Jun 2012 07:23:08 +0000

Revision: 9639
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=9639
Author:   vator
Date:     2012-06-21 07:23:05 +0000 (Thu, 21 Jun 2012)
Log Message:
-----------


Modified Paths:
--------------
    trunk/controller/inc/class.socheck_list.inc.php
    trunk/controller/inc/class.socommon.inc.php
    trunk/controller/inc/class.uicalendar.inc.php
    trunk/controller/inc/class.uicheck_list.inc.php
    trunk/controller/inc/component/class.year_calendar.inc.php
    trunk/controller/inc/helper/class.check_list_status_info.inc.php
    trunk/controller/inc/helper/class.check_list_status_manager.inc.php
    trunk/controller/js/controller/ajax.js
    trunk/controller/templates/base/calendar/check_list_status_checker.xsl
    trunk/controller/templates/base/calendar/view_calendar_year.xsl
    trunk/controller/templates/base/check_list/add_check_list.xsl

Modified: trunk/controller/inc/class.socheck_list.inc.php
===================================================================
--- trunk/controller/inc/class.socheck_list.inc.php     2012-06-21 06:58:01 UTC 
(rev 9638)
+++ trunk/controller/inc/class.socheck_list.inc.php     2012-06-21 07:23:05 UTC 
(rev 9639)
@@ -507,7 +507,7 @@
        */
        
        // Fetches control id and check lists for period and location
-       function get_check_lists_for_location_2( $location_code, $from_date_ts, 
$to_date_ts, $repeat_type ){
+       function get_check_lists_for_location_2( $location_code, $from_date_ts, 
$to_date_ts, $repeat_type_expr = null ){
                $sql =  "SELECT c.id as c_id, ";
                $sql .= "cl.id as cl_id, cl.status as cl_status, cl.comment as 
cl_comment, deadline, planned_date, completed_date, ";
                $sql .= "cl.component_id as cl_component_id, cl.location_code 
as cl_location_code, num_open_cases, num_pending_cases "; 
@@ -515,8 +515,8 @@
                $sql .= "LEFT JOIN controller_check_list cl on cl.control_id = 
c.id ";
                $sql .= "WHERE cl.location_code = '{$location_code}' ";
                
-               if( is_numeric($repeat_type) )
-                       $sql .= "AND c.repeat_type = $repeat_type ";
+               if( $repeat_type != null )
+                       $sql .= "AND c.repeat_type $repeat_type_expr ";
                
                $sql .= "AND deadline BETWEEN $from_date_ts AND $to_date_ts ";
                $sql .= "ORDER BY c.id;";
@@ -821,33 +821,36 @@
        {
                $cols = array(
                                'control_id',
-                               'status',
                                'comment',
                                'deadline',
                                'planned_date',
                                'completed_date',
+                               'component_id',
                                'location_code',
-                               'component_id',
                                'num_open_cases',
-                               'num_pending_cases'
+                               'num_pending_cases',
+                               'location_id',
+                               'status'
                );
-               
-               
+                               
+               $check_list->set_status(1);
                $values = array(
                        $this->marshal($check_list->get_control_id(), 'int'),
-                       $check_list->get_status(),
                        $this->marshal($check_list->get_comment(), 'string'),
                        $this->marshal($check_list->get_deadline(), 'int'),
                        $this->marshal($check_list->get_planned_date(), 'int'),
                        $this->marshal($check_list->get_completed_date(), 
'int'),
-                       $this->marshal($check_list->get_location_code(), 
'string'),
-                       $this->marshal($check_list->get_component_id(), 'int'),
-                       $this->marshal($check_list->get_num_open_cases(), 
'int'),
-                       $this->marshal($check_list->get_num_pending_cases(), 
'int')
+                       444,
+                       $this->marshal(sds, 'string'),
+                       intval(77),
+                       $this->marshal(88, 'int'),
+                       $check_list->get_status()
                );
+                               
+               //$result = $this->db->query('INSERT INTO controller_check_list 
(' . join(',', $cols) . ') VALUES (' . join(',', $values) . ')', 
__LINE__,__FILE__);
+               $result = $this->db->query('INSERT INTO controller_check_list 
(control_id,comment,deadline,planned_date,completed_date,component_id,location_code,num_open_cases,num_pending_cases,location_id,status)
 values(4,' . 4 . ',4,4,4,4,' . 4 . ',4,4,2,4)');
+               //$result = $this->db->query('INSERT INTO controller_check_list 
values(' . 84 . ',4,' . 4 . ',4,4,4,4,' . 4 . ',4,4,2,4)');
                
-               $result = $this->db->query('INSERT INTO controller_check_list 
(' . join(',', $cols) . ') VALUES (' . join(',', $values) . ')', 
__LINE__,__FILE__);
-
                return isset($result) ? 
$this->db->get_last_insert_id('controller_check_list', 'id') : 0;
        }
        
@@ -864,6 +867,7 @@
                        'completed_date = ' . 
$this->marshal($check_list->get_completed_date(), 'int'),
                        'location_code = ' . 
$this->marshal($check_list->get_location_code(), 'string'),
                        'component_id = ' . 
$this->marshal($check_list->get_component_id(), 'int'),
+                       'location_id = ' . 
$this->marshal($check_list->get_location_id(), 'int'),
                        'num_open_cases = ' . 
$this->marshal($check_list->get_num_open_cases(), 'int'),
                        'num_pending_cases = ' . 
$this->marshal($check_list->get_num_pending_cases(), 'int')
                );

Modified: trunk/controller/inc/class.socommon.inc.php
===================================================================
--- trunk/controller/inc/class.socommon.inc.php 2012-06-21 06:58:01 UTC (rev 
9638)
+++ trunk/controller/inc/class.socommon.inc.php 2012-06-21 07:23:05 UTC (rev 
9639)
@@ -71,6 +71,10 @@
                        {
                                return $this->db->db_addslashes($value);
                        }
+                       else if($type == 'string' & $value == '')
+                       {
+                               return 'NULL';
+                       }
 
                        return "'" . $this->db->db_addslashes($value) . "'";
                }

Modified: trunk/controller/inc/class.uicalendar.inc.php
===================================================================
--- trunk/controller/inc/class.uicalendar.inc.php       2012-06-21 06:58:01 UTC 
(rev 9638)
+++ trunk/controller/inc/class.uicalendar.inc.php       2012-06-21 07:23:05 UTC 
(rev 9639)
@@ -124,6 +124,27 @@
                                $controls_calendar_array[] = array("control" => 
$control->toArray(), "calendar_array" => $calendar_array);
                        }
                        
+                       // COMPONENTS
+                       foreach($components_with_controls_array as $component){
+                               $controls_for_component_array = 
$component->get_controls_array(); 
+                               $controls_components_calendar_array = array();
+                               
+                         foreach($controls_for_component_array as $control){
+                           // Fetches control ids with check lists for 
specified time period
+                                       $control_id_with_check_list_array = 
$this->so->get_check_lists_for_component($component->get_type(), 
$component->get_id(), $from_date_ts, $to_date_ts, $repeat_type = ">=2");
+
+                                       // Loops through all controls for 
location and populates controls with check lists
+                                       $controls_for_component_array = 
$this->populate_controls_with_check_lists($controls_for_component_array, 
$control_id_with_check_list_array);
+
+                                       $year_calendar = new year_calendar( 
$control, $year, $component, null, "component" );
+                                       $calendar_array = 
$year_calendar->build_calendar( $control->get_check_lists_array() );
+                                                                               
                                
+                                       $controls_components_calendar_array[] = 
array("control" => $control->toArray(), "calendar_array" => $calendar_array);
+                         }
+                         
+                         $components_calendar_array[] = array("component" => 
$component->toArray(), "controls_calendar" => 
$controls_components_calendar_array);
+                       }
+                       
                        $location_array = 
execMethod('property.bolocation.read_single', array('location_code' => 
$location_code));
                
                        $property_array = 
execMethod('property.solocation.read', array('type_id' => 1, 'allrows' => 
true));
@@ -133,6 +154,8 @@
                        
                        $heading_array = 
month_calendar::get_heading_array($year, $month);
                        
+                       $roles_array = $this->so_control->get_roles();
+                       
                        $data = array
                        (               
                                'buildings_on_property'         => 
$buildings_on_property,
@@ -145,6 +168,7 @@
                                'current_year'                                  
=> $year,
                                'current_month_nr'                      => 
$month,
                                'location_level'                                
=> $level,
+                               'roles_array'                                   
        => $roles_array,
                        );
                        
                        self::add_javascript('controller', 'controller', 
'jquery.js');
@@ -211,24 +235,17 @@
                                }
                        }
                        
-                       $repeat_type = 2;
+                       $repeat_type_expr = ">=2";
                        // Fetches control ids with check lists for specified 
time period
-                       $control_id_with_check_list_array = 
$this->so->get_check_lists_for_location_2($location_code, $from_date_ts, 
$to_date_ts, $repeat_type);
+                       $control_id_with_check_list_array = 
$this->so->get_check_lists_for_location_2($location_code, $from_date_ts, 
$to_date_ts, $repeat_type_expr);
                        
                        // Loops through all controls for location and 
populates controls with check lists
                        $controls_for_location_array = 
$this->populate_controls_with_check_lists($controls_for_location_array, 
$control_id_with_check_list_array);
                        
-                       $repeat_type = 3;
-                       // Fetches control ids with check lists for specified 
time period
-                       $control_id_with_check_list_array = 
$this->so->get_check_lists_for_location_2($location_code, $from_date_ts, 
$to_date_ts, $repeat_type);
-                       
-                       // Loops through all controls for location and 
populates controls with check lists
-                       $controls_for_location_array = 
$this->populate_controls_with_check_lists($controls_for_location_array, 
$control_id_with_check_list_array);
-
                        foreach($controls_for_location_array as $control){
                                if($control->get_repeat_type() == 2 | 
$control->get_repeat_type() == 3){
                                        
-                                       $year_calendar = new 
year_calendar($control, $year);
+                                       $year_calendar = new 
year_calendar($control, $year, null, $location_code, "location" );
                                        $calendar_array = 
$year_calendar->build_calendar( $control->get_check_lists_array() );
                                                                                
        
                                        $controls_calendar_array[] = 
array("control" => $control->toArray(), "calendar_array" => $calendar_array);
@@ -237,12 +254,10 @@
                        
                        // COMPONENTS
                        foreach($components_with_controls_array as $component){
-                               
                                $controls_for_component_array = 
$component->get_controls_array(); 
                                $controls_components_calendar_array = array();
                                
                          foreach($controls_for_component_array as $control){
-                          
                                  if($control->get_repeat_type() == 0 | 
$control->get_repeat_type() == 1){
                                        $cl_criteria = new 
controller_check_list();
                                                $cl_criteria->set_control_id( 
$control->get_id() );
@@ -261,17 +276,16 @@
 
                                                // Loops through all controls 
for location and populates controls with check lists
                                                $controls_for_component_array = 
$this->populate_controls_with_check_lists($controls_for_component_array, 
$control_id_with_check_list_array);
-                                               
-                                               $year_calendar = new 
year_calendar($control, $year, $component, null, "component");
+
+                                               $year_calendar = new 
year_calendar( $control, $year, $component, null, "component" );
                                                $calendar_array = 
$year_calendar->build_calendar( $control->get_check_lists_array() );
                                                                                
                                
                                                
$controls_components_calendar_array[] = array("control" => $control->toArray(), 
"calendar_array" => $calendar_array);
                                }
                          }
-                       
+                         
                          $components_calendar_array[] = array("component" => 
$component->toArray(), "controls_calendar" => 
$controls_components_calendar_array);
                        }
-                       print_r($components_calendar_array);
                        
                        $location_array = 
execMethod('property.bolocation.read_single', array('location_code' => 
$location_code));
 
@@ -280,6 +294,8 @@
                        
                        $heading_array = year_calendar::get_heading_array();
                        
+                       $roles_array = $this->so_control->get_roles();
+                       
                        $data = array
                        (
                                'buildings_on_property'                 => 
$buildings_on_property,
@@ -291,6 +307,7 @@
                                'date_format'                                   
        => $date_format,
                                'current_year'                                  
        => $year,
                                'location_level'                                
        => $level,
+                               'roles_array'                                   
                => $roles_array
                        );
                        
                        
self::render_template_xsl(array('calendar/view_calendar_year', 
'calendar/check_list_status_checker', 

Modified: trunk/controller/inc/class.uicheck_list.inc.php
===================================================================
--- trunk/controller/inc/class.uicheck_list.inc.php     2012-06-21 06:58:01 UTC 
(rev 9638)
+++ trunk/controller/inc/class.uicheck_list.inc.php     2012-06-21 07:23:05 UTC 
(rev 9639)
@@ -191,44 +191,34 @@
                 * @return data array
                */
                function add_check_list(){
-                       $location_code = phpgw::get_var('location_code');
+                       $type = phpgw::get_var('type');
                        $control_id = phpgw::get_var('control_id');
-                       $date = phpgw::get_var('date');
+                       $deadline_ts = phpgw::get_var('deadline_ts');
                        
+                       $check_list = new controller_check_list();
+                       $check_list->set_control_id($control_id);
+                       $check_list->set_deadline($deadline_ts);
+                       
+                       if($type == "component"){
+                               $location_id = phpgw::get_var('location_id');
+                               $check_list->set_location_id($location_id);
+                               $component_id = phpgw::get_var('component_id');
+                               $check_list->set_component_id($component_id);
+                       }else{
+                               $location_code = 
phpgw::get_var('location_code');       
+                       }
+                       
                        $control = $this->so_control->get_single($control_id);
                        
-                       if($date == null || $date == ''){
-                               $todays_date = mktime(0,0,0, date("m"), 
date("d"), date("Y"));
-                               $period_start_date = $todays_date;
-                               
-                               if( $control->get_repeat_type() == 1 )
-                               {
-                                       $period_end_date = mktime(0,0,0, 
date("m")+1, date("d"), date("Y"));
-                               }else if( $control->get_repeat_type() == 2 )
-                               {
-                                       $period_end_date = mktime(0,0,0, 
date("m"), date("d"), date("Y") + 1);
-                               }else if( $control->get_repeat_type() == 3 )
-                               {
-                                       $period_end_date = mktime(0,0,0, 
date("m"), date("d"), date("Y") + $control->get_repeat_interval());             
               
-                               }
-                               
-                               $date_generator = new 
date_generator($control->get_start_date(), $control->get_end_date(), 
$period_start_date, $period_end_date, $control->get_repeat_type(), 
$control->get_repeat_interval());
-                                                       
-                               $calendar_array = $date_generator->get_dates();
-                       }
-                       else
-                       {
-                               $calendar_array[] = $date;
-                       }                       
-
                        $location_array = 
execMethod('property.bolocation.read_single', array('location_code' => 
$location_code));
                        
                        $data = array
                        (
                                'location_array'        => $location_array,
-                               'control'                       => 
$control->toArray(),
-                               'deadline'                      => 
$calendar_array[0],
-                               'date_format'           => $date_format         
        
+                               'control'                                       
=> $control->toArray(),
+                               'date_format'           => $date_format,
+                               'check_list'                    => 
$check_list->toArray(),
+                               'type'                                          
=> $type
                        );
                        
                        self::add_javascript('controller', 'controller', 
'jquery.js');
@@ -248,25 +238,28 @@
                 * @return data array
                */
                function save_check_list(){
-                       $location_code = phpgw::get_var('location_code');
                        $control_id = phpgw::get_var('control_id');
                        $status = (int)phpgw::get_var('status');
-
+                       $type = phpgw::get_var('type');
                        $deadline_date = phpgw::get_var('deadline_date', 
'string');
                        $planned_date = phpgw::get_var('planned_date', 
'string');
                        $completed_date = phpgw::get_var('completed_date', 
'string');
+                       $comment = phpgw::get_var('comment', 'string');
                        
-                       $comment = phpgw::get_var('comment', 'string');
-                                                       
-                       if($planned_date != '')
+                       $deadline_date_ts = 
date_helper::get_timestamp_from_date( $deadline_date, "d/m-Y" );
+                       
+                       if($planned_date != ''){
                                $planned_date_ts = 
date_helper::get_timestamp_from_date( $planned_date, "d/m-Y" );
-
-                       if($deadline_date != '')
-                               $deadline_date_ts = 
date_helper::get_timestamp_from_date( $deadline_date, "d/m-Y" );
+                       }else{
+                               $planned_date_ts = 0;
+                       } 
                        
-                       if($completed_date != '')
+                       if($completed_date != ''){
                                $completed_date_ts = 
date_helper::get_timestamp_from_date( $completed_date, "d/m-Y" );
-                       
+                       }else{
+                               $completed_date_ts = 0;
+                       }               
+
                        $check_list = new controller_check_list();
                        $check_list->set_location_code($location_code);
                        $check_list->set_control_id($control_id);
@@ -276,9 +269,21 @@
                        $check_list->set_planned_date($planned_date_ts);
                        $check_list->set_completed_date($completed_date_ts);
                        
+                       if($type == "component"){
+                               $location_id = phpgw::get_var('location_id');
+                               $component_id = phpgw::get_var('component_id');
+                               $check_list->set_location_id( $location_id );
+                               $check_list->set_component_id( $component_id );
+                       }else {
+                               $location_code = 
phpgw::get_var('location_code');
+                               $check_list->set_location_code( $location_code 
);
+                       }
+                       
                        $check_list_id = $this->so->store($check_list);
                        
-                       $this->redirect(array('menuaction' => 
'controller.uicheck_list.edit_check_list', 'check_list_id'=>$check_list_id));
+                       if( $check_list_id > 0 ){
+                               $this->redirect(array('menuaction' => 
'controller.uicheck_list.edit_check_list', 'check_list_id'=>$check_list_id));   
  
+                       }
                }
                
                /**
@@ -294,18 +299,26 @@
                        $status_checker->update_check_list_status( 
$check_list_id );
                                
                        $check_list = $this->so->get_single($check_list_id);
-                       
                        $control = 
$this->so_control->get_single($check_list->get_control_id());
                        
                        $date_format = 
$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'];
-                       $location_code = $check_list->get_location_code();
+                       
+                       $component_id = $check_list->get_component_id();
+
+                       if($component_id > 0){
+                               
+                       }else{
+                               $location_code = 
$check_list->get_location_code();
        
-                       $location_array = 
execMethod('property.bolocation.read_single', array('location_code' => 
$location_code));
+                               $location_array = 
execMethod('property.bolocation.read_single', array('location_code' => 
$location_code));      
+                       }
+                       
+                       
                                                
                        $data = array
                        (
-                               'control'                       => 
$control->toArray(),
-                               'check_list'            => 
$check_list->toArray(),
+                               'control'                               => 
$control->toArray(),
+                               'check_list'                    => 
$check_list->toArray(),
                                'location_array'        => $location_array,
                                'date_format'           => $date_format
                        );

Modified: trunk/controller/inc/component/class.year_calendar.inc.php
===================================================================
--- trunk/controller/inc/component/class.year_calendar.inc.php  2012-06-21 
06:58:01 UTC (rev 9638)
+++ trunk/controller/inc/component/class.year_calendar.inc.php  2012-06-21 
07:23:05 UTC (rev 9639)
@@ -28,8 +28,7 @@
                
   /* Initializes calendar by setting status for each month in calendar array. 
    *   - CONTROL_NOT_DONE if month date is in the past 
-   *   - CONTROL_REGISTERED if month date is in the future
-   */ 
+   *   - CONTROL_REGISTERED if month date is in the future */ 
        function init_calendar(){
     for($i = 1;$i <= 12;$i++){
                  $this->calendar_array[$i] = null;
@@ -47,11 +46,19 @@
                
     // Inserts dates 
     foreach($dates_array as $date_ts){
-       
        $check_list = new controller_check_list();
        $check_list->set_deadline( $date_ts );
+       $check_list->set_control_id( $this->control->get_id() );
        
-       $check_list_status_manager = new check_list_status_manager( $check_list 
);
+       if($this->type == "component"){
+               $check_list->set_component_id( $this->component->get_id() );
+               $check_list->set_location_id( $this->component->get_type() );
+               $check_list_status_manager = new check_list_status_manager( 
$check_list, "component" );
+       }else {
+               $check_list->set_location_code( $this->location_code );
+               $check_list_status_manager = new check_list_status_manager( 
$check_list, "location" );
+       } 
+       
                        $check_list_status_info = 
$check_list_status_manager->get_status_for_check_list(); 
        
                        $month_nr = date("n", $date_ts);

Modified: trunk/controller/inc/helper/class.check_list_status_info.inc.php
===================================================================
--- trunk/controller/inc/helper/class.check_list_status_info.inc.php    
2012-06-21 06:58:01 UTC (rev 9638)
+++ trunk/controller/inc/helper/class.check_list_status_info.inc.php    
2012-06-21 07:23:05 UTC (rev 9639)
@@ -31,12 +31,16 @@
        class check_list_status_info
        {               
                private $check_list_id;
+               private $control_id;
                private $status;
                private $status_text;
                private $deadline_date_ts;
                private $deadline_date_txt;
                private $info_text;
                private $location_code;
+               private $component_id;
+               private $location_id;
+               private $type;
                private $num_open_cases;
                        
                public function __construct(){}
@@ -48,6 +52,13 @@
                
                public function get_check_list_id() { return 
$this->check_list_id; }
                
+               public function set_control_id($control_id)
+               {
+                       $this->control_id = $control_id;
+               }
+               
+               public function get_control_id() { return $this->control_id; }
+               
                public function set_status($status)
                {
                        $this->status = $status;
@@ -90,6 +101,27 @@
                
                public function get_location_code() { return 
$this->location_code; }
                
+               public function set_location_id($location_id)
+               {
+                       $this->location_id = $location_id;
+               }
+               
+               public function get_location_id() { return $this->location_id; }
+               
+               public function set_component_id($component_id)
+               {
+                       $this->component_id = $component_id;
+               }
+               
+               public function get_component_id() { return 
$this->component_id; }
+               
+               public function get_type() { return $this->type; }
+               
+               public function set_type($type)
+               {
+                       $this->type = $type;
+               }
+               
                public function set_num_open_cases($num_open_cases)
                {
                        $this->num_open_cases = $num_open_cases;
@@ -102,12 +134,16 @@
                {
                        return array(
                                'check_list_id' => $this->get_check_list_id(),
+                               'control_id' => $this->get_control_id(),
                                'status' => $this->get_status(),
                                'status_text' => $this->get_status_text(),
                                'deadline_date_ts' => 
$this->get_deadline_date_ts(),
                                'deadline_date_txt' => 
$this->get_deadline_date_txt(),
                                'info_text' => $this->get_info_text(),
                                'location_code' => $this->get_location_code(),
+                               'location_id' => $this->get_location_id(),
+                               'component_id' => $this->get_component_id(),
+                               'type' => $this->get_type(),
                                'num_open_cases' => $this->get_num_open_cases()
                        );
                }

Modified: trunk/controller/inc/helper/class.check_list_status_manager.inc.php
===================================================================
--- trunk/controller/inc/helper/class.check_list_status_manager.inc.php 
2012-06-21 06:58:01 UTC (rev 9638)
+++ trunk/controller/inc/helper/class.check_list_status_manager.inc.php 
2012-06-21 07:23:05 UTC (rev 9639)
@@ -33,26 +33,26 @@
        class check_list_status_manager
        {               
                private $check_list;
-               
-               public function __construct($check_list){
-                       $this->check_list = $check_list;
+               private $type;
+                                               
+               public function __construct($check_list, $type) {
+                       $this->check_list               = $check_list;
+       $this->type                                     = $type;
                }
                
-               function get_status_for_check_list(){
-               
+               function get_status_for_check_list() {
                        $check_list_status_info = new check_list_status_info();
-                       $check_list_status_info->set_check_list_id( 
$this->check_list->get_id() );
-       
+                               
                        $todays_date_ts = $this->get_todays_date_ts();
                        
                        if( $this->check_list->get_id() == 0){
+                               
                                if($this->check_list->get_deadline() < 
$todays_date_ts){
                $status = "CONTROL_NOT_DONE";
              }else{
                $status = "CONTROL_REGISTERED";
              }
-                       }
-                       else{
+                       }else {
                                if($this->check_list->get_status() == 
controller_check_list::STATUS_NOT_DONE & $this->check_list->get_planned_date() 
> 0 & $this->check_list->get_deadline() >= $todays_date_ts)
                                {
                                        $status = "CONTROL_PLANNED";
@@ -75,17 +75,29 @@
                                }
                                else if( $this->check_list->get_status() == 
controller_check_list::STATUS_DONE & $this->check_list->get_num_open_cases() > 
0){
                                        $status = "CONTROL_DONE_WITH_ERRORS";
+                                       
                                        
$check_list_status_info->set_num_open_cases($this->check_list->get_num_open_cases());
                                }
                                else if( $this->check_list->get_status() == 
controller_check_list::STATUS_CANCELED)
                                {
                                        $status = "CONTROL_CANCELED";
                                }
+                               
+                               $check_list_status_info->set_check_list_id( 
$this->check_list->get_id() );
                        }
                        
+                       $check_list_status_info->set_control_id( 
$this->check_list->get_control_id() );
                        $check_list_status_info->set_deadline_date_txt( 
date("d/m-Y", $this->check_list->get_deadline()) );
                        $check_list_status_info->set_deadline_date_ts( 
$this->check_list->get_deadline() );
-                       $check_list_status_info->set_location_code( 
$this->check_list->get_location_code() );
+                       $check_list_status_info->set_type( $this->type );
+                       
+                       if($this->type == "component"){
+                               $check_list_status_info->set_component_id( 
$this->check_list->get_component_id() );
+                               $check_list_status_info->set_location_id( 
$this->check_list->get_location_id() );
+                       }else {
+                               $check_list_status_info->set_location_code( 
$this->check_list->get_location_code() );
+                       }
+                       
                        $check_list_status_info->set_status($status);
                        
                        return $check_list_status_info; 

Modified: trunk/controller/js/controller/ajax.js
===================================================================
--- trunk/controller/js/controller/ajax.js      2012-06-21 06:58:01 UTC (rev 
9638)
+++ trunk/controller/js/controller/ajax.js      2012-06-21 07:23:05 UTC (rev 
9639)
@@ -517,7 +517,6 @@
        
        // ADD CHECKLIST
        $("#frm_add_check_list").live("submit", function(e){
-               
                var thisForm = $(this);
                var statusFieldVal = $("#status").val();
                var completedDateVal = $("#completed_date").val();

Modified: trunk/controller/templates/base/calendar/check_list_status_checker.xsl
===================================================================
--- trunk/controller/templates/base/calendar/check_list_status_checker.xsl      
2012-06-21 06:58:01 UTC (rev 9638)
+++ trunk/controller/templates/base/calendar/check_list_status_checker.xsl      
2012-06-21 07:23:05 UTC (rev 9639)
@@ -9,12 +9,24 @@
                        <a>
                                <xsl:attribute name="href">
                                        
<xsl:text>index.php?menuaction=controller.uicheck_list.add_check_list</xsl:text>
-                                       <xsl:text>&amp;date=</xsl:text>
-                                       <xsl:value-of select="info/date"/>
+                                       <xsl:text>&amp;deadline_ts=</xsl:text>
+                                       <xsl:value-of 
select="info/deadline_date_ts"/>
                                        <xsl:text>&amp;control_id=</xsl:text>
                                        <xsl:value-of select="info/control_id"/>
-                                       <xsl:text>&amp;location_code=</xsl:text>
-                                       <xsl:value-of select="$location_code"/>
+                                       <xsl:text>&amp;type=</xsl:text>
+                                       <xsl:value-of select="info/type"/>
+                                       <xsl:choose>
+                                         <xsl:when test="info/type = 
'component'">
+                                               
<xsl:text>&amp;location_id=</xsl:text>
+                                                       <xsl:value-of 
select="info/location_id"/>
+                                                       
<xsl:text>&amp;component_id=</xsl:text>
+                                                       <xsl:value-of 
select="info/component_id"/>
+                                         </xsl:when>
+                                         <xsl:otherwise>
+                                                       
<xsl:text>&amp;location_code=</xsl:text>
+                                                       <xsl:value-of 
select="$location_code"/>  
+                                         </xsl:otherwise>
+                                       </xsl:choose>
                                </xsl:attribute>
                                <img height="15" 
src="controller/images/status_icon_yellow_ring.png" />
                        </a>
@@ -37,12 +49,24 @@
                                <a>
                                        <xsl:attribute name="href">
                                                
<xsl:text>index.php?menuaction=controller.uicheck_list.add_check_list</xsl:text>
-                                               <xsl:text>&amp;date=</xsl:text>
-                                               <xsl:value-of 
select="info/date"/>
+                                               
<xsl:text>&amp;deadline_ts=</xsl:text>
+                                               <xsl:value-of 
select="info/deadline_date_ts"/>
                                                
<xsl:text>&amp;control_id=</xsl:text>
                                                <xsl:value-of 
select="info/control_id"/>
-                                               
<xsl:text>&amp;location_code=</xsl:text>
-                                               <xsl:value-of 
select="$location_code"/>
+                                               <xsl:text>&amp;type=</xsl:text>
+                                               <xsl:value-of 
select="info/type"/>
+                                               <xsl:choose>
+                                                 <xsl:when test="info/type = 
'component'">
+                                                       
<xsl:text>&amp;location_id=</xsl:text>
+                                                               <xsl:value-of 
select="info/location_id"/>
+                                                               
<xsl:text>&amp;component_id=</xsl:text>
+                                                               <xsl:value-of 
select="info/component_id"/>
+                                                 </xsl:when>
+                                                 <xsl:otherwise>
+                                                               
<xsl:text>&amp;location_code=</xsl:text>
+                                                               <xsl:value-of 
select="$location_code"/>  
+                                                 </xsl:otherwise>
+                                         </xsl:choose>
                                        </xsl:attribute>
                                        <img height="15" 
src="controller/images/status_icon_red_cross.png" />
                                </a>

Modified: trunk/controller/templates/base/calendar/view_calendar_year.xsl
===================================================================
--- trunk/controller/templates/base/calendar/view_calendar_year.xsl     
2012-06-21 06:58:01 UTC (rev 9638)
+++ trunk/controller/templates/base/calendar/view_calendar_year.xsl     
2012-06-21 07:23:05 UTC (rev 9639)
@@ -124,6 +124,17 @@
                        <!-- =====================  COLOR ICON MAP  
================= -->
                        <xsl:call-template name="icon_color_map" />
                        
+                               <select>
+                                       <xsl:for-each select="roles_array">
+                                               <xsl:variable 
name="role_id"><xsl:value-of select="id"/></xsl:variable>
+                                               <option value="{$role_id}">
+                                                       <xsl:value-of 
disable-output-escaping="yes" select="name"/>
+                                               </option>
+                                       </xsl:for-each>
+                               </select>
+                       
+                       
+                       
                        <!-- =====================  CALENDAR NAVIGATION  
================= -->
                        <div id="calNav">
                                <a class="showPrev">
@@ -169,7 +180,7 @@
                                                                        
<xsl:text>&amp;year=</xsl:text>
                                                                        
<xsl:value-of select="//current_year"/>
                                                                        
<xsl:text>&amp;location_code=</xsl:text>
-                                                                       
<xsl:value-of select="current_location/location_code"/>
+                                                                       
<xsl:value-of select="//current_location/location_code"/>
                                                                        
<xsl:text>&amp;month=</xsl:text>
                                                                        
<xsl:number/>
                                                                </xsl:attribute>
@@ -234,21 +245,46 @@
                                <tr class="cal_info_msg"><td colspan="3">Ingen 
sjekklister for bygg i angitt periode</td></tr>
                        </xsl:otherwise>
                </xsl:choose>
+               </table>
                
+               <h2>Komponenter</h2>
+               
+               <table id="calendar" class="year">
+                               <tr class="heading">
+                                               <th 
class="title"><span>Tittel</span></th>
+                                               <th 
class="assigned"><span>Tildelt</span></th>
+                                               <th 
class="frequency"><span>Frekvens</span></th>
+                                       <xsl:for-each select="heading_array">
+                                               <th>
+                                                       <a>
+                                                               <xsl:attribute 
name="href">
+                                                                       
<xsl:text>index.php?menuaction=controller.uicalendar.view_calendar_for_month</xsl:text>
+                                                                       
<xsl:text>&amp;year=</xsl:text>
+                                                                       
<xsl:value-of select="//current_year"/>
+                                                                       
<xsl:text>&amp;location_code=</xsl:text>
+                                                                       
<xsl:value-of select="current_location/location_code"/>
+                                                                       
<xsl:text>&amp;month=</xsl:text>
+                                                                       
<xsl:number/>
+                                                               </xsl:attribute>
+                                                               
+                                                               <xsl:variable 
name="month_str">short_month <xsl:number/> capitalized</xsl:variable>
+                                                               <xsl:value-of 
select="php:function('lang', $month_str)" />
+                                                       </a>                    
        
+                                               </th>
+                                       </xsl:for-each>
+                               </tr>
                <xsl:for-each select="components_calendar_array">
                
                <tr>
-               
                <td>
                        <h3><xsl:value-of 
select="component/location_code"/></h3>
                </td>
                        <xsl:for-each select="controls_calendar">
+                       
+                               
                                        <xsl:variable 
name="control_id"><xsl:value-of select="control/id"/></xsl:variable>
                                
                                        <tr>
-                                       
-                         
-                                                                       
                                                <xsl:choose>
                                                <xsl:when test="(position() mod 
2) != 1">
                                                    <xsl:attribute 
name="class">odd</xsl:attribute>
@@ -295,24 +331,7 @@
                
                </xsl:for-each>
                
-               
-               
-               
-               
-               
-               
-               
-               
-               
-               
-               
-               
-               
-               
-               
-               
-               
-               
+                       
        </table>
        </div>
 </div>

Modified: trunk/controller/templates/base/check_list/add_check_list.xsl
===================================================================
--- trunk/controller/templates/base/check_list/add_check_list.xsl       
2012-06-21 06:58:01 UTC (rev 9638)
+++ trunk/controller/templates/base/check_list/add_check_list.xsl       
2012-06-21 07:23:05 UTC (rev 9639)
@@ -45,12 +45,24 @@
        <div id="check_list_details">
                <h3 class="box_header">Sjekklistedetaljer</h3>
                <form id="frm_add_check_list" 
action="index.php?menuaction=controller.uicheck_list.save_check_list" 
method="post">
-                       <xsl:variable name="location_code"><xsl:value-of 
select="location_array/location_code"/></xsl:variable>
                        <xsl:variable name="control_id"><xsl:value-of 
select="control/id"/></xsl:variable>
-               
                        <input type="hidden" name="control_id" 
value="{$control_id}" />
-                       <input type="hidden" name="location_code" 
value="{$location_code}" />
+                       <xsl:variable name="type"><xsl:value-of 
select="type"/></xsl:variable>
+                       <input type="hidden" name="type" value="{$type}" />
                        
+                       <xsl:choose>
+                               <xsl:when test="type = 'component'">
+                                       <xsl:variable 
name="location_id"><xsl:value-of 
select="check_list/location_id"/></xsl:variable>
+                                       <input type="hidden" name="location_id" 
value="{$location_id}" />
+                                       <xsl:variable 
name="component_id"><xsl:value-of 
select="check_list/component_id"/></xsl:variable>
+                                       <input type="hidden" 
name="component_id" value="{$component_id}" />
+                               </xsl:when>
+                               <xsl:otherwise>
+                                       <xsl:variable 
name="location_code"><xsl:value-of 
select="location_array/location_code"/></xsl:variable>
+                                       <input type="hidden" 
name="location_code" value="{$location_code}" />
+                               </xsl:otherwise>
+                       </xsl:choose>
+                       
                        <fieldset>
                                <div class="row">
                                        <label>Status</label>
@@ -62,7 +74,7 @@
                                <div class="row">
                                        <label>Fristdato</label>
                                        <input type="text" id="deadline_date" 
name="deadline_date" class="date">
-                                     <xsl:attribute name="value"><xsl:value-of 
select="php:function('date', $date_format, number(deadline))"/></xsl:attribute>
+                                     <xsl:attribute name="value"><xsl:value-of 
select="php:function('date', $date_format, 
number(check_list/deadline))"/></xsl:attribute>
                                    </input>
                            </div>
                                <div class="row">




reply via email to

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