fmsystem-commits
[Top][All Lists]
Advanced

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

[Fmsystem-commits] [10015] controller: use dateformat from userprefs, us


From: Sigurd Nes
Subject: [Fmsystem-commits] [10015] controller: use dateformat from userprefs, use generated url
Date: Thu, 20 Sep 2012 11:48:54 +0000

Revision: 10015
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=10015
Author:   sigurdne
Date:     2012-09-20 11:48:53 +0000 (Thu, 20 Sep 2012)
Log Message:
-----------
controller: use dateformat from userprefs, use generated url

Modified Paths:
--------------
    trunk/controller/inc/class.uicalendar.inc.php
    trunk/controller/inc/class.uicase.inc.php
    trunk/controller/inc/class.uicontrol.inc.php
    trunk/controller/templates/base/case/view_case_message.xsl
    trunk/controller/templates/base/control/control.xsl
    trunk/controller/templates/base/control/control_details.xsl

Modified: trunk/controller/inc/class.uicalendar.inc.php
===================================================================
--- trunk/controller/inc/class.uicalendar.inc.php       2012-09-20 10:26:09 UTC 
(rev 10014)
+++ trunk/controller/inc/class.uicalendar.inc.php       2012-09-20 11:48:53 UTC 
(rev 10015)
@@ -448,7 +448,7 @@
                                        $agg_open_cases_pr_month_array = 
$this->build_agg_open_cases_pr_month_array($cl_criteria, $year, $from_month, 
$to_month);
                                        
                                        $year_calendar_agg = new 
year_calendar_agg($control, $year, $curr_location_code, 
"VIEW_LOCATIONS_FOR_CONTROL");
-                                       $calendar_array = 
$year_calendar->build_calendar($agg_open_cases_pr_month_array);
+                                       $calendar_array = 
$year_calendar_agg->build_calendar($agg_open_cases_pr_month_array);
                                        $locations_with_calendar_array[] = 
array( "location" => $location, "calendar_array" => $calendar_array );
                                }
 
@@ -852,4 +852,4 @@
                }
                
                public function query(){}
-       }
\ No newline at end of file
+       }

Modified: trunk/controller/inc/class.uicase.inc.php
===================================================================
--- trunk/controller/inc/class.uicase.inc.php   2012-09-20 10:26:09 UTC (rev 
10014)
+++ trunk/controller/inc/class.uicase.inc.php   2012-09-20 11:48:53 UTC (rev 
10015)
@@ -340,7 +340,8 @@
                        $this->redirect(array('menuaction' => 
'controller.uicase.view_case_message', 'check_list_id'=>$check_list_id, 
'message_ticket_id'=>$message_ticket_id));
                }
                
