fmsystem-commits
[Top][All Lists]
Advanced

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

[Fmsystem-commits] [16212] more on eventplanner


From: sigurdne
Subject: [Fmsystem-commits] [16212] more on eventplanner
Date: Tue, 31 Jan 2017 11:01:33 -0500 (EST)

Revision: 16212
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=16212
Author:   sigurdne
Date:     2017-01-31 11:01:32 -0500 (Tue, 31 Jan 2017)
Log Message:
-----------
more on eventplanner

Modified Paths:
--------------
    trunk/eventplanner/inc/class.menu.inc.php
    trunk/eventplanner/inc/class.soapplication.inc.php
    trunk/eventplanner/inc/class.socustomer.inc.php
    trunk/eventplanner/setup/phpgw_no.lang
    trunk/eventplanner/setup/setup.inc.php
    trunk/eventplanner/setup/tables_current.inc.php
    trunk/eventplanner/setup/tables_update.inc.php
    trunk/eventplannerfrontend/inc/model/class.metasettings.inc.php
    trunk/eventplannerfrontend/templates/base/metasettings.xsl
    trunk/phpgwapi/templates/frontend/css/frontend.css
    trunk/phpgwapi/templates/frontend/head.inc.php

Added Paths:
-----------
    trunk/eventplanner/inc/class.bopermission.inc.php
    trunk/eventplanner/inc/class.sopermission.inc.php
    trunk/eventplanner/inc/class.uipermission.inc.php
    trunk/eventplanner/inc/model/class.permission.inc.php
    trunk/eventplanner/js/portico/permission.edit.js
    trunk/eventplanner/templates/base/permission.xsl

Added: trunk/eventplanner/inc/class.bopermission.inc.php
===================================================================
--- trunk/eventplanner/inc/class.bopermission.inc.php                           
(rev 0)
+++ trunk/eventplanner/inc/class.bopermission.inc.php   2017-01-31 16:01:32 UTC 
(rev 16212)
@@ -0,0 +1,123 @@
+<?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 permission
+        * @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('phpgwapi.bocommon');
+       phpgw::import_class('eventplanner.sopermission');
+
+       include_class('eventplanner', 'permission', 'inc/model/');
+
+       class eventplanner_bopermission extends phpgwapi_bocommon
+       {
+               protected static
+                       $bo,
+                       $fields,
+                       $acl_location;
+
+               public function __construct()
+               {
+                       $this->fields = eventplanner_permission::get_fields();
+                       $this->acl_location = 
eventplanner_permission::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_bopermission();
+                       }
+                       return self::$bo;
+               }
+
+               public function store($object)
+               {
+                       $this->store_pre_commit($object);
+                       $ret = 
eventplanner_sopermission::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']);
+                       }
+
+                       $organization_number = 
phpgw::get_var('organization_number', 'bool');
+                       $values =  
eventplanner_sopermission::get_instance()->read($params);
+       //              $status_text = 
eventplanner_permission::get_status_list();
+                       $dateformat = 
$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'];
+                       foreach ($values['results'] as &$entry)
+                       {
+       //                              $entry['status'] = 
$status_text[$entry['status']];
+                                       if($organization_number)
+                                       {
+                                               $entry['name'] .= " 
[{$entry['organization_number']}]";
+                                       }
+                                       $entry['created'] = 
$GLOBALS['phpgw']->common->show_date($entry['created']);
+                                       $entry['modified'] = 
$GLOBALS['phpgw']->common->show_date($entry['modified']);
+                       }
+                       return $values;
+               }
+
+               public function read_single($id, $return_object = true)
+               {
+                       phpgw::import_class('eventplanner.sovendor');
+                       phpgw::import_class('eventplanner.socustomer');
+
+                       if ($id)
+                       {
+                               $values = 
eventplanner_sopermission::get_instance()->read_single($id, $return_object);
+                               //Temporary hack...
+                               if($values->object_type == 'vendor')
+                               {
+                                       $object = 
eventplanner_sovendor::get_instance()->read_single($values->object_id, 
$return_object);
+                               }
+                               if($values->object_type == 'customer')
+                               {
+                                       $object = 
eventplanner_socustomer::get_instance()->read_single($values->object_id, 
$return_object);
+                               }
+                               $values->object_name = $object->name;
+                       }
+                       else
+                       {
+                               $values = new eventplanner_permission();
+                       }
+
+                       return $values;
+               }
+       }
\ No newline at end of file

