fmsystem-commits
[Top][All Lists]
Advanced

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

[Fmsystem-commits] [7337] bkbooking: added posibility to upload document


From: Kjell Arne Espedal
Subject: [Fmsystem-commits] [7337] bkbooking: added posibility to upload documentation + more logging on event when sending notification to users
Date: Wed, 01 Jun 2011 12:30:38 +0000

Revision: 7337
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=7337
Author:   kjell
Date:     2011-06-01 12:30:37 +0000 (Wed, 01 Jun 2011)
Log Message:
-----------
bkbooking: added posibility to upload documentation + more logging on event 
when sending notification to users

Modified Paths:
--------------
    trunk/booking/inc/class.menu.inc.php
    trunk/booking/inc/class.uiallocation.inc.php
    trunk/booking/inc/class.uidocument.inc.php
    trunk/booking/inc/class.uievent.inc.php
    trunk/booking/setup/phpgw_no.lang
    trunk/booking/setup/setup.inc.php
    trunk/booking/setup/tables_current.inc.php
    trunk/booking/setup/tables_update.inc.php
    trunk/bookingfrontend/setup/phpgw_no.lang
    trunk/bookingfrontend/setup/setup.inc.php
    trunk/phpgwapi/setup/phpgw_no.lang
    trunk/phpgwapi/templates/bkbooking/head.inc.php

Added Paths:
-----------
    trunk/booking/inc/class.bodocumentation.inc.php
    trunk/booking/inc/class.sodocumentation.inc.php
    trunk/booking/inc/class.uidocumentation.inc.php
    trunk/booking/templates/base/documentation_form.xsl
    trunk/bookingfrontend/inc/class.uidocumentation.inc.php

Added: trunk/booking/inc/class.bodocumentation.inc.php
===================================================================
--- trunk/booking/inc/class.bodocumentation.inc.php                             
(rev 0)
+++ trunk/booking/inc/class.bodocumentation.inc.php     2011-06-01 12:30:37 UTC 
(rev 7337)
@@ -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();
+               }
+               
+       }


Property changes on: trunk/booking/inc/class.bodocumentation.inc.php
___________________________________________________________________
Added: svn:executable
   + *

Modified: trunk/booking/inc/class.menu.inc.php
===================================================================
--- trunk/booking/inc/class.menu.inc.php        2011-06-01 11:49:50 UTC (rev 
7336)
+++ trunk/booking/inc/class.menu.inc.php        2011-06-01 12:30:37 UTC (rev 
7337)
@@ -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'),

Added: trunk/booking/inc/class.sodocumentation.inc.php
===================================================================
--- trunk/booking/inc/class.sodocumentation.inc.php                             
(rev 0)
+++ trunk/booking/inc/class.sodocumentation.inc.php     2011-06-01 12:30:37 UTC 
(rev 7337)
@@ -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;
+               }
+       }


Property changes on: trunk/booking/inc/class.sodocumentation.inc.php
___________________________________________________________________
Added: svn:executable
   + *

Modified: trunk/booking/inc/class.uiallocation.inc.php
===================================================================
--- trunk/booking/inc/class.uiallocation.inc.php        2011-06-01 11:49:50 UTC 
(rev 7336)
+++ trunk/booking/inc/class.uiallocation.inc.php        2011-06-01 12:30:37 UTC 
(rev 7337)
@@ -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: trunk/booking/inc/class.uidocument.inc.php
===================================================================
--- trunk/booking/inc/class.uidocument.inc.php  2011-06-01 11:49:50 UTC (rev 
7336)
+++ trunk/booking/inc/class.uidocument.inc.php  2011-06-01 12:30:37 UTC (rev 
7337)
@@ -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'));

Added: trunk/booking/inc/class.uidocumentation.inc.php
===================================================================
--- trunk/booking/inc/class.uidocumentation.inc.php                             
(rev 0)
+++ trunk/booking/inc/class.uidocumentation.inc.php     2011-06-01 12:30:37 UTC 
(rev 7337)
@@ -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(); }
+       }