-               function view_case_message(){
+               function view_case_message()
+               {
                        $check_list_id = phpgw::get_var('check_list_id');
                        $message_ticket_id = 
phpgw::get_var('message_ticket_id');
                                
@@ -389,21 +390,49 @@
                        
                        $data = array
                        (
-                               'control'                                       
                                => $control->toArray(),
-                               'message_ticket_id'                             
=> $message_ticket_id,
-                               'message_ticket'                                
        => $message_ticket,
-                               'category'                                      
                        => $category[0]['name'],
-                               'location_array'                                
        => $location_array,
-                               'component_array'                               
        => $component_array,
-                               'control_array'                                 
        => $control->toArray(),
-                               'check_list'                                    
                => $check_list->toArray(),
-                               'check_items_and_cases'         => 
$check_items_and_cases,
-                               'current_year'                                  
        => $year,
-                               'current_month_nr'                              
=> $month,
-                               'date_format'                                   
        => $date_format,
-                               'type'                                          
                                => $type,
-                               'building_location_code'        => 
$building_location_code,
-                               'location_level'                                
        => $level
+                               'control'                                       
        => $control->toArray(),
+                       //      'message_ticket_id'                             
=> $message_ticket_id,
+                               'message_ticket'                                
=> $message_ticket,
+                               'category'                                      
        => $category[0]['name'],
+                               'location_array'                                
=> $location_array,
+                               'component_array'                               
=> $component_array,
+                               'control_array'                                 
=> $control->toArray(),
+                               'check_list'                                    
=> $check_list->toArray(),
+                               'check_items_and_cases'                 => 
$check_items_and_cases,
+                       //      'current_year'                                  
=> $year,
+                       //      'current_month_nr'                              
=> $month,
+                               'date_format'                                   
=> $date_format,
+                               'type'                                          
        => $type,
+                               'building_location_code'                => 
$building_location_code,
+                               'location_level'                                
=> $level,
+                               'dateformat'                                    
=> $GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'],
+                               'url_calendar_for_year'                 =>      
$GLOBALS['phpgw']->link('/index.php', array
+                                                                               
                                                                                
(
+                                                                               
                                                                                
        'menuaction'    => 'controller.uicalendar.view_calendar_for_year', 
+                                                                               
                                                                                
        'year'                  => $year,
+                                                                               
                                                                                
        'location_code' => $type == 'component' ? $building_location_code : 
$location_array['location_code']
+                                                                               
                                                                                
)
+                                                                               
                                                                        ),
+                               'url_calendar_for_month'                =>      
$GLOBALS['phpgw']->link('/index.php', array
+                                                                               
                                                                                
(
+                                                                               
                                                                                
        'menuaction'    => 'controller.uicalendar.view_calendar_for_month', 
+                                                                               
                                                                                
        'year'                  => $year,
+                                                                               
                                                                                
        'location_code' => $type == 'component' ? $building_location_code : 
$location_array['location_code']
+                                                                               
                                                                                
)
+                                                                               
                                                                        ),
+                               'url_ticket_view'                               
=>      $GLOBALS['phpgw']->link('/index.php', array
+                                                                               
                                                                                
(
+                                                                               
                                                                                
        'menuaction'    => 'property.uitts.view', 
+                                                                               
                                                                                
        'id'                    => $message_ticket_id
+                                                                               
                                                                                
)
+                                                                               
                                                                        ),
+
+                               'url_ticket_new'                                
=>      $GLOBALS['phpgw']->link('/index.php', array
+                                                                               
                                                                                
(
+                                                                               
                                                                                
        'menuaction'    => 'controller.uicase.create_case_message', 
+                                                                               
                                                                                
        'check_list_id' => $check_list->get_id()
+                                                                               
                                                                                
)
+                                                                               
                                                                        ),
                        );
                        
                        self::add_javascript('controller', 'controller', 
'jquery.js');

Modified: trunk/controller/inc/class.uicontrol.inc.php
===================================================================
--- trunk/controller/inc/class.uicontrol.inc.php        2012-09-20 10:26:09 UTC 
(rev 10014)
+++ trunk/controller/inc/class.uicontrol.inc.php        2012-09-20 11:48:53 UTC 
(rev 10015)
@@ -280,14 +280,16 @@
                        
                        $data = array
                        (
-                               'tabs'                                          
                        => $GLOBALS['phpgw']->common->create_tabs($tabs, 0),
-                               'view'                                          
                        => "control_details",
-                               'editable'                                      
                => true,
-                               'control'                                       
                        => ($control != null) ? $control->toArray() : null,
+                               'tabs'                                          
=> $GLOBALS['phpgw']->common->create_tabs($tabs, 0),
+                               'view'                                          
=> "control_details",
+                               'editable'                                      
=> true,
+                               'control'                                       
=> ($control != null) ? $control->toArray() : null,
                                'control_areas_array'           => 
$control_areas_array,
                                'procedures_array'                      => 
$procedures_array,
-                               'role_array'                                    
        => $role_array,
-                               'repeat_type_array'                     => 
$repeat_type_array
+                               'role_array'                            => 
$role_array,
+                               'repeat_type_array'                     => 
$repeat_type_array,
+                               'dateformat'                            => 
$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'],
+                               'action'                                        
=> $GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'controller.uicontrol.save_control_details'))
                        );
                        
                        self::add_javascript('controller', 'yahoo', 
'control_tabs.js');
@@ -302,6 +304,8 @@
                        self::render_template_xsl(array('control/control_tabs', 
'control/control'), $data);
                        
                        $this->use_yui_editor(array('description'));