Modified: trunk/eventplanner/inc/class.menu.inc.php
===================================================================
--- trunk/eventplanner/inc/class.menu.inc.php   2017-01-30 19:40:01 UTC (rev 
16211)
+++ trunk/eventplanner/inc/class.menu.inc.php   2017-01-31 16:01:32 UTC (rev 
16212)
@@ -73,6 +73,11 @@
                                                'url' => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'preferences.uiadmin_acl.list_acl',
                                                        'acl_app' => 
'eventplanner'))
                                        ),
+                                       'permission'    => array
+                                       (
+                                               'text'  => lang('permission'),
+                                               'url'   => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'eventplanner.uipermission.index') )
+                                       ),
                                        'list_atrribs' => array(
                                                'text' => 
$GLOBALS['phpgw']->translation->translate('custom fields', array(), true),
                                                'url' => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'admin.ui_custom.list_attribute',

Modified: trunk/eventplanner/inc/class.soapplication.inc.php
===================================================================
--- trunk/eventplanner/inc/class.soapplication.inc.php  2017-01-30 19:40:01 UTC 
(rev 16211)
+++ trunk/eventplanner/inc/class.soapplication.inc.php  2017-01-31 16:01:32 UTC 
(rev 16212)
@@ -112,8 +112,9 @@
 
                                if($this->currentapp == 'eventplannerfrontend')
                                {
+                                       $where = $clause ? 'OR' : 'AND';
                                        $org_id = 
phpgw::get_var('org_id','string' , 'SESSION', -1);
-                                       $clause .= " AND 
eventplanner_vendor.organization_number = '{$org_id}'";
+                                       $clause .= " {$where} 
eventplanner_vendor.organization_number = '{$org_id}'";
                                }
 
                                if($paranthesis)

Modified: trunk/eventplanner/inc/class.socustomer.inc.php
===================================================================
--- trunk/eventplanner/inc/class.socustomer.inc.php     2017-01-30 19:40:01 UTC 
(rev 16211)
+++ trunk/eventplanner/inc/class.socustomer.inc.php     2017-01-31 16:01:32 UTC 
(rev 16212)
@@ -27,6 +27,7 @@
         * @version $Id: $
         */
        phpgw::import_class('phpgwapi.socommon');
+       include_class('eventplanner', 'customer', 'inc/model/');
 
        class eventplanner_socustomer extends phpgwapi_socommon
        {

Added: trunk/eventplanner/inc/class.sopermission.inc.php
===================================================================
--- trunk/eventplanner/inc/class.sopermission.inc.php                           
(rev 0)
+++ trunk/eventplanner/inc/class.sopermission.inc.php   2017-01-31 16:01:32 UTC 
(rev 16212)
@@ -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/
+        * @package eventplanner
+        * @subpackage permission
+        * @version $Id: $
+        */
+       phpgw::import_class('phpgwapi.socommon');
+
+       class eventplanner_sopermission extends phpgwapi_socommon
+       {
+
+               protected static $so;
+
+               public function __construct()
+               {
+                       parent::__construct('eventplanner_permission', 
eventplanner_permission::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.sopermission');
+                       }
+                       return self::$so;
+               }
+
+
+               protected function populate( array $data )
+               {
+                       $object = new eventplanner_permission();
+                       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_permission::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
+                                       (
+                                               'permission_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_permission_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

Added: trunk/eventplanner/inc/class.uipermission.inc.php
===================================================================
--- trunk/eventplanner/inc/class.uipermission.inc.php                           
(rev 0)
+++ trunk/eventplanner/inc/class.uipermission.inc.php   2017-01-31 16:01:32 UTC 
(rev 16212)
@@ -0,0 +1,233 @@
+<?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 permission was funded by 
http://www.bergen.kommune.no/
+        * @package eventplanner
+        * @subpackage permission
+        * @version $Id: $
+        */
+       phpgw::import_class('phpgwapi.uicommon');
+       phpgw::import_class('phpgwapi.datetime');
+
+       include_class('eventplanner', 'permission', 'inc/model/');
+
+       class eventplanner_uipermission extends phpgwapi_uicommon
+       {
+
+               public $public_functions = array(
+                       'add' => true,
+                       'index' => true,
+                       'query' => true,
+                       'view' => true,
+                       'edit' => true,
+                       'save' => true,
+                       'object'        => true
+               );
+
+               protected
+                       $fields,
+                       $permissions,
+                       $currentapp;
+
+               public function __construct()
+               {
+                       parent::__construct();
+                       $GLOBALS['phpgw_info']['flags']['app_header'] .= '::' . 
lang('permission');
+                       $this->bo = createObject('eventplanner.bopermission');
+                       $this->fields = eventplanner_permission::get_fields();
+                       $this->permissions = 
eventplanner_permission::get_instance()->get_permission_array();
+                       $this->currentapp = 
$GLOBALS['phpgw_info']['flags']['currentapp'];
+                       
self::set_active_menu("{$this->currentapp}::permission");
+               }
+
+               private function get_category_options( $selected = 0 )
+               {
+                       $category_list = array();
+                       $category_list[] = array('id' => '','name' => 
lang('select'));
+                       $category_list[] = array('id' => 'customer', 'name' => 
lang('customer'));
+       //              $category_list[] = array('id' => 'vendor', 'name' => 
lang('vendor'));
+
+                       foreach ($category_list as $option)
+                       {
+                               $options['selected'] = $option['id'] == 
$selected ? 1 : 0;
+                       }
+                       return $category_list;
+               }
+
+               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('permission');
+
+                       $data = array(
+                               'datatable_name' => $function_msg,
+                               'form' => array(
+                                       'toolbar' => array(
+                                               'item' => array(
+                                                       array(
+                                                               'type' => 
'filter',
+                                                               'name' => 
'filter_object_type',
+                                                               'text' => 
lang('category'),
+                                                               'list' =>  
$this->get_category_options()
+                                                       )
+                                               )
+                                       )
+                               ),
+                               'datatable' => array(
+                                       'source' => self::link(array(
+                                               'menuaction' => 
"{$this->currentapp}.uipermission.index",
+                                               'phpgw_return_as' => 'json'
+                                       )),
+                                       'allrows' => true,
+                                       'new_item' => 
self::link(array('menuaction' => "{$this->currentapp}.uipermission.add")),
+                                       'editor_action' => '',
+                                       'field' => parent::_get_fields()
+                               )
+                       );
+
+                       $parameters = array(
+                               'parameter' => array(
+                                       array(
+                                               'name' => 'id',
+                                               'source' => 'id'
+                                       )
+                               )
+                       );
+
+                       $data['datatable']['actions'][] = array
+                               (
+                               'my_name' => 'edit',
+                               'text' => lang('edit'),
+                               'action' => self::link(array
+                                       (
+                                       'menuaction' => 
"{$this->currentapp}.uipermission.edit"
+                               )),
+                               'parameters' => json_encode($parameters)
+                       );
+
+                       self::add_javascript('eventplanner', 'portico', 
'permission.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']))
+                       {
+                               $permission = $values['object'];
+                       }
+                       else
+                       {
+                               $id = !empty($values['id']) ? $values['id'] : 
phpgw::get_var('id', 'int');
+                               $permission = $this->bo->read_single($id);
+                       }
+
+                       $tabs = array();
+                       $tabs['first_tab'] = array(
+                               'label' => lang('permission'),
+                               'link' => '#first_tab'
+                       );
+
+                       $category_list = $this->get_category_options( 
$permission->object_type );
+                       unset($category_list[0]);
+
+                       $data = array(
+                               'form_action' => self::link(array('menuaction' 
=> "{$this->currentapp}.uipermission.save")),
+                               'cancel_url' => self::link(array('menuaction' 
=> "{$this->currentapp}.uipermission.index",)),
+                               'permission' => $permission,
+                               'object_type_list' => array('options' => 
$category_list),
+                               'subject_list' => array('options' => 
$this->get_subjet($permission->subject_id)),
+                               'tabs' => 
phpgwapi_jquery::tabview_generate($tabs, $active_tab),
+                               'value_active_tab' => $active_tab
+                       );
+
+                       phpgwapi_jquery::load_widget('autocomplete');
+                       phpgwapi_jquery::formvalidator_generate(array());
+                       self::add_javascript('eventplanner', 'portico', 
'permission.edit.js');
+                       self::render_template_xsl(array('permission'), 
array('edit' => $data));
+               }
+               
+               public function save()
+               {
+                       parent::save();
+               }
+
+               public function object()
+               {
+                       $object_type = phpgw::get_var('object_type');
+
+                       switch ($object_type)
+                       {
+                               case 'customer':
+                                       return 
createObject('eventplanner.uicustomer')->get_list();
+                                       break;
+                               case 'vendor':
+                                       return 
createObject('eventplanner.uivendor')->get_list();
+                                       break;
+                               default:
+                                       break;
+                       }
+               }
+
+               public function get_subjet($selected = 0)
+               {
+                       $users = 
(array)$GLOBALS['phpgw']->acl->get_user_list_right(PHPGW_ACL_READ, 'run', 
'eventplanner');
+
+                       $user_list = array();
+                       $user_list[] = array('id' => '','name' => 
lang('select'));
+                       foreach ($users as $user)
+                       {
+                               $name = (isset($user['account_lastname']) ? 
$user['account_lastname'] . ' ' : '') . $user['account_firstname'];
+                               $user_list[] = array
+                               (
+                                       'id' => $user['account_id'],
+                                       'name' => $name,
+                                       'selected' => $user['account_id'] == 
$selected ? 1 : 0
+                               );
+                       }
+                       return $user_list;
+               }
+       }
\ No newline at end of file

Added: trunk/eventplanner/inc/model/class.permission.inc.php
===================================================================
--- trunk/eventplanner/inc/model/class.permission.inc.php                       
        (rev 0)
+++ trunk/eventplanner/inc/model/class.permission.inc.php       2017-01-31 
16:01:32 UTC (rev 16212)
@@ -0,0 +1,157 @@
+<?php
+       /**
+        * phpGroupWare - eventplanner: a part of a Facilities Management 
System.
+        *
+        * @author Sigurd Nes <address@hidden>
+        * @copyright Copyright (C) 2017 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/
+        * @package eventplanner
+        * @subpackage permission
+        * @version $Id: $
+        */
+
+       phpgw::import_class('eventplanner.bopermission');
+
+       include_class('phpgwapi', 'model', 'inc/model/');
+
+       class eventplanner_permission extends phpgwapi_model
+       {
+
+               const acl_location = '.admin';
+
+               protected
+                       $id,
+                       $subject_id,
+                       $object_id,
+                       $object_type,
+                       $permission,
+                       $subject_name;
+
+               protected $field_of_responsibility_name = '.admin';
+
+               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_permission();
+               }
+
+               public static function get_status_list()
+               {
+               }
+
+               public static function get_fields($debug = true)
+               {
+
+                       $fields = array(
+                               'id' => array('action'=> PHPGW_ACL_READ,
+                                       'type' => 'int',
+                                       'label' => 'id',
+                                       'sortable'=> true,
+                                       'formatter' => 
'JqueryPortico.formatLink',
+                               ),
+                               'subject_id' => array('action'=> PHPGW_ACL_ADD,
+                                       'type' => 'int',
+                                       'required' => true
+                               ),
+                               'object_id' => array('action'=>  PHPGW_ACL_READ 
| PHPGW_ACL_ADD,
+                                       'type' => 'int',
+                                       'label' => 'object id',
+                                       'required' => true
+                               ),
+                               'object_type' => array('action'=>  
PHPGW_ACL_READ | PHPGW_ACL_ADD,
+                                       'type' => 'string',
+                                       'label' => 'object type',
+                                       'required' => true,
+                                       'query' => true,
+                               ),
+                               'permission' => array('action'=>  
PHPGW_ACL_READ | PHPGW_ACL_ADD | PHPGW_ACL_EDIT,
+                                       'type' => 'int',
+                                       'label' => 'permission',
+                                       'required' => true,
+                                       'query' => true,
+                               ),
+                               'subject_name' => array('action'=>  
PHPGW_ACL_READ,
+                                       'type' => 'string',
+                                       'query' => true,
+                                       'label' => 'user',
+                                       'join' => array(
+                                               'table' => 'phpgw_accounts',
+                                               'fkey' => 'subject_id',
+                                               'key' => 'account_id',
+                                               'column' => 'account_lid'
+                                       )
+                               )
+                       );
+
+
+                       if($debug)
+                       {
+                               foreach ($fields as $field => $field_info)
+                               {
+                                       
if(!property_exists('eventplanner_permission', $field))
+                                       {
+                                          
phpgwapi_cache::message_set('$'."{$field},", 'error');
+                                       }
+
+                               }
+                       }
+                       return $fields;
+               }
+
+               /**
+                * Implement in subclasses to perform actions on entity before 
validation
+                */
+               protected function preValidate( &$entity )
+               {
+                       $permission = (array) phpgw::get_var('permission', 
'int');
+
+                       $entity->permission = 0;//reset
+                       foreach ($permission as $key => $value)
+                       {
+                               $entity->permission += $value;
+                       }
+               }
+
+
+               public function serialize()
+               {
+                       return self::toArray();
+               }
+
+               public function store()
+               {
+                       return 
eventplanner_bopermission::get_instance()->store($this);
+               }
+
+               public function read_single($id)
+               {
+                       return 
eventplanner_bopermission::get_instance()->read_single($id, true);
+               }
+       }

