fmsystem-commits
[Top][All Lists]
Advanced

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

[Fmsystem-commits] [15885] More on eventplanner


From: sigurdne
Subject: [Fmsystem-commits] [15885] More on eventplanner
Date: Sat, 22 Oct 2016 15:22:29 +0000 (UTC)

Revision: 15885
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=15885
Author:   sigurdne
Date:     2016-10-22 15:22:29 +0000 (Sat, 22 Oct 2016)
Log Message:
-----------
More on eventplanner

Modified Paths:
--------------
    trunk/eventplanner/inc/class.uiapplication.inc.php
    trunk/eventplanner/inc/class.uicommon.inc.php
    trunk/eventplanner/js/portico/application.edit.js
    trunk/eventplanner/setup/tables_current.inc.php
    trunk/eventplanner/templates/base/application.xsl

Added Paths:
-----------
    trunk/eventplanner/inc/class.bobooking.inc.php
    trunk/eventplanner/inc/class.sobooking.inc.php
    trunk/eventplanner/inc/class.uibooking.inc.php
    trunk/eventplanner/inc/model/class.booking.inc.php
    trunk/eventplanner/js/portico/booking.index.js
    trunk/eventplanner/templates/base/booking.xsl

Added: trunk/eventplanner/inc/class.bobooking.inc.php
===================================================================
--- trunk/eventplanner/inc/class.bobooking.inc.php                              
(rev 0)
+++ trunk/eventplanner/inc/class.bobooking.inc.php      2016-10-22 15:22:29 UTC 
(rev 15885)
@@ -0,0 +1,104 @@
+<?php
+       /**
+        * phpGroupWare
+        *
+        * @author Sigurd Nes <address@hidden>
+        * @copyright Copyright (C) 2016 Free Software Foundation 
http://www.fsf.org/
+        * @license http://www.gnu.org/licenses/gpl.html GNU General Public 
License v2 or later
+        * @internal
+        * @package eventplanner
+        * @subpackage booking
+        * @version $Id:$
+        */
+
+       /*
+          This program 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.
+
+          This program 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 Lesser General Public License for more details.
+
+          You should have received a copy of the GNU General Public License
+          along with this program.  If not, see <http://www.gnu.org/licenses/>.
+        */
+
+       phpgw::import_class('eventplanner.bocommon');
+       phpgw::import_class('eventplanner.sobooking');
+
+       include_class('eventplanner', 'booking', 'inc/model/');
+
+       class eventplanner_bobooking extends eventplanner_bocommon
+       {
+               protected static
+                       $bo,
+                       $fields,
+                       $acl_location;
+
+               public function __construct()
+               {
+                       $this->fields = eventplanner_booking::get_fields();
+                       $this->acl_location = 
eventplanner_booking::acl_location;
+               }
+
+               /**
+                * Implementing classes must return an instance of itself.
+                *
+                * @return the class instance.
+                */
+               public static function get_instance()
+               {
+                       if (self::$bo == null)
+                       {
+                               self::$bo = new eventplanner_bobooking();
+                       }
+                       return self::$bo;
+               }
+
+               public function store($object)
+               {
+                       $this->store_pre_commit($object);
+                       $ret = 
eventplanner_sobooking::get_instance()->store($object);
+                       $this->store_post_commit($object);
+                       return $ret;
+               }
+
+               public function read($params)
+               {
+                       if(empty($params['filters']['active']))
+                       {
+                               $params['filters']['active'] = 1;
+                       }
+                       else
+                       {
+                               unset($params['filters']['active']);
+                       }
+                       $values =  
eventplanner_sobooking::get_instance()->read($params);
+                       $dateformat = 
$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'];
+                       foreach ($values['results'] as &$entry)
+                       {
+                               $entry['created'] = 
$GLOBALS['phpgw']->common->show_date($entry['created']);
+                               $entry['modified'] = 
$GLOBALS['phpgw']->common->show_date($entry['modified']);
+                               $entry['from_'] = 
$GLOBALS['phpgw']->common->show_date($entry['from_']);
+                               $entry['to_'] = 
$GLOBALS['phpgw']->common->show_date($entry['to_']);
+                       }
+                       return $values;
+               }
+
+               public function read_single($id, $return_object = true)
+               {
+                       if ($id)
+                       {
+                               $values = 
eventplanner_sobooking::get_instance()->read_single($id, $return_object);
+                       }
+                       else
+                       {
+                               $values = new eventplanner_booking();
+                       }
+
+                       return $values;
+               }
+       }
\ No newline at end of file

Added: trunk/eventplanner/inc/class.sobooking.inc.php
===================================================================
--- trunk/eventplanner/inc/class.sobooking.inc.php                              
(rev 0)
+++ trunk/eventplanner/inc/class.sobooking.inc.php      2016-10-22 15:22:29 UTC 
(rev 15885)
@@ -0,0 +1,116 @@
+<?php
+       /**
+        * phpGroupWare - property: a part of a Facilities Management System.
+        *
+        * @author Sigurd Nes <address@hidden>
+        * @copyright Copyright (C) 2016 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/ and Nordlandssykehuset
+        * @package eventplanner
+        * @subpackage booking
+        * @version $Id: $
+        */
+       phpgw::import_class('phpgwapi.socommon');
+
+       class eventplanner_sobooking extends phpgwapi_socommon
+       {
+
+               protected static $so;
+
+               public function __construct()
+               {
+                       parent::__construct('eventplanner_booking', 
eventplanner_booking::get_fields());
+               }
+
+               /**
+                * Implementing classes must return an instance of itself.
+                *
+                * @return the class instance.
+                */
+               public static function get_instance()
+               {
+                       if (self::$so == null)
+                       {
+                               self::$so = 
CreateObject('eventplanner.sobooking');
+                       }
+                       return self::$so;
+               }
+
+
+               protected function populate( array $data )
+               {
+                       $object = new eventplanner_booking();
+                       foreach ($this->fields as $field => $field_info)
+                       {
+                               $object->set_field($field, $data[$field]);
+                       }
+
+                       return $object;
+               }
+
+               protected function update( $object )
+               {
+                       $this->db->transaction_begin();
+       //              $status_text = eventplanner_booking::get_status_list();
+                       $dateformat = 
$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'];
+                       $lang_active = lang('active');
+                       $lang_inactive = lang('inactive');
+
+                       $original = 
$this->read_single($object->get_id());//returned as array()
+                       foreach ($this->fields as $field => $params)
+                       {
+                               $new_value = $object->$field;
+                               $old_value = $original[$field];
+                               if (!empty($params['history']) && ($new_value 
!= $old_value))
+                               {
+                                       $label = !empty($params['label']) ? 
lang($params['label']) : $field;
+                                       switch ($field)
+                                       {
+                                               case 'status':
+                                                       $old_value = 
$status_text[$old_value];
+                                                       $new_value = 
$status_text[$new_value];
+                                                       break;
+                                               case 'active':
+                                                       $old_value = $old_value 
? $lang_active : $lang_inactive;
+                                                       $new_value = $new_value 
? $lang_active : $lang_inactive;
+                                                       break;
+                                               default:
+                                                       break;
+                                       }
+                                       $value_set = array
+                                       (
+                                               'booking_id'    => 
$object->get_id(),
+                                               'time'          => time(),
+                                               'author'        => 
$GLOBALS['phpgw_info']['user']['fullname'],
+                                               'comment'       => $label . ':: 
' . lang('old value') . ': ' . $this->db->db_addslashes($old_value) . ', ' 
.lang('new value') . ': ' . $this->db->db_addslashes($new_value),
+                                               'type'  => 'history',
+                                       );
+
+                                       $this->db->query( 'INSERT INTO 
eventplanner_booking_comment (' .  implode( ',', array_keys( $value_set ) )   . 
') VALUES ('
+                                       . $this->db->validate_insert( 
array_values( $value_set ) ) . ')',__LINE__,__FILE__);
+                               }
+
+                       }
+
+                       parent::update($object);
+
+                       return  $this->db->transaction_commit();
+               }
+
+       }
\ No newline at end of file

Modified: trunk/eventplanner/inc/class.uiapplication.inc.php
===================================================================
--- trunk/eventplanner/inc/class.uiapplication.inc.php  2016-10-22 10:32:18 UTC 
(rev 15884)
+++ trunk/eventplanner/inc/class.uiapplication.inc.php  2016-10-22 15:22:29 UTC 
(rev 15885)
@@ -234,6 +234,11 @@
                                'link' => '#demands',
                                'function' => "set_tab('demands')"
                        );
