source: trunk/jabberit_messenger/inc/class.uihostsjabber.inc.php @ 915

Revision 915, 4.5 KB checked in by alexandrecorreia, 15 years ago (diff)

Ticket #505 - Arquivos modificados para a administração de hosts virtuais jabber

  • Property svn:executable set to *
Line 
1<?php
2
3  /***************************************************************************\
4  *  Expresso - Expresso Messenger                                            *
5  *     - Alexandre Correia / Rodrigo Souza                                                               *
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
13require_once "class.bohostsjabber.inc.php";
14
15class uihostsjabber
16{
17        private $bo;
18        private $ldap;
19
20        public $public_functions = array(
21                'backPage'  => True,
22                'edit_conf' => True,
23        );
24
25        function __construct()
26        {
27                $this->bo = new bohostsjabber();
28        }
29       
30        public final function edit_conf()
31        {
32                if($GLOBALS['phpgw']->acl->check('applications_access',1,'admin'))
33                {
34                        $GLOBALS['phpgw']->redirect_link('/index.php');
35                }               
36               
37                $GLOBALS['phpgw_info']['flags']['app_header'] = lang('Admin') .' - ' . 'Configurar Organizações e Servidores Jabber';   
38               
39                $_SESSION['phpgwinfo']['db_host'] = $GLOBALS['phpgw_info']['server']['db_host'];
40        $_SESSION['phpgwinfo']['db_port'] = $GLOBALS['phpgw_info']['server']['db_port'];
41        $_SESSION['phpgwinfo']['db_name'] = $GLOBALS['phpgw_info']['server']['db_name'];
42        $_SESSION['phpgwinfo']['db_user'] = $GLOBALS['phpgw_info']['server']['db_user'];
43        $_SESSION['phpgwinfo']['db_pass'] = $GLOBALS['phpgw_info']['server']['db_pass'];
44        $_SESSION['phpgwinfo']['db_type'] = $GLOBALS['phpgw_info']['server']['db_type'];
45                       
46                $webserver_url = $GLOBALS['phpgw_info']['server']['webserver_url'];
47                $webserver_url = ( !empty($webserver_url) ) ? $webserver_url : '/';
48               
49                $GLOBALS['phpgw']->common->phpgw_header();
50                echo parse_navbar();
51
52                // Load Language;
53                require_once "load_lang.php";
54
55
56                // Load Ldap;
57                require_once "class.ldap_im.inc.php";
58               
59                $ldap = new ldap_im();
60               
61                $ous = "<option value='-1'>-- ".lang('Select Organization')." --</option>";     
62                if( ($LdapOus = $ldap->listOrganizationsLdap()) )
63                {
64                        foreach($LdapOus as $tmp )
65                                $ous .= "<option value='".$tmp."'>".$tmp."</option>";
66                }
67               
68                $ConfHosts = $this->bo->getHostsJabber();
69               
70                if( $ConfHosts )
71                {
72                        $ConfHosts = unserialize($this->bo->getHostsJabber());
73                        $ConfHosts = explode(";", $ConfHosts);
74                        natcasesort($ConfHosts);
75                }
76               
77                $value_Organizations_Servers = "";
78               
79                if(is_array($ConfHosts))       
80                {
81                        foreach($ConfHosts as $values)
82                        {
83                                $itens = explode(":", $values);
84                       
85                                $value_Organizations_Servers .= "<tr id='".$values."' style='width:40%' class='row_off'>";
86                                $value_Organizations_Servers .= "<td>".$itens[0]."</td>";
87                                $value_Organizations_Servers .= "<td>".$itens[1]."</td>";
88                                $value_Organizations_Servers .= "<td><a href='javascript:constructScript.removeHostsJ(\"".$values."\");'>".lang('Delete')."</a></td>";
89                                $value_Organizations_Servers .= "</tr>";
90                        }
91                }
92               
93                $GLOBALS['phpgw']->template->set_file(array('jabberit_messenger' => 'confServersJabber.tpl'));
94                $GLOBALS['phpgw']->template->set_block('jabberit_messenger','confServersJabber');       
95                $GLOBALS['phpgw']->template->set_var(array(
96                                                                                                    'action_url' => $GLOBALS['phpgw']->link('/index.php','menuaction=jabberit_messenger.uihostsjabber.backPage'),
97                                                                                                        'lang_Add_Organizations_and_Servers_Jabber' => lang('Add organizations and servers jabber'),
98                                                                                                        'lang_Back' => lang('Back'),
99                                                                                                    'lang_Delete' => lang('Delete'),
100                                                                                                    'lang_Example' => lang('Example'),
101                                                                                                    'lang_Organization' => lang('Organization'),
102                                                                                                        'lang_save' => lang('Save'),
103                                                                                                    'lang_ServerJabber' => lang('Servers Jabber'),
104                                                                                                        'lang_Registration_Organizations_and_Server_Jabber' => lang("Registration of Organizations and Servers Jabber"),                                                                                                       
105                                                                                                        'options_ous_ldap' => $ous,
106                                                                                                        'value_Organizations_Servers' => $value_Organizations_Servers,
107                                                                                ));
108       
109                $GLOBALS['phpgw']->template->pparse('out','confServersJabber');
110        }
111       
112        public final function backPage()
113        {
114                if($GLOBALS['phpgw']->acl->check('applications_access',1,'admin'))
115                {
116                        $GLOBALS['phpgw']->redirect_link('/index.php');
117                }               
118               
119                if ($_POST['cancel'])
120                {
121                        $GLOBALS['phpgw']->redirect_link('/admin/index.php');
122                }
123
124                $GLOBALS['phpgw']->redirect_link('/admin/index.php');
125        }
126       
127}
128
129?>
Note: See TracBrowser for help on using the repository browser.