Added: trunk/eventplanner/js/portico/permission.edit.js
===================================================================
--- trunk/eventplanner/js/portico/permission.edit.js                            
(rev 0)
+++ trunk/eventplanner/js/portico/permission.edit.js    2017-01-31 16:01:32 UTC 
(rev 16212)
@@ -0,0 +1,43 @@
+
+var lang;
+var oArgs = {menuaction: 'eventplanner.uipermission.subject'};
+var strURL = phpGWLink('index.php', oArgs, true);
+JqueryPortico.autocompleteHelper(strURL, 'subject_name', 'subject_id', 
'subject_container', 'name');
+
+
+$(document).ready(function ()
+{
+
+       var oArgs = {menuaction: 'eventplanner.uipermission.object', 
object_type: $("#object_type").val()};
+       var strURL = phpGWLink('index.php', oArgs, true);
+       JqueryPortico.autocompleteHelper(strURL, 'object_name', 'object_id', 
'object_container', 'name');
+
+       $("#object_type").change(function ()
+       {
+               $('#object_id').val('');
+               $('#object_name').val('');
+       });
+
+
+       $.formUtils.addValidator({
+               name: 'permission',
+               validatorFunction: function (value, $el, config, languaje, 
$form)
+               {
+                       var v = false;
+                       var permission_1 = $("#permission_1").is(':checked');
+                       var permission_2 = $("#permission_2").is(':checked');
+                       var permission_4 = $("#permission_4").is(':checked');
+                       var permission_8 = $("#permission_8").is(':checked');
+
+                       if (permission_1 || permission_2 || permission_4 || 
permission_8)
+                       {
+                               v = true;
+                       }
+
+                       return v;
+               },
+               errorMessage: lang['permission is required'] || 'permission is 
required',
+               errorMessageKey: ''
+       });
+
+});

