1 | <?php |
---|
2 | /***********************************************************************************\ |
---|
3 | * Expresso Administração * |
---|
4 | * by Joao Alfredo Knopik Junior (joao.alfredo@gmail.com, jakjr@celepar.pr.gov.br) * |
---|
5 | * modified by Valmir Andre de Sena valmirse@gmail.com valmir.sena@ati.pe.gov.br |
---|
6 | * ----------------------------------------------------------------------------------* |
---|
7 | * This program is free software; you can redistribute it and/or modify it * |
---|
8 | * under the terms of the GNU General Public License as published by the * |
---|
9 | * Free Software Foundation; either version 2 of the License, or (at your * |
---|
10 | * option) any later version. * |
---|
11 | \***********************************************************************************/ |
---|
12 | |
---|
13 | define('PHPGW_API_INC','../phpgwapi/inc'); |
---|
14 | |
---|
15 | class uishared_accounts |
---|
16 | { |
---|
17 | var $public_functions = array |
---|
18 | ( |
---|
19 | 'index' => True |
---|
20 | ); |
---|
21 | |
---|
22 | var $functions; |
---|
23 | var $current_config; |
---|
24 | |
---|
25 | function uishared_accounts() |
---|
26 | { |
---|
27 | if (function_exists('CreateObject')) |
---|
28 | { |
---|
29 | $this->functions = CreateObject('expressoAdmin1_2.functions'); |
---|
30 | |
---|
31 | if(!@is_object($GLOBALS['phpgw']->js)) |
---|
32 | { |
---|
33 | $GLOBALS['phpgw']->js = CreateObject('phpgwapi.javascript'); |
---|
34 | } |
---|
35 | $GLOBALS['phpgw']->js->validate_file('jscode','connector','expressoAdmin1_2');#diretorio, arquivo.js, aplicacao |
---|
36 | $GLOBALS['phpgw']->js->validate_file('jscode','shared_accounts','expressoAdmin1_2'); |
---|
37 | $GLOBALS['phpgw']->js->validate_file('modal','modal','expressoAdmin1_2'); |
---|
38 | $GLOBALS['phpgw']->js->validate_file('jscode','expressoadmin','expressoAdmin1_2'); |
---|
39 | $GLOBALS['phpgw']->js->validate_file('jscode','finder','expressoAdmin1_2'); |
---|
40 | $c = CreateObject('phpgwapi.config','expressoAdmin1_2'); |
---|
41 | $c->read_repository(); |
---|
42 | $this->current_config = $c->config_data; |
---|
43 | } |
---|
44 | } |
---|
45 | |
---|
46 | function index() |
---|
47 | { |
---|
48 | /* Begin: Check manager access */ |
---|
49 | $account_lid = $GLOBALS['phpgw']->accounts->data['account_lid']; |
---|
50 | $acl = $this->functions->read_acl($account_lid); |
---|
51 | $contexts = $acl['contexts']; |
---|
52 | |
---|
53 | // Loading Config Module |
---|
54 | $conf = CreateObject('phpgwapi.config','phpgwapi'); |
---|
55 | $conf->read_repository(); |
---|
56 | $config = $conf->config_data; |
---|
57 | |
---|
58 | foreach ($acl['contexts_display'] as $index=>$tmp_context) { |
---|
59 | $context_display .= '<br>'.$tmp_context; |
---|
60 | } |
---|
61 | |
---|
62 | if (!$this->functions->check_acl($account_lid,'list_shared_accounts')) { |
---|
63 | $GLOBALS['phpgw']->redirect($GLOBALS['phpgw']->link('/expressoAdmin1_2/inc/access_denied.php')); |
---|
64 | } |
---|
65 | /* End: Check manager access */ |
---|
66 | |
---|
67 | unset($GLOBALS['phpgw_info']['flags']['noheader']); |
---|
68 | unset($GLOBALS['phpgw_info']['flags']['nonavbar']); |
---|
69 | $GLOBALS['phpgw_info']['flags']['app_header'] = $GLOBALS['phpgw_info']['apps']['expressoAdmin1_2']['title'].' - '.lang('shared accounts'); |
---|
70 | $GLOBALS['phpgw']->common->phpgw_header(); |
---|
71 | |
---|
72 | $p = CreateObject('phpgwapi.Template',PHPGW_APP_TPL); |
---|
73 | |
---|
74 | $p->set_file( |
---|
75 | Array( |
---|
76 | 'shared_accounts' => 'shared_accounts.tpl', |
---|
77 | 'shared_accounts_modal' =>'shared_accounts_modal.tpl' |
---|
78 | ) |
---|
79 | ); |
---|
80 | $p->set_block('shared_accounts','body'); |
---|
81 | |
---|
82 | /* dinamic load lang */ |
---|
83 | $p->set_var($this->functions->make_dinamic_lang($p, 'body')); |
---|
84 | $p->set_var($this->functions->make_dinamic_lang($p, 'shared_accounts_modal')); |
---|
85 | |
---|
86 | |
---|
87 | /* Begin: set modal */ |
---|
88 | |
---|
89 | $functions = CreateObject('expressoAdmin1_2.functions'); |
---|
90 | |
---|
91 | //$organizations = $functions->get_organizations($GLOBALS['phpgw_info']['server']['ldap_context']); |
---|
92 | |
---|
93 | foreach ($contexts as $index=>$context) |
---|
94 | $combo_manager_org .= $this->functions->get_organizations($context); |
---|
95 | $combo_all_orgs = $this->functions->get_organizations($GLOBALS['phpgw_info']['server']['ldap_context']); |
---|
96 | |
---|
97 | $p->set_var('manager_organizations', $combo_manager_org); |
---|
98 | $p->set_var('all_organizations', $combo_all_orgs); |
---|
99 | |
---|
100 | $modal_id = 'shared_accounts_modal'; |
---|
101 | $p->set_var('modal_id', $modal_id); |
---|
102 | |
---|
103 | $davicalConf = parse_ini_file( dirname(__FILE__)."/../../prototype/config/CalDAV.srv", true ); |
---|
104 | $var = Array( |
---|
105 | 'mailquota' => $this->current_config['expressoAdmin_defaultSharedAccountQuota'], |
---|
106 | 'changequote_disabled' => $this->functions->check_acl($account_lid,'edit_shared_accounts_quote') ? '' : 'readonly', |
---|
107 | 'disabled_empty_inbox' => $this->functions->check_acl($account_lid,'empty_shared_accounts_inbox') ? '' : 'disabled', |
---|
108 | 'display_quota_used' => 'none', |
---|
109 | 'aclExpressoCalendar' => (isset($config['defaultCalendar']) && ($config['defaultCalendar'] == 'expressoCalendar')) ? '' : 'none', |
---|
110 | 'aclCalendar' => (isset($config['defaultCalendar']) && ($config['defaultCalendar'] == 'calendar')) ? '' : 'none', |
---|
111 | 'calendarName' => (isset($config['defaultCalendar']) && ($config['defaultCalendar'] == 'calendar')) ? 'Calendar' : 'ExpressoCalendar', |
---|
112 | 'sharedAccountsLocation' => isset($davicalConf['sharedAccountsLocation']) ? $davicalConf['sharedAccountsLocation'] : '' |
---|
113 | ); |
---|
114 | $p->set_var($var); |
---|
115 | $shared_accounts_modal_tpl = $p->fp('out','shared_accounts_modal'); |
---|
116 | /* End: set modal */ |
---|
117 | |
---|
118 | $var = Array( |
---|
119 | 'th_bg' => $GLOBALS['phpgw_info']['theme']['th_bg'], |
---|
120 | 'back_url' => $GLOBALS['phpgw']->link('/expressoAdmin1_2/index.php'), |
---|
121 | 'context_display' => $context_display, |
---|
122 | 'shared_accounts_modal' => $shared_accounts_modal_tpl, |
---|
123 | 'onclick_create_shared_account' => "modal(\"$modal_id\",\"create\")" |
---|
124 | ); |
---|
125 | $p->set_var($var); |
---|
126 | $p->pfp('out','body'); |
---|
127 | } |
---|
128 | } |
---|
129 | |
---|
130 | |
---|
131 | |
---|
132 | ?> |
---|