fmsystem-commits
[Top][All Lists]
Advanced

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

[Fmsystem-commits] [8344] property: simplify code


From: Sigurd Nes
Subject: [Fmsystem-commits] [8344] property: simplify code
Date: Fri, 16 Dec 2011 13:05:05 +0000

Revision: 8344
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=8344
Author:   sigurdne
Date:     2011-12-16 13:05:04 +0000 (Fri, 16 Dec 2011)
Log Message:
-----------
property: simplify code

Modified Paths:
--------------
    trunk/property/inc/class.bocommon.inc.php
    trunk/property/inc/class.notify.inc.php
    trunk/property/inc/class.uiworkorder.inc.php
    trunk/property/templates/base/workorder.xsl

Modified: trunk/property/inc/class.bocommon.inc.php
===================================================================
--- trunk/property/inc/class.bocommon.inc.php   2011-12-16 12:57:26 UTC (rev 
8343)
+++ trunk/property/inc/class.bocommon.inc.php   2011-12-16 13:05:04 UTC (rev 
8344)
@@ -781,12 +781,11 @@
                        $event['event_name'] = $data['event_name']; // Human 
readable description
                        if( isset($data['type']) && $data['type']=='view')
                        {
+                               
$GLOBALS['phpgw']->xslttpl->add_file(array('event_view'), $this->xsl_rootdir);
                                if(!isset($data['event']) || !$data['event'])
                                {
-                                       //                                      
return $event;
+                       //              return $event;
                                }
-
-                               
$GLOBALS['phpgw']->xslttpl->add_file(array('event_view'), $this->xsl_rootdir);
                        }
                        else
                        {

Modified: trunk/property/inc/class.notify.inc.php
===================================================================
--- trunk/property/inc/class.notify.inc.php     2011-12-16 12:57:26 UTC (rev 
8343)
+++ trunk/property/inc/class.notify.inc.php     2011-12-16 13:05:04 UTC (rev 
8344)
@@ -72,7 +72,7 @@
                {
                        if(!isset($data['location_id']) || 
!isset($data['location_item_id']) || !$data['location_item_id'])
                        {
-                               throw new Exception("property_notify::read() - 
Missing location info in input");
+                               return array();
                        }       
 
                        $location_id = (int) $data['location_id'];

Modified: trunk/property/inc/class.uiworkorder.inc.php
===================================================================
--- trunk/property/inc/class.uiworkorder.inc.php        2011-12-16 12:57:26 UTC 
(rev 8343)
+++ trunk/property/inc/class.uiworkorder.inc.php        2011-12-16 13:05:04 UTC 
(rev 8344)
@@ -823,80 +823,103 @@
                        $GLOBALS['phpgw']->js->validate_file( 'yahoo', 
'workorder.index', 'property' );
                }
 
-               function edit()
+               function edit($mode = 'edit')
                {
                        $id = phpgw::get_var('id'); // in case of bigint
 
-                       if(!$this->acl_add && !$this->acl_edit)
+                       if($mode == 'edit' && (!$this->acl_add && 
!$this->acl_edit))
                        {
-                               
$GLOBALS['phpgw']->redirect_link('/index.php',array('menuaction'=> 
'property.uiworkorder.view', 'id'=> $id));
+                               
$GLOBALS['phpgw']->redirect_link('/index.php',array('menuaction'        => 
'property.uiworkorder.view', 'id'=> $id));
                        }
-                       $boproject                                      = 
CreateObject('property.boproject');
-                       $bolocation                                     = 
CreateObject('property.bolocation');
-                       $config                                         = 
CreateObject('phpgwapi.config','property');
 
-                       $project_id                             = 
phpgw::get_var('project_id', 'int');
-                       $values                                         = 
phpgw::get_var('values');
-                       $values['ecodimb']                      = 
phpgw::get_var('ecodimb');
-
-                       $values['vendor_id']            = 
phpgw::get_var('vendor_id', 'int', 'POST');
-                       $values['vendor_name']          = 
phpgw::get_var('vendor_name', 'string', 'POST');
-                       $values['b_account_id']         = 
phpgw::get_var('b_account_id', 'int', 'POST');
-                       $values['b_account_name']       = 
phpgw::get_var('b_account_name', 'string', 'POST');
-                       $values['event_id']                     = 
phpgw::get_var('event_id', 'int', 'POST');
-
-                       $location_id    = 
$GLOBALS['phpgw']->locations->get_id('property', $this->acl_location);
-
-                       $config->read();
-
-                       $origin                                         = 
phpgw::get_var('origin');
-                       $origin_id                                      = 
phpgw::get_var('origin_id', 'int');
-
-                       if($origin == '.ticket' && $origin_id && 
!$values['descr'])
+                       if($mode == 'view')
                        {
-                               $boticket= CreateObject('property.botts');
-                               $ticket = $boticket->read_single($origin_id);
-                               $values['descr'] = $ticket['details'];
-                               $values['title'] = $ticket['subject'] ? 
$ticket['subject'] : $ticket['category_name'];
-                               $ticket_notes = 
$boticket->read_additional_notes($origin_id);
-                               $i = count($ticket_notes)-1;
-                               if(isset($ticket_notes[$i]['value_note']) && 
$ticket_notes[$i]['value_note'])
+                               if( !$this->acl_read)
                                {
-                                       $values['descr'] .= ": " . 
$ticket_notes[$i]['value_note'];
+                                       $this->bocommon->no_access();
+                                       return;
                                }
 
-                               $values['location_data'] = 
$ticket['location_data'];
+                               if(!$id)
+                               {
+                                       phpgwapi_cache::message_set('ID is 
required for the function uiworkorder::view()', 'error'); 
+                                       
$GLOBALS['phpgw']->redirect_link('/index.php',array('menuaction'=> 
'property.uiworkorder.index'));
+                               }
                        }
-
-                       if ( preg_match("/(^.entity.|^.catch.)/i", $origin) && 
$origin_id )
+                       else
                        {
-                               $_origin = explode('.', $origin);
-                               $_boentity= CreateObject('property.boentity', 
false, $_origin[1], $_origin[2], $_origin[3]);
-                               $_entity = 
$_boentity->read_single(array('entity_id'=> 
$_origin[2],'cat_id'=>$_origin[3],'id'=>$origin_id, 'view' => true));
-                               $values['location_data'] = 
$_entity['location_data'];
-                               unset($_origin);
-                               unset($_boentity);
-                               unset($_entity);
+                               if(!$this->acl_add && !$this->acl_edit)
+                               {
+                                       $this->bocommon->no_access();
+                                       return;
+                               }
                        }
 
-                       if(isset($values['origin']) && $values['origin'])
-                       {
-                               $origin         = $values['origin'];
-                               $origin_id      = $values['origin_id'];
-                       }
+                       $boproject                                      = 
CreateObject('property.boproject');
+                       $bolocation                                     = 
CreateObject('property.bolocation');
+                       $config                                         = 
CreateObject('phpgwapi.config','property');
+                       $location_id                            = 
$GLOBALS['phpgw']->locations->get_id('property', $this->acl_location);
+                       $config->read();
 
-                       $interlink      = & $this->bo->interlink;
-                       if(isset($origin) && $origin)
+                       if($mode == 'edit')
                        {
-                               unset($values['origin']);
-                               unset($values['origin_id']);
-                               $values['origin'][0]['location']= $origin;
-                               $values['origin'][0]['descr']= 
$interlink->get_location_name($origin);
-                               $values['origin'][0]['data'][]= array
+                               $project_id                             = 
phpgw::get_var('project_id', 'int');
+                               $values                                         
= phpgw::get_var('values');
+                               $values['ecodimb']                      = 
phpgw::get_var('ecodimb');
+                               $values['vendor_id']            = 
phpgw::get_var('vendor_id', 'int', 'POST');
+                               $values['vendor_name']          = 
phpgw::get_var('vendor_name', 'string', 'POST');
+                               $values['b_account_id']         = 
phpgw::get_var('b_account_id', 'int', 'POST');
+                               $values['b_account_name']       = 
phpgw::get_var('b_account_name', 'string', 'POST');
+                               $values['event_id']                     = 
phpgw::get_var('event_id', 'int', 'POST');
+                               $origin                                         
= phpgw::get_var('origin');
+                               $origin_id                                      
= phpgw::get_var('origin_id', 'int');
+
+                               if($origin == '.ticket' && $origin_id && 
!$values['descr'])
+                               {
+                                       $boticket= 
CreateObject('property.botts');
+                                       $ticket = 
$boticket->read_single($origin_id);
+                                       $values['descr'] = $ticket['details'];
+                                       $values['title'] = $ticket['subject'] ? 
$ticket['subject'] : $ticket['category_name'];
+                                       $ticket_notes = 
$boticket->read_additional_notes($origin_id);
+                                       $i = count($ticket_notes)-1;
+                                       
if(isset($ticket_notes[$i]['value_note']) && $ticket_notes[$i]['value_note'])
+                                       {
+                                               $values['descr'] .= ": " . 
$ticket_notes[$i]['value_note'];
+                                       }
+
+                                       $values['location_data'] = 
$ticket['location_data'];
+                               }
+
+                               if ( preg_match("/(^.entity.|^.catch.)/i", 
$origin) && $origin_id )
+                               {
+                                       $_origin = explode('.', $origin);
+                                       $_boentity= 
CreateObject('property.boentity', false, $_origin[1], $_origin[2], $_origin[3]);
+                                       $_entity = 
$_boentity->read_single(array('entity_id'=> 
$_origin[2],'cat_id'=>$_origin[3],'id'=>$origin_id, 'view' => true));
+                                       $values['location_data'] = 
$_entity['location_data'];
+                                       unset($_origin);
+                                       unset($_boentity);
+                                       unset($_entity);
+                               }
+
+                               if(isset($values['origin']) && 
$values['origin'])
+                               {
+                                       $origin         = $values['origin'];
+                                       $origin_id      = $values['origin_id'];
+                               }
+
+                               $interlink      = & $this->bo->interlink;
+                               if(isset($origin) && $origin)
+                               {
+                                       unset($values['origin']);
+                                       unset($values['origin_id']);
+                                       $values['origin'][0]['location']= 
$origin;
+                                       $values['origin'][0]['descr']= 
$interlink->get_location_name($origin);
+                                       $values['origin'][0]['data'][]= array
                                        (
                                                'id'    => $origin_id,
                                                'link'  => 
$interlink->get_relation_link(array('location' => $origin), $origin_id),
                                        );
+                               }
                        }
 
                        if (isset($values['save']))
@@ -1166,7 +1189,8 @@
                                        $project        = 
$boproject->read_single_mini($values['project_id']);
                                }
 
-                               if 
(!$this->bocommon->check_perms($project['grants'],PHPGW_ACL_EDIT))
+                               $acl_required = $mode == 'edit' ? 
PHPGW_ACL_EDIT : PHPGW_ACL_READ;
+                               if 
(!$this->bocommon->check_perms($project['grants'],$acl_required))
                                {
                                        
$receipt['error'][]=array('msg'=>lang('You have no edit right for this 
project'));
                                        
$GLOBALS['phpgw']->session->appsession('receipt','property',$receipt);
@@ -1223,25 +1247,9 @@
                                $record_history = array();
                        }
 
-                       //_debug_array($hour_data);
-                       $table_header_history[] = array
-                               (
-                                       'lang_date'             => lang('Date'),
-                                       'lang_user'             => lang('User'),
-                                       'lang_action'           => 
lang('Action'),
-                                       'lang_new_value'        => lang('New 
value')
-                               );
-
-                       $table_header_workorder_budget[] = array
-                               (
-                                       'lang_workorder_id'     => 
lang('Workorder'),
-
-                                       'lang_sum'              => lang('Sum')
-                               );
-
                        if ($id)
                        {
-                               $function_msg = lang('Edit Workorder');
+                               $function_msg = lang("{$mode} workorder");
                        }
                        else
                        {
@@ -1282,9 +1290,14 @@
                                        }
                                }
 
+                               if($mode == 'view')
+                               {
+                                       $location_template_type='view';
+                               }
+                               
                                
$location_data=$bolocation->initiate_ui_location(array(
                                        'values'                        => 
$_location_data,
-                                       'type_id'                       => 
$max_level,
+                                       'type_id'                       => 
$mode == 'edit' ? $max_level : 
count(explode('-',$_location_data['location_data']['location_code'])),
                                        'no_link'                       => 
false, // disable lookup links for location type less than type_id
                                        'tenant'                        => true,
                                        'block_parent'          => 
$location_level,
@@ -1320,26 +1333,27 @@
 
                        $vendor_data = 
$this->bocommon->initiate_ui_vendorlookup(array(
                                'vendor_id'             => $values['vendor_id'],
-                               'vendor_name'           => 
$values['vendor_name']));
+                               'vendor_name'   => $values['vendor_name'],
+                               'type'                  => $mode));
 
 
                        $b_group_data = 
$this->bocommon->initiate_ui_budget_account_lookup(array(
                                'b_account_id'          => 
$project['b_account_id'],
-                               'role'                          => 'group'
-                       ));
+                               'role'                          => 'group',
+                               'type'                          => $mode));
 
                        $b_account_data = 
$this->bocommon->initiate_ui_budget_account_lookup(array(
                                'b_account_id'          => 
$values['b_account_id'],
                                'b_account_name'        => 
$values['b_account_name'],
                                'disabled'                      => '',
-                               'parent'                        => 
$project['b_account_id']
-                       ));
+                               'parent'                        => 
$project['b_account_id'],
+                               'type'                          => $mode));
 
                        $ecodimb_data = 
$this->bocommon->initiate_ecodimb_lookup(array
                                (
                                        'ecodimb'                       => 
$project['ecodimb'] ? $project['ecodimb'] : $values['ecodimb'],
                                        'ecodimb_descr'         => 
$values['ecodimb_descr'],
-                                       'disabled'                      => 
!!$project['ecodimb']
+                                       'disabled'                      => 
$project['ecodimb'] || $mode == 'view'
                                )
                        );
 
@@ -1349,7 +1363,8 @@
                                        'name'                  => 'event_id',
                                        'event_name'    => lang('schedule'),
                                        'event_id'              => 
$values['event_id'],
-                                       'item_id'               => $id
+                                       'item_id'               => $id,
+                                       'type'                  => $mode
                                );
                        $event_data = 