Modified: trunk/eventplanner/setup/phpgw_no.lang
===================================================================
--- trunk/eventplanner/setup/phpgw_no.lang      2017-01-30 19:40:01 UTC (rev 
16211)
+++ trunk/eventplanner/setup/phpgw_no.lang      2017-01-31 16:01:32 UTC (rev 
16212)
@@ -107,4 +107,6 @@
 program data   eventplanner    no      Om programmet
 booking        eventplanner    no      Booking
 customer contact email eventplanner    no      Epost
-showall        eventplanner    no      Vis alle
\ No newline at end of file
+showall        eventplanner    no      Vis alle
+read   eventplanner    no      Les
+permission     eventplanner    no      Rettighet
\ No newline at end of file

Modified: trunk/eventplanner/setup/setup.inc.php
===================================================================
--- trunk/eventplanner/setup/setup.inc.php      2017-01-30 19:40:01 UTC (rev 
16211)
+++ trunk/eventplanner/setup/setup.inc.php      2017-01-31 16:01:32 UTC (rev 
16212)
@@ -11,7 +11,7 @@
         * @version $Id: setup.inc.php 14728 2016-02-11 22:28:46Z sigurdne $
         */
        $setup_info['eventplanner']['name'] = 'eventplanner';
-       $setup_info['eventplanner']['version'] = '0.9.18.005';
+       $setup_info['eventplanner']['version'] = '0.9.18.006';
        $setup_info['eventplanner']['app_order'] = 20;
        $setup_info['eventplanner']['enable'] = 1;
        $setup_info['eventplanner']['app_group'] = 'office';