+                       $tabs['calendar'] = array(
+                               'label' => lang('calendar'),
+                               'link' => '#calendar',
+                               'function' => "set_tab('calendar')"
+                       );
 
                        $bocommon = CreateObject('property.bocommon');
 
@@ -263,7 +268,7 @@
                                array('key' => 'author', 'label' => 
lang('User'), 'sortable' => true, 'resizeable' => true),
                                array('key' => 'comment', 'label' => 
lang('Note'), 'sortable' => true, 'resizeable' => true)
                        );
- 
+
                        $datatable_def[] = array(
                                'container' => 'datatable-container_0',
                                'requestUrl' => "''",
@@ -275,6 +280,69 @@
                                )
                        );
 
+                       $dates_def = array(
+                               array('key' => 'id',  'hidden' => true),
+                               array('key' => 'from_', 'label' => 
lang('From'), 'sortable' => false, 'resizeable' => true),
+                               array('key' => 'to_', 'label' => lang('To'), 
'sortable' => false, 'resizeable' => true),
+                               array('key' => 'active', 'label' => 
lang('active'), 'sortable' => false, 'resizeable' => true),
+                               array('key' => 'where', 'label' => 
lang('where'), 'sortable' => false, 'resizeable' => true),
+                               array('key' => 'customer_name', 'label' => 
lang('who'), 'sortable' => true, 'resizeable' => true),
+                               array('key' => 'comment', 'label' => 
lang('Note'), 'sortable' => false, 'resizeable' => true),
+                               array('key' => 'application_id', 'hidden' => 
true),
+                       );
+
+                       $tabletools = array(
+                               array(
+                                       'my_name' => 'add',
+                                       'text' => lang('add'),
+                                       'type' => 'custom',
+                                       'className' => 'add',
+                                       'custom_code' => "
+                                                               add_booking();"
+                               ),
+                               array('my_name' => 'select_all'),
+                               array('my_name' => 'select_none'),
+                               array(
+                                       'my_name' => 'enable',
+                                       'text' => lang('enable'),
+                                       'type' => 'custom',
+                                       'custom_code' => "
+                                                               
onActionsClick('enable');"
+                               ),
+                               array(
+                                       'my_name' => 'disable',
+                                       'text' => lang('disable'),
+                                       'type' => 'custom',
+                                       'custom_code' => "
+                                                               
onActionsClick('disable');"
+                               ),
+                               array(
+                                       'my_name' => 'edit',
+                                       'text' => lang('edit'),
+                                       'type' => 'custom',
+                                       'custom_code' => "
+                                                               
onActionsClick('edit');"
+                               )
+                       );
+
+                       $datatable_def[] = array(
+                               'container' => 'datatable-container_1',
+                               'requestUrl' => 
json_encode(self::link(array('menuaction' => 'eventplanner.uibooking.query',
+                                       'filter_application_id' => $id,
+                                       'filter_active' => 1,
+                                       'phpgw_return_as' => 'json'))),
+//                             'requestUrl' => "''",
+                               'tabletools' => $tabletools,
+                               'ColumnDefs' => $dates_def,
+                               'data' => json_encode(array()),
+                               'config' => array(
+                                       array('disableFilter' => true),
+                                       array('disablePagination' => true)
+                               )
+                       );
+                       $GLOBALS['phpgw']->jqcal->add_listener('from_', 
'datetime');
+                       $GLOBALS['phpgw']->jqcal->add_listener('to_', 
'datetime');
+
                        $application_type_list = 
execMethod('eventplanner.bogeneric.get_list', array('type' => 
'application_type'));
                        $types = (array)$application->types;
                        if($types)