$this->bocommon->initiate_event_lookup($event_criteria);
 
@@ -1559,7 +1574,10 @@
                        $datavalues[]   = $notify_info['datavalues'];
                        $myColumnDefs[] = $notify_info['column_defs'];
                        $myButtons              = array();
-                       $myButtons[]    = $notify_info['buttons'];
+                       if($mode == 'edit')
+                       {
+                               $myButtons[]    = $notify_info['buttons'];
+                       }
 
                        $link_claim = '';
                        
if(isset($values['charge_tenant'])?$values['charge_tenant']:'')
@@ -1584,6 +1602,7 @@
                        $value_user = isset($values['user_id']) ? 
$GLOBALS['phpgw']->accounts->get($values['user_id'])->__toString() : 
$GLOBALS['phpgw']->accounts->get($this->account)->__toString();
                        $data = array
                                (
+                                       'mode'                                  
                                => $mode,
                                        'value_user'                            
                        => $value_user,
                                        'event_data'                            
                        => $event_data,
                                        'link_claim'                            
                        => $link_claim,
@@ -1611,11 +1630,9 @@
                                        'project_link'                          
                        => 
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=> 
'property.uiproject.edit')),
                                        'b_group_data'                          
                        => $b_group_data,
                                        'b_account_data'                        
                        => $b_account_data,
-                                       'table_header_workorder_budget'         
        => $table_header_workorder_budget,
+
                                        'lang_no_workorders'                    
                => lang('No workorder budget'),
                                        'workorder_link'                        
                        => 
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=> 
'property.uiworkorder.w_edit')),
-                                       'record_history'                        
                        => $record_history,
-                                       'table_header_history'                  
                => $table_header_history,
                                        'lang_history'                          
                        => lang('History'),
                                        'lang_no_history'                       
                        => lang('No history'),
 
@@ -1762,6 +1779,9 @@
                                        'lang_file_statustext'                  
                => lang('Select file to upload'),
                                        'value_billable_hours'                  
                => $values['billable_hours'],
                                        'base_java_url'                         
                        => 
"{menuaction:'property.notify.update_data',location_id:{$location_id},location_item_id:'{$id}'}",
+                                       'edit_action'                           
                        => 
$GLOBALS['phpgw']->link('/index.php',array('menuaction' => 
'property.uiworkorder.edit', 'id' => $id)),
+                                       'lang_edit_statustext'                  
                => lang('Edit this entry workorder'),
+                                       'lang_edit'                             
                                => lang('Edit'),
                                );
 
                        $appname                                                