Modified: trunk/eventplanner/setup/tables_current.inc.php
===================================================================
--- trunk/eventplanner/setup/tables_current.inc.php     2017-01-30 19:40:01 UTC 
(rev 16211)
+++ trunk/eventplanner/setup/tables_current.inc.php     2017-01-31 16:01:32 UTC 
(rev 16212)
@@ -341,4 +341,19 @@
                        'ix' => array(),
                        'uc' => array()
                ),
+               'eventplanner_permission' => array(
+                       'fd' => array(
+                               'id' => array('type' => 'auto', 'nullable' => 
false),
+                               'subject_id' => array('type' => 'int', 
'precision' => '4', 'nullable' => false),
+                               'object_id' => array('type' => 'int', 
'precision' => '4', 'nullable' => false),
+                               'object_type' => array('type' => 'varchar', 
'precision' => '255', 'nullable' => false),
+                               'permission' => array('type' => 'int', 
'precision' => '4', 'nullable' => false),
+                       ),
+                       'pk' => array('id'),
+                       'fk' => array(
+                               'phpgw_accounts' => array('subject_id' => 
'account_id'),
+                       ),
+                       'ix' => array(array('object_id', 'object_type'), 
array('object_type')),
+                       'uc' => array('subject_id', 'permission', 
'object_type', 'object_id'),
+               ),
        );

Modified: trunk/eventplanner/setup/tables_update.inc.php
===================================================================
--- trunk/eventplanner/setup/tables_update.inc.php      2017-01-30 19:40:01 UTC 
(rev 16211)
+++ trunk/eventplanner/setup/tables_update.inc.php      2017-01-31 16:01:32 UTC 
(rev 16212)
@@ -153,3 +153,33 @@
                }
                return $GLOBALS['setup_info']['eventplanner']['currentver'];
        }
