[2] | 1 | <?php |
---|
| 2 | /*************************************************************************************\ |
---|
| 3 | * Expresso Administração * |
---|
| 4 | * by Joao Alfredo Knopik Junior (joao.alfredo@gmail.com, jakjr@celepar.pr.gov.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 | class uimaillists |
---|
| 13 | { |
---|
| 14 | var $public_functions = array |
---|
| 15 | ( |
---|
[23] | 16 | 'list_maillists' => True, |
---|
| 17 | 'add_maillists' => True, |
---|
| 18 | 'edit_maillists' => True, |
---|
| 19 | 'scl_maillists' => True, |
---|
| 20 | 'css' => True |
---|
[2] | 21 | ); |
---|
| 22 | |
---|
| 23 | var $nextmatchs; |
---|
| 24 | var $functions; |
---|
| 25 | |
---|
| 26 | function uimaillists() |
---|
| 27 | { |
---|
| 28 | $this->maillist = CreateObject('expressoAdmin1_2.maillist'); |
---|
| 29 | $this->functions = CreateObject('expressoAdmin1_2.functions'); |
---|
| 30 | $this->nextmatchs = CreateObject('phpgwapi.nextmatchs'); |
---|
| 31 | |
---|
[23] | 32 | $c = CreateObject('phpgwapi.config','expressoAdmin1_2'); |
---|
| 33 | $c->read_repository(); |
---|
| 34 | $this->current_config = $c->config_data; |
---|
| 35 | |
---|
[2] | 36 | if(!@is_object($GLOBALS['phpgw']->js)) |
---|
| 37 | { |
---|
| 38 | $GLOBALS['phpgw']->js = CreateObject('phpgwapi.javascript'); |
---|
| 39 | } |
---|
| 40 | $GLOBALS['phpgw']->js->validate_file('jscode','connector','expressoAdmin1_2');#diretorio, arquivo.js, aplicacao |
---|
| 41 | $GLOBALS['phpgw']->js->validate_file('jscode','expressoadmin','expressoAdmin1_2'); |
---|
| 42 | $GLOBALS['phpgw']->js->validate_file('jscode','maillists','expressoAdmin1_2'); |
---|
| 43 | } |
---|
| 44 | |
---|
| 45 | function list_maillists() |
---|
| 46 | { |
---|
| 47 | |
---|
[64] | 48 | $manager_lid = $GLOBALS['phpgw']->accounts->data['account_lid']; |
---|
| 49 | $manager_acl = $this->functions->read_acl($manager_lid); |
---|
| 50 | $manager_contexts = $manager_acl['contexts']; |
---|
| 51 | foreach ($manager_acl['contexts_display'] as $index=>$tmp_context) |
---|
| 52 | { |
---|
| 53 | $context_display .= '<br>'.$tmp_context; |
---|
| 54 | } |
---|
| 55 | |
---|
[2] | 56 | // Verifica se tem acesso a este modulo |
---|
[64] | 57 | if (!$this->functions->check_acl($manager_lid,'list_maillists')) |
---|
[2] | 58 | { |
---|
| 59 | $GLOBALS['phpgw']->redirect($GLOBALS['phpgw']->link('/expressoAdmin1_2/inc/access_denied.php')); |
---|
| 60 | } |
---|
| 61 | |
---|
| 62 | if(isset($_POST['query'])) |
---|
| 63 | { |
---|
| 64 | // limit query to limit characters |
---|
| 65 | if(eregi('^[a-z_0-9_%-].+$',$_POST['query'])) |
---|
| 66 | $GLOBALS['query'] = $_POST['query']; |
---|
| 67 | } |
---|
| 68 | |
---|
| 69 | unset($GLOBALS['phpgw_info']['flags']['noheader']); |
---|
| 70 | unset($GLOBALS['phpgw_info']['flags']['nonavbar']); |
---|
| 71 | |
---|
[283] | 72 | $GLOBALS['phpgw_info']['flags']['app_header'] = $GLOBALS['phpgw_info']['apps']['expressoAdmin1_2']['title'].' - '.lang('E-mail lists'); |
---|
[2] | 73 | $GLOBALS['phpgw']->common->phpgw_header(); |
---|
| 74 | |
---|
| 75 | $p = CreateObject('phpgwapi.Template',PHPGW_APP_TPL); |
---|
| 76 | $p->set_file(array('maillists' => 'maillists.tpl')); |
---|
| 77 | $p->set_block('maillists','list','list'); |
---|
| 78 | $p->set_block('maillists','row','row'); |
---|
| 79 | $p->set_block('maillists','row_empty','row_empty'); |
---|
| 80 | |
---|
| 81 | // Seta as variaveis padroes. |
---|
| 82 | $var = Array( |
---|
[283] | 83 | 'add_action' => $GLOBALS['phpgw']->link('/index.php','menuaction=expressoAdmin1_2.uimaillists.add_maillists'), |
---|
[2] | 84 | 'th_bg' => $GLOBALS['phpgw_info']['theme']['th_bg'], |
---|
| 85 | 'back_url' => $GLOBALS['phpgw']->link('/expressoAdmin1_2/index.php'), |
---|
[64] | 86 | 'add_email_lists_disabled' => $this->functions->check_acl($manager_lid,'add_maillists') ? '' : 'disabled', |
---|
[2] | 87 | 'context_display' => $context_display, |
---|
[283] | 88 | |
---|
| 89 | 'lang_email_lists_uid' => lang('E-mail list names'), |
---|
| 90 | 'lang_email_lists_names' => lang('E-mail list descriptions'), |
---|
| 91 | 'lang_add_email_lists' => lang('Create e-mail list'), |
---|
[2] | 92 | 'lang_edit' => lang('Edit'), |
---|
[283] | 93 | 'lang_scl' => lang('SCL'), |
---|
| 94 | 'lang_delete' => lang('Delete'), |
---|
[2] | 95 | 'lang_view' => lang('View'), |
---|
[283] | 96 | 'lang_back' => lang('Back'), |
---|
| 97 | 'lang_context' => lang('Context'), |
---|
[2] | 98 | 'lang_email' => lang('E-mail'), |
---|
[283] | 99 | 'lang_delete_list' => lang('Delete e-mail list?'), |
---|
| 100 | 'lang_delete_list_success' => lang('E-mail list successfully deleted!'), |
---|
| 101 | 'lang_search' => lang('Search') |
---|
[2] | 102 | ); |
---|
| 103 | $p->set_var($var); |
---|
| 104 | |
---|
| 105 | // Save query |
---|
| 106 | $p->set_var('query', $GLOBALS['query']); |
---|
| 107 | |
---|
| 108 | //Admin make a search |
---|
| 109 | if ($GLOBALS['query'] != '') |
---|
| 110 | { |
---|
[64] | 111 | $maillists_info = $this->functions->get_list('maillists', $GLOBALS['query'], $manager_contexts); |
---|
[2] | 112 | } |
---|
| 113 | |
---|
[283] | 114 | if (!count($maillists_info) && $GLOBALS['query'] != '') |
---|
[2] | 115 | { |
---|
| 116 | $p->set_var('message',lang('No matches found')); |
---|
| 117 | } |
---|
[283] | 118 | else if (count($maillists_info)) |
---|
[2] | 119 | { |
---|
[64] | 120 | if ($this->functions->check_acl($manager_lid,'edit_maillists')) |
---|
[2] | 121 | { |
---|
| 122 | $can_edit = True; |
---|
| 123 | } |
---|
[64] | 124 | if ($this->functions->check_acl($manager_lid,'delete_maillists')) |
---|
[2] | 125 | { |
---|
| 126 | $can_delete = True; |
---|
| 127 | } |
---|
[283] | 128 | if ($this->functions->check_acl($manager_lid,'edit_scl_email_lists')) |
---|
| 129 | { |
---|
| 130 | $can_edit_scl = True; |
---|
| 131 | } |
---|
[2] | 132 | |
---|
[283] | 133 | |
---|
[2] | 134 | foreach($maillists_info as $maillist) |
---|
| 135 | { |
---|
| 136 | $tr_color = $this->nextmatchs->alternate_row_color($tr_color); |
---|
| 137 | $var = array( |
---|
| 138 | 'tr_color' => $tr_color, |
---|
| 139 | 'row_uid' => $maillist['uid'], |
---|
| 140 | 'row_name' => $maillist['name'], |
---|
| 141 | 'row_email' => $maillist['email'] |
---|
| 142 | ); |
---|
| 143 | $p->set_var($var); |
---|
| 144 | |
---|
| 145 | if ($can_edit) |
---|
| 146 | { |
---|
| 147 | $p->set_var('edit_link',$this->row_action('edit','maillists',$maillist['uidnumber'],$maillist['uid'])); |
---|
[283] | 148 | } |
---|
| 149 | else |
---|
| 150 | { |
---|
| 151 | $p->set_var('edit_link',' '); |
---|
| 152 | } |
---|
| 153 | |
---|
| 154 | if ($can_edit_scl) |
---|
| 155 | { |
---|
[23] | 156 | $p->set_var('scl_link',$this->row_action('scl','maillists',$maillist['uidnumber'],$maillist['uid'])); |
---|
[2] | 157 | } |
---|
| 158 | else |
---|
| 159 | { |
---|
[23] | 160 | $p->set_var('scl_link',' '); |
---|
[2] | 161 | } |
---|
| 162 | |
---|
| 163 | if ($can_delete) |
---|
| 164 | { |
---|
[283] | 165 | $p->set_var('delete_link',"<a href='#' onClick='javascript:delete_maillist(\"".$maillist['uid']."\",\"".$maillist['uidnumber']."\");'>".lang('Delete')."</a>"); |
---|
[2] | 166 | } |
---|
| 167 | else |
---|
| 168 | $p->set_var('delete_link',' '); |
---|
| 169 | |
---|
| 170 | $p->fp('rows','row',True); |
---|
| 171 | } |
---|
| 172 | } |
---|
| 173 | $p->parse('rows','row_empty',True); |
---|
| 174 | $p->set_var($var); |
---|
| 175 | $p->pfp('out','list'); |
---|
| 176 | } |
---|
| 177 | |
---|
| 178 | function add_maillists() |
---|
| 179 | { |
---|
| 180 | $GLOBALS['phpgw']->js->set_onload('get_available_users(document.forms[0].org_context.value, document.forms[0].ea_check_allUsers.checked);'); |
---|
[64] | 181 | |
---|
| 182 | $manager_lid = $GLOBALS['phpgw']->accounts->data['account_lid']; |
---|
| 183 | $manager_acl = $this->functions->read_acl($manager_lid); |
---|
| 184 | $manager_contexts = $manager_acl['contexts']; |
---|
| 185 | |
---|
[2] | 186 | // Verifica se tem acesso a este modulo |
---|
[64] | 187 | if (!$this->functions->check_acl($manager_lid,'add_maillists')) |
---|
[2] | 188 | { |
---|
| 189 | $GLOBALS['phpgw']->redirect($GLOBALS['phpgw']->link('/expressoAdmin1_2/inc/access_denied.php')); |
---|
| 190 | } |
---|
| 191 | |
---|
| 192 | unset($GLOBALS['phpgw_info']['flags']['noheader']); |
---|
| 193 | unset($GLOBALS['phpgw_info']['flags']['nonavbar']); |
---|
[283] | 194 | $GLOBALS['phpgw_info']['flags']['app_header'] = $GLOBALS['phpgw_info']['apps']['expressoAdmin1_2']['title'].' - '.lang('Create e-mail list'); |
---|
[2] | 195 | $GLOBALS['phpgw']->common->phpgw_header(); |
---|
| 196 | |
---|
| 197 | // Set o template |
---|
| 198 | $p = CreateObject('phpgwapi.Template',PHPGW_APP_TPL); |
---|
| 199 | $p->set_file(Array('create_maillist' => 'maillists_form.tpl')); |
---|
| 200 | |
---|
[180] | 201 | // Obtem combos das organizações. |
---|
[64] | 202 | foreach ($manager_contexts as $index=>$context) |
---|
[180] | 203 | $combo_manager_org .= $this->functions->get_organizations($context); |
---|
[208] | 204 | $combo_all_orgs = $this->functions->get_organizations($GLOBALS['phpgw_info']['server']['ldap_context'], '', true, true, true); |
---|
[180] | 205 | |
---|
[2] | 206 | // Seta variaveis utilizadas pelo tpl. |
---|
| 207 | $var = Array( |
---|
[283] | 208 | 'back_url' => $GLOBALS['phpgw']->link('/index.php','menuaction=expressoAdmin1_2.uimaillists.list_maillists'), |
---|
[2] | 209 | 'color_bg1' => "#E8F0F0", |
---|
| 210 | 'color_bg2' => "#D3DCE3", |
---|
| 211 | 'type' => 'create_maillist', |
---|
| 212 | 'ldap_context' => $GLOBALS['phpgw_info']['server']['ldap_context'], |
---|
| 213 | 'accountStatus_checked' => 'CHECKED', |
---|
[23] | 214 | 'restrictionsOnEmailLists' => $this->current_config['expressoAdmin_restrictionsOnEmailLists'], |
---|
[283] | 215 | 'combo_manager_org' => $combo_manager_org, |
---|
| 216 | 'combo_all_orgs' => $combo_all_orgs, |
---|
| 217 | 'defaultDomain' => $this->current_config['expressoAdmin_defaultDomain'], |
---|
| 218 | 'combo_org' => $sectors, |
---|
[2] | 219 | 'lang_back' => lang('Back'), |
---|
[283] | 220 | 'lang_save' => lang('Save'), |
---|
| 221 | 'lang_maillist_organization' => lang('E-mail list organization'), |
---|
| 222 | 'lang_search_organization' => lang('Search organization'), |
---|
[180] | 223 | 'lang_search_user' => lang('Search user'), |
---|
[283] | 224 | 'lang_users' => lang('Users'), |
---|
[180] | 225 | 'lang_organizations' => lang('Organizations'), |
---|
[283] | 226 | 'lang_maillist_uid' => lang('E-mail list login'), |
---|
| 227 | 'lang_maillist_mail' => lang('E-mail list address'), |
---|
| 228 | 'lang_maillist_name' => lang('E-mail list name'), |
---|
| 229 | 'lang_maillist_users' => lang('E-mail list users'), |
---|
[2] | 230 | 'lang_add_user' => lang('Add User'), |
---|
| 231 | 'lang_rem_user' => lang('Remove User'), |
---|
[23] | 232 | 'lang_all_users' => lang('Show users from all sub-organizations'), |
---|
[233] | 233 | 'login_field_has_spaces' => lang('Login field has spaces'), |
---|
[283] | 234 | 'list_email_field_is_empty' => lang('E-mail list address field is empty'), |
---|
| 235 | 'lang_list_name_field_is_empty' => lang('E-mail list name is empty'), |
---|
| 236 | 'no_user_is_part_of_the_list' => lang('No user is member of the list!'), |
---|
| 237 | 'email_list_successfully_created' => lang('E-mail list successfully created!'), |
---|
| 238 | 'field_email_is_invalid' => lang('E-mail list address is invalid'), |
---|
| 239 | 'lang_email_list_empty' => lang('The e-mail list is empty'), |
---|
| 240 | 'lang_hide_email_list' => lang('Hide e-mail list'), |
---|
| 241 | 'it_is_not_possible_select_users' => lang('It is impossible to create an e-mail list with all organization users'), |
---|
| 242 | 'login_field_incomplete' => lang("The lists' name field is incomplete. The lists' name must be in the following format: lista-organization-name. Ex: lista-celepar-rh") |
---|
[2] | 243 | ); |
---|
[233] | 244 | |
---|
[2] | 245 | $p->set_var($var); |
---|
| 246 | |
---|
| 247 | $p->pfp('out','create_maillist'); |
---|
| 248 | } |
---|
| 249 | |
---|
| 250 | function edit_maillists() |
---|
| 251 | { |
---|
| 252 | $GLOBALS['phpgw']->js->set_onload('get_available_users(document.forms[0].org_context.value, document.forms[0].ea_check_allUsers.checked);'); |
---|
[64] | 253 | |
---|
| 254 | $manager_lid = $GLOBALS['phpgw']->accounts->data['account_lid']; |
---|
| 255 | $manager_acl = $this->functions->read_acl($manager_lid); |
---|
| 256 | $manager_contexts = $manager_acl['contexts']; |
---|
| 257 | |
---|
[2] | 258 | // Verifica se tem acesso a este modulo |
---|
[64] | 259 | if (!$this->functions->check_acl($manager_lid,'edit_maillists')) |
---|
[2] | 260 | { |
---|
| 261 | $GLOBALS['phpgw']->redirect($GLOBALS['phpgw']->link('/expressoAdmin1_2/inc/access_denied.php')); |
---|
| 262 | } |
---|
| 263 | |
---|
| 264 | // GET all infomations about the group. |
---|
[64] | 265 | $maillist_info = $this->maillist->get_info($_GET['uidnumber']); |
---|
[2] | 266 | |
---|
| 267 | unset($GLOBALS['phpgw_info']['flags']['noheader']); |
---|
| 268 | unset($GLOBALS['phpgw_info']['flags']['nonavbar']); |
---|
[283] | 269 | $GLOBALS['phpgw_info']['flags']['app_header'] = $GLOBALS['phpgw_info']['apps']['expressoAdmin1_2']['title'].' - '.lang('Edit e-mail list'); |
---|
[2] | 270 | $GLOBALS['phpgw']->common->phpgw_header(); |
---|
| 271 | |
---|
| 272 | // Set o template |
---|
| 273 | $p = CreateObject('phpgwapi.Template',PHPGW_APP_TPL); |
---|
| 274 | $p->set_file(Array('edit_maillist' => 'maillists_form.tpl')); |
---|
| 275 | |
---|
[180] | 276 | // Obtem combos das organizações. |
---|
| 277 | foreach ($manager_contexts as $index=>$context) |
---|
| 278 | $combo_manager_org .= $this->functions->get_organizations($context, trim(strtolower($maillist_info['context']))); |
---|
[208] | 279 | $combo_all_orgs = $this->functions->get_organizations($GLOBALS['phpgw_info']['server']['ldap_context'], trim(strtolower($maillist_info['context'])), true, true, true); |
---|
[2] | 280 | |
---|
| 281 | // Usuarios da lista. |
---|
[73] | 282 | $user_count = 0; |
---|
[180] | 283 | if (count($maillist_info['mailForwardingAddress_info']) > 0) |
---|
[2] | 284 | { |
---|
[180] | 285 | foreach ($maillist_info['mailForwardingAddress_info'] as $mail=>$userinfo) |
---|
[2] | 286 | { |
---|
[180] | 287 | $array_users[$mail] = $userinfo['cn']; |
---|
| 288 | $array_users_uid[$mail] = $userinfo['uid']; |
---|
| 289 | $array_users_type[$mail] = $userinfo['type']; |
---|
[2] | 290 | } |
---|
| 291 | natcasesort($array_users); |
---|
[180] | 292 | foreach ($array_users as $mail=>$cn) |
---|
[2] | 293 | { |
---|
[73] | 294 | $user_count++; |
---|
[180] | 295 | if ($array_users_type[$mail] == 'u') |
---|
[23] | 296 | { |
---|
[180] | 297 | $users .= "<option value=" . $mail . ">" . $cn . " [" . $array_users_uid[$mail] . "]</option>"; |
---|
[23] | 298 | } |
---|
[180] | 299 | elseif ($array_users_type[$mail] == 'l') |
---|
[23] | 300 | { |
---|
[180] | 301 | $lists .= "<option value=" . $mail . ">" . $cn . " [" . $array_users_uid[$mail] . "]</option>"; |
---|
[23] | 302 | } |
---|
[24] | 303 | else |
---|
| 304 | { |
---|
[180] | 305 | $mail_not_found .= "<option value=" . $mail . ">" . $cn . " [" . $array_users_uid[$mail] . "]</option>"; |
---|
[24] | 306 | } |
---|
[2] | 307 | } |
---|
[23] | 308 | |
---|
[180] | 309 | if ($mail_not_found != '') |
---|
[24] | 310 | { |
---|
[283] | 311 | $opt_tmp_mail_not_found = '<option value="-1" disabled>-------------------- '.lang('E-mails not found').' ------------------ </option>'."\n"; |
---|
[180] | 312 | $ea_select_usersInMaillist .= $opt_tmp_mail_not_found . $mail_not_found; |
---|
[24] | 313 | } |
---|
| 314 | if ($lists != '') |
---|
| 315 | { |
---|
[283] | 316 | $opt_tmp_lists = '<option value="-1" disabled>------------------------------ '.lang('Lists').' ------------------------------ </option>'."\n"; |
---|
[24] | 317 | $ea_select_usersInMaillist .= $opt_tmp_lists . $lists; |
---|
| 318 | } |
---|
[283] | 319 | $opt_tmp_users = '<option value="-1" disabled>----------------------------- '.lang('Users').' ---------------------------- </option>'."\n"; |
---|
[24] | 320 | $ea_select_usersInMaillist .= $opt_tmp_users . $users; |
---|
[2] | 321 | } |
---|
| 322 | |
---|
| 323 | // Seta variaveis utilizadas pelo tpl. |
---|
| 324 | $var = Array( |
---|
[283] | 325 | 'back_url' => $GLOBALS['phpgw']->link('/index.php','menuaction=expressoAdmin1_2.uimaillists.list_maillists'), |
---|
[2] | 326 | 'color_bg1' => "#E8F0F0", |
---|
| 327 | 'color_bg2' => "#D3DCE3", |
---|
| 328 | 'type' => 'edit_maillist', |
---|
[23] | 329 | 'ldap_context' => $GLOBALS['phpgw_info']['server']['ldap_context'], |
---|
[180] | 330 | 'combo_manager_org' => $combo_manager_org, |
---|
| 331 | 'combo_all_orgs' => $combo_all_orgs, |
---|
[2] | 332 | 'uidnumber' => $_GET['uidnumber'], |
---|
| 333 | 'uid' => $maillist_info['uid'], |
---|
| 334 | 'mail' => $maillist_info['mail'], |
---|
| 335 | 'cn' => $maillist_info['cn'], |
---|
[73] | 336 | 'user_count' => $user_count, |
---|
[2] | 337 | 'accountStatus_checked' => $maillist_info['accountStatus'] == 'active' ? 'CHECKED' : '', |
---|
| 338 | 'phpgwAccountVisible_checked' => $maillist_info['phpgwAccountVisible'] == '-1' ? 'CHECKED' : '', |
---|
[180] | 339 | 'ea_select_usersInMaillist' => $ea_select_usersInMaillist, |
---|
[283] | 340 | 'defaultDomain' => $this->current_config['expressoAdmin_defaultDomain'], |
---|
| 341 | 'restrictionsOnEmailLists' => $this->current_config['expressoAdmin_restrictionsOnEmailLists'], |
---|
| 342 | 'lang_back' => lang('Back'), |
---|
| 343 | 'lang_save' => lang('Save'), |
---|
| 344 | 'lang_maillist_organization' => lang('E-mail list organization'), |
---|
| 345 | 'lang_search_organization' => lang('Search organization'), |
---|
| 346 | 'lang_search_user' => lang('Search user'), |
---|
| 347 | 'lang_organizations' => lang('Organizations'), |
---|
| 348 | 'lang_maillist_uid' => lang('E-mail list login'), |
---|
| 349 | 'lang_maillist_mail' => lang('E-mail list address'), |
---|
| 350 | 'lang_maillist_name' => lang('E-mail list name'), |
---|
| 351 | 'lang_maillist_users' => lang('E-mail list users'), |
---|
| 352 | 'lang_users' => lang('Users'), |
---|
| 353 | 'lang_add_user' => lang('Add User'), |
---|
| 354 | 'lang_rem_user' => lang('Remove User'), |
---|
| 355 | 'lang_email_list_empty' => lang('The e-mail list is empty'), |
---|
| 356 | 'lang_hide_email_list' => lang('Hide e-mail list'), |
---|
| 357 | 'email_list_successfully_saved' => lang('E-mail list successfully saved!'), |
---|
| 358 | 'lang_all_users' => lang('Show users from all sub-organizations'), |
---|
| 359 | 'login_field_incomplete' => lang("The lists' name field is incomplete. The lists' name must be in the following format: lista-organization-name. Ex: lista-celepar-rh") |
---|
[2] | 360 | ); |
---|
| 361 | $p->set_var($var); |
---|
| 362 | |
---|
| 363 | $p->pfp('out','edit_maillist'); |
---|
| 364 | } |
---|
[23] | 365 | |
---|
| 366 | function scl_maillists() |
---|
| 367 | { |
---|
| 368 | $GLOBALS['phpgw']->js->set_onload('get_available_users(document.forms[0].org_context.value, document.forms[0].ea_check_allUsers.checked);'); |
---|
| 369 | |
---|
[64] | 370 | $manager_lid = $GLOBALS['phpgw']->accounts->data['account_lid']; |
---|
| 371 | $manager_acl = $this->functions->read_acl($manager_lid); |
---|
| 372 | $manager_contexts = $manager_acl['contexts']; |
---|
| 373 | |
---|
[23] | 374 | // Verifica se tem acesso a este modulo |
---|
[64] | 375 | if (!$this->functions->check_acl($manager_lid,'edit_maillists')) |
---|
[23] | 376 | { |
---|
| 377 | $GLOBALS['phpgw']->redirect($GLOBALS['phpgw']->link('/expressoAdmin1_2/inc/access_denied.php')); |
---|
| 378 | } |
---|
| 379 | |
---|
| 380 | // GET all infomations about the group. |
---|
[64] | 381 | $maillist_info = $this->maillist->get_scl_info($_GET['uidnumber']); |
---|
[23] | 382 | |
---|
| 383 | unset($GLOBALS['phpgw_info']['flags']['noheader']); |
---|
| 384 | unset($GLOBALS['phpgw_info']['flags']['nonavbar']); |
---|
[283] | 385 | $GLOBALS['phpgw_info']['flags']['app_header'] = $GLOBALS['phpgw_info']['apps']['expressoAdmin1_2']['title'].' - '.lang('Edit sending control list'); |
---|
[23] | 386 | $GLOBALS['phpgw']->common->phpgw_header(); |
---|
| 387 | |
---|
| 388 | // Set o template |
---|
| 389 | $p = CreateObject('phpgwapi.Template',PHPGW_APP_TPL); |
---|
| 390 | $p->set_file(Array('sql_maillist' => 'maillists_scl.tpl')); |
---|
| 391 | |
---|
| 392 | // Pega combo das organizações e seleciona a org da lista. |
---|
[64] | 393 | // $org = $this->functions->get_organizations($manager_context, trim(strtolower($maillist_info['context']))); |
---|
| 394 | foreach ($manager_contexts as $index=>$context) |
---|
| 395 | $sectors .= $this->functions->get_organizations($context, trim(strtolower($maillist_info['context'])) ); |
---|
[23] | 396 | |
---|
| 397 | // Usuarios de senders. |
---|
| 398 | if (count($maillist_info['senders_info']) > 0) |
---|
| 399 | { |
---|
[208] | 400 | foreach ($maillist_info['senders_info'] as $mail=>$senderinfo) |
---|
[23] | 401 | { |
---|
[208] | 402 | $array_senders[$mail] = $senderinfo['cn']; |
---|
[23] | 403 | } |
---|
| 404 | natcasesort($array_senders); |
---|
[208] | 405 | foreach ($array_senders as $mail=>$cn) |
---|
[23] | 406 | { |
---|
[208] | 407 | $ea_select_users_SCL_Maillist .= "<option value=" . $mail . ">" . $cn . " [" . $mail . "]</option>"; |
---|
[23] | 408 | } |
---|
| 409 | } |
---|
| 410 | |
---|
| 411 | // Seta variaveis utilizadas pelo tpl. |
---|
| 412 | $var = Array( |
---|
| 413 | 'color_bg1' => "#E8F0F0", |
---|
| 414 | 'color_bg2' => "#D3DCE3", |
---|
| 415 | 'type' => 'edit_maillist', |
---|
| 416 | 'ldap_context' => $GLOBALS['phpgw_info']['server']['ldap_context'], |
---|
| 417 | 'dn' => $maillist_info['dn'], |
---|
| 418 | 'back_url' => $GLOBALS['phpgw']->link('/index.php','menuaction=expressoAdmin1_2.uimaillists.list_maillists'), |
---|
[64] | 419 | 'combo_org' => $sectors, |
---|
[23] | 420 | 'uidnumber' => $_GET['uidnumber'], |
---|
| 421 | 'uid' => $maillist_info['uid'], |
---|
| 422 | 'mail' => $maillist_info['mail'], |
---|
| 423 | 'cn' => $maillist_info['cn'], |
---|
| 424 | 'accountRestrictive_checked' => $maillist_info['accountRestrictive'] == 'mailListRestriction' ? 'CHECKED' : '', |
---|
[283] | 425 | 'participantCanSendMail_checked' => $maillist_info['participantCanSendMail'] == 'TRUE' ? 'CHECKED' : '', |
---|
| 426 | 'ea_select_users_SCL_Maillist' => $ea_select_users_SCL_Maillist, |
---|
| 427 | 'lang_back' => lang('Back'), |
---|
| 428 | 'lang_save' => lang('Save'), |
---|
| 429 | 'lang_org' => lang('Organizations'), |
---|
| 430 | 'lang_maillist_uid' => lang('E-mail list login'), |
---|
| 431 | 'lang_maillist_mail' => lang('E-mail list address'), |
---|
| 432 | 'lang_maillist_name' => lang('E-mail list name'), |
---|
| 433 | 'lang_maillist_users' => lang('E-mail list users'), |
---|
| 434 | 'lang_add_user' => lang('Add user'), |
---|
| 435 | 'lang_rem_user' => lang('Remove user'), |
---|
| 436 | 'lang_apply_scl' => lang('Apply send control to this list?'), |
---|
| 437 | 'lang_list_email' => lang('List e-mail'), |
---|
| 438 | 'lang_members_send' => lang('List members can send e-mail?'), |
---|
| 439 | 'lang_allowed_send_email' => lang('Users allowed to send e-mail to the list'), |
---|
| 440 | 'lang_organization' => lang('Organizations'), |
---|
| 441 | 'lang_search_user' => lang('Search user'), |
---|
| 442 | 'lang_users' => lang('Users'), |
---|
| 443 | 'sending_control_list_successfully_saved' => lang('Sending control list sucessfully saved!'), |
---|
| 444 | 'lang_all_users' => lang('Show users from all sub-organizations') |
---|
[23] | 445 | ); |
---|
| 446 | $p->set_var($var); |
---|
| 447 | |
---|
| 448 | $p->pfp('out','sql_maillist'); |
---|
| 449 | } |
---|
| 450 | |
---|
[2] | 451 | function row_action($action,$type,$uidnumber,$maillist_uid) |
---|
| 452 | { |
---|
| 453 | return '<a href="'.$GLOBALS['phpgw']->link('/index.php',Array( |
---|
| 454 | 'menuaction' => 'expressoAdmin1_2.uimaillists.'.$action.'_'.$type, |
---|
| 455 | 'uidnumber' => $uidnumber, |
---|
| 456 | 'maillist_uid' => $maillist_uid |
---|
| 457 | )).'"> '.lang($action).' </a>'; |
---|
| 458 | } |
---|
| 459 | |
---|
| 460 | function css() |
---|
| 461 | { |
---|
| 462 | $appCSS = ''; |
---|
| 463 | return $appCSS; |
---|
| 464 | } |
---|
| 465 | } |
---|
| 466 | ?> |
---|