= lang('Workorder');
@@ -1883,228 +1903,10 @@
                {
                        if(!$this->acl_read)
                        {
-                               
$GLOBALS['phpgw']->redirect_link('/index.php',array('menuaction'=> 
'property.uilocation.stop','perm'=>1, 'acl_location'=> $this->acl_location));
+                               $this->bocommon->no_access();
+                               return;
                        }
-
-                       $boproject                      = 
CreateObject('property.boproject');
-                       $bolocation                     = 
CreateObject('property.bolocation');
-
-                       $receipt = 
$GLOBALS['phpgw']->session->appsession('receipt','property');
-                       
$GLOBALS['phpgw']->session->appsession('receipt','property','');
-
-                       if(!$id = phpgw::get_var('id'))
-                       {
-                               phpgwapi_cache::message_set('ID is required for 
the function uiworkorder::view()', 'error'); 
-                               
$GLOBALS['phpgw']->redirect_link('/index.php',array('menuaction'=> 
'property.uiworkorder.index'));
-                       }
-
-                       $GLOBALS['phpgw']->xslttpl->add_file(array('workorder', 
'hour_data_view', 'files'));
-
-                       $uiwo_hour      = CreateObject('property.uiwo_hour');
-                       $hour_data      = 
$uiwo_hour->common_data($id,$view=true);
-                       $values         = $this->bo->read_single($id);
-                       $project        = 
$boproject->read_single($values['project_id']);
-                       $record_history = $this->bo->read_record_history($id);
-
-                       $table_header_history[] = array
-                               (
-                                       'lang_date'             => lang('Date'),
-                                       'lang_user'             => lang('User'),
-                                       'lang_action'           => 
lang('Action'),
-                                       'lang_new_value'        => lang('New 
value')
-                               );
-
-                       $table_header_workorder_budget[] = array
-                               (
-                                       'lang_workorder_id'     => 
lang('Workorder'),
-                                       'lang_sum'              => lang('Sum')
-                               );
-
-                       $function_msg = lang('View Workorder');
-
-                       $_location_data = array();
-                       $_tenant = 0;
-                       $_level = 0;
-                       if(isset($values['location_data']) && 
$values['location_data'])
-                       {
-                               $_location_data = $values['location_data'];
-                               $_tenant = 
isset($values['location_data']['tenant_id']) ? 
$values['location_data']['tenant_id'] : 0;
-                               $_level = 
count(explode('-',$values['location_data']['location_code']));
-                       }
-                       else
-                       {
-                               if(isset($project['location_data']) && 
$project['location_data'])
-                               {
-                                       $_location_data = 
$project['location_data'];
-                                       $_tenant = 
isset($project['location_data']['tenant_id']) ? 
$project['location_data']['tenant_id'] : 0;
-                                       $_level = 
count(explode('-',$project['location_data']['location_code']));
-                               }
-                       }
-
-                       $location_data=$bolocation->initiate_ui_location(array(
-                               'values'        => $_location_data,
-                               'type_id'       => $_level,
-                               'no_link'       => false, // disable lookup 
links for location type less than type_id
-                               'tenant'        => $_tenant,
-                               'lookup_type'   => 'view'
-                       ));
-
-                       
$ecodimb_data=$this->bocommon->initiate_ecodimb_lookup(array(
-                               'ecodimb'                       => 
$values['ecodimb'],
-                               'ecodimb_descr'         => 
$values['ecodimb_descr'],
-                               'type'                          =>'view'));
-
-
-                       if($project['contact_phone'])
-                       {
-                               for 
($i=0;$i<count($location_data['location']);$i++)
-                               {
-                                       
if($location_data['location'][$i]['input_name'] == 'contact_phone')
-                                       {
-                                               
unset($location_data['location'][$i]['value']);
-                                       }
-                               }
-                       }
-
-                       $link_file_data = array
-                               (
-                                       'menuaction'    => 
'property.uiworkorder.view_file',
-                                       'id'            => $id
-                               );
-
-                       $categories = 
$this->cats->formatted_xslt_list(array('selected' => $project['cat_id']));
-
-                       $config                         = 
CreateObject('phpgwapi.config','property');
-                       $config->read();
-
-
-                       $suppresscoordination                   = 
isset($config->config_data['project_suppresscoordination']) && 
$config->config_data['project_suppresscoordination'] ? 1 : '';
-
-                       $data = array
-                               (
-                                       'suppressmeter'                         
                => isset($config->config_data['project_suppressmeter']) && 
$config->config_data['project_suppressmeter'] ? 1 : '',
-                                       'suppresscoordination'                  
        => $suppresscoordination,
-                                       'tabs'                                  
                        => self::_generate_tabs(array(),array('coordination' => 
$suppresscoordination)),
-                                       'project_link'                          
                => $GLOBALS['phpgw']->link('/index.php',array('menuaction'=> 
'property.uiproject.view')),
-                                       'table_header_workorder_budget'         
=> $table_header_workorder_budget,
-                                       'lang_no_workorders'                    
        => lang('No workorder budget'),
-                                       'workorder_link'                        
                => $GLOBALS['phpgw']->link('/index.php',array('menuaction'=> 
'property.uiworkorder.view')),
-                                       'record_history'                        
                => $record_history,
-                                       'table_header_history'                  
        => $table_header_history,
-                                       'lang_history'                          
                => lang('History'),
-                                       'lang_no_history'                       
                => lang('No history'),
-
-                                       'lang_project_name'                     
                => lang('Project name'),
-                                       'value_project_name'                    
        => $project['name'],
-
-                                       'value_origin'                          
                => $values['origin'],
-
-                                       'lang_vendor'                           
                => lang('Vendor'),
-                                       'value_vendor_id'                       
                => $values['vendor_id'],
-                                       'value_vendor_name'                     
                => $values['vendor_name'],
-                                       'ecodimb_data'                          
                => $ecodimb_data,
-                                       'lang_b_account'                        
                => lang('Budget account'),
-                                       'value_b_account_id'                    
        => $values['b_account_id'],
-                                       'value_b_account_name'                  
        => $values['b_account_name'],
-
-                                       'lang_start_date'                       
                => lang('Project start date'),
-                                       'value_start_date'                      
                => $values['start_date'],
-
-                                       'lang_end_date'                         
                => lang('Project end date'),
-                                       'value_end_date'                        
                => $values['end_date'],
-
-                                       'lang_charge_tenant'                    
        => lang('Charge tenant'),
-                                       'charge_tenant'                         
                => $values['charge_tenant'],
-
-                                       'lang_power_meter'                      
                => lang('Power meter'),
-                                       'value_power_meter'                     
                => $project['power_meter'],
-
-                                       'lang_addition_rs'                      
                => lang('Rig addition'),
-                                       'lang_addition_rs_statustext'           
=> lang('Enter any round sum addition per order'),
-                                       'value_addition_rs'                     
                => $values['addition_rs'],
-
-                                       'lang_addition_percentage'              
        => lang('Percentage addition'),
-                                       'lang_addition_percentage_statustext'   
=> lang('Enter any persentage addition per unit'),
-                                       'value_addition_percentage'             
        => $values['addition_percentage'],
-
-                                       'lang_budget'                           
                => lang('Budget'),
-                                       'value_budget'                          
                => $values['budget'],
-
-                                       'actual_cost'                           
                => $values['actual_cost'],
-                                       'lang_actual_cost'                      
                => lang('Actual cost'),
-
-                                       'location_data'                         
                => $location_data,
-                                       'location_type'                         
                => 'view',
-                                       'done_action'                           
                => $GLOBALS['phpgw']->link('/index.php',array('menuaction'=> 
'property.uiworkorder.index')),
-                                       'lang_year'                             
                        => lang('Year'),
-                                       'lang_category'                         
                => lang('category'),
-                                       'lang_save'                             
                        => lang('save'),
-                                       'lang_done'                             
                        => lang('done'),
-                                       'lang_name'                             
                        => lang('Name'),
-
-                                       'lang_title'                            
                => lang('Title'),
-                                       'value_title'                           
                => $values['title'],
-
-                                       'lang_project_id'                       
                => lang('Project ID'),
-                                       'value_project_id'                      
                => $values['project_id'],
-                                       'value_name'                            
                => $values['name'],
-
-                                       'lang_other_branch'                     
                => lang('Other branch'),
-                                       'value_other_branch'                    
        => $project['other_branch'],
-
-                                       'lang_descr'                            
                => lang('Description'),
-                                       'value_descr'                           
                => $values['descr'],
-                                       'lang_done_statustext'                  
        => lang('Back to the list'),
-
-                                       'cat_list'                              
                        => $categories['cat_list'],
-                                       'lang_workorder_id'                     
                => lang('Workorder ID'),
-                                       'value_workorder_id'                    
        => $values['workorder_id'],
-
-                                       'lang_coordinator'                      
                => lang('Coordinator'),
-                                       'lang_sum'                              
                        => lang('Sum'),
-                                       'user_list'                             
                        => 
$this->bocommon->get_user_list('select',$project['coordinator'],$extra=false,$default=false,$start=-1,$sort=false,$order=false,$query='',$offset=-1),
-
-                                       'status_list'                           
                => $this->bo->select_status_list('select',$values['status']),
-                                       'lang_no_status'                        
                => lang('Select status'),
-                                       'lang_status'                           
                => lang('Status'),
-
-                                       'branch_list'                           
                => $this->bo->select_branch_p_list($values['project_id']),
-                                       'lang_branch'                           
                => lang('branch'),
-
-                                       'key_responsible_list'                  
        => $this->bo->select_branch_list($project['key_responsible']),
-                                       'lang_key_responsible'                  
        => lang('key responsible'),
-
-                                       'key_fetch_list'                        
                => $this->bo->select_key_location_list($values['key_fetch']),
-                                       'lang_key_fetch'                        
                => lang('key fetch location'),
-
-                                       'key_deliver_list'                      
                => $this->bo->select_key_location_list($values['key_deliver']),
-                                       'lang_key_deliver'                      
                => lang('key deliver location'),
-
-                                       'edit_action'                           
                => $GLOBALS['phpgw']->link('/index.php',array('menuaction' => 
'property.uiworkorder.edit', 'id' => $id)),
-                                       'lang_edit_statustext'                  
        => lang('Edit this entry workorder'),
-                                       'lang_edit'                             
                        => lang('Edit'),
-                                       'currency'                              
                        => 
$GLOBALS['phpgw_info']['user']['preferences']['common']['currency'],
-                                       'lang_total_records'                    
        => lang('Total records'),
-                                       'total_hours_records'                   
        => $hour_data['total_hours_records'],
-                                       'table_header_hour'                     
                => $hour_data['table_header'],
-                                       'values_hour'                           
                => $hour_data['content'],
-                                       'table_sum'                             
                        => $hour_data['table_sum'],
-                                       'lang_contact_phone'                    
        => lang('Contact phone'),
-                                       'contact_phone'                         
                => $project['contact_phone'],
-
-                                       'link_view_file'                        
                => $GLOBALS['phpgw']->link('/index.php',$link_file_data),
-                                       'files'                                 
                        => $values['files'],
-                                       'lang_files'                            
                => lang('files'),
-                                       'lang_filename'                         
                => lang('Filename'),
-                                       'lang_view_file_statustext'             
        => lang('click to view file'),
-                                       'lang_remark'                           
                => lang('remark'),
-                                       'value_remark'                          
                => isset($values['remark'])?$values['remark']:''
-                               );
-
-                       $appname                                        = 
lang('Workorder');
-
-                       $GLOBALS['phpgw_info']['flags']['app_header'] = 
lang('property') . ' - ' . $appname . ': ' . $function_msg;
-                       
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('view' => $data));
+                       $this->edit('view');
                }
 
                protected function _generate_tabs($tabs_ = array(), $suppress = 
array())

Modified: trunk/property/templates/base/workorder.xsl
===================================================================
--- trunk/property/templates/base/workorder.xsl 2011-12-16 12:57:26 UTC (rev 
8343)
+++ trunk/property/templates/base/workorder.xsl 2011-12-16 13:05:04 UTC (rev 
8344)
@@ -11,9 +11,6 @@
                        <xsl:when test="view">
                                <xsl:apply-templates select="view"/>
                        </xsl:when>
-                       <xsl:otherwise>
-                               <xsl:apply-templates select="list_workorder"/>
-                       </xsl:otherwise>
                </xsl:choose>
        </xsl:template>
 
@@ -28,10 +25,8 @@
                                        <xsl:variable 
name="lang_add"><xsl:value-of select="lang_add"/></xsl:variable>
                                        <form method="post" 
action="{$add_action}">
                                                <input type="submit" 
class="forms" name="add" value="{$lang_add}" 
onMouseout="window.status='';return true;">
-                                                       <xsl:attribute 
name="onMouseover">
-                                                               
<xsl:text>window.status='</xsl:text>
+                                                       <xsl:attribute 
name="title">
                                                                <xsl:value-of 
select="lang_add_statustext"/>
-                                                               <xsl:text>'; 
return true;</xsl:text>
                                                        </xsl:attribute>
                                                </input>
                                        </form>
@@ -40,10 +35,8 @@
                                        <xsl:variable 
name="lang_search"><xsl:value-of select="lang_search"/></xsl:variable>
                                        <form method="post" 
action="{$search_action}">
                                                <input type="submit" 
class="forms" name="search" value="{$lang_search}" 
onMouseout="window.status='';return true;">
-                                                       <xsl:attribute 
name="onMouseover">
-                                                               
<xsl:text>window.status='</xsl:text>
+                                                       <xsl:attribute 
name="title">
                                                                <xsl:value-of 
select="lang_search_statustext"/>
-                                                               <xsl:text>'; 
return true;</xsl:text>
                                                        </xsl:attribute>
                                                </input>
                                        </form>
@@ -64,244 +57,6 @@
                </table>
        </xsl:template>
 
-       <xsl:template match="list_workorder">
-               <xsl:apply-templates select="menu"/>
-               <table width="100%"  cellpadding="2" cellspacing="2" 
align="center">
-                       <tr>
-                               <xsl:choose>
-                                       <xsl:when test="group_filters != ''">
-                                               <xsl:variable 
name="select_action"><xsl:value-of select="select_action"/></xsl:variable>
-                                               <form method="post" 
name="search" action="{$select_action}">
-                                                       <td>
-                                                               
<xsl:call-template name="categories"/>
-                                                       </td>
-                                                       <td align="left">
-                                                               
<xsl:call-template name="status_select"/>
-                                                       </td>
-                                                       <td align="left">
-                                                               
<xsl:call-template name="wo_hour_cat_select"/>
-                                                       </td>
-                                                       <td align="center">
-                                                               
<xsl:call-template name="user_id_select"/>
-                                                       </td>
-                                                       <td align="right">
-                                                               
<xsl:call-template name="search_field_workorder_grouped"/>
-                                                       </td>
-
-                                               </form>
-                                       </xsl:when>
-                                       <xsl:otherwise>
-                                               <td>
-                                                       <xsl:call-template 
name="categories"/>
-                                               </td>
-                                               <td align="left">
-                                                       <xsl:call-template 
name="status_filter"/>
-                                               </td>
-                                               <td align="left">
-                                                       <xsl:call-template 
name="wo_hour_cat_filter"/>
-                                               </td>
-                                               <td align="center">
-                                                       <xsl:call-template 
name="user_id_filter"/>
-                                               </td>
-                                               <td align="right">
-                                                       <xsl:call-template 
name="search_field_workorder"/>
-                                               </td>
-                                       </xsl:otherwise>
-                               </xsl:choose>
-                               <td class="small_text" valign="top" 
align="left">
-                                       <xsl:variable 
name="link_download"><xsl:value-of select="link_download"/></xsl:variable>
-                                       <xsl:variable 
name="lang_download_help"><xsl:value-of 
select="lang_download_help"/></xsl:variable>
-                                       <xsl:variable 
name="lang_download"><xsl:value-of select="lang_download"/></xsl:variable>
-                                       <a href="javascript:var 
w=window.open('{$link_download}','','left=50,top=100')"
-                                               
onMouseOver="overlib('{$lang_download_help}', CAPTION, '{$lang_download}')"
-                                               onMouseOut="nd()">
-                                               <xsl:value-of 
select="lang_download"/></a>
-                               </td>
-                       </tr>
-                       <tr>
-                               <td colspan="16" width="100%">
-                                       <xsl:call-template name="nextmatchs"/>
-                               </td>
-                       </tr>
-               </table>
-               <table width="100%" cellpadding="2" cellspacing="2" 
align="center">
-                       <xsl:call-template name="table_header"/>
-                       <xsl:choose>
-                               <xsl:when test="values">
-                                       <xsl:call-template name="values"/>
-                               </xsl:when>
-                       </xsl:choose>
-                       <xsl:choose>
-                               <xsl:when test="table_add !=''">
-                                       <xsl:apply-templates 
select="table_add"/>
-                               </xsl:when>
-                       </xsl:choose>
-               </table>
-       </xsl:template>
-
-       <xsl:template match="table_add">
-               <tr>
-                       <td height="50">
-                               <xsl:variable name="add_action"><xsl:value-of 
select="add_action"/></xsl:variable>
-                               <xsl:variable name="lang_add"><xsl:value-of 
select="lang_add"/></xsl:variable>
-                               <form method="post" action="{$add_action}">
-                                       <input type="submit" name="add" 
value="{$lang_add}" onMouseout="window.status='';return true;">
-                                               <xsl:attribute 
name="onMouseover">
-                                                       
<xsl:text>window.status='</xsl:text>
-                                                       <xsl:value-of 
select="lang_add_statustext"/>
-                                                       <xsl:text>'; return 
true;</xsl:text>
-                                               </xsl:attribute>
-                                       </input>
-                               </form>
-                       </td>
-               </tr>
-       </xsl:template>
-
-
-       <xsl:template name="search_field_workorder">
-               <xsl:variable name="select_url"><xsl:value-of 
select="select_action"/></xsl:variable>
-               <xsl:variable name="query"><xsl:value-of 
select="query"/></xsl:variable>
-               <xsl:variable name="search_vendor"><xsl:value-of 
select="search_vendor"/></xsl:variable>
-               <xsl:variable name="lang_search"><xsl:value-of 
select="lang_search"/></xsl:variable>
-               <table>
-                       <tr>
-                               <td class="small_text" valign="top" 
align="left">
-                                       <xsl:variable 
name="link_date_search"><xsl:value-of select="link_date_search"/></xsl:variable>
-                                       <xsl:variable 
name="lang_date_search_help"><xsl:value-of 
select="lang_date_search_help"/></xsl:variable>
-                                       <xsl:variable 
name="lang_date_search"><xsl:value-of select="lang_date_search"/></xsl:variable>
-                                       <a href="javascript:var 
w=window.open('{$link_date_search}','','left=50,top=100,width=300,height=300')"
-                                               
onMouseOver="overlib('{$lang_date_search_help}', CAPTION, 
'{$lang_date_search}')"
-                                               onMouseOut="nd()">
-                                               <xsl:value-of 
select="lang_date_search"/></a>
-
-                                       <table>
-                                               <xsl:choose>
-                                                       <xsl:when 
test="start_date!=''">
-                                                               <tr>
-                                                                       <td 
class="small_text" align="left">
-                                                                               
<xsl:value-of select="start_date"/>
-                                                                       </td>
-                                                               </tr>
-                                                               <tr>
-                                                                       <td 
class="small_text" align="left">
-                                                                               
<xsl:value-of select="end_date"/>
-                                                                       </td>
-                                                               </tr>
-                                                       </xsl:when>
-                                                       <xsl:otherwise>
-                                                               <tr>
-                                                                       <td 
class="small_text" align="left">
-                                                                               
<xsl:value-of select="lang_none"/>
-                                                                       </td>
-                                                               </tr>
-                                                       </xsl:otherwise>
-                                               </xsl:choose>
-                                       </table>
-                               </td>
-
-                               <td valign="top" align="right">
-                                       <form method="post" name="search" 
action="{$select_url}">
-                                               <input type="hidden" 
name="start_date" value="{start_date}"></input>
-                                               <input type="hidden" 
name="end_date" value="{end_date}"></input>
-                                               <input type="text" 
name="search_vendor" value="{$search_vendor}" 
onMouseout="window.status='';return true;">
-                                                       <xsl:attribute 
name="onMouseover">
-                                                               
<xsl:text>window.status='</xsl:text>
-                                                               <xsl:value-of 
select="lang_searchvendor_statustext"/>
-                                                               <xsl:text>'; 
return true;</xsl:text>
-                                                       </xsl:attribute>
-                                               </input>
-                                               <input type="text" name="query" 
value="{$query}" onMouseout="window.status='';return true;">
-                                                       <xsl:attribute 
name="onMouseover">
-                                                               
<xsl:text>window.status='</xsl:text>
-                                                               <xsl:value-of 
select="lang_searchfield_statustext"/>
-                                                               <xsl:text>'; 
return true;</xsl:text>
-                                                       </xsl:attribute>
-                                               </input>
-                                               <xsl:text> </xsl:text>
-                                               <input type="submit" 
name="submit" value="{$lang_search}" onMouseout="window.status='';return true;">
-                                                       <xsl:attribute 
name="onMouseover">
-                                                               
<xsl:text>window.status='</xsl:text>
-                                                               <xsl:value-of 
select="lang_searchbutton_statustext"/>
-                                                               <xsl:text>'; 
return true;</xsl:text>
-                                                       </xsl:attribute>
-                                               </input>
-                                       </form>
-                               </td>
-                       </tr>
-               </table>
-       </xsl:template>
-
-       <xsl:template name="search_field_workorder_grouped">
-               <xsl:variable name="query"><xsl:value-of 
select="query"/></xsl:variable>
-               <xsl:variable name="search_vendor"><xsl:value-of 
select="search_vendor"/></xsl:variable>
-               <xsl:variable name="lang_search"><xsl:value-of 
select="lang_search"/></xsl:variable>
-               <table>
-                       <tr>
-                               <td class="small_text" valign="top" 
align="left">
-                                       <xsl:variable 
name="link_date_search"><xsl:value-of select="link_date_search"/></xsl:variable>
-                                       <xsl:variable 
name="lang_date_search_help"><xsl:value-of 
select="lang_date_search_help"/></xsl:variable>
-                                       <xsl:variable 
name="lang_date_search"><xsl:value-of select="lang_date_search"/></xsl:variable>
-                                       <a href="javascript:var 
w=window.open('{$link_date_search}','','left=50,top=100,width=300,height=300')"
-                                               
onMouseOver="overlib('{$lang_date_search_help}', CAPTION, 
'{$lang_date_search}')"
-                                               onMouseOut="nd()">
-                                               <xsl:value-of 
select="lang_date_search"/></a>
-
-                                       <table>
-                                               <xsl:choose>
-                                                       <xsl:when 
test="start_date!=''">
-                                                               <tr>
-                                                                       <td 
class="small_text" align="left">
-                                                                               
<xsl:value-of select="start_date"/>
-                                                                       </td>
-                                                               </tr>
-                                                               <tr>
-                                                                       <td 
class="small_text" align="left">
-                                                                               
<xsl:value-of select="end_date"/>
-                                                                       </td>
-                                                               </tr>
-                                                       </xsl:when>
-                                                       <xsl:otherwise>
-                                                               <tr>
-                                                                       <td 
class="small_text" align="left">
-                                                                               
<xsl:value-of select="lang_none"/>
-                                                                       </td>
-                                                               </tr>
-                                                       </xsl:otherwise>
-                                               </xsl:choose>
-                                       </table>
-                               </td>
-
-                               <td valign="top" align="right">
-                                       <input type="hidden" name="start_date" 
value="{start_date}"></input>
-                                       <input type="hidden" name="end_date" 
value="{end_date}"></input>
-                                       <input type="text" name="search_vendor" 
value="{$search_vendor}" onMouseout="window.status='';return true;">
-                                               <xsl:attribute 
name="onMouseover">
-                                                       
<xsl:text>window.status='</xsl:text>
-                                                       <xsl:value-of 
select="lang_searchvendor_statustext"/>
-                                                       <xsl:text>'; return 
true;</xsl:text>
-                                               </xsl:attribute>
-                                       </input>
-                                       <input type="text" name="query" 
value="{$query}" onMouseout="window.status='';return true;">
-                                               <xsl:attribute 
name="onMouseover">
-                                                       
<xsl:text>window.status='</xsl:text>
-                                                       <xsl:value-of 
select="lang_searchfield_statustext"/>
-                                                       <xsl:text>'; return 
true;</xsl:text>
-                                               </xsl:attribute>
-                                       </input>
-                                       <xsl:text> </xsl:text>
-                                       <input type="submit" name="submit" 
value="{$lang_search}" onMouseout="window.status='';return true;">
-                                               <xsl:attribute 
name="onMouseover">
-                                                       
<xsl:text>window.status='</xsl:text>
-                                                       <xsl:value-of 
select="lang_searchbutton_statustext"/>
-                                                       <xsl:text>'; return 
true;</xsl:text>
-                                               </xsl:attribute>
-                                       </input>
-                               </td>
-                       </tr>
-               </table>
-       </xsl:template>
-
-
 <!-- add / edit -->
 
        <xsl:template match="edit" xmlns:php="http://php.net/xsl";>