+       $test[] = '0.9.18.005';
+
+       function eventplanner_upgrade0_9_18_005()
+       {
+               $GLOBALS['phpgw_setup']->oProc->m_odb->transaction_begin();
+
+               $GLOBALS['phpgw_setup']->oProc->CreateTable(
+                       'eventplanner_permission', array(
+                               'fd' => array(
+                                       'id' => array('type' => 'auto', 
'nullable' => false),
+                                       'subject_id' => array('type' => 'int', 
'precision' => '4', 'nullable' => false),
+                                       'object_id' => array('type' => 'int', 
'precision' => '4', 'nullable' => false),
+                                       'object_type' => array('type' => 
'varchar', 'precision' => '255', 'nullable' => false),
+                                       'permission' => array('type' => 'int', 
'precision' => '4', 'nullable' => false),
+                               ),
+                               'pk' => array('id'),
+                               'fk' => array(
+                                       'phpgw_accounts' => array('subject_id' 
=> 'account_id'),
+                               ),
+                               'ix' => array(array('object_id', 
'object_type'), array('object_type')),
+                               'uc' => array('subject_id', 'permission', 
'object_type', 'object_id'),
+                       )
+               );
+
+               if($GLOBALS['phpgw_setup']->oProc->m_odb->transaction_commit())
+               {
+                       $GLOBALS['setup_info']['eventplanner']['currentver'] = 
'0.9.18.006';
+               }
+               return $GLOBALS['setup_info']['eventplanner']['currentver'];
+       }

Added: trunk/eventplanner/templates/base/permission.xsl
===================================================================
--- trunk/eventplanner/templates/base/permission.xsl                            
(rev 0)
+++ trunk/eventplanner/templates/base/permission.xsl    2017-01-31 16:01:32 UTC 
(rev 16212)
@@ -0,0 +1,238 @@
+
+<!-- $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 class="content">
+               <script type="text/javascript">
+                       var lang = <xsl:value-of 
select="php:function('js_lang', 'Name or company is required', 'please enter a 
valid organization number', 'please enter a valid account number')"/>;
+               </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="permission/id > 
0">
+                                                       <div 
class="pure-control-group">
+                                                               <label>
+                                                                       
<xsl:value-of select="php:function('lang', 'id')"/>
+                                                               </label>
+                                                               <input 
type="hidden" name="id" value="{permission/id}"/>
+                                                               <xsl:value-of 
select="permission/id"/>
+                                                       </div>
+                                               </xsl:if>
+                                               <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 
id="object_type" name="object_type">
+                                                               <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="object_type_list/options"/>
+                                                       </select>
+                                               </div>
+                                               <div class="pure-control-group">
+                                                       <xsl:variable 
name="lang_user">
+                                                               <xsl:value-of 
select="php:function('lang', 'user')"/>
+                                                       </xsl:variable>
+                                                       <label>
+                                                               <xsl:value-of 
select="$lang_user"/>
+                                                       </label>
+                                                       <select id="subject_id" 
name="subject_id">
+                                                               <xsl:attribute 
name="title">
+                                                                       
<xsl:value-of select="$lang_user"/>
+                                                               </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_user"/>
+                                                               </xsl:attribute>
+                                                               
<xsl:apply-templates select="subject_list/options"/>
+                                                       </select>
+
+                                               </div>
+                                               <div class="pure-control-group">
+                                                       <xsl:variable 
name="lang_object">
+                                                               <xsl:value-of 
select="php:function('lang', 'object')"/>
+                                                       </xsl:variable>
+                                                       <label>
+                                                               <xsl:value-of 
select="$lang_object"/>
+                                                       </label>
+                                                       <input type="hidden" 
id="object_id" name="object_id"  value="{permission/object_id}">
+                                                               <xsl:attribute 
name="data-validation">
+                                                                       
<xsl:text>required</xsl:text>
+                                                               </xsl:attribute>
+                                                               <xsl:attribute 
name="data-validation-error-msg">
+                                                                       
<xsl:value-of select="$lang_object"/>
+                                                               </xsl:attribute>
+                                                               <xsl:attribute 
name="placeholder">
+                                                                       
<xsl:value-of select="$lang_object"/>
+                                                               </xsl:attribute>
+                                                       </input>
+                                                       <input type="text" 
id="object_name" name="object_name" value="{permission/object_name}">
+                                                               <xsl:attribute 
name="placeholder">
+                                                                       
<xsl:value-of select="$lang_object"/>
+                                                               </xsl:attribute>
+                                                               <xsl:attribute 
name="data-validation">
+                                                                       
<xsl:text>required</xsl:text>
+                                                               </xsl:attribute>
+                                                       </input>
+                                                       <div 
id="object_container"/>
+                                               </div>
+                                               <div class="pure-control-group">
+                                                       <xsl:variable 
name="lang_permission">
+                                                               <xsl:value-of 
select="php:function('lang', 'permission')"/>
+                                                       </xsl:variable>
+                                                       <label>
+                                                               <xsl:value-of 
select="$lang_permission"/>
+                                                       </label>
+                                                       <div 
class="pure-custom">
+                                                               <table 
class="pure-table pure-table-bordered" border="0" cellspacing="2" 
cellpadding="2">
+                                                                       <thead>
+                                                                               
<tr>
+                                                                               
        <th>
