fmsystem-commits
[Top][All Lists]
Advanced

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

[Fmsystem-commits] [7339] Merge 7333:7338 from trunk


From: Sigurd Nes
Subject: [Fmsystem-commits] [7339] Merge 7333:7338 from trunk
Date: Wed, 01 Jun 2011 13:22:04 +0000

Revision: 7339
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=7339
Author:   sigurdne
Date:     2011-06-01 13:22:03 +0000 (Wed, 01 Jun 2011)
Log Message:
-----------
Merge 7333:7338 from trunk

Modified Paths:
--------------
    branches/Version-1_0-branch/booking/inc/class.menu.inc.php
    branches/Version-1_0-branch/booking/inc/class.uiallocation.inc.php
    branches/Version-1_0-branch/booking/inc/class.uidocument.inc.php
    branches/Version-1_0-branch/booking/inc/class.uievent.inc.php
    branches/Version-1_0-branch/booking/setup/phpgw_no.lang
    branches/Version-1_0-branch/booking/setup/setup.inc.php
    branches/Version-1_0-branch/booking/setup/tables_current.inc.php
    branches/Version-1_0-branch/booking/setup/tables_update.inc.php
    branches/Version-1_0-branch/bookingfrontend/setup/phpgw_no.lang
    branches/Version-1_0-branch/bookingfrontend/setup/setup.inc.php
    branches/Version-1_0-branch/frontend/inc/class.bofrontend.inc.php
    branches/Version-1_0-branch/frontend/inc/class.uidelegates.inc.php
    branches/Version-1_0-branch/phpgwapi/setup/phpgw_no.lang
    branches/Version-1_0-branch/phpgwapi/templates/bkbooking/head.inc.php
    branches/Version-1_0-branch/property/inc/class.uitts.inc.php

Added Paths:
-----------
    branches/Version-1_0-branch/activitycalendarfrontend/
    branches/Version-1_0-branch/booking/inc/class.bodocumentation.inc.php
    branches/Version-1_0-branch/booking/inc/class.sodocumentation.inc.php
    branches/Version-1_0-branch/booking/inc/class.uidocumentation.inc.php
    branches/Version-1_0-branch/booking/templates/base/documentation_form.xsl
    
branches/Version-1_0-branch/bookingfrontend/inc/class.uidocumentation.inc.php
    branches/Version-1_0-branch/property/inc/class.soexportentity.inc.php

Property Changed:
----------------
    branches/Version-1_0-branch/


Property changes on: branches/Version-1_0-branch
___________________________________________________________________
Modified: svn:mergeinfo
   - 
/trunk:6439-6441,6443,6445-6447,6449-6464,6466-6468,6470-6474,6476-6477,6479-6480,6483-6488,6490-6491,6493-6494,6496-6501,6503-6504,6506,6508,6510-6511,6513,6515-6516,6518,6520-6524,6526-6528,6533-6534,6536-6541,6543-6565,6567,6569,6571-6576,6578,6580-6586,6588-6596,6598-6600,6602-6604,6606-6607,6609-6611,6613-6625,6629-6639,6641-6643,6645-6646,6648,6650-6654,6656-6659,6661-6663,6665-6666,6668-6669,6672-6673,6675,6677-6678,6680,6682-6686,6688-6717,6719,6721-6722,6724-6728,6730,6732-6734,6736-6739,6741,6743,6745-6746,6748-6756,6758-6762,6764,6766-6788,6790,6792-6798,6800-6814,6816-6819,6821-6822,6824-6826,6828-6837,6839,6841,6843-6849,6851,6853-6869,6871-6874,6876-6877,6879,6881,6883,6885-6886,6888-6893,6895-6897,6899-6901,6903,6905-6907,6909,6911-6929,6931-6936,6938-6947,6949,6951,6953,6955-6956,6958-6959,6961-6968,6970-6971,6973-6974,6976-6978,6980,6982-7017,7019-7025,7027-7035,7037-7039,7041-7045,7047-7055,7057,7059-7065,7067-7069,7071,7073,7075-7076,7078,7080-7081,7083,7085,7087,7089-7097,7099-7102,7104-7105,7107-7111,7113-7120,7122-7124,7126-7129,7131,7133-7141,7143,7145-7146,7148-7150,7152-7153,7155-7158,7160-7164,7166-7167,7169-7170,7172,7174,7176,7178,7180-7181,7183,7185,7187-7188,7190,7192-7196,7198-7199,7201-7203,7205,7207,7209-7210,7212,7214,7216-7217,7219-7222,7224-7226,7228-7229,7231,7233-7234,7236-7238,7240-7241,7243-7244,7246,7248,7250,7252-7256,7258-7259,7261-7264,7266-7273,7275-7279,7281-7332
   + 
/trunk:6439-6441,6443,6445-6447,6449-6464,6466-6468,6470-6474,6476-6477,6479-6480,6483-6488,6490-6491,6493-6494,6496-6501,6503-6504,6506,6508,6510-6511,6513,6515-6516,6518,6520-6524,6526-6528,6533-6534,6536-6541,6543-6565,6567,6569,6571-6576,6578,6580-6586,6588-6596,6598-6600,6602-6604,6606-6607,6609-6611,6613-6625,6629-6639,6641-6643,6645-6646,6648,6650-6654,6656-6659,6661-6663,6665-6666,6668-6669,6672-6673,6675,6677-6678,6680,6682-6686,6688-6717,6719,6721-6722,6724-6728,6730,6732-6734,6736-6739,6741,6743,6745-6746,6748-6756,6758-6762,6764,6766-6788,6790,6792-6798,6800-6814,6816-6819,6821-6822,6824-6826,6828-6837,6839,6841,6843-6849,6851,6853-6869,6871-6874,6876-6877,6879,6881,6883,6885-6886,6888-6893,6895-6897,6899-6901,6903,6905-6907,6909,6911-6929,6931-6936,6938-6947,6949,6951,6953,6955-6956,6958-6959,6961-6968,6970-6971,6973-6974,6976-6978,6980,6982-7017,7019-7025,7027-7035,7037-7039,7041-7045,7047-7055,7057,7059-7065,7067-7069,7071,7073,7075-7076,7078,7080-7081,7083,7085,7087,7089-7097,7099-7102,7104-7105,7107-7111,7113-7120,7122-7124,7126-7129,7131,7133-7141,7143,7145-7146,7148-7150,7152-7153,7155-7158,7160-7164,7166-7167,7169-7170,7172,7174,7176,7178,7180-7181,7183,7185,7187-7188,7190,7192-7196,7198-7199,7201-7203,7205,7207,7209-7210,7212,7214,7216-7217,7219-7222,7224-7226,7228-7229,7231,7233-7234,7236-7238,7240-7241,7243-7244,7246,7248,7250,7252-7256,7258-7259,7261-7264,7266-7273,7275-7279,7281-7332,7334-7338

Copied: branches/Version-1_0-branch/booking/inc/class.bodocumentation.inc.php 
(from rev 7338, trunk/booking/inc/class.bodocumentation.inc.php)
===================================================================
--- branches/Version-1_0-branch/booking/inc/class.bodocumentation.inc.php       
                        (rev 0)
