fmsystem-commits
[Top][All Lists]
Advanced

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

[Fmsystem-commits] [15493] property: assigning responsibility to both gr


From: sigurdne
Subject: [Fmsystem-commits] [15493] property: assigning responsibility to both groups and users
Date: Fri, 19 Aug 2016 11:45:56 +0000 (UTC)

Revision: 15493
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=15493
Author:   sigurdne
Date:     2016-08-19 11:45:55 +0000 (Fri, 19 Aug 2016)
Log Message:
-----------
property: assigning responsibility to both groups and users

Modified Paths:
--------------
    trunk/property/inc/class.sogeneric.inc.php
    trunk/property/inc/class.uilocation.inc.php
    trunk/property/setup/phpgw_no.lang

Modified: trunk/property/inc/class.sogeneric.inc.php
===================================================================
--- trunk/property/inc/class.sogeneric.inc.php  2016-08-19 00:36:59 UTC (rev 
15492)
+++ trunk/property/inc/class.sogeneric.inc.php  2016-08-19 11:45:55 UTC (rev 
15493)
@@ -2361,18 +2361,12 @@
                                                                'name' => 
'remark',
                                                                'descr' => 
lang('remark'),
                                                                'type' => 'text'
-                                                       ),/*
+                                                       ),
                                                        array(
                                                                'name' => 
'location_level',
                                                                'descr' => 
lang('location level'),
-                                                               'type' => 
'select',
-                                                               'values_def' => 
array
-                                                                       (
-                                                                       
'valueset' => false,
-                                                                       
'method' => 'preferences.boadmin_acl.get_locations',
-                                                                       
'method_input' => array('acl_app' => 'property', 'selected' => '##location##')
-                                                               )
-                                                       ),*/
+                                                               'type' => 
'varchar'
+                                                       ),
                                                        array
                                                                (
                                                                'name' => 
'responsibility_id',

Modified: trunk/property/inc/class.uilocation.inc.php
===================================================================
--- trunk/property/inc/class.uilocation.inc.php 2016-08-19 00:36:59 UTC (rev 
15492)
+++ trunk/property/inc/class.uilocation.inc.php 2016-08-19 11:45:55 UTC (rev 
15493)
@@ -55,6 +55,7 @@
                        'get_part_of_town' => true,
                        'get_history_data' => true,
                        'get_documents' => true,
+                       'get_accounts'  => true,
                        'download' => true,
                        'index' => true,
                        'view' => true,
@@ -522,33 +523,94 @@
                                'list' => $values_combo_box[4]
                        );
 
-//                             $values_combo_box[5]  = 
$this->bocommon->get_user_list_right2('filter',PHPGW_ACL_READ,$this->user_id,".location.{$type_id}");
-                       $_users = 
$GLOBALS['phpgw']->accounts->get_list('accounts', -1, 'ASC', 
'account_lastname', '', -1);
-                       $values_combo_box[5] = array();
-                       foreach ($_users as $_user)
-                       {
-                               $values_combo_box[5][] = array
-                                       (
-                                       'id' => $_user->id,
-                                       'name' => $_user->__toString(),
+
+/**
+ *
+ *
+ */
+                       $link = self::link(array(
+                                       'menuaction' => 
'property.uilocation.get_accounts',
+                                       'phpgw_return_as' => 'json'
+                       ));
+
+                       $code = '
+                               var link = "' . $link . '";
+                               var data = {"account_type": $(this).val()};
+                               execute_ajax(link,
+                                       function(result){
+                                               var $el = $("#user_id");
+                                               $el.empty();
+                                               $.each(result, function(key, 
value) {
+                                                 
$el.append($("<option></option>").attr("value", value.id).text(value.name));
+                                               });
+                                       }, data, "GET", "json"
                                );
-                       }
-                       unset($_users);
-                       unset($_user);
+                               ';
 
-                       array_unshift($values_combo_box[5], array('id' => (-1 * 
$GLOBALS['phpgw_info']['user']['account_id']),
-                               'name' => lang('mine roles')));
-                       array_unshift($values_combo_box[5], array('id' => '', 
'name' => lang('no user')));
+                       $account_types = array();
+                       $account_types[] = array('id' => '', 'name' => 
lang('Select'));
+                       $account_types[] = array('id' => 'accounts', 'name' => 
lang('user'));
+                       $account_types[] = array('id' => 'groups', 'name' => 
lang('group'));
+       
                        $combos[] = array('type' => 'filter',
+                               'name' => 'account_type',
+                               'extra' => $code,
+                               'text' => lang('account type'),
+                               'list' => $account_types
+                       );
+
+                       $_users = $this->get_accounts();
+
+                       $combos[] = array('type' => 'filter',
                                'name' => 'user_id',
                                'extra' => '',
                                'text' => lang('user'),
-                               'list' => $values_combo_box[5]
+                               'list' => $_users
                        );
 
                        return $combos;
                }
 
+
+               public function get_accounts( $account_type = '')
+               {
+                       if(!$account_type)
+                       {
+                               $account_type = phpgw::get_var('account_type');
+                       }
+                       switch ($account_type)
+                       {
+                               case 'accounts':
+                                       $_accounts = 
$GLOBALS['phpgw']->accounts->get_list('accounts', -1, 'ASC', 
'account_lastname', '', -1);
+                                       break;
+                               case 'groups':
+                                       $_accounts = 
$GLOBALS['phpgw']->accounts->get_list('groups', -1, 'ASC', 'account_lastname', 
'', -1);
+                                       break;
+                               default:
+                                       $_accounts = array_merge(
+                                               
$GLOBALS['phpgw']->accounts->get_list('groups', -1, 'ASC', 'account_lastname', 
'', -1),
+                                               
$GLOBALS['phpgw']->accounts->get_list('accounts', -1, 'ASC', 
'account_lastname', '', -1)
+                                       );
+                                       break;
+                       }
+                       $values = array();
+                       foreach ($_accounts as $_account)
+                       {
+                               $values[] = array
+                                       (
+                                       'id' => $_account->id,
+                                       'name' => $_account->__toString(),
+                               );
+                       }
+                       if($account_type == 'accounts')
+                       {
+                               array_unshift($values, array('id' => (-1 * 
$GLOBALS['phpgw_info']['user']['account_id']),
+                                               'name' => lang('mine roles')));
+                       }
+                       array_unshift($values, array('id' => '', 'name' => 
lang('Select')));
+                       return $values;
+               }
+
                private function _get_categories_summary()
                {
                        $values_combo_box = array();

Modified: trunk/property/setup/phpgw_no.lang
===================================================================
--- trunk/property/setup/phpgw_no.lang  2016-08-19 00:36:59 UTC (rev 15492)
+++ trunk/property/setup/phpgw_no.lang  2016-08-19 11:45:55 UTC (rev 15493)
@@ -2062,4 +2062,6 @@
 receive order  property        no      Motta vare
 check date type        property        no      Dato filter type
 no date        property        no      Ingen dato
-Please select an external project!     property        no      Velg et 
tilnyttet eksternt prosjekt
\ No newline at end of file
+Please select an external project!     property        no      Velg et 
tilnyttet eksternt prosjekt
+mine roles     property        no      Mine roller
+account type   property        no      Rolletype
\ No newline at end of file




reply via email to

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