Added: trunk/eventplanner/inc/class.uibooking.inc.php
===================================================================
--- trunk/eventplanner/inc/class.uibooking.inc.php                              
(rev 0)
+++ trunk/eventplanner/inc/class.uibooking.inc.php      2016-10-22 15:22:29 UTC 
(rev 15885)
@@ -0,0 +1,230 @@
+<?php
+/**
+        * phpGroupWare - eventplanner: a part of a Facilities Management 
System.
+        *
+        * @author Sigurd Nes <address@hidden>
+        * @copyright Copyright (C) 2016 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 booking was funded by 
http://www.bergen.kommune.no/ and Nordlandssykehuset
+        * @package eventplanner
+        * @subpackage booking
+        * @version $Id: $
+        */
+       phpgw::import_class('eventplanner.uicommon');
+       phpgw::import_class('phpgwapi.datetime');
+
+       include_class('eventplanner', 'booking', 'inc/model/');
+
+       class eventplanner_uibooking extends eventplanner_uicommon
+       {
+
+               public $public_functions = array(
+                       'add' => true,
+                       'index' => true,
+                       'query' => true,
+                       'view' => true,
+                       'edit' => true,
+                       'save' => true,
+                       'save_ajax'     => true
+               );
+
+               protected
+                       $fields,
+                       $permissions;
+
+               public function __construct()
+               {
+                       parent::__construct();
+                       self::set_active_menu('eventplanner::booking');
+                       $GLOBALS['phpgw_info']['flags']['app_header'] .= '::' . 
lang('booking');
+                       $this->bo = createObject('eventplanner.bobooking');
+                       $this->fields = eventplanner_booking::get_fields();
+                       $this->permissions = 
eventplanner_booking::get_instance()->get_permission_array();
+               }
+
+
+               public function index()
+               {
+                       if (empty($this->permissions[PHPGW_ACL_READ]))
+                       {
+                               phpgw::no_access();
+                       }
+
+                       if (phpgw::get_var('phpgw_return_as') == 'json')
+                       {
+                               return $this->query();
+                       }
+
+                       phpgwapi_jquery::load_widget('autocomplete');
+
+                       $function_msg = lang('booking');
+
+                       $data = array(
+                               'datatable_name' => $function_msg,
+                               'form' => array(
+                                       'toolbar' => array(
+                                               'item' => array(
+                                                       array(
+                                                               'type' => 
'autocomplete',
+                                                               'name' => 
'application',
+                                                               'app' => 
'eventplanner',
+                                                               'ui' => 
'application',
+                                                               'label_attr' => 
'title',
+                                                               'text' => 
lang('application') . ':',
+                                                               
'requestGenerator' => 'requestWithApplicationFilter'
+                                                       ),
+                                                       array(
+                                                               'type' => 
'checkbox',
+                                                               'name' => 
'filter_active',
+                                                               'text' => 
lang('showall'),
+                                                               'value' =>  1,
+                                                               'checked'=> 1,
+                                                       )
+                                               )
+                                       )
+                               ),
+                               'datatable' => array(
+                                       'source' => self::link(array(
+                                               'menuaction' => 
'eventplanner.uibooking.index',
+                                               'phpgw_return_as' => 'json'
+                                       )),
+                                       'allrows' => true,
+                                       'new_item' => 
self::link(array('menuaction' => 'eventplanner.uibooking.add')),
+                                       'editor_action' => '',
+                                       'field' => parent::_get_fields()
+                               )
+                       );
+
+                       $parameters = array(
+                               'parameter' => array(
+                                       array(
+                                               'name' => 'id',
+                                               'source' => 'id'
+                                       )
+                               )
+                       );
+
+                       $data['datatable']['actions'][] = array
+                               (
+                               'my_name' => 'view',
+                               'text' => lang('show'),
+                               'action' => 
$GLOBALS['phpgw']->link('/index.php', array
+                                       (
+                                       'menuaction' => 
'eventplanner.uibooking.view'
+                               )),
+                               'parameters' => json_encode($parameters)
+                       );
+
+                       $data['datatable']['actions'][] = array
+                               (
+                               'my_name' => 'edit',
+                               'text' => lang('edit'),
+                               'action' => 
$GLOBALS['phpgw']->link('/index.php', array
+                                       (
+                                       'menuaction' => 
'eventplanner.uibooking.edit'
+                               )),
+                               'parameters' => json_encode($parameters)
+                       );
+
+                       self::add_javascript('eventplanner', 'portico', 
'booking.index.js');
+                       phpgwapi_jquery::load_widget('numberformat');
+
+                       self::render_template_xsl('datatable_jquery', $data);
+               }
+
+               /*
+                * Edit the price item with the id given in the http variable 
'id'
+                */
+
+               public function edit( $values = array(), $mode = 'edit' )
+               {
+                       $active_tab = !empty($values['active_tab']) ? 
$values['active_tab'] : phpgw::get_var('active_tab', 'string', 'REQUEST', 
'first_tab');
+                       $GLOBALS['phpgw_info']['flags']['app_header'] .= '::' . 
lang('edit');
+                       if (empty($this->permissions[PHPGW_ACL_ADD]))
+                       {
+                               phpgw::no_access();
+                       }
+
+                       if (!empty($values['object']))
+                       {
+                               $booking = $values['object'];
+                       }
+                       else
+                       {
+                               $id = !empty($values['id']) ? $values['id'] : 
phpgw::get_var('id', 'int');
+                               $booking = $this->bo->read_single($id);
+                       }
+
+                       $tabs = array();
+                       $tabs['first_tab'] = array(
+                               'label' => lang('booking'),
+                               'link' => '#first_tab',
+                               'function' => "set_tab('first_tab')"
+                       );
+
+                       $bocommon = CreateObject('property.bocommon');
+
+                       $comments = (array)$booking->comments;
+                       foreach ($comments as $key => &$comment)
+                       {
+                               $comment['value_count'] = $key +1;
+                               $comment['value_date'] = 
$GLOBALS['phpgw']->common->show_date($comment['time']);
+                       }
+
+                       $comments_def = array(
+                               array('key' => 'from_', 'label' => 
lang('From'), 'sortable' => false, 'resizeable' => true),
+                               array('key' => 'to_', 'label' => lang('To'), 
'sortable' => false, 'resizeable' => true),
+                               array('key' => 'author', 'label' => 
lang('User'), 'sortable' => false, 'resizeable' => true),
+                               array('key' => 'comment', 'label' => 
lang('Note'), 'sortable' => false, 'resizeable' => true)
+                       );
+ 
+                       $datatable_def[] = array(
+                               'container' => 'datatable-container_0',
+                               'requestUrl' => "''",
+                               'ColumnDefs' => $comments_def,
+                               'data' => json_encode($comments),
+                               'config' => array(
+                                       array('disableFilter' => true),
+                                       array('disablePagination' => true)
+                               )
+                       );
+
+                       $data = array(
+                               'datatable_def' => $datatable_def,
+                               'form_action' => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'eventplanner.uibooking.save')),
+                               'cancel_url' => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'eventplanner.uibooking.index',)),
+                               'booking' => $booking,
+                               'mode' => $mode,
+                               'tabs' => 
phpgwapi_jquery::tabview_generate($tabs, $active_tab),
+                               'value_active_tab' => $active_tab
+                       );
+                       phpgwapi_jquery::formvalidator_generate(array());
+                       self::add_javascript('eventplanner', 'portico', 
'booking.edit.js');
+                       self::render_template_xsl(array('booking', 
'datatable_inline'), array($mode => $data));
+               }
+               
+               public function save()
+               {
+                       parent::save();
+               }
+               public function save_ajax()
+               {
+                       return parent::save(true);
+               }
+       }
\ No newline at end of file

Modified: trunk/eventplanner/inc/class.uicommon.inc.php
===================================================================
--- trunk/eventplanner/inc/class.uicommon.inc.php       2016-10-22 10:32:18 UTC 
(rev 15884)
+++ trunk/eventplanner/inc/class.uicommon.inc.php       2016-10-22 15:22:29 UTC 
(rev 15885)
@@ -112,7 +112,7 @@
                        $this->edit();
                }
 
