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

Revision 2707, 5.1 KB checked in by rodsouza, 14 years ago (diff)

Ticket #1058 - Corrigindo problemas no expressoAdmin1_2.

RevLine 
[1913]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        class uishared_accounts
14        {
15                var $public_functions = array
16                (
17                        'index' => True
18                );
19               
20                var $functions;
21                var $current_config;
22
23                function uishared_accounts()
24                {                       
25                        if (function_exists('CreateObject'))
26                        {
27                                $this->functions = CreateObject('expressoAdmin1_2.functions');
28                               
29                                if(!@is_object($GLOBALS['phpgw']->js))
30                                {
31                                        $GLOBALS['phpgw']->js = CreateObject('phpgwapi.javascript');
32                                }
[2707]33                                $GLOBALS['phpgw']->js->validate_file('jscode','globals','expressoAdmin1_2');
34                                $GLOBALS['phpgw']->js->validate_file('jscode','connector','expressoAdmin1_2');
[1913]35                                $GLOBALS['phpgw']->js->validate_file('jscode','shared_accounts','expressoAdmin1_2');
36                                $GLOBALS['phpgw']->js->validate_file('modal','modal','expressoAdmin1_2');
37                                $GLOBALS['phpgw']->js->validate_file('jscode','expressoadmin','expressoAdmin1_2');
38                                $c = CreateObject('phpgwapi.config','expressoAdmin1_2');
39                                $c->read_repository();
40                                $this->current_config = $c->config_data;
41                        }
42                }
43
44                function index()
45                {
46                        /* Begin:  Check manager access */
47                        $account_lid = $GLOBALS['phpgw']->accounts->data['account_lid'];
48                        $acl = $this->functions->read_acl($account_lid);
49                        $contexts = $acl['contexts'];
50                       
51                        foreach ($acl['contexts_display'] as $index=>$tmp_context) {
52                                $context_display .= '<br>'.$tmp_context;
53                        }
54                       
55                        if (!$this->functions->check_acl($account_lid,'list_shared_accounts')) {
56                                $GLOBALS['phpgw']->redirect($GLOBALS['phpgw']->link('/expressoAdmin1_2/inc/access_denied.php'));
57                        }
58                        /* End: Check manager access */
59
[2419]60                        //unset($GLOBALS['phpgw_info']['flags']['noheader']);
61                        //unset($GLOBALS['phpgw_info']['flags']['nonavbar']);
[1913]62                        $GLOBALS['phpgw_info']['flags']['app_header'] = $GLOBALS['phpgw_info']['apps']['expressoAdmin1_2']['title'].' - '.lang('shared accounts');
[2419]63                        //$GLOBALS['phpgw']->common->phpgw_header();
[1913]64
65                        $p = CreateObject('phpgwapi.Template',PHPGW_APP_TPL);
66
67                        $p->set_file(
68                                                Array(
69                                                                'shared_accounts'               => 'shared_accounts.tpl',
70                                                                'shared_accounts_modal' =>'shared_accounts_modal.tpl'
71                                                        )
72                                                );
73                        $p->set_block('shared_accounts','body');
74                       
75                        /* dinamic load lang */                       
76                        $p->set_var($this->functions->make_dinamic_lang($p, 'body'));
77                        $p->set_var($this->functions->make_dinamic_lang($p, 'shared_accounts_modal'));
78
79
80                        /* Begin: set modal */
81
82                        $functions = CreateObject('expressoAdmin1_2.functions');
83                       
84                        //$organizations = $functions->get_organizations($GLOBALS['phpgw_info']['server']['ldap_context']);
85                       
86                        foreach ($contexts as $index=>$context)
87                                $combo_manager_org .= $this->functions->get_organizations($context);
88                        $combo_all_orgs = $this->functions->get_organizations($GLOBALS['phpgw_info']['server']['ldap_context']);
89                       
90                        $p->set_var('manager_organizations', $combo_manager_org);
91                        $p->set_var('all_organizations', $combo_all_orgs);
92                       
93                        $modal_id = 'shared_accounts_modal';
94                        $p->set_var('modal_id', $modal_id);
95                       
96                        $var = Array(
97                            'mailquota' =>  $this->current_config['expressoAdmin_defaultUserQuota'],
98                            'changequote_disabled' => $this->functions->check_acl($account_lid,'edit_shared_accounts_quote') ? '' : 'readonly',
99                            'disabled_empty_inbox' => $this->functions->check_acl($account_lid,'empty_shared_accounts_inbox') ? '' : 'disabled',
100                            'display_quota_used' => 'none'
101                        );
102                        $p->set_var($var);
103                        $shared_accounts_modal_tpl = $p->fp('out','shared_accounts_modal');
104                        /* End: set modal */
105                       
106                        $var = Array(
107                                'th_bg'                                         => $GLOBALS['phpgw_info']['theme']['th_bg'],
108                                'back_url'                                      => $GLOBALS['phpgw']->link('/expressoAdmin1_2/index.php'),
109                                'context_display'                       => $context_display,
110                                'shared_accounts_modal' => $shared_accounts_modal_tpl,                               
111                                'onclick_create_shared_account' => "modal(\"$modal_id\",\"create\")"
112                        );
113                        $p->set_var($var);
[2549]114                        $GLOBALS['phpgw_info']['flags']['java_script_thirst'] = "<script>var expressoAdmin_url = '{$GLOBALS[ 'phpgw' ] -> link( '/expressoAdmin1_2/' )}';var expressoAdmin_controller = '{$GLOBALS[ 'phpgw' ] -> link( '/expressoAdmin1_2/controller.php' )}?action=';</script>";
[1913]115                        $p->pfp('out','body');
116                }
117        }
118
119
120       
121?>
Note: See TracBrowser for help on using the repository browser.