source: trunk/expressoAdmin1_2/inc/class.uishared_accounts.inc.php @ 5133

Revision 5133, 4.9 KB checked in by wmerlotto, 12 years ago (diff)

Ticket #2305 - Enviando alteracoes, desenvolvidas internamente na Prognus, do modulo ExpressoAdmin.

Line 
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                        foreach ($acl['contexts_display'] as $index=>$tmp_context) {
54                                $context_display .= '<br>'.$tmp_context;
55                        }
56                       
57                        if (!$this->functions->check_acl($account_lid,'list_shared_accounts')) {
58                                $GLOBALS['phpgw']->redirect($GLOBALS['phpgw']->link('/expressoAdmin1_2/inc/access_denied.php'));
59                        }
60                        /* End: Check manager access */
61
62                        unset($GLOBALS['phpgw_info']['flags']['noheader']);
63                        unset($GLOBALS['phpgw_info']['flags']['nonavbar']);
64                        $GLOBALS['phpgw_info']['flags']['app_header'] = $GLOBALS['phpgw_info']['apps']['expressoAdmin1_2']['title'].' - '.lang('shared accounts');
65                        $GLOBALS['phpgw']->common->phpgw_header();
66
67                        $p = CreateObject('phpgwapi.Template',PHPGW_APP_TPL);
68
69                        $p->set_file(
70                                                Array(
71                                                                'shared_accounts'               => 'shared_accounts.tpl',
72                                                                'shared_accounts_modal' =>'shared_accounts_modal.tpl'
73                                                        )
74                                                );
75                        $p->set_block('shared_accounts','body');
76                       
77                        /* dinamic load lang */                       
78                        $p->set_var($this->functions->make_dinamic_lang($p, 'body'));
79                        $p->set_var($this->functions->make_dinamic_lang($p, 'shared_accounts_modal'));
80
81
82                        /* Begin: set modal */
83
84                        $functions = CreateObject('expressoAdmin1_2.functions');
85                       
86                        //$organizations = $functions->get_organizations($GLOBALS['phpgw_info']['server']['ldap_context']);
87                       
88                        foreach ($contexts as $index=>$context)
89                                $combo_manager_org .= $this->functions->get_organizations($context);
90                        $combo_all_orgs = $this->functions->get_organizations($GLOBALS['phpgw_info']['server']['ldap_context']);
91                       
92                        $p->set_var('manager_organizations', $combo_manager_org);
93                        $p->set_var('all_organizations', $combo_all_orgs);
94                       
95                        $modal_id = 'shared_accounts_modal';
96                        $p->set_var('modal_id', $modal_id);
97                       
98                        $var = Array(
99                            'mailquota' =>  $this->current_config['expressoAdmin_defaultSharedAccountQuota'],
100                            'changequote_disabled' => $this->functions->check_acl($account_lid,'edit_shared_accounts_quote') ? '' : 'readonly',
101                            'disabled_empty_inbox' => $this->functions->check_acl($account_lid,'empty_shared_accounts_inbox') ? '' : 'disabled',
102                            'display_quota_used' => 'none'
103                        );
104                        $p->set_var($var);
105                        $shared_accounts_modal_tpl = $p->fp('out','shared_accounts_modal');
106                        /* End: set modal */
107                       
108                        $var = Array(
109                                'th_bg'                                         => $GLOBALS['phpgw_info']['theme']['th_bg'],
110                                'back_url'                                      => $GLOBALS['phpgw']->link('/expressoAdmin1_2/index.php'),
111                                'context_display'                       => $context_display,
112                                'shared_accounts_modal' => $shared_accounts_modal_tpl,                               
113                                'onclick_create_shared_account' => "modal(\"$modal_id\",\"create\")"
114                        );
115                        $p->set_var($var);
116                        $p->pfp('out','body');
117                }
118        }
119
120
121       
122?>
Note: See TracBrowser for help on using the repository browser.