-               public function save()
+               public function save($ajax = false)
                {
                        $called_class = get_called_class();
 
@@ -135,23 +135,59 @@
                        {
                                if($object->store($object))
                                {
-                                       
phpgwapi_cache::message_set(lang('messages_saved_form'), 'message');
-                                       self::redirect(array(
-                                               'menuaction' => 
"{$this->called_class_arr[0]}.{$this->called_class_arr[1]}.edit",
-                                               'id'            => 
$object->get_id(),
-                                               'active_tab' => $active_tab
-                                               )
-                                       );
+                                       if($ajax)
+                                       {
+                                               
phpgwapi_cache::session_clear('phpgwapi', 'phpgw_messages');
+                                               return array(
+                                                       'status_kode' => 'ok',
+                                                       'status' => lang('ok'),
+                                                       'msg' => 
lang('messages_saved_form')
+                                               );
+                                       }
+                                       else
+                                       {
+                                               
phpgwapi_cache::message_set(lang('messages_saved_form'), 'message');
+                                               self::redirect(array(
+                                                       'menuaction' => 
"{$this->called_class_arr[0]}.{$this->called_class_arr[1]}.edit",
+                                                       'id'            => 
$object->get_id(),
+                                                       'active_tab' => 
$active_tab
+                                                       )
+                                               );
+                                       }
                                }
                                else
                                {
-                                       
phpgwapi_cache::message_set(lang('messages_form_error'), 'error');
-                                       $this->edit(array('object'      => 
$object, 'active_tab' => $active_tab));
+                                       if($ajax)
+                                       {
+                                               
phpgwapi_cache::session_clear('phpgwapi', 'phpgw_messages');
+                                               return array(
+                                                       'status_kode' => 
'error',
+                                                       'status' => 
lang('error'),
+                                                       'msg' => 
lang('messages_form_error')
+                                               );
+                                       }
+                                       else
+                                       {
+                                               
phpgwapi_cache::message_set(lang('messages_form_error'), 'error');
+                                               $this->edit(array('object'      
=> $object, 'active_tab' => $active_tab));
+                                       }
                                }
                        }
                        else
                        {
-                               $this->edit(array('object'      => $object, 
'active_tab' => $active_tab));
+                               if($ajax)
+                               {
+                                       
phpgwapi_cache::session_clear('phpgwapi', 'phpgw_messages');
+                                       return array(
+                                               'status_kode' => 'error',
+                                               'status' => lang('error'),
+                                               'msg' => lang('Did not 
validate')
+                                       );
+                               }
+                               else
+                               {
+                                       $this->edit(array('object'      => 
$object, 'active_tab' => $active_tab));
+                               }
                        }
                }
 

Added: trunk/eventplanner/inc/model/class.booking.inc.php
===================================================================
--- trunk/eventplanner/inc/model/class.booking.inc.php                          
(rev 0)
+++ trunk/eventplanner/inc/model/class.booking.inc.php  2016-10-22 15:22:29 UTC 
(rev 15885)
@@ -0,0 +1,224 @@
+<?php
+       /**
+        * phpGroupWare - eventplanner: a part of a Facilities Management 
System.
+        *
+        * @author Sigurd Nes <address@hidden>
+        * @copyright Copyright (C) 2016 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/ and Nordlandssykehuset
+        * @package eventplanner
+        * @subpackage booking
+        * @version $Id: $
+        */
+
+       phpgw::import_class('eventplanner.bobooking');
+
+       include_class('phpgwapi', 'model', 'inc/model/');
+
+       class eventplanner_booking extends phpgwapi_model
+       {
+
+               const STATUS_REGISTERED = 1;
+               const STATUS_PENDING = 2;
+               const STATUS_REJECTED = 3;
+               const STATUS_APPROVED = 4;
+               const acl_location = '.booking';
+
+               protected
+                       $id,
+                       $active,
+                       $completed,
+                       $cost,
+                       $from_,
+                       $to_,
+                       $application_id,
+                       $application_name,
+                       $customer_id,
+                       $customer_name,
+                       $created,
+                       $secret;
+
+               protected $field_of_responsibility_name = '.booking';
+
+               public function __construct( int $id = null )
+               {
+                       parent::__construct((int)$id);
+                       $this->field_of_responsibility_name = 
self::acl_location;
+               }
+
+               /**
+                * Implementing classes must return an instance of itself.
+                *
+                * @return the class instance.
+                */
+               public static function get_instance()
+               {
+                       return new eventplanner_booking();
+               }
+
+               public static function get_status_list()
+               {
+                       return array(
+                               self::STATUS_REGISTERED => lang('registered'),
+                               self::STATUS_PENDING    => lang('pending'),
+                               self::STATUS_REJECTED => lang('rejected'),
+                               self::STATUS_APPROVED   => lang('approved')
+                       );
+               }
+
+               public static function get_fields($debug = true)
+               {
+                        $fields = array(
+                               'id' => array('action'=> PHPGW_ACL_READ,
+                                       'type' => 'int',
+                                       'label' => 'id',
+                                       'sortable'=> true,
+                                       'formatter' => 
'JqueryPortico.formatLink',
+                                       ),
+                               'active' => array('action'=> PHPGW_ACL_ADD | 
PHPGW_ACL_EDIT,
+                                       'type' => 'int',
+                                       'history'       => true
+                                       ),
+                               'completed' => array('action'=>  PHPGW_ACL_EDIT,
+                                       'type' => 'int',
+                                       'history'       => true
+                                       ),
+                               'cost' => array('action'=>  PHPGW_ACL_ADD | 
PHPGW_ACL_EDIT,
+                                       'type' => 'decimal'
+                                       ),
+                               'from_' => array('action'=> PHPGW_ACL_READ | 
PHPGW_ACL_ADD | PHPGW_ACL_EDIT,
+                                       'type' => 'date',
+                                       'label' => 'from',
+                                       'history' => true,
+                                       'required' => true,
+                                       ),
+                               'to_' => array('action'=> PHPGW_ACL_READ | 
PHPGW_ACL_ADD | PHPGW_ACL_EDIT,
+                                       'type' => 'date',
+                                       'label' => 'to',
+                                       'history' => true,
+                                       'required' => true,
+                               ),
+                               'application_id' => array('action'=> 
PHPGW_ACL_ADD | PHPGW_ACL_EDIT,
+                                       'type' => 'int',
+                                       'label' => 'application',
+                                       'sortable' => true,
+                                       'required' => true,
+                                       ),
+                               'application_name' => array('action'=>  
PHPGW_ACL_READ,
+                                       'type' => 'string',
+                                       'query' => true,
+                                       'label' => 'application',
+                                       'join' => array(
+                                               'table' => 
'eventplanner_application',
+                                               'fkey' => 'application_id',
+                                               'key' => 'id',
+                                               'column' => 'title'
+                                               )
+                                       ),
+                               'customer_id' => array('action'=> PHPGW_ACL_ADD 
| PHPGW_ACL_EDIT,
+                                       'type' => 'int',
+                                       'label' => 'customer',
+                                       'sortable' => true,
+                                       'history' => true,
+                                       ),
+                               'customer_name' => array('action'=>  
PHPGW_ACL_READ,
+                                       'type' => 'string',
+                                       'query' => true,
+                                       'label' => 'customer',
+                                       'join' => array(
+                                               'table' => 
'eventplanner_customer',
+                                               'fkey' => 'customer_id',
+                                               'key' => 'id',
+                                               'column' => 'name'
+                                               )
+                                       ),
+                               'created' => array('action'=> PHPGW_ACL_READ,
+                                       'type' => 'date',
+                                       'label' => 'created',
+                                       'sortable' => true,
+                                       ),
+                               'secret' => array('action'=> PHPGW_ACL_ADD,
+                                       'type' => 'string',
+                                       'label' => 'secret',
+                                       'sortable' => false,
+                                       ),
+                               );
+
+                       if($debug)
+                       {
+                               foreach ($fields as $field => $field_info)
+                               {
+                                       
if(!property_exists('eventplanner_booking', $field))
+                                       {
+                                          
phpgwapi_cache::message_set('$'."{$field},", 'error');
+                                       }
+
+                               }
+                       }
+                       return $fields;
+               }
+
+               /**
+                * Implement in subclasses to perform actions on entity before 
validation
+                */
+               protected function preValidate( &$entity )
+               {
+                       if (!empty($entity->comment))
+                       {
+                               $entity->comment_input = array(
+                                       'time' => time(),
+                                       'author' => 
$GLOBALS['phpgw_info']['user']['fullname'],
+                                       'comment' => $entity->comment,
+                                       'type' => 'comment'
+                               );
+                       }
+
+                       $entity->modified = time();
+                       $entity->active = (int)$entity->active;
+
+                       if($entity->get_id())
+                       {
+                       }
+                       else
+                       {
+                               $entity->status = 
eventplanner_booking::STATUS_REGISTERED;
+                               $entity->secret = self::generate_secret();
+                       }
+               }
+
+               protected function generate_secret( $length = 10 )
+               {
+                       return substr(base64_encode(rand(1000000000, 
9999999999)), 0, $length);
+               }
+
+               public function serialize()
+               {
+                       return self::toArray();
+               }
+
+               public function store()
+               {
+                       return 
eventplanner_bobooking::get_instance()->store($this);
+               }
+
+               public function read_single($id)
+               {
+                       return 
eventplanner_bobooking::get_instance()->read_single($id, true);
+               }
+       }

Modified: trunk/eventplanner/js/portico/application.edit.js
===================================================================
--- trunk/eventplanner/js/portico/application.edit.js   2016-10-22 10:32:18 UTC 
(rev 15884)
+++ trunk/eventplanner/js/portico/application.edit.js   2016-10-22 15:22:29 UTC 
(rev 15885)
@@ -27,29 +27,100 @@
 
        calculate_stage_size();
 
-       $.formUtils.addValidator({
-               name: 'naming',
-               validatorFunction: function (value, $el, config, languaje, 
$form)
+//     $.formUtils.addValidator({
+//             name: 'naming',
+//             validatorFunction: function (value, $el, config, languaje, 
$form)
+//             {
+//                     var v = false;
+//                     var firstname = $('#firstname').val();
+//                     var lastname = $('#lastname').val();
+//                     var company_name = $('#company_name').val();
+//                     var department = $('#department').val();
+//                     if ((firstname != "" && lastname != "") || 
(company_name != "" && department != ""))
+//                     {
+//                             v = true;
+//                     }
+//                     return v;
+//             },
+//             errorMessage: lang['Name or company is required'],
+//             errorMessageKey: ''
+//     });
+
+
+       $("#from_").change(function ()
+       {
+               $("#to_").val($("#from_").val());
+       });
+
+       var width = 200;
+
+       $("#submitbox").css({
+               position: 'absolute',
+               right: '10px',
+               border: '1px solid #B5076D',
+               padding: '0 5px 5px 5px',
+               width: width + 'px',
+               "background - color": '#FFF',
+               display: "block",
+       });
+
+       var offset = $("#submitbox").offset();
+       var topPadding = 180;
+
+       if ($("#center_content").length === 1)
+       {
+               $("#center_content").scroll(function ()
                {
-                       var v = false;
-                       var firstname = $('#firstname').val();
-                       var lastname = $('#lastname').val();
-                       var company_name = $('#company_name').val();
-                       var department = $('#department').val();
-                       if ((firstname != "" && lastname != "") || 
(company_name != "" && department != ""))
+                       if ($("#center_content").scrollTop() > offset.top)
                        {
-                               v = true;
+                               $("#submitbox").stop().animate({
+                                       marginTop: 
$("#center_content").scrollTop() - offset.top + topPadding
+                               }, 100);
                        }
-                       return v;
-               },
-               errorMessage: lang['Name or company is required'],
-               errorMessageKey: ''
-       });
+                       else
+                       {
+                               $("#submitbox").stop().animate({
+                                       marginTop: 0
+                               }, 100);
+                       }
+                       ;
+               });
+       }
+       else
+       {
+               $(window).scroll(function ()
+               {
+                       if ($(window).scrollTop() > offset.top)
+                       {
+                               $("#submitbox").stop().animate({
+                                       marginTop: $(window).scrollTop() - 
offset.top + topPadding
+                               }, 100);
+                       }
+                       else
+                       {
+                               $("#submitbox").stop().animate({
+                                       marginTop: 0
+                               }, 100);
+                       }
+                       ;
+               });
+       }
+
 });
 
 function set_tab(tab)
 {
        $("#active_tab").val(tab);
+       if (tab === 'calendar')
+       {
+               $("#floating-box").hide();
+               $("#submit_group_bottom").hide();
+       }
+       else
+       {
+               $("#floating-box").show();
+               $("#submit_group_bottom").show();
+       }
 }
 
 function calculate_total_amount()
