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 | |
---|
12 | require_once "class.bomodule.inc.php"; |
---|
13 | |
---|
14 | class uimodule |
---|
15 | { |
---|
16 | public $public_functions = array( |
---|
17 | 'add' => True, |
---|
18 | 'edit_conf' => True, |
---|
19 | ); |
---|
20 | |
---|
21 | private $bo; |
---|
22 | |
---|
23 | final function __construct() |
---|
24 | { |
---|
25 | $this->bo = new bomodule(); |
---|
26 | } |
---|
27 | |
---|
28 | public final function edit_conf() |
---|
29 | { |
---|
30 | if( !$GLOBALS['phpgw']->acl->check('run',1,'admin') ) |
---|
31 | { |
---|
32 | $GLOBALS['phpgw']->redirect_link('/admin/index.php'); |
---|
33 | } |
---|
34 | |
---|
35 | $GLOBALS['phpgw_info']['flags']['app_header'] = lang('Admin') .' - ' . 'Configurar o Uso do Módulo'; |
---|
36 | |
---|
37 | if(!@is_object($GLOBALS['phpgw']->js)) |
---|
38 | { |
---|
39 | $GLOBALS['phpgw']->js = CreateObject('phpgwapi.javascript'); |
---|
40 | } |
---|
41 | |
---|
42 | $webserver_url = $GLOBALS['phpgw_info']['server']['webserver_url']; |
---|
43 | $webserver_url = ( !empty($webserver_url) ) ? $webserver_url : '/'; |
---|
44 | |
---|
45 | $js = array('functions'); |
---|
46 | |
---|
47 | foreach( $js as $tmp ) |
---|
48 | $GLOBALS['phpgw']->js->validate_file('',$tmp,'jabberit_messenger'); |
---|
49 | |
---|
50 | //$GLOBALS['phpgw']->common->phpgw_header(); |
---|
51 | //echo parse_navbar(); |
---|
52 | |
---|
53 | if( $apps_list = $this->bo->getApplicationsEnabled()) |
---|
54 | { |
---|
55 | $apps_list = unserialize($apps_list); |
---|
56 | if(is_array($apps_list)) |
---|
57 | { |
---|
58 | foreach($apps_list as $tmp) |
---|
59 | $apps_en .= "<option value='".$tmp."'>".substr($tmp,strpos($tmp, ";")+1)."</option>"; |
---|
60 | } |
---|
61 | } |
---|
62 | |
---|
63 | if( $apps_enabled = $this->bo->getApplicationsList() ) |
---|
64 | { |
---|
65 | if(is_array($apps_enabled)) |
---|
66 | { |
---|
67 | foreach($apps_enabled as $tmp ) |
---|
68 | $apps .= "<option value='".$tmp['name'].";".$tmp['title']."'>".$tmp['title']."</option>"; |
---|
69 | } |
---|
70 | } |
---|
71 | |
---|
72 | $GLOBALS['phpgw']->template->set_file(array('jabberit_messenger'=>'module.tpl')); |
---|
73 | $GLOBALS['phpgw']->template->set_block('jabberit_messenger','module'); |
---|
74 | $GLOBALS['phpgw']->template->set_var(array( |
---|
75 | 'action_url' => $GLOBALS['phpgw']->link('/index.php','menuaction=jabberit_messenger.uimodule.add'), |
---|
76 | 'apps_enabled' => $apps_en, |
---|
77 | 'apps_list' => $apps, |
---|
78 | 'lang_Select_the_modules_where_the_Expresso_Messenger_will_be_loaded' => lang('Select the modules where the Expresso Messenger will be loaded.'), |
---|
79 | 'lang_Enable_the_Expresso_Messenger_module' => lang('Enable the Expresso Messenger module'), |
---|
80 | 'lang_Modules_List' => lang('Modules List'), |
---|
81 | 'lang_Modules_Enabled' => lang('Modules Enabled'), |
---|
82 | 'lang_save' => lang('Save'), |
---|
83 | 'lang_cancel' => lang('Cancel') |
---|
84 | )); |
---|
85 | |
---|
86 | $GLOBALS['phpgw']->template->pparse('out','module'); |
---|
87 | } |
---|
88 | |
---|
89 | public final function add() |
---|
90 | { |
---|
91 | if( !$GLOBALS['phpgw']->acl->check('run',1,'admin') ) |
---|
92 | { |
---|
93 | $GLOBALS['phpgw']->redirect_link('/admin/index.php'); |
---|
94 | } |
---|
95 | |
---|
96 | if ($_POST['cancel']) |
---|
97 | { |
---|
98 | $GLOBALS['phpgw']->redirect_link('/index.php?menuaction=jabberit_messenger.uiconfig.configPermission'); |
---|
99 | } |
---|
100 | |
---|
101 | if ( $_POST['save'] ) |
---|
102 | { |
---|
103 | if(is_array($_POST['apps_enabled'])) |
---|
104 | $this->bo->setApplications($_POST['apps_enabled']); |
---|
105 | else |
---|
106 | $this->bo->setApplications(""); |
---|
107 | } |
---|
108 | |
---|
109 | $GLOBALS['phpgw']->redirect_link('/index.php?menuaction=jabberit_messenger.uiconfig.configPermission'); |
---|
110 | } |
---|
111 | } |
---|
112 | |
---|
113 | ?> |
---|