@@ -327,7 +82,7 @@
                                </xsl:when>
                        </xsl:choose>
                        <xsl:choose>
-                               <xsl:when test="value_workorder_id!=''">
+                               <xsl:when test="value_workorder_id!='' and 
location_template_type='form'">
                                        <td>
                                                <table>
                                                        <tr>
@@ -380,11 +135,9 @@
                                                                                
        <xsl:value-of select="lang_project_id"/>
                                                                                
</td>
                                                                                
<td>
-                                                                               
        <input type="text" name="values[project_id]" value="" 
onMouseout="window.status='';return true;">
-                                                                               
                <xsl:attribute name="onMouseover">
-                                                                               
                        <xsl:text>window.status='</xsl:text>
+                                                                               
        <input type="text" name="values[project_id]" value="">
+                                                                               
                <xsl:attribute name="title">
                                                                                
                        <xsl:value-of select="lang_title_statustext"/>
-                                                                               
                        <xsl:text>'; return true;</xsl:text>
                                                                                
                </xsl:attribute>
                                                                                
        </input>
                                                                                
</td>
@@ -503,20 +256,22 @@
                                                                                
        <xsl:value-of select="value_workorder_id"/>
                                                                                
</td>
                                                                        </tr>
-                                                                       <tr>
-                                                                               
<td>
-                                                                               
        <xsl:value-of select="lang_copy_workorder"/>