+                                                                               
                <xsl:value-of select="php:function('lang', 'read')"/>
+                                                                               
        </th>
+                                                                               
        <th>
+                                                                               
                <xsl:value-of select="php:function('lang', 'add')"/>
+                                                                               
        </th>
+                                                                               
        <th>
+                                                                               
                <xsl:value-of select="php:function('lang', 'edit')"/>
+                                                                               
        </th>
+                                                                               
        <th>
+                                                                               
                <xsl:value-of select="php:function('lang', 'delete')"/>
+                                                                               
        </th>
+                                                                               
</tr>
+                                                                       </thead>
+                                                                       <tbody>
+                                                                               
<tr>
+                                                                               
        <td>
+                                                                               
                <input type="checkbox" id="permission_1" 
name="permission[read]" value="1">
+                                                                               
                        <xsl:if test="floor(permission/permission div 1) mod 2 
= 1">
+                                                                               
                                <xsl:attribute name="checked" value="checked"/>
+                                                                               
                        </xsl:if>
+                                                                               
                        <xsl:attribute name="data-validation">
+                                                                               
                                <xsl:text>permission</xsl:text>
+                                                                               
                        </xsl:attribute>
+                                                                               
                </input>
+                                                                               
        </td>
+                                                                               
        <td>
+                                                                               
                <input type="checkbox" id="permission_2" name="permission[add]" 
value="2">
+                                                                               
                        <xsl:if test="floor(permission/permission div 2) mod 2 
= 1">
+                                                                               
                                <xsl:attribute name="checked" value="checked"/>
+                                                                               
                        </xsl:if>
+                                                                               
                        <xsl:attribute name="data-validation">
+                                                                               
                                <xsl:text>permission</xsl:text>
+                                                                               
                        </xsl:attribute>
+                                                                               
                </input>
+                                                                               
        </td>
+                                                                               
        <td>
+                                                                               
                <input type="checkbox" id="permission_4" 
name="permission[edit]" value="4">
+                                                                               
                        <xsl:if test="floor(permission/permission div 4) mod 2 
= 1">
+                                                                               
                                <xsl:attribute name="checked" value="checked"/>
+                                                                               
                        </xsl:if>
+                                                                               
                        <xsl:attribute name="data-validation">
+                                                                               
                                <xsl:text>permission</xsl:text>
+                                                                               
                        </xsl:attribute>
+                                                                               
                </input>
+                                                                               
        </td>
+                                                                               
        <td>
+                                                                               
                <input type="checkbox" id="permission_8" 
name="permission[delete]" value="8">
+                                                                               
                        <xsl:if test="floor(permission/permission div 8) mod 2 
= 1">
+                                                                               
                                <xsl:attribute name="checked" value="checked"/>
+                                                                               
                        </xsl:if>
+                                                                               
                        <xsl:attribute name="data-validation">
+                                                                               
                                <xsl:text>permission</xsl:text>
+                                                                               
                        </xsl:attribute>
+                                                                               
                </input>
+                                                                               
        </td>
+                                                                               
</tr>
+                                                                       </tbody>
+                                                               </table>
+                                                       </div>
+                                               </div>
+                                               <!--object_id, permission-->
+
+                                       </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>

Modified: trunk/eventplannerfrontend/inc/model/class.metasettings.inc.php
===================================================================
--- trunk/eventplannerfrontend/inc/model/class.metasettings.inc.php     
2017-01-30 19:40:01 UTC (rev 16211)
+++ trunk/eventplannerfrontend/inc/model/class.metasettings.inc.php     
2017-01-31 16:01:32 UTC (rev 16212)
@@ -67,12 +67,12 @@
                                        'type' => 'string',
                                        'history'       => false
                                        ),