+++ branches/Version-1_0-branch/booking/inc/class.bodocumentation.inc.php       
2011-06-01 13:22:03 UTC (rev 7339)
@@ -0,0 +1,28 @@
+<?php
+       phpgw::import_class('booking.bocommon');
+       
+       class booking_bodocumentation extends booking_bocommon
+       {
+
+               function __construct()
+               {
+                       parent::__construct();
+                       $this->so = CreateObject('booking.sodocumentation');
+               }
+               
+               public function get_files_root()
+               {
+                       return $this->so->get_files_root();
+               }
+               
+               public function get_files_path()
+               {
+                       return $this->so->get_files_path();
+               }
+               
+               public function get_categories()
+               {
+                       return $this->so->get_categories();
+               }
+               
+       }

Modified: branches/Version-1_0-branch/booking/inc/class.menu.inc.php
===================================================================
--- branches/Version-1_0-branch/booking/inc/class.menu.inc.php  2011-06-01 
13:17:17 UTC (rev 7338)
+++ branches/Version-1_0-branch/booking/inc/class.menu.inc.php  2011-06-01 
13:22:03 UTC (rev 7339)
@@ -257,6 +257,11 @@
                                                                'text'  => 
lang('Asynchronous Tasks'),
                                                                'url'   => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'booking.uiasync_settings.index', 'appname' => 'booking') )
                                                        ),