Property changes on: trunk/booking/inc/class.uidocumentation.inc.php
___________________________________________________________________
Added: svn:executable
   + *

Modified: trunk/booking/inc/class.uievent.inc.php
===================================================================
--- trunk/booking/inc/class.uievent.inc.php     2011-06-01 11:49:50 UTC (rev 
7336)
+++ trunk/booking/inc/class.uievent.inc.php     2011-06-01 12:30:37 UTC (rev 
7337)
@@ -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: trunk/booking/setup/phpgw_no.lang
===================================================================
--- trunk/booking/setup/phpgw_no.lang   2011-06-01 11:49:50 UTC (rev 7336)
+++ trunk/booking/setup/phpgw_no.lang   2011-06-01 12:30:37 UTC (rev 7337)
@@ -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: trunk/booking/setup/setup.inc.php
===================================================================
--- trunk/booking/setup/setup.inc.php   2011-06-01 11:49:50 UTC (rev 7336)
+++ trunk/booking/setup/setup.inc.php   2011-06-01 12:30:37 UTC (rev 7337)
@@ -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: trunk/booking/setup/tables_current.inc.php
===================================================================
--- trunk/booking/setup/tables_current.inc.php  2011-06-01 11:49:50 UTC (rev 
7336)
+++ trunk/booking/setup/tables_current.inc.php  2011-06-01 12:30:37 UTC (rev 
7337)
@@ -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: trunk/booking/setup/tables_update.inc.php
===================================================================
--- trunk/booking/setup/tables_update.inc.php   2011-06-01 11:49:50 UTC (rev 
7336)
+++ trunk/booking/setup/tables_update.inc.php   2011-06-01 12:30:37 UTC (rev 
7337)
@@ -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'];
+               }
+       }
+
+
+

Added: trunk/booking/templates/base/documentation_form.xsl
===================================================================
--- trunk/booking/templates/base/documentation_form.xsl                         
(rev 0)
+++ trunk/booking/templates/base/documentation_form.xsl 2011-06-01 12:30:37 UTC 
(rev 7337)
@@ -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>


Property changes on: trunk/booking/templates/base/documentation_form.xsl
___________________________________________________________________
Added: svn:executable
   + *

Added: trunk/bookingfrontend/inc/class.uidocumentation.inc.php
===================================================================
--- trunk/bookingfrontend/inc/class.uidocumentation.inc.php                     
        (rev 0)
+++ trunk/bookingfrontend/inc/class.uidocumentation.inc.php     2011-06-01 
12:30:37 UTC (rev 7337)
@@ -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: trunk/bookingfrontend/setup/phpgw_no.lang
===================================================================
--- trunk/bookingfrontend/setup/phpgw_no.lang   2011-06-01 11:49:50 UTC (rev 
7336)
+++ trunk/bookingfrontend/setup/phpgw_no.lang   2011-06-01 12:30:37 UTC (rev 
7337)
@@ -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: trunk/bookingfrontend/setup/setup.inc.php
===================================================================
--- trunk/bookingfrontend/setup/setup.inc.php   2011-06-01 11:49:50 UTC (rev 
7336)
+++ trunk/bookingfrontend/setup/setup.inc.php   2011-06-01 12:30:37 UTC (rev 
7337)
@@ -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: trunk/phpgwapi/setup/phpgw_no.lang
===================================================================
--- trunk/phpgwapi/setup/phpgw_no.lang  2011-06-01 11:49:50 UTC (rev 7336)
+++ trunk/phpgwapi/setup/phpgw_no.lang  2011-06-01 12:30:37 UTC (rev 7337)
@@ -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: trunk/phpgwapi/templates/bkbooking/head.inc.php
===================================================================
--- trunk/phpgwapi/templates/bkbooking/head.inc.php     2011-06-01 11:49:50 UTC 
(rev 7336)
+++ trunk/phpgwapi/templates/bkbooking/head.inc.php     2011-06-01 12:30:37 UTC 
(rev 7337)
@@ -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(),




reply via email to

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