@@ -59,7 +130,7 @@
        var number_of_units = $("#number_of_units").val();
        var charge_per_unit = $("#charge_per_unit").val();
 
-       if(charge_per_unit && number_of_units)
+       if (charge_per_unit && number_of_units)
        {
                total_amount = number_of_units * charge_per_unit;
        }
@@ -73,10 +144,114 @@
        var stage_width = $("#stage_width").val();
        var stage_depth = $("#stage_depth").val();
 
-       if(stage_width && stage_depth)
+       if (stage_width && stage_depth)
        {
                total_size = stage_width * stage_depth;
        }
        $("#stage_size").val(total_size);
 }
 
+add_booking = function ()
+{
+       oArgs = {
+               menuaction: 'eventplanner.uibooking.save_ajax',
+               application_id: $("#application_id").val()
+       };
+
+       var requestUrl = phpGWLink('index.php', oArgs, true);
+       var htmlString = '';
+       $("#receipt").html("");
+
+       $.ajax({
+               type: 'POST',
+               dataType: 'json',
+               data: {from_: $("#from_").val(), to_: $("#to_").val(), active: 
1},
+               url: requestUrl,
+               success: function (data)
+               {
+                       if (data != null)
+                       {
+                               if (data.status_kode == 'ok')
+                               {
+                                       $("#from_").val('');
+                                       $("#to_").val('');
+                                       htmlString += "<div 
class=\"msg_good\">";
+                               }
+                               else
+                               {
+                                       htmlString += "<div class=\"error\">";
+                               }
+                               htmlString += data.msg;
+                               htmlString += '</div>';
+                               $("#receipt").html(htmlString);
+                       }
+               }
+       });
+       JqueryPortico.updateinlineTableHelper('datatable-container_1');
+};
+
+this.onActionsClick = function (action)
+{
+       $("#receipt").html("");
+       if (action === 'add')
+       {
+               add_booking();
+       }
+
+       var api = $('#datatable-container_1').dataTable().api();
+       var selected = api.rows({selected: true}).data();
+
+       var numSelected = selected.length;
+
+       if (numSelected === 0)
+       {
+               alert('None selected');
+               return false;
+       }
+       var ids = [];
+       for (var n = 0; n < selected.length; ++n)
+       {
+               var aData = selected[n];
+               ids.push(aData['id']);
+       }
+
+       if (ids.length > 0)
+       {
+               var data = {"ids": ids, "action": action, from_: 
$("#from_").val(), to_: $("#to_").val()};
+
+               oArgs = {
+                       menuaction: 'eventplanner.uibooking.update',
+                       application_id: $("#application_id").val()
+               };
+
+               var requestUrl = phpGWLink('index.php', oArgs, true);
+
+               $.ajax({
+                       type: 'POST',
+                       dataType: 'json',
+                       url: requestUrl,
+                       data: data,
+                       success: function (data)
+                       {
+                               if (data != null)
+                               {
+                                       if (data.status_kode == 'ok')
+                                       {
+                                               $("#from_").val('');
+                                               $("#to_").val('');
+                                               htmlString += "<div 
class=\"msg_good\">";
+                                       }
+                                       else
+                                       {
+                                               htmlString += "<div 
class=\"error\">";
+                                       }
+                                       htmlString += data.msg;
+                                       htmlString += '</div>';
+                                       $("#receipt").html(htmlString);
+                               }
+                       }
+               });
+
+               JqueryPortico.updateinlineTableHelper('datatable-container_4');
+       }
+};

Added: trunk/eventplanner/js/portico/booking.index.js
===================================================================
--- trunk/eventplanner/js/portico/booking.index.js                              
(rev 0)
+++ trunk/eventplanner/js/portico/booking.index.js      2016-10-22 15:22:29 UTC 
(rev 15885)
@@ -0,0 +1,4 @@
+function requestWithApplicationFilter(request)
+{
+       return request// +  '&filter_active=1';
+}