-                               'frontpage_header' => array('action'=> 
PHPGW_ACL_ADD | PHPGW_ACL_EDIT,
+                               'metatag_keywords' => array('action'=> 
PHPGW_ACL_ADD | PHPGW_ACL_EDIT,
                                        'type' => 'string',
                                        'history'       => false
                                        ),
-                               'frontpage_sub_header' => array('action'=> 
PHPGW_ACL_ADD | PHPGW_ACL_EDIT,
-                                       'type' => 'html',
+                               'metatag_description' => array('action'=> 
PHPGW_ACL_ADD | PHPGW_ACL_EDIT,
+                                       'type' => 'string',
                                        'history'       => false
                                        ),
                                'frontpage_text' => array('action'=> 
PHPGW_ACL_ADD | PHPGW_ACL_EDIT,

Modified: trunk/eventplannerfrontend/templates/base/metasettings.xsl
===================================================================
--- trunk/eventplannerfrontend/templates/base/metasettings.xsl  2017-01-30 
19:40:01 UTC (rev 16211)
+++ trunk/eventplannerfrontend/templates/base/metasettings.xsl  2017-01-31 
16:01:32 UTC (rev 16212)
@@ -25,26 +25,27 @@
                                                        </xsl:attribute>
                                                </input>
                                        </div>
-                                       <!--div class="pure-control-group">
-                                               <label 
for="field_frontpage_header">
-                                                       <xsl:value-of 
select="php:function('lang', 'frontpage header')"/>
+                                       <div class="pure-control-group">
+                                               <label 
for="field_metatag_keywords">
+                                                       <xsl:value-of 
select="php:function('lang', 'keywords')"/>
                                                </label>
-                                               <input 
id="field_frontpage_header" name="frontpage_header" type="text" size="50">
+                                               <input 
id="field_metatag_keywords" name="metatag_keywords" type="text" size="50">
                                                        <xsl:attribute 
name="value">
-                                                               <xsl:value-of 
select="config_data/frontpage_header"/>
+                                                               <xsl:value-of 
select="config_data/metatag_keywords"/>
                                                        </xsl:attribute>
                                                </input>
                                        </div>
                                        <div class="pure-control-group">
-                                               <label 
for="field_frontpage_sub_header">
-                                                       <xsl:value-of 
select="php:function('lang', 'frontpage sub header')"/>
+                                               <label 
for="field_metatag_description">
+                                                       <xsl:value-of 
select="php:function('lang', 'description')"/>
                                                </label>
-                                               <input 
id="field_frontpage_sub_header" name="frontpage_sub_header" type="text" 
size="50">
-                                                       <xsl:attribute 
name="value">
-                                                               <xsl:value-of 
select="config_data/frontpage_sub_header"/>
-                                                       </xsl:attribute>
-                                               </input>
-                                       </div-->
+                                               <div class="pure-custom">
+                                                       <textarea 
id="field_metatag_description" class="full-width" name="metatag_description">
+                                                               <xsl:value-of 
select="config_data/metatag_description"/>
+                                                       </textarea>
+                                               </div>
+                                       </div>
+
                                        <div class="pure-control-group">
                                                <label 
for="field_frontpage_text">
                                                        <xsl:value-of 
select="php:function('lang', 'Frontpage text')"/>

Modified: trunk/phpgwapi/templates/frontend/css/frontend.css
===================================================================
--- trunk/phpgwapi/templates/frontend/css/frontend.css  2017-01-30 19:40:01 UTC 
(rev 16211)
+++ trunk/phpgwapi/templates/frontend/css/frontend.css  2017-01-31 16:01:32 UTC 
(rev 16212)
@@ -237,7 +237,7 @@
 
 /* This is the class used for the footer */
 .footer {
-    background: #111;
+    background: #DF0101;
 }
 
 /*

Modified: trunk/phpgwapi/templates/frontend/head.inc.php
===================================================================
--- trunk/phpgwapi/templates/frontend/head.inc.php      2017-01-30 19:40:01 UTC 
(rev 16211)
+++ trunk/phpgwapi/templates/frontend/head.inc.php      2017-01-31 16:01:32 UTC 
(rev 16212)
@@ -114,7 +114,8 @@
 
        $config = CreateObject('phpgwapi.config',$app)->read();
        $logofile_frontend = !empty($config['logopath_frontend']) ? 
$config['logopath_frontend'] : '';
-       $keywords = !empty($config['keywords']) ? $config['keywords'] : '';
+       $keywords = !empty($config['metatag_keywords']) ? 
$config['metatag_keywords'] : '';
+       $description = !empty($config['metatag_description']) ? 
$config['metatag_description'] : '';
 
        if($keywords)
        {
@@ -124,7 +125,7 @@
        {
                $keywords = '<meta name="keywords" content="phpGroupWare">';
        }
-       if(!empty($description))
+       if($description)
        {
                $description = '<meta name="description" 
content="'.$description.'">';
        }




reply via email to

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