1 | <?php |
---|
2 | /***********************************************************************************\ |
---|
3 | * Expresso Administração * |
---|
4 | * by Prognus Software Livre (prognus@prognus.com.br, airton@prognus.com.br) * |
---|
5 | * ----------------------------------------------------------------------------------* |
---|
6 | * This program is free software; you can redistribute it and/or modify it * |
---|
7 | * under the terms of the GNU General Public License as published by the * |
---|
8 | * Free Software Foundation; either version 2 of the License, or (at your * |
---|
9 | * option) any later version. * |
---|
10 | \***********************************************************************************/ |
---|
11 | |
---|
12 | define('PHPGW_API_INC','../phpgwapi/inc'); |
---|
13 | |
---|
14 | class uimessages_size |
---|
15 | { |
---|
16 | var $public_functions = array |
---|
17 | ( |
---|
18 | 'index' => True |
---|
19 | ); |
---|
20 | |
---|
21 | var $functions; |
---|
22 | var $current_config; |
---|
23 | var $bo; |
---|
24 | |
---|
25 | /** |
---|
26 | * Construtor |
---|
27 | */ |
---|
28 | function uimessages_size() |
---|
29 | { |
---|
30 | $this->bo = CreateObject('expressoAdmin1_2.bomessages_size'); |
---|
31 | if (function_exists('CreateObject')) |
---|
32 | { |
---|
33 | $this->functions = CreateObject('expressoAdmin1_2.functions'); |
---|
34 | |
---|
35 | if(!@is_object($GLOBALS['phpgw']->js)) |
---|
36 | { |
---|
37 | $GLOBALS['phpgw']->js = CreateObject('phpgwapi.javascript'); |
---|
38 | } |
---|
39 | $GLOBALS['phpgw']->js->validate_file('jscode','connector','expressoAdmin1_2'); #diretorio, arquivo.js, aplicacao |
---|
40 | $GLOBALS['phpgw']->js->validate_file('jscode','finder','expressoAdmin1_2'); |
---|
41 | $GLOBALS['phpgw']->js->validate_file('jscode','messages_size','expressoAdmin1_2'); |
---|
42 | $GLOBALS['phpgw']->js->validate_file('modal','modal','expressoAdmin1_2'); |
---|
43 | $GLOBALS['phpgw']->js->validate_file('jscode','expressoadmin','expressoAdmin1_2'); |
---|
44 | $c = CreateObject('phpgwapi.config','expressoAdmin1_2'); |
---|
45 | $c->read_repository(); |
---|
46 | $this->current_config = $c->config_data; |
---|
47 | } |
---|
48 | } |
---|
49 | |
---|
50 | |
---|
51 | /** |
---|
52 | * @abstract Cria a página principal da funcionalidade. |
---|
53 | */ |
---|
54 | function index() |
---|
55 | { |
---|
56 | $p = CreateObject('phpgwapi.Template',PHPGW_APP_TPL); |
---|
57 | $p->set_file( |
---|
58 | Array( |
---|
59 | 'messages_size' => 'messages_size.tpl', |
---|
60 | 'messages_size_modal' => 'messages_size_modal.tpl' |
---|
61 | ) |
---|
62 | ); |
---|
63 | $p->set_block('messages_size','body'); |
---|
64 | $p->set_var($this->functions->make_dinamic_lang($p, 'body')); |
---|
65 | $p->set_var($this->functions->make_dinamic_lang($p, 'messages_size_modal')); |
---|
66 | |
---|
67 | |
---|
68 | /* Início da verificação ACL */ |
---|
69 | $account_lid = $GLOBALS['phpgw']->accounts->data['account_lid']; |
---|
70 | $acl = $this->functions->read_acl($account_lid); |
---|
71 | $contexts = $acl['contexts']; |
---|
72 | |
---|
73 | foreach ($acl['contexts_display'] as $index=>$tmp_context) { |
---|
74 | $context_display .= '<br>'.$tmp_context; |
---|
75 | } |
---|
76 | |
---|
77 | if (!$this->functions->check_acl($account_lid,'messages_size')) { |
---|
78 | $GLOBALS['phpgw']->redirect($GLOBALS['phpgw']->link('/expressoAdmin1_2/inc/access_denied.php')); |
---|
79 | } |
---|
80 | /* Fim da verificação ACL */ |
---|
81 | |
---|
82 | unset($GLOBALS['phpgw_info']['flags']['noheader']); |
---|
83 | unset($GLOBALS['phpgw_info']['flags']['nonavbar']); |
---|
84 | $GLOBALS['phpgw_info']['flags']['app_header'] = $GLOBALS['phpgw_info']['apps']['expressoAdmin1_2']['title'].' - '.lang('Messages Size'); |
---|
85 | $GLOBALS['phpgw']->common->phpgw_header(); |
---|
86 | |
---|
87 | /* Begin: set modal */ |
---|
88 | $functions = CreateObject('expressoAdmin1_2.functions'); |
---|
89 | |
---|
90 | foreach ($contexts as $index=>$context) |
---|
91 | $combo_manager_org .= $this->functions->get_organizations($context); |
---|
92 | $combo_all_orgs = $this->functions->get_organizations($GLOBALS['phpgw_info']['server']['ldap_context']); |
---|
93 | |
---|
94 | $p->set_var('manager_organizations', $combo_manager_org); |
---|
95 | $p->set_var('all_organizations', $combo_all_orgs); |
---|
96 | |
---|
97 | $modal_id = 'messages_size_modal'; |
---|
98 | $p->set_var('modal_id', $modal_id); |
---|
99 | |
---|
100 | |
---|
101 | $messages_size_modal_tpl = $p->fp('out','messages_size_modal'); |
---|
102 | /* End: set modal */ |
---|
103 | |
---|
104 | $var = Array( |
---|
105 | 'th_bg' => $GLOBALS['phpgw_info']['theme']['th_bg'], |
---|
106 | 'back_url' => $GLOBALS['phpgw']->link('/expressoAdmin1_2/index.php'), |
---|
107 | 'context_display' => $context_display, |
---|
108 | 'messages_size_modal' => $messages_size_modal_tpl, |
---|
109 | 'onclick_create_messages_size' => "modal(\"$modal_id\",\"create\")" |
---|
110 | ); |
---|
111 | $p->set_var($var); |
---|
112 | |
---|
113 | $default_value = ''; |
---|
114 | $rules = ''; |
---|
115 | $all_rules = $this->bo->get_all_rules(); |
---|
116 | |
---|
117 | for ($i = 0; $i<count($all_rules); $i++) |
---|
118 | { |
---|
119 | /* Verificação para não listar a regra default */ |
---|
120 | if($all_rules[$i]['email_recipient'] != 'default') |
---|
121 | { |
---|
122 | $name_link = (string)str_replace(" ", "%", $all_rules[$i]['email_recipient']); |
---|
123 | $rules .= "<tr class='normal' onMouseOver=this.className='selected' onMouseOut=this.className='normal'><td onClick=javascript:edit_messages_size('" . $name_link . "')>" . $all_rules[$i]['email_recipient'] . "</td><td onClick=edit_messages_size('$name_link')>" . $all_rules[$i]['email_max_recipient'] . " MB</td><td align='center' onClick=delete_messages_size('$name_link')><img HEIGHT='16' WIDTH='16' src=./expressoAdmin1_2/templates/default/images/delete.png></td></tr>"; |
---|
124 | } |
---|
125 | } |
---|
126 | |
---|
127 | $default_value = $this->bo->get_default_rule(); |
---|
128 | |
---|
129 | $p->set_var('list_rules', $rules); |
---|
130 | $p->set_var('default_value', $default_value); |
---|
131 | $p->pfp('out','body'); |
---|
132 | } |
---|
133 | } // end class uimessages_size |
---|
134 | ?> |
---|