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

Revision 2549, 5.0 KB checked in by rodsouza, 14 years ago (diff)

Ticket #1009 - Corrigindo problemas com a inclusão de javascript.

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