source: branches/2.2/jabberit_messenger/inc/class.uijmessenger.inc.php @ 3102

Revision 3102, 3.8 KB checked in by amuller, 14 years ago (diff)

Ticket #986 - Efetuado merge para o Branch 2.2( atualizacao do modulo)

  • Property svn:executable set to *
Line 
1<?php
2  /***************************************************************************\
3  *  Expresso - Expresso Messenger                                            *
4  *     - Alexandre Correia / Rodrigo Souza                                                               *
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
12require_once "class.bojmessenger.inc.php";
13
14class uijmessenger
15{
16        private $bo;
17       
18        public $public_functions = array(
19                'backPage'              => true,
20                'getGroups'             => true,
21                'setGroups'             => true,
22        );
23       
24        function __construct()
25        {
26                $this->bo = new bojmessenger();
27        }
28
29        public final function getGroups()
30        {
31                if( !$GLOBALS['phpgw']->acl->check('run',1,'admin') )
32                {
33                        $GLOBALS['phpgw']->redirect_link('/admin/index.php');
34                }
35
36                $GLOBALS['phpgw']->common->phpgw_header();
37                echo parse_navbar();
38               
39                $webserver_url = $GLOBALS['phpgw_info']['server']['webserver_url'];
40                $webserver_url = ( !empty($webserver_url) ) ? $webserver_url : '/';
41
42                if(strrpos($webserver_url,'/') === false || strrpos($webserver_url,'/') != (strlen($webserver_url)-1))
43                        $webserver_url .= '/';
44
45                echo '<script type="text/javascript">var path_jabberit="'.$webserver_url .'"</script>';
46               
47                // Ldap Groups;
48                $optionsOUS = "<option value='-1'>-- ".lang('Select Organization')." --</option>";     
49                if( ($LdapOus = $this->bo->getOrganizationsLdap('localhost')) )
50                {
51                        foreach($LdapOus as $key => $val )
52                                $optionsOUS .= "<option value='".$key."'>".$val."</option>";
53                }
54               
55                // JMessenger Groups;           
56                $groups = unserialize($this->bo->getGroupsJmessenger());
57
58                if( $groups )
59                {
60                        natcasesort($groups);
61                               
62                        foreach($groups as $tmp)
63                        {
64                                $grp = explode(":", $tmp);
65                                $optionsGroups .= "<option value='".$tmp."'>".$grp[0]."</option>";
66                        }
67                }                                               
68
69                $GLOBALS['phpgw']->template->set_file(array('jabberit_messenger'=>'jmessenger.tpl'));
70                $GLOBALS['phpgw']->template->set_block('jabberit_messenger','edit_groups_jmessenger'); 
71                $GLOBALS['phpgw']->template->set_var(array(
72                                                                                                'action_url' => $GLOBALS['phpgw']->link('/index.php','menuaction=jabberit_messenger.uijmessenger.setGroups'),                                                                           
73                                                                                                'label_Back'                    => "Voltar",
74                                                                                                'lang_add'                              => lang("add"),
75                                                                                                'lang_cancel'                   => lang("Cancel"),
76                                                                                                'lang_description'              => "Adicione somente os grupos para utilizar o JMESSENGER SEM JAVA.",
77                                                                                                'lang_groups_add'               => lang("Groups Added"),
78                                                                                                'lang_groups_ldap'              => lang("Groups Ldap"),
79                                                                                                'lang_organizations'    => lang("Organizations"),
80                                                                                                'lang_remove'                   => lang("Remove"),
81                                                                                                'lang_save'                             => lang("Save"),
82                                                                                                'lang_Search_quick_for' => "Busca rápida por",
83                                                                                                'lang_settings'                 => lang("Settings"),
84                                                                                                'value_ous_ldap'                => $optionsOUS,
85                                                                                                'value_groups_added'    => $optionsGroups,                                                                                             
86                                                                                                'value_serverLdap'              => 'localhost'
87                                                                                        ));
88
89                $GLOBALS['phpgw']->template->pparse('out','edit_groups_jmessenger');
90        }
91
92        public final function setGroups()
93        {               
94                if( !$GLOBALS['phpgw']->acl->check('run',1,'admin') )
95                {
96                        $GLOBALS['phpgw']->redirect_link('/admin/index.php');
97                }
98               
99                if( $_POST['cancel'] || $_POST['save'] )
100                {
101                        if( $_POST['save'] )
102                        {
103                                $groups_added_jabberit = ( $_POST['groups_added_jabberit'] ) ? $_POST['groups_added_jabberit'] : "";                           
104                                $this->bo->setAddGroupsJmessenger($groups_added_jabberit);
105                        }       
106                               
107                        $GLOBALS['phpgw']->redirect_link('/index.php?menuaction=jabberit_messenger.uiconfig.configPermission');
108                }
109        }
110                       
111}
112
113?>
Note: See TracBrowser for help on using the repository browser.