Modified: trunk/eventplanner/setup/tables_current.inc.php
===================================================================
--- trunk/eventplanner/setup/tables_current.inc.php     2016-10-22 10:32:18 UTC 
(rev 15884)
+++ trunk/eventplanner/setup/tables_current.inc.php     2016-10-22 15:22:29 UTC 
(rev 15885)
@@ -267,11 +267,12 @@
                                'to_' => array('type' => 'int', 'precision' => 
'8', 'nullable' => False),
                                'active' => array('type' => 'int', 'precision' 
=> 4, 'nullable' => False, 'default' => '1'),
                                'completed' => array('type' => 'int', 
'precision' => 4, 'nullable' => False,'default' => '0'),
-                               'cost' => array('type' => 'decimal', 
'precision' => 10, 'scale' => 2, 'nullable' => True,'default' => '0.0'),
+                               'cost' => array('type' => 'decimal', 
'precision' => 20, 'scale' => 2, 'nullable' => True,'default' => '0.00'),
                                'application_id' => array('type' => 'int', 
'precision' => 4, 'nullable' => True),
                                'reminder' => array('type' => 'int', 
'precision' => 4, 'nullable' => False, 'default' => '0'),
                                'secret' => array('type' => 'text', 'nullable' 
=> False),
-                               'sms_total' => array('type' => 'int', 
'precision' => 4, 'nullable' => True)
+                               'sms_total' => array('type' => 'int', 
'precision' => 4, 'nullable' => True),
+                               'created' => array('type' => 'int', 'precision' 
=> '8',  'nullable' => False, 'default' => 'current_timestamp'),
                        ),
                        'pk' => array('id'),
                        'fk' => array(

Modified: trunk/eventplanner/templates/base/application.xsl
===================================================================
--- trunk/eventplanner/templates/base/application.xsl   2016-10-22 10:32:18 UTC 
(rev 15884)
+++ trunk/eventplanner/templates/base/application.xsl   2016-10-22 15:22:29 UTC 
(rev 15885)
@@ -18,10 +18,19 @@
 
 <!-- add / edit  -->
 <xsl:template xmlns:php="http://php.net/xsl"; match="edit">
+       <style type="text/css">
+               #floating-box {
+               position: relative;
+               z-index: 1000;
+               }
+               #submitbox {
+               display: none;
+               }       </style>
        <xsl:variable name="date_format">
                <xsl:value-of select="php:function('get_phpgw_info', 
'user|preferences|common|dateformat')" />
        </xsl:variable>
 
+       <div id='receipt'></div>
        <div>
                <xsl:variable name="form_action">
                        <xsl:value-of select="form_action"/>
@@ -33,6 +42,39 @@
                <form id="form" name="form" method="post" 
action="{$form_action}" class="pure-form pure-form-aligned">
                        <div id="tab-content">
                                <xsl:value-of disable-output-escaping="yes" 
select="tabs"/>
+                               <div id="floating-box">
+                               <div id="submitbox">
+                                       <table width="200px">
+                                               <tbody>
+                                                       <tr>
+                                                               <td 
width="200px">
+                                                                       
<xsl:variable name="lang_savel">
+                                                                               
<xsl:value-of select="php:function('lang', 'save')"/>
+                                                                       
</xsl:variable>
+                                                                       <input 
type="submit" class="pure-button pure-button-primary" name="save">
+                                                                               
<xsl:attribute name="value">
+                                                                               
        <xsl:value-of select="$lang_savel"/>
+                                                                               
</xsl:attribute>
+                                                                               
<xsl:attribute name="title">
+                                                                               
        <xsl:value-of select="$lang_savel"/>
+                                                                               
</xsl:attribute>
+                                                                       </input>
+                                                               </td>
+                                                               <td>
+                                                                       
<xsl:variable name="lang_cancel">
+                                                                               
<xsl:value-of select="php:function('lang', 'cancel')"/>
+                                                                       
</xsl:variable>
+                                                                       <input 
type="button" class="pure-button pure-button-primary" name="done" 
value="{$lang_cancel}" onClick="window.location = '{cancel_url}';">
+                                                                               
<xsl:attribute name="title">
+                                                                               
        <xsl:value-of select="php:function('lang', 'Back to the ticket list')"/>
+                                                                               
</xsl:attribute>
+                                                                       </input>
+                                                               </td>
+                                                       </tr>
+                                               </tbody>
+                                       </table>
+                               </div>
+                       </div>
                                <input type="hidden" id="active_tab" 
name="active_tab" value="{value_active_tab}"/>
                                <div id="first_tab">
                                        <fieldset>
@@ -41,7 +83,7 @@
                                                                <label>
                                                                        
<xsl:value-of select="php:function('lang', 'id')"/>
                                                                </label>
-                                                               <input 
type="hidden" name="id" value="{application/id}"/>
+                                                               <input 
type="hidden" id="application_id" name="id" value="{application/id}"/>
                                                                <xsl:value-of 
select="application/id"/>
                                                        </div>
                                                </xsl:if>
@@ -645,8 +687,70 @@
                                                </div>
                                        </fieldset>
                                </div>
+                               <div id='calendar'>
+                                       <fieldset>
+                                       
+                                               <div class="pure-control-group">
+                                                       <label>
+                                                               <xsl:value-of 
select="php:function('lang', 'date start')"/>
+                                                       </label>
+                                                       <xsl:if 
test="application/date_start != 0 and application/date_start != ''">
+                                                               <xsl:value-of 
select="php:function('date', $date_format, number(application/date_start))"/>
+                                                       </xsl:if>
+                                               </div>
+                                               <div class="pure-control-group">
+                                                       <label>
+                                                               <xsl:value-of 
select="php:function('lang', 'date end')"/>
+                                                       </label>
+                                                       <xsl:if 
test="application/date_end != 0 and application/date_end != ''">
+                                                               <xsl:value-of 
select="php:function('date', $date_format, number(application/date_end))"/>
+                                                       </xsl:if>
+                                               </div>
+
+                                               <div class="pure-control-group">
+                                                       <label>
+                                                               <xsl:value-of 
select="php:function('lang', 'from')"/>
+                                                       </label>
+                                                       <input type="text" 
id="from_" name="from_" size="16" readonly="readonly">
+                                                       </input>
+                                               </div>
+                                               <div class="pure-control-group">
+                                                       <label>
+                                                               <xsl:value-of 
select="php:function('lang', 'to')"/>
+                                                       </label>
+                                                       <input type="text" 
id="to_" name="to_" size="16" readonly="readonly">
+                                                       </input>
+                                               </div>
+
+                                               <div class="pure-control-group">
+                                                       <label>
+                                                               <xsl:value-of 
select="php:function('lang', 'dates')"/>
+                                                       </label>
+                                                       <div 
class="pure-custom">
+                                                               <xsl:for-each 
select="datatable_def">
+                                                                       <xsl:if 
test="container = 'datatable-container_1'">
+                                                                               
<xsl:call-template name="table_setup">
+                                                                               
        <xsl:with-param name="container" select ='container'/>
+                                                                               
        <xsl:with-param name="requestUrl" select ='requestUrl'/>
+                                                                               
        <xsl:with-param name="ColumnDefs" select ='ColumnDefs'/>
+                                                                               
        <xsl:with-param name="tabletools" select ='tabletools'/>
+                                                                               
        <xsl:with-param name="data" select ='data'/>