-                                                                               
</td>
-                                                                               
<td>
-                                                                               
        <input type="checkbox" name="values[copy_workorder]" value="True"  
onMouseout="window.status='';return true;">
-                                                                               
                <xsl:attribute name="onMouseover">
-                                                                               
                        <xsl:text>window.status='</xsl:text>
-                                                                               
                        <xsl:value-of select="lang_copy_workorder_statustext"/>
-                                                                               
                        <xsl:text>'; return true;</xsl:text>
-                                                                               
                </xsl:attribute>
-                                                                               
        </input>
-                                                                               
</td>
-                                                                       </tr>
+                                                                       
<xsl:choose>
+                                                                               
<xsl:when test="location_template_type='form'">
+                                                                               
        <tr>
+                                                                               
                <td>
+                                                                               
                        <xsl:value-of select="lang_copy_workorder"/>
+                                                                               
                </td>
+                                                                               
                <td>
+                                                                               
                        <input type="checkbox" name="values[copy_workorder]" 
value="True">
+                                                                               
                                <xsl:attribute name="title">
+                                                                               
                                        <xsl:value-of 
select="lang_copy_workorder_statustext"/>
+                                                                               
                                </xsl:attribute>
+                                                                               
                        </input>
+                                                                               
                </td>
+                                                                               
        </tr>