+                                                       'documentation' => array
+                                                       (
+                                                               'text'  => 
lang('Documentation'),
+                                                               'url'   => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'booking.uidocumentation.index', 'appname' => 'booking') )
+                                                       ),
                                                        'office'        => array
                                                        (
                                                                'text'  => 
lang('office'),

Copied: branches/Version-1_0-branch/booking/inc/class.sodocumentation.inc.php 
(from rev 7338, trunk/booking/inc/class.sodocumentation.inc.php)
===================================================================
--- branches/Version-1_0-branch/booking/inc/class.sodocumentation.inc.php       
                        (rev 0)
+++ branches/Version-1_0-branch/booking/inc/class.sodocumentation.inc.php       
2011-06-01 13:22:03 UTC (rev 7339)
@@ -0,0 +1,199 @@
+<?php
+       phpgw::import_class('booking.socommon');
+       
+       class booking_sodocumentation extends booking_socommon
+       {
+               const CATEGORY_BACKEND = 'backend';
+               const CATEGORY_FRONTEND = 'frontend';
+               
+               protected 
+                       $defaultCategories = array(
+                          self::CATEGORY_BACKEND,
+                          self::CATEGORY_FRONTEND,
+                       ),
+                       $uploadRootDir,
+                       $ownerType = null;
+                       
+               function __construct()
+               {
+                       parent::__construct('bb_documentation',
+                               array(
+                                       'id'                    => array('type' 
=> 'int'),
+                                       'name'                  => array('type' 
=> 'string', 'query' => true),
+                                       'category'              => array('type' 
=> 'string', 'required' => true),
+                                       'description'   => array('type' => 
'string', 'required' => false),
+                               )
+                       );
+                       $this->account  = 
$GLOBALS['phpgw_info']['user']['account_id'];
+                       
+                       $server_files_dir = 
$this->_chomp_dir_sep($GLOBALS['phpgw_info']['server']['files_dir']);
+                       
+                       if (!file_exists($server_files_dir) || 
!is_dir($server_files_dir)) {
+                               throw new LogicException('The upload directory 
is not properly configured: '.$server_files_dir);
+                       }
+                       
+                       if (!is_writable($server_files_dir)) {
+                               throw new LogicException('The upload directory 
is not writable');
+                       }
+                       
+                       $this->uploadRootDir = 
$server_files_dir.DIRECTORY_SEPARATOR.'booking';
+               }
+               
+#              public static function get_document_owners() {
+#                      return self::$document_owners;
+#              }
+#              
+               public function get_categories()
+               {
+                       return $this->defaultCategories;
+               }
+#              
+#              public function get_owner_type()
+#              {
+#                      return $this->ownerType;
+#              }
+#              
+               public function get_files_root()
+               {       
+                       return $this->uploadRootDir;
+               }
+               
+               public function get_files_path()
+               {
+                       return 
self::get_files_root().DIRECTORY_SEPARATOR.'manual';
+               }
+               
+               private function _chomp_dir_sep($string)
+               {
+                       $sep = DIRECTORY_SEPARATOR == '/' ? '\\/' : 
preg_quote(DIRECTORY_SEPARATOR);
+                       return preg_replace('/('.$sep.')+$/', '', 
trim($string));
+               }
+
+               public function generate_filename($document_id, $document_name)
+               {
+                       return 
$this->get_files_path().DIRECTORY_SEPARATOR.$document_id.'_'.$document_name;
+               }
+               
+               function read_single($id)
+               {
+                       $document = parent::read_single($id);
+                       if (is_array($document)) { 
+                               $document['filename'] = 
$this->generate_filename($document['id'], $document['name']); 
+                       }
+                       return $document;
+               }
+               
+               public function read_parent($owner_id)
+               {
+                       $parent_so = CreateObject(sprintf('booking.so%s', 
$this->get_owner_type()));
+                       return $parent_so->read_single($owner_id);
+               }
+               
+               protected function doValidate($document, booking_errorstack 
$errors)
+               {       
+                       $this->newFile = null;
+                       
+                       if (!$document['id'])
+                       {
+                               $fileValidator = 
createObject('booking.sfValidatorFile');
+                               $files = $document['files'];
+                               unset($document['files']);
+                               try {
+                                       if ($this->newFile = 
$fileValidator->clean($files['name'])) {
+                                               $document['name'] = 
$this->newFile->getOriginalName();
+                                       }
+                               } catch (sfValidatorError $e) {
+                                       if ($e->getCode() == 'required') {
+                                               $errors['name'] = lang('Missing 
file for document');
+                                               return;
+                                       }
+                                       throw $e;
+                               }
+                       }
+                       
+                       if (!in_array($document['category'], 
$this->defaultCategories)) {
+                               $errors['category'] = lang('Invalid category');
+                       }
+               }
+               
+               function add($document)
+               {
+                       if (!$this->newFile) { throw new 
LogicException('Missing file'); }
+                       
+                       $this->db->transaction_begin();
+
+                       $document['name'] = $this->newFile->getOriginalName();
+                       $receipt = parent::add($document);
+                       
+                       $filePath = $this->generate_filename($receipt['id'], 
$document['name']);
+                       $this->newFile->save($filePath);
+
+                       // make sure that uploaded images are "web friendly"
+                       // automatically resize pictures that are too big
+                       
+                       if ($this->db->transaction_commit()) { 
+                               return $receipt;
+                       }
+                       
+                       throw new UnexpectedValueException('Transaction 
failed.');
+               }
+               
+               function delete($id)
+               {
+                       if (!is_array($document = $this->read_single($id))) {
+                               return false;
+                       }
+                       
+                       $this->db->transaction_begin();
+                       
+                       parent::delete($id);
+                       
+                       if ($this->db->transaction_commit()) { 
+                               if (file_exists($document['filename'])) {
+                                       unlink($document['filename']);
+                               }
+                               return true;
+                       }
+                       
+                       return false;
+               }
+               
+               function has_results(&$result)
+               {
+                       return is_array($result) && 
isset($result['total_records']) && $result['total_records'] > 0 && 
isset($result['results']);
+               }
+               
+               function read($params)
+               {
+                       $result = parent::read($params);
+                       
+                       return $result;
+               }
+               
+               public function get_file_extension(array &$entity)
+               {
+                       return (false === $pos = strrpos($entity['name'], '.')) 
? false : substr($entity['name'], $pos+1);
+               }
+
+               public function getFrontendDoc()
+               {
+                               $this->db->query("SELECT id,name FROM 
bb_documentation WHERE category='frontend' ORDER BY id DESC", __LINE__, 
__FILE__);
+                               if($this->db->next_record())
+                               {
+                                       $id = $this->db->f('id', false);
+                                       return 
sprintf('index.php?menuaction=bookingfrontend.uidocumentation.download&id=%s',$id);
+                               }
+                       return null;
+               }
+
+               public function getBackendDoc()
+               {
+                               $this->db->query("SELECT id,name FROM 
bb_documentation WHERE category='backend' ORDER BY id DESC", __LINE__, 
__FILE__);
+                               if($this->db->next_record())
+                               {
+                                       $id = $this->db->f('id', false);
+                                       return 
sprintf('index.php?menuaction=booking.uidocumentation.download&id=%s',$id);
+                               }
+                       return null;
+               }
+       }

Modified: branches/Version-1_0-branch/booking/inc/class.uiallocation.inc.php
===================================================================
--- branches/Version-1_0-branch/booking/inc/class.uiallocation.inc.php  
2011-06-01 13:17:17 UTC (rev 7338)
+++ branches/Version-1_0-branch/booking/inc/class.uiallocation.inc.php  
2011-06-01 13:22:03 UTC (rev 7339)
@@ -381,7 +381,7 @@
                        $id = intval(phpgw::get_var('allocation_id', 'GET'));
                        $outseason = phpgw::get_var('outseason', 'GET');
                        $recurring = phpgw::get_var('recurring', 'GET');
-                       $repeat_untild = phpgw::get_var('repeat_until', 'GET');
+                       $repeat_until = phpgw::get_var('repeat_until', 'GET');
                        $field_interval = 
intval(phpgw::get_var('field_interval', 'GET'));
                        $allocation = $this->bo->read_single($id);
                $season = 
$this->season_bo->read_single($allocation['season_id']);

Modified: branches/Version-1_0-branch/booking/inc/class.uidocument.inc.php
===================================================================
--- branches/Version-1_0-branch/booking/inc/class.uidocument.inc.php    
2011-06-01 13:17:17 UTC (rev 7338)
+++ branches/Version-1_0-branch/booking/inc/class.uidocument.inc.php    
2011-06-01 13:22:03 UTC (rev 7339)
@@ -295,7 +295,9 @@
                                $errors = $this->bo->validate($document);
                                if(!$errors)
                                {
+                                       echo 
"<pre>";print_r($document);print_r($errors);exit;
                                        try {
+
                                                $receipt = 
$this->bo->add($document);
                                                
$this->redirect_to_parent_if_inline();
                                                
$this->redirect($this->get_owner_typed_link_params('index'));

Copied: branches/Version-1_0-branch/booking/inc/class.uidocumentation.inc.php 
(from rev 7338, trunk/booking/inc/class.uidocumentation.inc.php)
===================================================================
--- branches/Version-1_0-branch/booking/inc/class.uidocumentation.inc.php       
                        (rev 0)
+++ branches/Version-1_0-branch/booking/inc/class.uidocumentation.inc.php       
2011-06-01 13:22:03 UTC (rev 7339)
@@ -0,0 +1,238 @@
+<?php
+       phpgw::import_class('booking.uicommon');
+
+       class booking_uidocumentation extends booking_uicommon
+       {
+               protected
+                       $documentOwnerType = null,
+                       $module;
+               
+               public 
+                       $public_functions = array(
+                               'index'                 => true,
+                               'show'                  => true,
+                               'add'                   => true,
+                               'edit'                  => true,
+                               'download'              => true,
+                               'delete'                => true,
+                       );
+               
+               public function __construct()
+               {
+                       parent::__construct();
+                       $this->bo = CreateObject('booking.bodocumentation');
+                       $this->fields = array('category', 'description');
+                       $this->module = 'booking';
+               }
+               
+               public function index()
+               {
+                       if(phpgw::get_var('phpgw_return_as') == 'json') {
+                               return $this->index_json();
+                       }
+                       
+                       self::add_javascript('booking', 'booking', 
'datatable.js');
+                       phpgwapi_yui::load_widget('datatable');
+                       phpgwapi_yui::load_widget('paginator');
+                       
+                       // if($_SESSION['showall'])
+                       // {
+                       //      $active_botton = lang('Show only active');
+                       // }else{
+                       //      $active_botton = lang('Show all');
+                       // }
+                       
+                                               
+                       $data = array(
+                               'form' => array(
+                                       'toolbar' => array(
+                                               'item' => array(
+                                                       array(
+                                                               'type' => 
'text', 
+                                                               'name' => 
'query'
+                                                       ),
+                                                       array(
+                                                               'type' => 
'submit',
+                                                               'name' => 
'search',
+                                                               'value' => 
lang('Search')
+                                                       ),
+                                                       // array(
+                                                       //      'type' => 
'link',
+                                                       //      'value' => 
$active_botton,
+                                                       //      'href' => 
self::link(array('menuaction' => $this->get_owner_typed_link('active')))
+                                                       // ),
+                                               )
+                                       ),
+                               ),
+                               'datatable' => array(
+                                       'source' => 
self::link(array('menuaction' => 'booking.uidocumentation.index', 
'phpgw_return_as' => 'json')),
+                                       'field' => array(
+                                               array(
+                                                       'key' => 'name',
+                                                       'label' => 
lang('Document Name'),
+                                                       'formatter' => 
'YAHOO.booking.formatLink',
+                                               ),
+                                               array(
+                                                       'key' => 'description',
+                                                       'label' => 
lang('Description'),
+                                               ),
+                                               array(
+                                                       'key' => 'category',
+                                                       'label' => 
lang('Category'),
+                                               ),
+                                               array(
+                                                       'key' => 'actions',
+                                                       'label' => 
lang('Actions'),
+                                                       'formatter' => 
'YAHOO.booking.'.sprintf('formatGenericLink(\'%s\', \'%s\')', lang('edit'), 
lang('delete')),
+                                               ),
+                                               array(
+                                                       'key' => 'link',
+                                                       'hidden' => true
+                                               )
+                                       )
+                               )
+                       );
+                       
+                       
+                               array_unshift($data['form']['toolbar']['item'], 
array(
+                                       'type' => 'link',
+                                       'value' => lang('New document'),
+                                       'href' => self::link(array('menuaction' 
=> $this->module.'.uidocumentation.add')),
+                               ));
+                       
+                       self::render_template('datatable', $data);
+               }
+
+               public function index_json()
+               {
+                       $documents = $this->bo->read();
+                       
+                       foreach($documents['results'] as &$document)
+                       {
+                               $document['link'] = 
self::link(array('menuaction' => $this->module.'.uidocumentation.download', 
'id' => $document['id']));
+                               $document['category'] = 
lang(self::humanize($document['category']));
+                               #$document['active'] = $document['active'] ? 
lang('Active') : lang('Inactive');
+                               
+                               $document_actions = array();
+                               $document_actions[] = 
self::link(array('menuaction' => $this->module.'.uidocumentation.edit', 'id' => 
$document['id']));
+                               $document_actions[] = 
self::link(array('menuaction' => $this->module.'.uidocumentation.delete', 'id' 
=> $document['id']));
+                               
+                               $document['actions'] = $document_actions;
+                       }
+                       return $this->yui_results($documents);
+               }
+
+               public function index_images()
+               {
+                       $images = $this->bo->read_images();
+                       
+                       foreach($images['results'] as &$image) {
+                               $image['src'] = 
$this->get_owner_typed_link('download', array('id' => $image['id']));
+                       }
+                       
+                       return $this->yui_results($images);
+               }
+               
+               protected function get_document_categories()
+               {
+                       $types = array();
+                       foreach($this->bo->get_categories() as $type) { 
$types[$type] = self::humanize($type); }
+                       return $types;
+               }
+               
+               protected function add_default_display_data(&$document_data)
+               {
+#                      $document_data['owner_pathway']         = 
$this->get_owner_pathway($document_data);
+#                      $document_data['owner_type']            = 
lang('manual');
+#                      $document_data['owner_type_label']      = 
ucfirst($document_data['owner_type']);
+#                      $document_data['inline']                        = 
$this->is_inline();
+                       $document_data['document_types']        = 
$this->get_document_categories();
+                       $document_data['documents_link']        = 
self::link(array('menuaction' => $this->module.'.uidocumentation.index'));
+                       $document_data['cancel_link']           = 
self::link(array('menuaction' => $this->module.'.uidocumentation.index'));
+               }
+               
+               public function show()
+               {
+                       $id = intval(phpgw::get_var('id', 'GET'));
+                       $document = $this->bo->read_single($id);
+                       $this->add_default_display_data($document);
+                       self::render_template('documentation', array('document' 
=> $document));
+               }
+               
+               public function add()
+               {       
+                       $errors = array();
+                       $document = array();
+                       
+                       if($_SERVER['REQUEST_METHOD'] == 'POST')
+                       {
+                               $document = extract_values($_POST, 
$this->fields);      
+                               $document['files'] = $this->get_files();
+                               $errors = $this->bo->validate($document);
+                               if(!$errors)
+                               {
+                                       $receipt = $this->bo->add($document);
+                                       
$this->redirect('booking.uidocumentation.index');
+                               }
+                       }
+                       
+                       self::add_javascript('booking', 'booking', 
'document.js');
+
+                       $this->add_default_display_data($document);
+                       
+                       $this->flash_form_errors($errors);
+
+                       self::render_template('documentation_form', 
array('document' => $document));
+               }
+               
+               public function edit()
+               {
+                       $id = intval(phpgw::get_var('id', 'GET'));
+                       $document = $this->bo->read_single($id);
+                       
+                       $errors = array();
+                       if($_SERVER['REQUEST_METHOD'] == 'POST')
+                       {
+                               $document = array_merge($document, 
extract_values($_POST, $this->fields));
+                               $errors = $this->bo->validate($document);
+                               if(!$errors)
+                               {
+                                       $receipt = 
$this->bo->update($document);        
+                                       
$this->redirect('booking.uidocumentation.index');
+                               }
+                       }
+                       
+                       self::add_javascript('booking', 'booking', 
'document.js');
+                       $this->flash_form_errors($errors);
+                       $this->add_default_display_data($document);
+                       
+                       self::render_template('documentation_form', 
array('document' => $document));
+               }
+               
+               public function download()
+               {
+                       $id = intval(phpgw::get_var('id', 'GET'));
+                       
+                       $document = $this->bo->read_single($id);
+                       
+                       self::send_file($document['filename'], array('filename' 
=> $document['name']));
+               }
+               
+               public function delete()
+               {
+                       $id = intval(phpgw::get_var('id', 'GET'));
+                       $this->bo->delete($id);
+                       
+                       $this->redirect('booking.uidocumentation.index');
+               }
+               
+               
+               /**
+                * Implement to return the full hierarchical pathway to this 
documents owner(s).
+                *
+                * @param int $document_id
+                *
+                * @return array of url(s) to owner(s) in order of hierarchy.
+                */
+               protected function get_owner_pathway(array $forDocumentData) { 
return array(); }
+       }

Modified: branches/Version-1_0-branch/booking/inc/class.uievent.inc.php
===================================================================
--- branches/Version-1_0-branch/booking/inc/class.uievent.inc.php       
2011-06-01 13:17:17 UTC (rev 7338)
+++ branches/Version-1_0-branch/booking/inc/class.uievent.inc.php       
2011-06-01 13:22:03 UTC (rev 7339)
@@ -554,21 +554,34 @@
                                                        }
                                                        
if(phpgw::get_var('sendtocollision', 'POST'))
                                                        {
+                                                               
+                                                               $mail_sendt_to 
= '';
+                                                               $mail_message = 
lang('There are changes to your reservations').": \n";
                                                                foreach 
(array_keys($maildata) as $mail)
                                                                {
                                                                        
$comment_text_log = lang('There are changes to your reservations').": \n";
+                                                                       
$mail_sendt_to = $mail_sendt_to.' '.$mail;
                                                                        
foreach($maildata[$mail] as $data)
                                                                        {
                                                                                
$comment_text_log .= $data['date'].', '.$data['building'].', 
'.$data['resource'].', Kl. '.$data['start'].' - '.$data['end']." \n";
+                                                                               
$mail_message .= $comment_text_log;
                                                                        }
                                                                        
$comment_text_log .= phpgw::get_var('mail', 'POST');
                                                                        
$this->send_mailnotification($mail, lang('Event changed'), $comment_text_log);
                                                                }
+                                                               if 
(strpos($mail_sendt_to,'@') !== False)                               
+                                                               {
+                                                                       
$comment = $mail_message."\n".phpgw::get_var('mail', 'POST').".\n Denne er 
sendt til ".$mail_sendt_to;
+                                                                       
$this->add_comment($event,$comment);                    
+                                                               }
                                                        }
                                                        
if(phpgw::get_var('sendtocontact', 'POST'))
                                                        {
                                                                
$comment_text_log = phpgw::get_var('mail', 'POST');
                                                                
$this->send_mailnotification($event['contact_email'], lang('Event changed'), 
$comment_text_log);
+                                                               $comment = 
$comment_text_log.' Denne er sendt til '.$event['contact_email'];
+                                                               
$this->add_comment($event,$comment);                    
+               
                                                        }
                                                        
if(phpgw::get_var('sendtorbuilding', 'POST'))
                                                        {
@@ -581,22 +594,32 @@
                                                                
$comment_text_log = $comment_text_log.' har fått innvilget et arrangement i 
'.$event['building_name'].' '.date('d-m-Y H:i', 
strtotime($event['from_'])).".\nFor mer opplysinger slå opp i AktivBy.";
 //                                                             
$comment_text_log = phpgw::get_var('mail', 'POST');
                                                                $sendt = 0;
+                                                               $mail_sendt_to 
= '';
                                                                
if($building_info['email']) {
                                                                        
$sendt++;
+                                                                       
$mail_sendt_to = $mail_sendt_to.' '.$building_info['email'];
                                                                        
$this->send_mailnotification($building_info['email'], lang('Message about new 
event'), $comment_text_log);
                                                                } 
                                                                if 
($_POST['sendtorbuilding_email1']) {
                                                                        
$sendt++;
+                                                                       
$mail_sendt_to = $mail_sendt_to.' '.$_POST['sendtorbuilding_email1'];
                                                                        
$this->send_mailnotification($_POST['sendtorbuilding_email1'], lang('Message 
about new event'), $comment_text_log);
                
                                                                } 
                                                                if 
($_POST['sendtorbuilding_email2']) {
                                                                        
$sendt++;
+                                                                       
$mail_sendt_to = $mail_sendt_to.' '.$_POST['sendtorbuilding_email2'];
                                                                        
$this->send_mailnotification($_POST['sendtorbuilding_email2'], lang('Message 
about new event'), $comment_text_log);
                                                                }
                                                                if ($sendt > 0) 
{
                                                                        
$errors['mailtobuilding'] = lang('Unable to send warning, No mailadresses 
found');
+                                                               } 
+                                                               else 
+                                                               {
+                                                                       
$comment = $comment_text_log.' Denne er sendt til '.$mail_sendt_to;
+                                                                       
$this->add_comment($event,$comment);                    
                                                                }
+                                                               
                                                        }
                                                }                               
                                                else 

Modified: branches/Version-1_0-branch/booking/setup/phpgw_no.lang
===================================================================
--- branches/Version-1_0-branch/booking/setup/phpgw_no.lang     2011-06-01 
13:17:17 UTC (rev 7338)
+++ branches/Version-1_0-branch/booking/setup/phpgw_no.lang     2011-06-01 
13:22:03 UTC (rev 7339)
@@ -515,3 +515,6 @@
 Internal customer output format        booking no      Intern kunde eksport 
format
 Internal_account_helptext      booking no      Data som brukes for faktura 
eksport av interne kunder
 searchfield    booking no      Fritekstsøk
+Backend        booking no      Backend
+Documentation  booking no      Dokumentasjon
+Upload manual  booking no      Last opp dokumentasjon

Modified: branches/Version-1_0-branch/booking/setup/setup.inc.php
===================================================================
--- branches/Version-1_0-branch/booking/setup/setup.inc.php     2011-06-01 
13:17:17 UTC (rev 7338)
+++ branches/Version-1_0-branch/booking/setup/setup.inc.php     2011-06-01 
13:22:03 UTC (rev 7339)
@@ -1,6 +1,6 @@
 <?php
        $setup_info['booking']['name'] = 'booking';
-       $setup_info['booking']['version'] = '0.2.07';
+       $setup_info['booking']['version'] = '0.2.08';
        $setup_info['booking']['app_order'] = 9;
        $setup_info['booking']['enable'] = 1;
        $setup_info['booking']['app_group'] = 'office';
@@ -54,7 +54,8 @@
                'bb_billing_sequential_number_generator',
                'bb_system_message',
                'bb_office',
-               'bb_office_user'
+               'bb_office_user',
+               'bb_documentation'
        );
 
        $setup_info['booking']['description'] = 'Bergen kommune booking';

Modified: branches/Version-1_0-branch/booking/setup/tables_current.inc.php
===================================================================
--- branches/Version-1_0-branch/booking/setup/tables_current.inc.php    
2011-06-01 13:17:17 UTC (rev 7338)
+++ branches/Version-1_0-branch/booking/setup/tables_current.inc.php    
2011-06-01 13:22:03 UTC (rev 7339)
@@ -768,6 +768,18 @@
                        'fk' => array(),
                        'ix' => array(),
                        'uc' => array()
-               )
+               ),
+               'bb_documentation' => array(
+                       'fd' => array(
+                               'id' => array('type' => 'auto', 'nullable' => 
false),
+                               'name' => array('type' => 'varchar', 
'precision' => '255', 'nullable' => false),
+                               'category' => array('type' => 'varchar', 
'precision' => '150', 'nullable' => false),
+                               'description' => array('type' => 'text', 
'nullable' => true),
+                       ),
+                       'pk' => array('id'),
+                       'fk' => array(),
+                       'ix' => array(),
+                       'uc' => array()
+               ),
 
        );

Modified: branches/Version-1_0-branch/booking/setup/tables_update.inc.php
===================================================================
--- branches/Version-1_0-branch/booking/setup/tables_update.inc.php     
2011-06-01 13:17:17 UTC (rev 7338)
+++ branches/Version-1_0-branch/booking/setup/tables_update.inc.php     
2011-06-01 13:22:03 UTC (rev 7339)
@@ -2582,3 +2582,38 @@
                }
        }
 
+       $test[] = '0.2.07';
+       /**
+       * Update booking version from 0.2.07 to 0.2.08
+       * Add custom fields to request
+       * 
+       */
+       function booking_upgrade0_2_07()
+       {
+               $GLOBALS['phpgw_setup']->oProc->m_odb->transaction_begin();
+
+
+               $GLOBALS['phpgw_setup']->oProc->CreateTable(
+                       'bb_documentation', array(
+                               'fd' => array(
+                                       'id' => array('type' => 'auto', 
'nullable' => false),
+                                       'name' => array('type' => 'varchar', 
'precision' => '255', 'nullable' => false),
+                                       'category' => array('type' => 
'varchar', 'precision' => '150', 'nullable' => false),
+                                       'description' => array('type' => 
'text', 'nullable' => true),
+                               ),
+                               'pk' => array('id'),
+                               'fk' => array(),
+                               'ix' => array(),
+                               'uc' => array()
+                       )
+               );
+       
+               if($GLOBALS['phpgw_setup']->oProc->m_odb->transaction_commit())
+               {
+                       $GLOBALS['setup_info']['booking']['currentver'] = 
'0.2.08';
+                       return $GLOBALS['setup_info']['booking']['currentver'];
+               }
+       }
+
+
+

Copied: 
branches/Version-1_0-branch/booking/templates/base/documentation_form.xsl (from 
rev 7338, trunk/booking/templates/base/documentation_form.xsl)
===================================================================
--- branches/Version-1_0-branch/booking/templates/base/documentation_form.xsl   
                        (rev 0)
+++ branches/Version-1_0-branch/booking/templates/base/documentation_form.xsl   
2011-06-01 13:22:03 UTC (rev 7339)
@@ -0,0 +1,94 @@
+<xsl:template match="data" xmlns:php="http://php.net/xsl";>
+       <script type="text/javascript">
+               YAHOO.booking.documentOwnerType = "<xsl:value-of 
select="document/owner_type"/>";
+               YAHOO.booking.documentOwnerAutocomplete = <xsl:value-of 
select="document/inline"/> == 0;
+       </script>
+       
+    <div id="content">
+       <xsl:call-template name="msgbox"/>
+               <xsl:call-template name="yui_booking_i18n"/>
+
+       <form action="" method="POST" enctype='multipart/form-data'>
+                       <dl class="form">
+                               <xsl:if test="document/id">
+                                       <dt class="heading"><xsl:value-of 
select="php:function('lang', 'Edit manual')" /></dt>
+                               </xsl:if>
+                               <xsl:if test="not(document/id)">
+                                       <dt class="heading"><xsl:value-of 
select="php:function('lang', 'Upload manual')" /></dt>
+                               </xsl:if>
+                               <xsl:if test="document/id">
+                                       <!-- An update, add id column -->
+                                       <input name='field_id' type='hidden'>
+                                               <xsl:attribute 
name="value"><xsl:value-of select="document/id"/></xsl:attribute>
+                                       </input>
+                               </xsl:if>
+                               <dt><label for="field_name"><xsl:value-of 
select="php:function('lang', 'Document')" /></label></dt>
+                   <dd>
+                       <input name="name" id='field_name'>
+                                               <xsl:attribute 
name="value"><xsl:value-of select="document/name"/></xsl:attribute>
+                                               <xsl:attribute name="type">
+                                                       <xsl:choose>
+                                                               <xsl:when 
test="document/id">text</xsl:when>
+                                                               
<xsl:otherwise>file</xsl:otherwise>
+                                                       </xsl:choose>
+                                               </xsl:attribute>
+                           
+                                               <xsl:if test="document/id">
+                                                       <xsl:attribute 
name="disabled" value="disabled"/>
+                                               </xsl:if>
+                                               
+                                               <xsl:attribute 
name='title'><xsl:value-of select="document/name"/></xsl:attribute>
+                       </input>
+                   </dd>
+                       </dl>
+                       <dl class="form-col">
+
+                   <dt><label for="field_description"><xsl:value-of 
select="php:function('lang', 'Description')" /></label></dt>
+                   <dd>
+                       <textarea name="description" 
id='field_description'><xsl:value-of select="document/description"/></textarea>
+                   </dd>
+               </dl>
+       
+               <dl class="form-col">
+                               
+                               <dt><label for="field_category"><xsl:value-of 
select="php:function('lang', 'Category')" /></label></dt>
+                               <dd>
+                                       <select name='category' 
id='field_category'>
+                                               <option value=''><xsl:value-of 
select="php:function('lang', 'Select Category...')" /></option>
+                                               <xsl:for-each 
select="document/document_types/*">
+                                                       <option>
+                                                               <xsl:if 
test="../../category = local-name()">
+                                                                       
<xsl:attribute name="selected">selected</xsl:attribute>
+                                                               </xsl:if>
+                                               
+                                                               <xsl:attribute 
name="value"><xsl:value-of select="local-name()"/></xsl:attribute>
+                                                               <xsl:value-of 
select="php:function('lang', string(node()))"/>
+                                                       </option>
+                                               </xsl:for-each>
+                                       </select>
+                               </dd>
+                               
+                       </dl>
+
+               <div class="clr"/>
+               <div class="form-buttons">
+            <input type="submit">
+                               <xsl:attribute name="value">
+                                       <xsl:choose>
+                                               <xsl:when test="document/id">
+                                                       <xsl:value-of 
select="php:function('lang', 'Update')"/>
+                                               </xsl:when>
+                                               <xsl:otherwise>
+                                                       <xsl:value-of 
select="php:function('lang', 'Create')"/>
+                                               </xsl:otherwise>
+                                       </xsl:choose>
+                               </xsl:attribute>
+                       </input>
+            <a class="cancel">
+                <xsl:attribute name="href"><xsl:value-of 
select="document/cancel_link"/></xsl:attribute>
+                               <xsl:value-of select="php:function('lang', 
'Cancel')" />
+            </a>
+        </div>
+       </form>
+    </div>
+</xsl:template>

Copied: 
branches/Version-1_0-branch/bookingfrontend/inc/class.uidocumentation.inc.php 
(from rev 7338, trunk/bookingfrontend/inc/class.uidocumentation.inc.php)
===================================================================
--- 
branches/Version-1_0-branch/bookingfrontend/inc/class.uidocumentation.inc.php   
                            (rev 0)
+++ 
branches/Version-1_0-branch/bookingfrontend/inc/class.uidocumentation.inc.php   
    2011-06-01 13:22:03 UTC (rev 7339)
@@ -0,0 +1,20 @@
+<?php
+       phpgw::import_class('booking.uidocumentation');
+
+       class bookingfrontend_uidocumentation extends booking_uidocumentation
+       {
+               public $public_functions = array
+               (
+                       'download'      =>      true,
+                       'index'         =>  true,
+                       'index_images' => true,
+               );
+               
+               protected $module;
+
+               public function __construct()
+               {
+                       parent::__construct();
+                       $this->module = "bookingfrontend";
+               }
+       }

Modified: branches/Version-1_0-branch/bookingfrontend/setup/phpgw_no.lang
===================================================================
--- branches/Version-1_0-branch/bookingfrontend/setup/phpgw_no.lang     
2011-06-01 13:17:17 UTC (rev 7338)
+++ branches/Version-1_0-branch/bookingfrontend/setup/phpgw_no.lang     
2011-06-01 13:22:03 UTC (rev 7339)
@@ -334,3 +334,5 @@
 Cancelation of booking from    bookingfrontend no      Avbestilling av booking 
fra
 To cancel booking use this link        bookingfrontend no      For å slette 
bookingen bruk lenken
 To cancel allocation use this link     bookingfrontend no      For å slette 
tildelingen bruk lenken
+manual common  no      Veiledning lag og organisasjoner
+

Modified: branches/Version-1_0-branch/bookingfrontend/setup/setup.inc.php
===================================================================
--- branches/Version-1_0-branch/bookingfrontend/setup/setup.inc.php     
2011-06-01 13:17:17 UTC (rev 7338)
+++ branches/Version-1_0-branch/bookingfrontend/setup/setup.inc.php     
2011-06-01 13:22:03 UTC (rev 7339)
@@ -21,7 +21,7 @@
 
        $setup_info['bookingfrontend']['depends'][] = array(
                'appname' => 'booking',
-               'versions' => Array('0.2.00', 
'0.2.01','0.2.02','0.2.03','0.2.04','0.2.05','0.2.06','0.2.07')
+               'versions' => Array('0.2.00', 
'0.2.01','0.2.02','0.2.03','0.2.04','0.2.05','0.2.06','0.2.07','0.2.08','0.2.09')
        );
 
        $setup_info['bookingfrontend']['depends'][] = array(

Modified: branches/Version-1_0-branch/frontend/inc/class.bofrontend.inc.php
===================================================================
--- branches/Version-1_0-branch/frontend/inc/class.bofrontend.inc.php   
2011-06-01 13:17:17 UTC (rev 7338)
+++ branches/Version-1_0-branch/frontend/inc/class.bofrontend.inc.php   
2011-06-01 13:22:03 UTC (rev 7339)
@@ -86,11 +86,11 @@
                }
                
                public static function get_delegations(int $account_id)
-               {
+               {       
                        if(isset($account_id))
-                       {
+                       { 
                                //$sql = "SELECT pa.account_lid FROM 
phpgw_account_delegates pad LEFT JOIN phpgw_accounts pa ON (pa.account_id = 
pad.owner_id) WHERE pad.account_id = {$account_id}";
-                               $location_id = 
$GLOBALS['phpgw']->locations->get_id( 'frontend' , '.');;
+                               $location_id = 
$GLOBALS['phpgw']->locations->get_id( 'frontend' , '.');
                                $sql = "SELECT data FROM 
phpgw_account_delegates WHERE account_id = {$account_id} AND location_id = 
{$location_id}";
                                
                                $db = clone $GLOBALS['phpgw']->db;
@@ -198,26 +198,32 @@
                }
                
                /**
-                * Get delegates based on either the organisational unit, the 
delagations given by this user
+                * Get delegates based on a organisational unit, all units and 
distinct delegates 
+                * when all units is requested. The delagations given by this 
user
                 * 
                 * @param int $owner_id the person who has given the delegation
                 * @param unknown_type $org_unit_id     the target 
organisational unit
                 */
-               public static function get_delegates($org_unit_id)
+               public static function get_delegates($org_unit_id, $distinct = 
false)
                {
                        // The location
                        $location_id = $GLOBALS['phpgw']->locations->get_id( 
'frontend' , '.');;
                        $owner_id = isset($owner_id) ? $owner_id : 
$GLOBALS['phpgw_info']['user']['account_id'];
-                       
-                       
+       
                        // If a specific organisational unit is chosen
-                       if(!isset($org_unit_id))
+                       if(!isset($org_unit_id) && !$distinct)
                        {
-                               $sql =  "SELECT pad.account_id, pad.owner_id, 
pad.data, pa.account_lid, pa.account_firstname, pa.account_lastname FROM 
phpgw_account_delegates pad LEFT JOIN phpgw_accounts pa ON (pa.account_id = 
pad.account_id) WHERE owner_id = {$owner_id}";
+                               $sql = "SELECT pad.account_id, pad.owner_id, 
pad.data, pa.account_lid, pa.account_firstname, pa.account_lastname 
+                               FROM phpgw_account_delegates pad LEFT JOIN 
phpgw_accounts pa ON (pa.account_id = pad.account_id) WHERE owner_id = 
{$owner_id}";
                        }
-                       else if($org_unit_id != 'all')
+                       else if(!isset($org_unit_id) && $distinct)
                        {
-                               $sql =  "SELECT pad.account_id, pa.account_lid, 
pa.account_firstname, pa.account_lastname 
+                               $sql = "SELECT DISTINCT ON (pad.account_id) 
pad.account_id, pad.owner_id, pad.data, pa.account_lid, pa.account_firstname, 
pa.account_lastname 
+                                    FROM phpgw_account_delegates pad LEFT JOIN 
phpgw_accounts pa ON (pa.account_id = pad.account_id) WHERE owner_id = 
{$owner_id}";
+                       }
+                       else if($org_unit_id != 'all' && !$distinct)
+                       {
+                               $sql = "SELECT pad.account_id, pa.account_lid, 
pa.account_firstname, pa.account_lastname 
                                FROM phpgw_account_delegates pad 
                                LEFT JOIN phpgw_accounts pa 
                                ON (pa.account_id = pad.account_id) WHERE data 
= '{$org_unit_id}' AND location_id = {$location_id}";
@@ -226,11 +232,9 @@
                                return array();
                        }
                        
-                       
                        $db = clone $GLOBALS['phpgw']->db;
                        $db->query($sql,__LINE__,__FILE__);
                        
-                       
                        $delegates = array();
                while($db->next_record())
                {
@@ -242,6 +246,7 @@
                                'account_lastname'      =>      
$db->f('account_lastname', true)
                        );
                } 
+                       
                        return $delegates;
                }
                

Modified: branches/Version-1_0-branch/frontend/inc/class.uidelegates.inc.php
===================================================================
--- branches/Version-1_0-branch/frontend/inc/class.uidelegates.inc.php  
2011-06-01 13:17:17 UTC (rev 7338)
+++ branches/Version-1_0-branch/frontend/inc/class.uidelegates.inc.php  
2011-06-01 13:22:03 UTC (rev 7339)
@@ -18,7 +18,7 @@
                
 
                public function index()
-               {               
+               {       
                        $config = CreateObject('phpgwapi.config','rental');
                        $config->read();
                        $use_fellesdata = 
$config->config_data['use_fellesdata'];       
@@ -141,7 +141,7 @@
                                }
                        }
                        else if(isset($_POST['remove']))
-                       {
+                       { 
                                $account_id = phpgw::get_var('account_id'); 
                                $result = 
frontend_bofrontend::remove_delegate($account_id,null,null);
                                if($result)
@@ -168,10 +168,10 @@
                                        $msglog['error'][] = array('msg' => 
lang('remove_delegate_error'));     
                                }
                        }
-                       
+
                        $form_action = 
$GLOBALS['phpgw']->link('/index.php',array('menuaction' => 
'frontend.uidelegates.index'));
                        $delegates_per_org_unit = 
frontend_bofrontend::get_delegates($this->header_state['selected_org_unit']);
-                       $delegates_per_user = 
frontend_bofrontend::get_delegates(null);
+                       $delegates_per_user = 
frontend_bofrontend::get_delegates(null, true);
                        
                        $number_of_delegates = count($delegates_per_org_unit);
                        $number_of_user_delegates = count($delegates_per_user);

Modified: branches/Version-1_0-branch/phpgwapi/setup/phpgw_no.lang
===================================================================
--- branches/Version-1_0-branch/phpgwapi/setup/phpgw_no.lang    2011-06-01 
13:17:17 UTC (rev 7338)
+++ branches/Version-1_0-branch/phpgwapi/setup/phpgw_no.lang    2011-06-01 
13:22:03 UTC (rev 7339)
@@ -50,7 +50,6 @@
 group public   common  no      Gruppe Public
 groups common  no      Grupper
 help   common  no      Hjelp
-manual common  no      Veiledning lag og organisasjoner
 high   common  no      Høy
 home   common  no      Hjemme
 it has been more then %1 days since you changed your password  common  no      
Det er mer enn %1 dager siden du har endet ditt passord

Modified: branches/Version-1_0-branch/phpgwapi/templates/bkbooking/head.inc.php
===================================================================
--- branches/Version-1_0-branch/phpgwapi/templates/bkbooking/head.inc.php       
2011-06-01 13:17:17 UTC (rev 7338)
+++ branches/Version-1_0-branch/phpgwapi/templates/bkbooking/head.inc.php       
2011-06-01 13:22:03 UTC (rev 7339)
@@ -114,11 +114,14 @@
        $config->read();
        $logofile_frontend = isset($config->config_data['logopath_frontend']) 
&& $config->config_data['logopath_frontend'] ? 
$config->config_data['logopath_frontend'] : 
"/phpgwapi/templates/bkbooking/images/bergen_logo.png";
 
+       $bodoc = CreateObject('booking.bodocumentation');
+       
+       $test  =  $bodoc->so->getFrontendDoc(); 
        $app = lang($app);
        $tpl_vars = array
        (
-#              'manual_text'   => lang('manual'),
-#              'manual_url'    => '#',
+               'manual_text'   => lang('manual'),
+               'manual_url'    => $test,
 #              'help_text'     => lang('help'),
 #              'help_url'              => '#',
                'css'                   => $GLOBALS['phpgw']->common->get_css(),

Copied: branches/Version-1_0-branch/property/inc/class.soexportentity.inc.php 
(from rev 7338, trunk/property/inc/class.soexportentity.inc.php)
===================================================================
--- branches/Version-1_0-branch/property/inc/class.soexportentity.inc.php       
                        (rev 0)
+++ branches/Version-1_0-branch/property/inc/class.soexportentity.inc.php       
2011-06-01 13:22:03 UTC (rev 7339)
@@ -0,0 +1,198 @@
+<?php
+       /**
+       * phpGroupWare - property: a Facilities Management System.
+       *
+       * @author Sigurd Nes <address@hidden>
+       * @copyright Copyright (C) 2003,2004,2005,2006,2007 Free Software 
Foundation, Inc. http://www.fsf.org/
+       * This file is part of phpGroupWare.
+       *
+       * phpGroupWare is free software; you can redistribute it and/or modify
+       * it under the terms of the GNU General Public License as published by
+       * the Free Software Foundation; either version 2 of the License, or
+       * (at your option) any later version.
+       *
+       * phpGroupWare is distributed in the hope that it will be useful,
+       * but WITHOUT ANY WARRANTY; without even the implied warranty of
+       * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+       * GNU General Public License for more details.
+       *
+       * You should have received a copy of the GNU General Public License
+       * along with phpGroupWare; if not, write to the Free Software
+       * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 
 USA
+       *
+       * @license http://www.gnu.org/licenses/gpl.html GNU General Public 
License
+       * @internal Development of this application was funded by 
http://www.bergen.kommune.no/bbb_/ekstern/
+       * @package property
+       * @subpackage helpdesk
+       * @version $Id: class.sotts.inc.php 7196 2011-04-07 12:13:40Z sigurdne $
+       */
+
+       phpgw::import_class('phpgwapi.datetime');
+
+       /**
+        * Description
+        * @package property
+        */
+
+       class property_soexportentity
+       {
+               var $uicols_related = array();
+               var $acl_location = '.entity.1.11';
+               var $entity_id = 1;
+               var $cat_id = 11;
+               public $total_records   = 0;
+               public $sum_budget              = 0;
+               public $sum_actual_cost = 0;
+               protected $type = 'entity';
+
+               public $soap_functions = array
+                       (
+                               'read' => array(
+                                       'in'  => array('array'),
+                                       'out' => array('array')
+                               )
+                       );
+
+
+               public $xmlrpc_methods = array
+                       (
+                               array
+                               (
+                                       'name'       => 'read',
+                                       'decription' => 'Get list of meter'
+                               )
+                       );
+
+               public $public_functions = array
+               (
+                       'read'                  => true
+               );
+
+               function __construct()
+               {
+                       $this->account          = 
(int)$GLOBALS['phpgw_info']['user']['account_id'];
+                       $this->historylog       = 
CreateObject('property.historylog','tts');
+                       $this->db                       = & 
$GLOBALS['phpgw']->db;
+                       $this->like             = & $this->db->like;
+                       $this->join             = & $this->db->join;
+                       $this->left_join        = & $this->db->left_join;
+                       $this->dateformat       = 
$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'];
+
+                       $this->acl                      = & 
$GLOBALS['phpgw']->acl;
+                       $this->type                     = 'entity';
+               }
+
+
+               function list_methods($_type='xmlrpc')
+               {
+                       /*
+                         This handles introspection or discovery by the logged 
in client,
+                         in which case the input might be an array.  The 
server always calls
+                         this function to fill the server dispatch map using a 
string.
+                        */
+                       if (is_array($_type))
+                       {
+                               $_type = $_type['type'] ? $_type['type'] : 
$_type[0];
+                       }
+                       switch($_type)
+                       {
+                       case 'xmlrpc':
+                               $xml_functions = array(
+                                       'read' => array(
+                                               'function'  => 'read',
+                                               'signature' => 
array(array(xmlrpcArray,xmlrpcArray)),
+                                               'docstring' => 'Get list of 
meters'
+                                       ),
+                               );
+                               return $xml_functions;
+                               break;
+                       case 'soap':
+                               return $this->soap_functions;
+                               break;
+                       default:
+                               return array();
+                               break;
+                       }
+               }
+
+
+               function read($data = array())
+               {
+                       $this->entity_id        = isset($data['entity_id']) && 
$data['entity_id'] ? $data['entity_id'] : $this->entity_id;
+                       $this->cat_id           = isset($data['cat_id']) && 
$data['cat_id'] ? $data['cat_id'] : $this->cat_id;
+                       $acl_location           = 
".entity.{$this->entity_id}.{$this->cat_id}";
+                       
+                       if(!$this->acl->check($acl_location, PHPGW_ACL_READ, 
'property'))
+                       {
+                               return array('error' => 'sorry: no access to 
this function');
+                       }
+                       
+                       $soentity                       = 
CreateObject('property.soentity',$this->entity_id,$this->cat_id);
+                       $soentity->type         = $this->type;
+                       
+
+                       if(isset($this->allrows))
+                       {
+                               $data['allrows'] = true;
+                       }
+
+                       $custom = createObject('phpgwapi.custom_fields');
+                       $attrib_data = 
$custom->find('property',$this->acl_location, 0, '','','',true, true);
+
+                       $attrib_filter = array();
+                       if($attrib_data)
+                       {
+                               foreach ( $attrib_data as $attrib )
+                               {
+                                       if($attrib['datatype'] == 'LB' || 
$attrib['datatype'] == 'R')
+                                       {
+                                               if($_attrib_filter_value = 
phpgw::get_var($attrib['column_name'], 'int'))
+                                               {
+                                                       $attrib_filter[] = 
"fm_{$this->type}_{$this->entity_id}_{$this->cat_id}.{$attrib['column_name']} = 
'{$_attrib_filter_value}'";
+                                               }
+                                       }
+                                       else if($attrib['datatype'] == 'CH')
+                                       {
+                                               if($_attrib_filter_value = 
phpgw::get_var($attrib['column_name'], 'int'))
+                                               {
+                                                       $attrib_filter[] = 
"fm_{$this->type}_{$this->entity_id}_{$this->cat_id}.{$attrib['column_name']} 
{$GLOBALS['phpgw']->db->like} '%,{$_attrib_filter_value},%'";
+                                               }
+                                       }
+                               }
+                       }
+
+                       $criteria = array
+                       (
+                               'start'                 => 
isset($data['start']) && $data['start'] ? (int)$data['start'] : 0,
+                               'query'                 => 
isset($data['query']) ? $data['query'] : '',
+                               'sort'                  => isset($data['sort']) 
? $data['sort'] : '',
+                               'order'                 => 
isset($data['order']) ? $data['order'] : '',
+                               'filter'                => 
isset($data['filter']) ? $data['filter'] : '',
+                               'cat_id'                => $this->cat_id,
+                               'district_id'   => isset($data['district_id']) 
&& $data['district_id'] ? (int)$data['district_id'] : 0,
+                               'lookup'                => 
isset($data['lookup'])?$data['lookup']:'',
+                               'allrows'               => 
isset($data['allrows'])?$data['allrows']:'',
+                               'entity_id'             => 
(int)$this->entity_id,
+                               'cat_id'                => (int)$this->cat_id,
+                               'status'                => 
isset($data['status']) ? $data['status'] : '',
+                               'start_date'    => 
phpgwapi_datetime::date_to_timestamp($data['start_date']),
+                               'end_date'              => 
phpgwapi_datetime::date_to_timestamp($data['end_date']),
+                               'dry_run'               => $data['dry_run'],
+                               'type'                  => $data['type'],
+                               'location_code' => 
isset($data['location_code']) ? $data['location_code'] : '',
+                               'criteria_id'   => $data['criteria_id'],
+                               'attrib_filter' => $attrib_filter,
+                               'p_num'                 => $this->p_num
+                       );
+
+                       $values = $soentity->read($criteria);
+//_debug_array($values);                               
+                       foreach($values as &$entry)
+                       {
+                               $entry['address'] = 
utf8_decode($entry['address']);
+                               $entry['user_id'] = 
utf8_decode($entry['user_id']);
+                       }
+
+                       return $values;
+               }
+       }

Modified: branches/Version-1_0-branch/property/inc/class.uitts.inc.php
===================================================================
--- branches/Version-1_0-branch/property/inc/class.uitts.inc.php        
2011-06-01 13:17:17 UTC (rev 7338)
+++ branches/Version-1_0-branch/property/inc/class.uitts.inc.php        
2011-06-01 13:22:03 UTC (rev 7339)
@@ -1870,6 +1870,8 @@
                                'entity_data'   => 
(isset($values['p'])?$values['p']:'')
                        ));
 
+                       
+//                     $ticket['contact_id'] = 
$GLOBALS['phpgw']->accounts->get($this->account)->person_id;
                        
$contact_data=$this->bocommon->initiate_ui_contact_lookup(array(
                                'contact_id'            => 
$ticket['contact_id'],
                                'field'                         => 'contact',




reply via email to

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