+                                                                               
        <xsl:with-param name="config" select ='config'/>
+                                                                               
</xsl:call-template>
+                                                                       
</xsl:if>
+                                                               </xsl:for-each>
+                                                       </div>
+                                               </div>
+
+
+                                       </fieldset>
+
+
+
+                               </div>
+
                        </div>
-                       <div class="proplist-col">
+                       <div id="submit_group_bottom" class="proplist-col">
                                <input type="submit" class="pure-button 
pure-button-primary" name="save">
                                        <xsl:attribute name="value">
                                                <xsl:value-of 
select="php:function('lang', 'save')"/>

Added: trunk/eventplanner/templates/base/booking.xsl
===================================================================
--- trunk/eventplanner/templates/base/booking.xsl                               
(rev 0)
+++ trunk/eventplanner/templates/base/booking.xsl       2016-10-22 15:22:29 UTC 
(rev 15885)
@@ -0,0 +1,302 @@
+
+<!-- $Id: price_item.xsl 12604 2015-01-15 17:06:11Z nelson224 $ -->
+<xsl:template match="data">
+       <xsl:choose>
+               <xsl:when test="edit">
+                       <xsl:apply-templates select="edit" />
+               </xsl:when>
+               <xsl:when test="view">
+                       <xsl:apply-templates select="view" />
+               </xsl:when>
+       </xsl:choose>
+
+</xsl:template>
+
+<!-- add / edit  -->
+<xsl:template xmlns:php="http://php.net/xsl"; match="edit">
+       <xsl:variable name="date_format">
+               <xsl:value-of select="php:function('get_phpgw_info', 
'user|preferences|common|dateformat')" />
+       </xsl:variable>
+       <xsl:variable name="form_action">
+               <xsl:value-of select="form_action"/>
+       </xsl:variable>
+       <xsl:variable name="mode">
+               <xsl:value-of select="mode"/>
+       </xsl:variable>
+
+       <div>
+               <script type="text/javascript">
+                       var lang = <xsl:value-of 
select="php:function('js_lang', 'Name or company is required')"/>;
+               </script>
+               <form id="form" name="form" method="post" 
action="{$form_action}" class="pure-form pure-form-aligned">
+                       <div id="tab-content">
+                               <xsl:value-of disable-output-escaping="yes" 
select="tabs"/>
+                               <input type="hidden" id="active_tab" 
name="active_tab" value="{value_active_tab}"/>
+                               <div id="first_tab">
+                                       <fieldset>
+                                               <xsl:if test="booking/id > 0">
+                                                       <div 
class="pure-control-group">
+                                                               <label>
+                                                                       
<xsl:value-of select="php:function('lang', 'id')"/>
+                                                               </label>
+                                                               <input 
type="hidden" name="id" value="{booking/id}"/>
+                                                               <xsl:value-of 
select="booking/id"/>
+                                                       </div>
+                                               </xsl:if>
+                                               <div class="pure-control-group">
+                                                       <label>
+                                                               <xsl:value-of 
select="php:function('lang', 'active')"/>
+                                                       </label>
+                                                       <input type="checkbox" 
name="active" id="active" value="1">
+                                                               <xsl:if 
test="booking/active = 1">
+                                                                       
<xsl:attribute name="checked" value="checked"/>
+                                                               </xsl:if>
+                                                       </input>
+                                               </div>
+                                               <div class="pure-control-group">
+                                                       <xsl:variable 
name="lang_category">
+                                                               <xsl:value-of 
select="php:function('lang', 'category')"/>
+                                                       </xsl:variable>
+                                                       <label>
+                                                               <xsl:value-of 
select="$lang_category"/>
+                                                       </label>
+                                                       <select 
name="category_id">
+                                                               <xsl:attribute 
name="title">
+                                                                       
<xsl:value-of select="$lang_category"/>
+                                                               </xsl:attribute>
+                                                               <xsl:attribute 
name="data-validation">
+                                                                       
<xsl:text>required</xsl:text>
+                                                               </xsl:attribute>
+                                                               <xsl:attribute 
name="data-validation-error-msg">
+                                                                       
<xsl:value-of select="$lang_category"/>
+                                                               </xsl:attribute>
+                                                               
<xsl:apply-templates select="category_list/options"/>
+                                                       </select>
+                                               </div>
+                                               <div class="pure-control-group">
+                                                       <label>
+                                                               <xsl:value-of 
select="php:function('lang', 'name')"/>
+                                                       </label>
+                                                       <input type="text" 
name="name" value="{booking/name}">
+                                                               <xsl:attribute 
name="data-validation">
+                                                                       
<xsl:text>required</xsl:text>
+                                                               </xsl:attribute>
+                                                               <xsl:attribute 
name="placeholder">
+                                                                       
<xsl:value-of select="php:function('lang', 'name')"/>
+                                                               </xsl:attribute>
+                                                       </input>
+                                               </div>
+                                               <div class="pure-control-group">
+                                                       <xsl:variable 
name="lang_address_1">
+                                                               <xsl:value-of 
select="php:function('lang', 'address_1')"/>
+                                                       </xsl:variable>
+                                                       <xsl:variable 
name="lang_address_2">
+                                                               <xsl:value-of 
select="php:function('lang', 'address_2')"/>
+                                                       </xsl:variable>
+                                                       <label>
+                                                               <xsl:value-of 
select="php:function('lang', 'address')"/>
+                                                       </label>
+                                                       <input type="text" 
name="address_1" value="{booking/address_1}">
+                                                               <xsl:attribute 
name="data-validation">
+                                                                       
<xsl:text>required</xsl:text>
+                                                               </xsl:attribute>
+                                                               <xsl:attribute 
name="placeholder">
+                                                                       
<xsl:value-of select="$lang_address_1"/>
+                                                               </xsl:attribute>
+
+                                                       </input>
+                                                       <input type="text" 
name="address_2" value="{booking/address_2}">
+                                                               <xsl:attribute 
name="data-validation">
+                                                                       
<xsl:text>required</xsl:text>
+                                                               </xsl:attribute>
+                                                               <xsl:attribute 
name="placeholder">
+                                                                       
<xsl:value-of select="$lang_address_2"/>
+                                                               </xsl:attribute>
+                                                       </input>
+                                               </div>
+                                               <div class="pure-control-group">
+                                                       <label>
+                                                               <xsl:value-of 
select="php:function('lang', 'postal_code_place')"/>
+                                                       </label>
+                                                       <input type="text" 
name="zip_code" value="{booking/zip_code}">
+                                                               <xsl:attribute 
name="data-validation">
+                                                                       
<xsl:text>required</xsl:text>
+                                                               </xsl:attribute>
+                                                               <xsl:attribute 
name="placeholder">
+                                                                       
<xsl:value-of select="php:function('lang', 'zip_code')"/>
+                                                               </xsl:attribute>
+                                                       </input>
+                                                       <input type="text" 
name="city" value="{booking/city}">
+                                                               <xsl:attribute 
name="data-validation">
+                                                                       
<xsl:text>required</xsl:text>
+                                                               </xsl:attribute>
+                                                               <xsl:attribute 
name="placeholder">
+                                                                       
<xsl:value-of select="php:function('lang', 'city')"/>
+                                                               </xsl:attribute>
+                                                       </input>
+                                               </div>
+                                               <div class="pure-control-group">
+                                                       <label>
+                                                               <xsl:value-of 
select="php:function('lang', 'booking_organization_number')"/>
+                                                       </label>
+                                                       <input type="text" 
id="lastname" name="booking_organization_number" 
value="{booking/booking_organization_number}">
+                                                               <xsl:attribute 
name="data-validation">
+                                                                       
<xsl:text>required</xsl:text>
+                                                               </xsl:attribute>
+                                                               <xsl:attribute 
name="placeholder">
+                                                                       
<xsl:value-of select="php:function('lang', 'booking_organization_number')"/>
+                                                               </xsl:attribute>
+                                                       </input>
+                                               </div>
+                                               <div class="pure-control-group">
+                                                       <label>
+                                                               <xsl:value-of 
select="php:function('lang', 'contact name')"/>
+                                                       </label>
+                                                       <input type="text" 
name="contact_name" value="{booking/contact_name}">
+                                                               <xsl:attribute 
name="data-validation">
+                                                                       
<xsl:text>required</xsl:text>
+                                                               </xsl:attribute>
+                                                               <xsl:attribute 
name="placeholder">
+                                                                       
<xsl:value-of select="php:function('lang', 'contact_name')"/>
+                                                               </xsl:attribute>
+                                                       </input>
+                                               </div>
+                                               <div class="pure-control-group">
+                                                       <label>
+                                                               <xsl:value-of 
select="php:function('lang', 'email')"/>
+                                                       </label>
+                                                       <input type="text" 
name="contact_email" id="contact_email" value="{booking/contact_email}">
+                                                               <xsl:attribute 
name="data-validation">
+                                                                       
<xsl:text>email</xsl:text>
+                                                               </xsl:attribute>
+                                                               <xsl:attribute 
name="placeholder">
+                                                                       
<xsl:value-of select="php:function('lang', 'email')"/>
+                                                               </xsl:attribute>
+                                                       </input>
+                                                       <xsl:choose>
+                                                               <xsl:when 
test="valid_email = 1">
+                                                                       
<xsl:text> </xsl:text>
+                                                                       <a 
href="{link_create_user}">
+                                                                               
<xsl:value-of select="php:function('lang', 'create_user_based_on_email_link')"/>
+                                                                       </a>
+                                                               </xsl:when>
+                                                       </xsl:choose>
+                                               </div>
+                                               <div class="pure-control-group">
+                                                       <label>
+                                                               <xsl:value-of 
select="php:function('lang', 'contact phone')"/>
+                                                       </label>
+                                                       <input type="text" 
name="contact_phone" value="{booking/contact_phone}">
+                                                               <xsl:attribute 
name="data-validation">
+                                                                       
<xsl:text>required</xsl:text>
+                                                               </xsl:attribute>
+                                                               <xsl:attribute 
name="placeholder">
+                                                                       
<xsl:value-of select="php:function('lang', 'contact_phone')"/>
+                                                               </xsl:attribute>
+                                                       </input>
+                                               </div>
+                                               <div class="pure-control-group">
+                                                       <label>
+                                                               <xsl:value-of 
select="php:function('lang', 'account_number')"/>
+                                                       </label>
+                                                       <input type="text" 
name="account_number" value="{booking/account_number}">
+                                                               <xsl:attribute 
name="data-validation">
+                                                                       
<xsl:text>required</xsl:text>
+                                                               </xsl:attribute>
+                                                               <xsl:attribute 
name="placeholder">
+                                                                       
<xsl:value-of select="php:function('lang', 'account_number')"/>
+                                                               </xsl:attribute>
+                                                       </input>
+                                               </div>
+                                               <div class="pure-control-group">
+                                                       <label>
+                                                               <xsl:value-of 
select="php:function('lang', 'description')"/>
+                                                       </label>
+                                                       <textarea cols="47" 
rows="7" name="description">
+                                                               <xsl:value-of 
select="booking/description"/>
+                                                       </textarea>
+                                               </div>
+                                               <div class="pure-control-group">
+                                                       <label>
+                                                               <xsl:value-of 
select="php:function('lang', 'remark')"/>
+                                                       </label>
+                                                       <textarea cols="47" 
rows="7" name="remark">
+                                                               <xsl:value-of 
select="booking/remark"/>
+                                                       </textarea>
+                                               </div>
+                                               <div class="pure-control-group">
+                                                       <label>
+                                                               <xsl:value-of 
select="php:function('lang', 'comment')"/>
+                                                       </label>
+                                                       <textarea cols="47" 
rows="7" name="comment">
+                                                               <xsl:value-of 
select="booking/comment"/>
+                                                       </textarea>
+                                               </div>
+                                               <div class="pure-control-group">
+                                                       <label>
+                                                               <xsl:value-of 
select="php:function('lang', 'details')"/>
+                                                       </label>
+                                                       <div 
class="pure-custom">
+                                                               <xsl:for-each 
select="datatable_def">
+                                                                       <xsl:if 
test="container = 'datatable-container_0'">
+                                                                               
<xsl:call-template name="table_setup">
+                                                                               
        <xsl:with-param name="container" select ='container'/>