+                                                                               
</xsl:when>
+                                                                       
</xsl:choose>
                                                                </xsl:when>
                                                        </xsl:choose>
                                                        <tr>
@@ -555,8 +310,9 @@
                                                                        
<xsl:call-template name="status_select"/>
                                                                </td>
                                                        </tr>
+
                                                        <xsl:choose>
-                                                               <xsl:when 
test="value_workorder_id!=''">
+                                                               <xsl:when 
test="value_workorder_id!='' and location_template_type='form'">
                                                                        <tr>
                                                                                
<td>
                                                                                
        <xsl:value-of select="lang_confirm_status"/>
@@ -572,7 +328,7 @@
                                                                </xsl:when>
                                                        </xsl:choose>
                                                        <xsl:choose>
-                                                               <xsl:when 
test="need_approval='1'">
+                                                               <xsl:when 
test="need_approval='1' and location_template_type='form'">
                                                                        <tr>
                                                                                
<td valign="top">
                                                                                
        <xsl:value-of select="lang_ask_approval"/>
@@ -651,10 +407,18 @@
                                                                </td>
                                                        </tr>
 
-                                                       <xsl:call-template 
name="event_form"/>
-                                                       <xsl:call-template 
name="vendor_form"/>
-                                                       <xsl:call-template 
name="ecodimb_form"/>
+                                                       <xsl:choose>
+                                                               <xsl:when 
test="location_template_type='form'">
+                                                                       
<xsl:call-template name="event_form"/>
+                                                                       
<xsl:call-template name="vendor_form"/>
+                                                               </xsl:when>
+                                                               <xsl:otherwise>
+                                                                       
<xsl:call-template name="event_view"/>
+                                                                       
<xsl:call-template name="vendor_view"/>
+                                                               </xsl:otherwise>
+                                                       </xsl:choose>
 
+                                                       <xsl:call-template 
name="ecodimb_form"/>
                                                        <tr>
                                                                <td 
valign="top">
                                                                        
<xsl:value-of select="b_group_data/lang_b_account"/>
@@ -673,26 +437,16 @@
                                                                </td>
                                                        </tr>
 
-                                                       <xsl:call-template 
name="b_account_form"/>
-
-<!--
+                                                       <xsl:choose>
+                                                               <xsl:when 
test="location_template_type='form'">
+                                                                       
<xsl:call-template name="b_account_form"/>
+                                                               </xsl:when>
+                                                               <xsl:otherwise>
+                                                                       
<xsl:call-template name="b_account_view"/>
+                                                               </xsl:otherwise>
+                                                       </xsl:choose>
                        <tr>
                                <td>
-                                       <xsl:value-of select="lang_category"/>
-                               </td>
-                               <xsl:for-each select="cat_list" >
-                                       <xsl:choose>
-                                               <xsl:when 
test="selected='selected'">
-                                                       <td>
-                                                               <xsl:value-of 
select="name"/>
-                                                       </td>
-                                               </xsl:when>
-                                       </xsl:choose>
-                               </xsl:for-each>
-                       </tr>
--->
-                       <tr>
-                               <td>
                                        <xsl:value-of select="lang_cat_sub"/>
                                </td>
                                <td>
@@ -827,20 +581,30 @@
 
        <div id="coordination">
                <table cellpadding="2" cellspacing="2" width="80%" 
align="center">
-                       <xsl:variable 
name="lang_contact_statustext"><xsl:value-of select="php:function('lang', 
'click this link to select')" /></xsl:variable>
+                       <xsl:choose>
+                               <xsl:when test="location_template_type='form'">
+                                       <xsl:variable 
name="lang_contact_statustext"><xsl:value-of select="php:function('lang', 
'click this link to select')" /></xsl:variable>
+                                       <tr>
+                                               <td valign="top">
+                                                       <a 
href="javascript:notify_contact_lookup()" title="{$lang_contact_statustext}">
+                                                               <xsl:value-of 
select="php:function('lang', 'contact')" />
+                                                       </a>
+                                               </td>
+                                               <td>
+                                                       <table>
+                                                               <tr>
+                                                                       <td>
+                                                                               
<input type="hidden" id = "notify_contact" name="notify_contact" value="" 
title="{$lang_contact_statustext}">
+                                                                               
</input>
+                                                                               
<input size="30" type="text" name="notify_contact_name" value="" 
onClick="notify_contact_lookup();" readonly = 'readonly' 
title="{$lang_contact_statustext}"/>
+                                                                       </td>
+                                                               </tr>
+                                                       </table>
+                                               </td>
+                                       </tr>
+                               </xsl:when>
+                       </xsl:choose>
                        <tr>
-                               <td valign="top">
-                                       <a 
href="javascript:notify_contact_lookup()" title="{$lang_contact_statustext}">
-                                               <xsl:value-of 
select="php:function('lang', 'contact')" />
-                                       </a>
-                               </td>
-                               <td><table><tr><td>
-                                       <input type="hidden" id = 
"notify_contact" name="notify_contact" value="" 
title="{$lang_contact_statustext}">
-                                       </input>
-                                       <input size="30" type="text" 
name="notify_contact_name" value="" onClick="notify_contact_lookup();" readonly 
= 'readonly' title="{$lang_contact_statustext}"/>
-                               </td></tr></table></td>
-                       </tr>
-                       <tr>
                                <td valign = "top" class="th_text">
                                        <xsl:value-of 
select="php:function('lang', 'notify')" />
                                </td>
@@ -944,18 +708,23 @@
 
 </div>
 </div>
-<table>
-       <tr height="50">
-               <td>
-                       <xsl:variable name="lang_save"><xsl:value-of 
select="lang_save"/></xsl:variable>
-                       <input type="submit" name="values[save]" 
value="{$lang_save}" onMouseout="window.status='';return true;">
-                               <xsl:attribute name="title">
-                                       <xsl:value-of 
select="lang_save_statustext"/>
-                               </xsl:attribute>
-                       </input>
-               </td>
-       </tr>
-</table>
+       <xsl:choose>
+               <xsl:when test="location_template_type='form'">
+               <table>
+                       <tr height="50">
+                               <td>
+                                       <xsl:variable 
name="lang_save"><xsl:value-of select="lang_save"/></xsl:variable>
+                                       <input type="submit" 
name="values[save]" value="{$lang_save}" onMouseout="window.status='';return 
true;">
+                                               <xsl:attribute name="title">
+                                                       <xsl:value-of 
select="lang_save_statustext"/>
+                                               </xsl:attribute>
+                                       </input>
+                               </td>
+                       </tr>
+               </table>
+               </xsl:when>
+       </xsl:choose>
+
                </form>
                <table>
                        <tr>
@@ -970,16 +739,35 @@
                                                </input>
                                        </form>
                                </td>
+                               <xsl:choose>
+                                       <xsl:when 
test="location_template_type='view'">
+                                               <td>
+                                                       <xsl:variable 
name="edit_action"><xsl:value-of select="edit_action"/></xsl:variable>
+                                                       <xsl:variable 
name="lang_edit"><xsl:value-of select="lang_edit"/></xsl:variable>
+                                                       <form method="post" 
action="{$edit_action}">
+                                                               <input 
type="submit" class="forms" name="edit" value="{$lang_edit}" 
onMouseout="window.status='';return true;">
+                                                                       
<xsl:attribute name="title">
+                                                                               
<xsl:value-of select="lang_edit_statustext"/>
+                                                                       
</xsl:attribute>
+                                                               </input>
+                                                       </form>
+                                               </td>
+                                       </xsl:when>
+                               </xsl:choose>
                        </tr>
                </table>
                <hr noshade="noshade" width="100%" align="center" size="1"/>
 
-               <xsl:variable name="calculate_action"><xsl:value-of 
select="calculate_action"/>&amp;workorder_id=<xsl:value-of 
select="value_workorder_id"/></xsl:variable>
-               <form method="post" name="calculate_workorder_form" 
action="{$calculate_action}">
-               </form>
-               <xsl:variable name="send_action"><xsl:value-of 
select="send_action"/>&amp;workorder_id=<xsl:value-of 
select="value_workorder_id"/></xsl:variable>
-               <form method="post" name="send_workorder_form" 
action="{$send_action}">
-               </form>
+               <xsl:choose>
+                       <xsl:when test="location_template_type='form'">
+                               <xsl:variable 
name="calculate_action"><xsl:value-of 
select="calculate_action"/>&amp;workorder_id=<xsl:value-of 
select="value_workorder_id"/></xsl:variable>
+                               <form method="post" 
name="calculate_workorder_form" action="{$calculate_action}">
+                               </form>
+                               <xsl:variable name="send_action"><xsl:value-of 
select="send_action"/>&amp;workorder_id=<xsl:value-of 
select="value_workorder_id"/></xsl:variable>
+                               <form method="post" name="send_workorder_form" 
action="{$send_action}">
+                               </form>
+                       </xsl:when>
+               </xsl:choose>
        </xsl:template>
 
 