+                       $GLOBALS['phpgw']->jqcal->add_listener('start_date');
+                       $GLOBALS['phpgw']->jqcal->add_listener('end_date');
                }
                
                /**
@@ -612,11 +616,12 @@
                public function get_control_details()
                {
                        $control_id = phpgw::get_var('control_id');
-                 $control = $this->so->get_single($control_id);
-                       
-                 $data = array
+                       $control = $this->so->get_single($control_id);
+
+                       $data = array
                        (
-                               'control'                                       
        => $control->toArray()
+                               'control'                                       
        => $control->toArray(),
+                               'dateformat'                                    
=> $GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'],
                        );
                  
                        self::render_template_xsl('control/control_details', 
$data);

Modified: trunk/controller/templates/base/case/view_case_message.xsl
===================================================================
--- trunk/controller/templates/base/case/view_case_message.xsl  2012-09-20 
10:26:09 UTC (rev 10014)
+++ trunk/controller/templates/base/case/view_case_message.xsl  2012-09-20 
11:48:53 UTC (rev 10015)
@@ -1,6 +1,6 @@
 <!-- $Id: edit_check_list.xsl 8374 2011-12-20 07:45:04Z vator $ -->
 <xsl:template match="data" name="view_check_list" 
xmlns:php="http://php.net/xsl";>
-<xsl:variable name="date_format">d/m-Y</xsl:variable>
+<xsl:variable name="date_format"><xsl:value-of 
select="dateformat"/></xsl:variable>
 
 <div id="main_content" class="medium">
        
@@ -24,40 +24,10 @@
                        </xsl:choose>
                </div>
                <div class="box-2 select-box">
-                       <a>
-                               <xsl:attribute name="href">
-                                       
<xsl:text>index.php?menuaction=controller.uicalendar.view_calendar_for_year</xsl:text>
-                                       <xsl:text>&amp;year=</xsl:text>
-                                       <xsl:value-of select="current_year"/>
-                                       <xsl:text>&amp;location_code=</xsl:text>
-                                       <xsl:choose>
-                                         <xsl:when test="type = 'component'">
-                                                 <xsl:value-of 
select="building_location_code"/>
-                                               </xsl:when>
-                                               <xsl:otherwise>
-                                                 <xsl:value-of 
select="location_array/location_code"/>
-                                               </xsl:otherwise>
-                                       </xsl:choose>
-                               </xsl:attribute>
+                       <a href="{url_calendar_for_year}">
                                Kontrolplan for bygg/eiendom (år)
                        </a>
-                       <a class="last">
-                               <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;month=</xsl:text>
-                                       <xsl:value-of 
select="current_month_nr"/>
-                                       <xsl:text>&amp;location_code=</xsl:text>
-                                       <xsl:choose>
-                                         <xsl:when test="type = 'component'">
-                                                 <xsl:value-of 
select="building_location_code"/>
-                                               </xsl:when>
-                                               <xsl:otherwise>
-                                                 <xsl:value-of 
select="location_array/location_code"/>
-                                               </xsl:otherwise>
-                                       </xsl:choose>
-                               </xsl:attribute>
+                       <a class="last" href="{url_calendar_for_year}">
                                Kontrolplan for bygg/eiendom (måned)
                        </a>
                </div>
@@ -70,15 +40,9 @@
        <h3 class="box_header ext">Melding registrert</h3>
        <div id="caseMessage" class="box ext">
                
-                       <a id="showMessage" target="_blank">
-                               <xsl:attribute name="href">
-                                       
<xsl:text>index.php?menuaction=property.uitts.view</xsl:text>
-                                       <xsl:text>&amp;id=</xsl:text>
-                                       <xsl:value-of 
select="message_ticket_id"/>
-                               </xsl:attribute>
+                       <a id="showMessage" target="_blank" 
href="{url_ticket_view}">
                        Vis melding
                        </a>
-                               
                    <!-- === TITLE === -->
                    <div class="row">                           
                                <label>Tittel på 
melding:</label><span><xsl:value-of select="message_ticket/subject"/></span>
@@ -113,12 +77,7 @@
                                </xsl:choose>
                        </xsl:for-each>
                </ul>
-               <a class="btn">
-                       <xsl:attribute name="href">
-                               
<xsl:text>index.php?menuaction=controller.uicase.create_case_message</xsl:text>
-                               <xsl:text>&amp;check_list_id=</xsl:text>
-                               <xsl:value-of select="check_list/id"/>
-                       </xsl:attribute>
+               <a class="btn" href="{url_ticket_new}">
              Registrer ny melding
                </a>
        </div>

Modified: trunk/controller/templates/base/control/control.xsl
===================================================================
--- trunk/controller/templates/base/control/control.xsl 2012-09-20 10:26:09 UTC 
(rev 10014)
+++ trunk/controller/templates/base/control/control.xsl 2012-09-20 11:48:53 UTC 
(rev 10015)
@@ -6,29 +6,11 @@
 <xsl:variable name="control_procedure_id"><xsl:value-of 
select="control/procedure_id"/></xsl:variable>
 <xsl:variable name="control_repeat_type"><xsl:value-of 
select="control/repeat_type"/></xsl:variable>
 <xsl:variable name="control_role"><xsl:value-of 
select="control/responsibility_id"/></xsl:variable>
-<xsl:variable name="date_format">d/m-Y</xsl:variable>
+<xsl:variable name="date_format"><xsl:value-of 
select="dateformat"/></xsl:variable>
 
-<script>
-               $(function() {
-                       $( "#start_date" ).datepicker({ 
-                               monthNames: 
['Januar','Februar','Mars','April','Mai','Juni','Juli','August','September','Oktober','November','Desember'],
-                               dayNamesMin: ['Sø', 'Ma', 'Ti', 'On', 'To', 
'Fr', 'Lø'],
-                               dateFormat: 'd/m-yy',
-                               changeMonth: true,
-                               changeYear: true 
-                       });
-                       $( "#end_date" ).datepicker({ 
-                               monthNames: 
['Januar','Februar','Mars','April','Mai','Juni','Juli','August','September','Oktober','November','Desember'],
-                               dayNamesMin: ['Sø', 'Ma', 'Ti', 'On', 'To', 
'Fr', 'Lø'],
-                               dateFormat: 'd/m-yy',
-                               changeMonth: true,
-                               changeYear: true
-                       });     
-               });
-       </script>
 <div class="yui-content">
        <div id="control_details">
-               <form id="frm_save_control_details" 
action="index.php?menuaction=controller.uicontrol.save_control_details" 
method="post">
+               <form id="frm_save_control_details" action="{action}" 
method="post">
                        <input type="hidden" name="control_id" 
value="{$control_id}" />
                        <input type="hidden" name="saved_control_area_id" 
value="{$control_area_id}" /> 
        
@@ -257,4 +239,4 @@
                </form>                                 
        </div>
 </div>
-</xsl:template>
\ No newline at end of file
+</xsl:template>

Modified: trunk/controller/templates/base/control/control_details.xsl
===================================================================
--- trunk/controller/templates/base/control/control_details.xsl 2012-09-20 
10:26:09 UTC (rev 10014)
+++ trunk/controller/templates/base/control/control_details.xsl 2012-09-20 
11:48:53 UTC (rev 10015)
@@ -1,7 +1,6 @@
 <!-- $Id: control.xsl 9951 2012-08-31 10:14:12Z vator $ -->
 <xsl:template match="data" name="control_details" 
xmlns:php="http://php.net/xsl";>
-<xsl:variable name="date_format">d/m-Y</xsl:variable>
-
+<xsl:variable name="date_format"><xsl:value-of 
select="dateformat"/></xsl:variable>
        <div id="show-control-details-box">
         <h3>Detaljer for kontroll</h3>
                
@@ -39,4 +38,4 @@
                                  </li>
                                                </ul>
                        </div>
-</xsl:template>
\ No newline at end of file
+</xsl:template>




reply via email to

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