+                                                                               
        <xsl:with-param name="requestUrl" select ='requestUrl'/>
+                                                                               
        <xsl:with-param name="ColumnDefs" select ='ColumnDefs'/>
+                                                                               
        <xsl:with-param name="data" select ='data'/>
+                                                                               
        <xsl:with-param name="config" select ='config'/>
+                                                                               
</xsl:call-template>
+                                                                       
</xsl:if>
+                                                               </xsl:for-each>
+                                                       </div>
+                                               </div>
+                                       </fieldset>
+                               </div>
+                       </div>
+                       <div class="proplist-col">
+                               <input type="submit" class="pure-button 
pure-button-primary" name="save">
+                                       <xsl:attribute name="value">
+                                               <xsl:value-of 
select="php:function('lang', 'save')"/>
+                                       </xsl:attribute>
+                               </input>
+                               <xsl:variable name="cancel_url">
+                                       <xsl:value-of select="cancel_url"/>
+                               </xsl:variable>
+                               <input type="button" class="pure-button 
pure-button-primary" name="cancel" onClick="window.location = '{cancel_url}';">
+                                       <xsl:attribute name="value">
+                                               <xsl:value-of 
select="php:function('lang', 'cancel')"/>
+                                       </xsl:attribute>
+                               </input>
+                       </div>
+               </form>
+       </div>
+</xsl:template>
+
+<xsl:template match="options">
+       <option value="{id}">
+               <xsl:if test="selected != 0">
+                       <xsl:attribute name="selected" value="selected"/>
+               </xsl:if>
+               <xsl:value-of disable-output-escaping="yes" select="name"/>
+       </option>
+</xsl:template>
+
+
+<xsl:template xmlns:php="http://php.net/xsl"; match="view">
+       <div>
+               <form id="form" name="form" method="post" action="" 
class="pure-form pure-form-aligned">
+                       <div id="tab-content">
+                               <xsl:value-of disable-output-escaping="yes" 
select="tabs"/>
+                               <div id="showing">
+
+                               </div>
+                       </div>
+                       <div class="proplist-col">
+                               <xsl:variable name="cancel_url">
+                                       <xsl:value-of select="cancel_url"/>
+                               </xsl:variable>
+                               <input type="button" class="pure-button 
pure-button-primary" name="cancel" value="{lang_cancel}" 
onMouseout="window.status='';return true;" onClick="window.location = 
'{cancel_url}';"/>
+                       </div>
+               </form>
+       </div>
+</xsl:template>




reply via email to

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