@@ -1008,465 +796,3 @@
                </xsl:choose>
        </xsl:template>
 
-
-       <xsl:template match="table_header_history">
-               <tr class="th">
-                       <td class="th_text" width="20%" align="left">
-                               <xsl:value-of select="lang_date"/>
-                       </td>
-                       <td class="th_text" width="10%" align="left">
-                               <xsl:value-of select="lang_user"/>
-                       </td>
-                       <td class="th_text" width="30%" align="left">
-                               <xsl:value-of select="lang_action"/>
-                       </td>
-                       <td class="th_text" width="10%" align="left">
-                               <xsl:value-of select="lang_new_value"/>
-                       </td>
-               </tr>
-       </xsl:template>
-
-       <xsl:template match="record_history">
-               <tr>
-                       <xsl:attribute name="class">
-                               <xsl:choose>
-                                       <xsl:when test="@class">
-                                               <xsl:value-of select="@class"/>
-                                       </xsl:when>
-                                       <xsl:when test="position() mod 2 = 0">
-                                               <xsl:text>row_off</xsl:text>
-                                       </xsl:when>
-                                       <xsl:otherwise>
-                                               <xsl:text>row_on</xsl:text>
-                                       </xsl:otherwise>
-                               </xsl:choose>
-                       </xsl:attribute>
-                       <td align="left">
-                               <xsl:value-of select="value_date"/>
-                       </td>
-                       <td align="left">
-                               <xsl:value-of select="value_user"/>
-                       </td>
-                       <td align="left">
-                               <xsl:value-of select="value_action"/>
-                       </td>
-                       <td align="left">
-                               <xsl:value-of select="value_new_value"/>
-                       </td>
-               </tr>
-       </xsl:template>
-
-       <xsl:template match="table_header_workorder_budget">
-               <tr class="th">
-                       <td class="th_text" width="4%" align="right">
-                               <xsl:value-of select="lang_workorder_id"/>
-                       </td>
-                       <td class="th_text" width="10%" align="right">
-                               <xsl:value-of select="lang_sum"/>
-                       </td>
-               </tr>
-       </xsl:template>
-
-
-<!-- view -->
-
-       <xsl:template match="view">
-               <div class="yui-navset" id="workorder_tabview">
-                       <xsl:value-of disable-output-escaping="yes" 
select="tabs" />
-                       <div class="yui-content">
-                               <div id="general">
-                                       <table cellpadding="2" cellspacing="2" 
width="80%" align="center">
-                                               <tr>
-                                                       <td width="25%" >
-                                                               <xsl:value-of 
select="lang_project_id"/>
-                                                       </td>
-                                                       <td width="75%">
-                                                               <xsl:variable 
name="project_link"><xsl:value-of select="project_link"/>&amp;id=<xsl:value-of 
select="value_project_id"/></xsl:variable>
-                                                               <a 
href="{$project_link}"><xsl:value-of select="value_project_id"/></a>
-                                                               <input 
type="hidden" name="values[project_id]" value="{value_project_id}"></input>
-                                                       </td>
-                                               </tr>
-                                               <tr>
-                                                       <td valign="top">
-                                                               <xsl:value-of 
select="lang_project_name"/>
-                                                       </td>
-                                                       <td>
-                                                               <xsl:value-of 
select="value_project_name"/>
-                                                       </td>
-                                               </tr>
-                                               <tr>
-                                                       <td>
-                                                               <xsl:value-of 
select="lang_category"/>
-                                                       </td>
-                                                       <xsl:for-each 
select="cat_list" >
-                                                               <xsl:choose>
-                                                                       
<xsl:when test="selected='selected'">
-                                                                               
<td>
-                                                                               
        <xsl:value-of select="name"/>
-                                                                               
</td>
-                                                                       
</xsl:when>
-                                                               </xsl:choose>
-                                                       </xsl:for-each>
-                                               </tr>
-                                               <xsl:call-template 
name="location_view"/>
-
-                                               <xsl:choose>
-                                                       <xsl:when 
test="contact_phone !=''">
-                                                               <tr>
-                                                                       <td 
class="th_text"  align="left">
-                                                                               
<xsl:value-of select="lang_contact_phone"/>
-                                                                       </td>
-                                                                       <td  
align="left">
-                                                                               
<xsl:value-of select="contact_phone"/>
-                                                                       </td>
-                                                               </tr>
-                                                       </xsl:when>
-                                               </xsl:choose>
-                                               <xsl:choose>
-                                                       <xsl:when 
test="suppressmeter =''">
-                                                               <tr>
-                                                                       <td 
valign="top">
-                                                                               
<xsl:value-of select="lang_power_meter"/>
-                                                                       </td>
-                                                                       <td>
-                                                                               
<xsl:value-of select="value_power_meter"/>
-                                                                       </td>
-                                                               </tr>
-                                                       </xsl:when>
-                                               </xsl:choose>
-                                               <tr>
-                                                       <td>
-                                                               <xsl:value-of 
select="lang_coordinator"/>
-                                                       </td>
-                                                       <xsl:for-each 
select="user_list" >
-                                                               <xsl:choose>
-                                                                       
<xsl:when test="selected">
-                                                                               
<td>
-                                                                               
        <xsl:value-of select="name"/>
-                                                                               
</td>
-                                                                       
</xsl:when>
-                                                               </xsl:choose>
-                                                       </xsl:for-each>
-                                               </tr>
-                                               <tr>
-                                                       <td valign="top">
-                                                               <xsl:value-of 
select="lang_branch"/>
-                                                       </td>
-                                                       <td>
-                                                               <xsl:for-each 
select="branch_list[selected='selected']" >
-                                                                       
<xsl:value-of select="name"/>
-                                                                       <xsl:if 
test="position() != last()">, </xsl:if>
-                                                               </xsl:for-each>
-                                                       </td>
-                                               </tr>
-                                               <tr>
-                                                       <td valign="top">
-                                                               <xsl:value-of 
select="lang_other_branch"/>
-                                                       </td>
-                                                       <td>
-                                                               <xsl:value-of 
select="value_other_branch"/>
-                                                       </td>
-                                               </tr>
-                                               <xsl:for-each 
select="value_origin" >
-                                                       <tr>
-                                                               <td valign 
="top">
-                                                                       
<xsl:value-of select="descr"/>
-                                                               </td>
-                                                               <td>
-                                                                       <table>
-                                                                               
<xsl:for-each select="data">
-                                                                               
        <tr>
-                                                                               
                <td class="th_text"  align="left" >
-                                                                               
                        <a href="{link}"  title="{statustext}"><xsl:value-of 
select="id"/></a>
-                                                                               
                        <xsl:text> </xsl:text>
-                                                                               
                </td>
-                                                                               
        </tr>
-                                                                               
</xsl:for-each>
-                                                                       </table>
-                                                               </td>
-                                                       </tr>
-                                               </xsl:for-each>
-
-                                               <tr>
-                                                       <td>
-                                                               <xsl:value-of 
select="lang_charge_tenant"/>
-                                                       </td>
-                                                       <td>
-                                                               <xsl:choose>
-                                                                       
<xsl:when test="charge_tenant='1'">
-                                                                               
X
-                                                                       
</xsl:when>
-                                                               </xsl:choose>
-                                                       </td>
-                                               </tr>
-                                               <tr>
-                                                       <td>
-                                                               <xsl:value-of 
select="lang_workorder_id"/>
-                                                       </td>
-                                                       <td>
-                                                               <xsl:value-of 
select="value_workorder_id"/>
-                                                       </td>
-                                               </tr>
-                                               <tr>
-                                                       <td valign="top">
-                                                               <xsl:value-of 
select="lang_title"/>
-                                                       </td>
-                                                       <td>
-                                                               <xsl:value-of 
select="value_title"/>
-                                                       </td>
-                                               </tr>
-                                               <tr>
-                                                       <td valign="top">
-                                                               <xsl:value-of 
select="lang_descr"/>
-                                                       </td>
-                                                       <td>
-                                                               <textarea 
cols="60" rows="6" name="values[remark]" onMouseout="window.status='';return 
true;">
-                                                                       
<xsl:attribute name="readonly">
-                                                                               
<xsl:text>readonly</xsl:text>
-                                                                       
</xsl:attribute>
-                                                                       
<xsl:value-of select="value_descr"/>
-                                                               </textarea>
-
-                                                       </td>
-                                               </tr>
-                                               <tr>
-                                                       <td valign="top">
-                                                               <xsl:value-of 
select="lang_remark"/>
-                                                       </td>
-                                                       <td>
-                                                               <textarea 
cols="60" rows="6" name="values[remark]" onMouseout="window.status='';return 
true;">
-                                                                       
<xsl:attribute name="readonly">
-                                                                               
<xsl:text>readonly</xsl:text>
-                                                                       
</xsl:attribute>
-                                                                       
<xsl:value-of select="value_remark"/>
-                                                               </textarea>
-                                                       </td>
-                                               </tr>
-                                       </table>
-                               </div>
-
-                               <div id="budget">
-                                       <table cellpadding="2" cellspacing="2" 
width="80%" align="center">
-                                               <tr>
-                                                       <td valign="top">
-                                                               <xsl:value-of 
select="lang_vendor"/>
-                                                       </td>
-                                                       <td>
-                                                               <xsl:value-of 
select="value_vendor_id"/>
-                                                               <xsl:text> - 
</xsl:text>
-                                                               <xsl:value-of 
select="value_vendor_name"/>
-                                                       </td>
-                                               </tr>
-                                               <xsl:choose>
-                                                       <xsl:when 
test="ecodimb_data!=''">
-                                                               
<xsl:call-template name="ecodimb_view"/>
-                                                       </xsl:when>
-                                               </xsl:choose>
-
-                                               <tr>
-                                                       <td valign="top">
-                                                               <xsl:value-of 
select="lang_b_account"/>
-                                                       </td>
-                                                       <td>
-                                                               <xsl:value-of 
select="value_b_account_id"/>
-                                                               <xsl:text> - 
</xsl:text>
-                                                               <xsl:value-of 
select="value_b_account_name"/>
-                                                       </td>
-                                               </tr>
-
-                                               <tr>
-                                                       <td valign="top">
-                                                               <xsl:value-of 
select="lang_budget"/>
-                                                       </td>
-                                                       <td>
-                                                               <xsl:value-of 
select="value_budget"/>
-                                                               <xsl:text> 
</xsl:text> [ <xsl:value-of select="currency"/> ]
-                                                       </td>
-                                               </tr>
-                                               <tr>
-                                                       <td valign="top">
-                                                               <xsl:value-of 
select="lang_addition_rs"/>
-                                                       </td>
-                                                       <td>
-                                                               <xsl:value-of 
select="value_addition_rs"/>
-                                                               <xsl:text> 
</xsl:text> [ <xsl:value-of select="currency"/> ]
-                                                       </td>
-                                               </tr>
-                                               <tr>
-                                                       <td valign="top">
-                                                               <xsl:value-of 
select="lang_addition_percentage"/>
-                                                       </td>
-                                                       <td>
-                                                               <xsl:value-of 
select="value_addition_percentage"/>
-                                                               <xsl:text> 
</xsl:text> [ % ]
-                                                       </td>
-                                               </tr>
-                                               <tr>
-                                                       <td>
-                                                               <xsl:value-of 
select="lang_status"/>
-                                                       </td>
-                                                       <xsl:for-each 
select="status_list" >
-                                                               <xsl:choose>
-                                                                       
<xsl:when test="selected">
-                                                                               
<td>
-                                                                               
        <xsl:value-of select="name"/>
-                                                                               
</td>
-                                                                       
</xsl:when>
-                                                               </xsl:choose>
-                                                       </xsl:for-each>
-                                               </tr>
-                                               <tr>
-                                                       <td valign="top">
-                                                               <xsl:value-of 
select="lang_start_date"/>
-                                                       </td>
-                                                       <td>
-                                                               <xsl:value-of 
select="value_start_date"/>
-                                                       </td>
-                                               </tr>
-                                               <tr>
-                                                       <td valign="top">
-                                                               <xsl:value-of 
select="lang_end_date"/>
-                                                       </td>
-                                                       <td>
-                                                               <xsl:value-of 
select="value_end_date"/>
-                                                       </td>
-                                               </tr>
-                                               <tr>
-                                                       <td align="left" 
colspan="2">
-                                                               <table>
-                                                                       
<xsl:call-template name="hour_data_view"/>
-                                                               </table>
-                                                       </td>
-                                               </tr>
-                                               <tr>
-                                                       <td valign="top">
-                                                               <xsl:value-of 
select="lang_actual_cost"/>
-                                                       </td>
-                                                       <td>
-                                                               <xsl:value-of 
select="actual_cost"/>
-                                                               <xsl:text> 
</xsl:text> [ <xsl:value-of select="currency"/> ]
-                                                       </td>
-                                               </tr>
-                                       </table>
-                               </div>
-
-                               <xsl:choose>
-                                       <xsl:when test="suppresscoordination 
=''">
-
-                                               <div id="coordination">
-                                                       <table cellpadding="2" 
cellspacing="2" width="80%" align="center">
-                                                               <tr>
-                                                                       <td>
-                                                                               
<xsl:value-of select="lang_key_fetch"/>
-                                                                       </td>
-                                                                       
<xsl:for-each select="key_fetch_list" >
-                                                                               
<xsl:choose>
-                                                                               
        <xsl:when test="selected">
-                                                                               
                <td>
-                                                                               
                        <xsl:value-of select="name"/>
-                                                                               
                </td>
-                                                                               
        </xsl:when>
-                                                                               
</xsl:choose>
-                                                                       
</xsl:for-each>
-                                                               </tr>
-                                                               <tr>
-                                                                       <td>
-                                                                               
<xsl:value-of select="lang_key_deliver"/>
-                                                                       </td>
-                                                                       
<xsl:for-each select="key_deliver_list" >
-                                                                               
<xsl:choose>
-                                                                               
        <xsl:when test="selected">
-                                                                               
                <td>
-                                                                               
                        <xsl:value-of select="name"/>
-                                                                               
                </td>
-                                                                               
        </xsl:when>
-                                                                               
</xsl:choose>
-                                                                       
</xsl:for-each>
-                                                               </tr>
-                                                               <tr>
-                                                                       <td>
-                                                                               
<xsl:value-of select="lang_key_responsible"/>
-                                                                       </td>
-                                                                       <td>
-                                                                               
<xsl:for-each select="key_responsible_list" >
-                                                                               
        <xsl:choose>
-                                                                               
                <xsl:when test="selected">
-                                                                               
                        <xsl:value-of select="name"/>
-                                                                               
                </xsl:when>
-                                                                               
        </xsl:choose>
-                                                                               
</xsl:for-each>
-                                                                       </td>
-                                                               </tr>
-                                                       </table>
-                                               </div>
-                                       </xsl:when>
-                               </xsl:choose>
-
-                               <div id="documents">
-                                       <table cellpadding="2" cellspacing="2" 
width="80%" align="center">
-                                               <xsl:choose>
-                                                       <xsl:when 
test="files!=''">
-                                                               
<xsl:call-template name="file_list_view"/>
-                                                       </xsl:when>
-                                               </xsl:choose>
-                                       </table>
-
-                               </div>
-                               <div id="history">
-
-                                       <hr noshade="noshade" width="100%" 
align="center" size="1"/>
-                                       <table cellpadding="2" cellspacing="2" 
width="80%" align="center">
-                                               <xsl:choose>
-                                                       <xsl:when 
test="record_history=''">
-                                                               <tr>
-                                                                       <td 
class="th_text" align="center">
-                                                                               
<xsl:value-of select="lang_no_history"/>
-                                                                       </td>
-                                                               </tr>
-                                                       </xsl:when>
-                                                       <xsl:otherwise>
-                                                               <tr>
-                                                                       <td 
class="th_text" align="left">
-                                                                               
<xsl:value-of select="lang_history"/>
-                                                                       </td>
-                                                               </tr>
-                                                               
<xsl:apply-templates select="table_header_history"/>
-                                                               
<xsl:apply-templates select="record_history"/>
-                                                       </xsl:otherwise>
-                                               </xsl:choose>
-                                       </table>
-                               </div>
-                       </div>
-               </div>
-               <table>
-                       <tr height="50">
-                               <td>
-                                       <xsl:variable 
name="done_action"><xsl:value-of select="done_action"/></xsl:variable>
-                                       <xsl:variable 
name="lang_done"><xsl:value-of select="lang_done"/></xsl:variable>
-                                       <form method="post" 
action="{$done_action}">
-                                               <input type="submit" 
class="forms" name="done" value="{$lang_done}" 
onMouseout="window.status='';return true;">
-                                                       <xsl:attribute 
name="onMouseover">
-                                                               
<xsl:text>window.status='</xsl:text>
-                                                               <xsl:value-of 
select="lang_done_statustext"/>
-                                                               <xsl:text>'; 
return true;</xsl:text>
-                                                       </xsl:attribute>
-                                               </input>
-                                       </form>
-                               </td>
-                               <td>
-                                       <xsl:variable 
name="edit_action"><xsl:value-of select="edit_action"/></xsl:variable>
-                                       <xsl:variable 
name="lang_edit"><xsl:value-of select="lang_edit"/></xsl:variable>
-                                       <form method="post" 
action="{$edit_action}">
-                                               <input type="submit" 
class="forms" name="edit" value="{$lang_edit}" 
onMouseout="window.status='';return true;">
-                                                       <xsl:attribute 
name="onMouseover">
-                                                               
<xsl:text>window.status='</xsl:text>
-                                                               <xsl:value-of 
select="lang_edit_statustext"/>
-                                                               <xsl:text>'; 
return true;</xsl:text>
-                                                       </xsl:attribute>
-                                               </input>
-                                       </form>
-                               </td>
-                       </tr>
-               </table>
-               <hr noshade="noshade" width="100%" align="center" size="1"/>
-       </xsl:template>




reply via email to

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