source: sandbox/filemanager/inc/class.uiconfig.inc.php @ 1787

Revision 1787, 5.9 KB checked in by amuller, 14 years ago (diff)

Ticket #597 - Melhorias no módulos gerenciador de arquivos do expresso livre

  • Property svn:executable set to *
Line 
1<?php
2        /**************************************************************************\
3        * -------------------------------------------------------------------------*
4        * This library is free software; you can redistribute it and/or modify it  *
5        * under the terms of the GNU Lesser General Public License as published by *
6        * the Free Software Foundation; either version 2.1 of the License,         *
7        * or any later version.                                                    *
8        \**************************************************************************/
9
10        class uiconfig
11        {
12                var $public_functions = array(
13                        'search_dir' => True,
14                        'update_quota' => True,
15                        'load_quota' => True,
16                        'quota' => True,
17                        'removeFolder' => True,
18                        'folders' => True
19                 );
20
21                function vfs_functions(){
22                }
23                 function folders(){
24                         $GLOBALS['phpgw_info']['flags'] = array
25                                 (
26                                         'currentapp'    => 'filemanager',
27                                         'noheader'      => False,
28                                         'nonavbar' => False,
29                                         'nofooter'      => False,
30                                         'noappheader'   => False,
31                                         'enable_browser_class'  => True
32                                 );
33
34                         $GLOBALS['phpgw']->common->phpgw_header();
35                        include('load_lang.php');
36                        echo "<script src='".$GLOBALS['phpgw_info']['flags']['currentapp']."/js/connector.js'></script>";
37                        echo "<script src='".$GLOBALS['phpgw_info']['flags']['currentapp']."/js/common_functions.js'></script>";
38                        echo "<script src='".$GLOBALS['phpgw_info']['flags']['currentapp']."/js/config.js'></script>";
39                        $t = $GLOBALS['phpgw']->template;
40                        $t->set_file(array('config_list' => 'config_folders.tpl'));
41                        $t->set_block('config_list','body','body');
42                        $vars[lang_directory]=lang('directory');
43                        $vars[lang_search]=lang('search');
44                        $vars[lang_remove]=lang('remove');
45
46                        $t->set_var($vars);
47                        $t->pparse('out','body');
48                        $GLOBALS['phpgw']->common->phpgw_footer();
49                        $GLOBALS['phpgw']->common->phpgw_exit();
50
51                 }
52                 function removeFolder(){
53                         $GLOBALS['phpgw_info']['flags'] = array
54                                 (
55                                         'currentapp'    => 'filemanager',
56                                         'noheader'      => True,
57                                         'nonavbar' => True,
58                                         'nofooter'      => True,
59                                         'noappheader'   => True,
60                                         'enable_browser_class'  => True
61                                 );
62                         $bo = CreateObject('filemanager.bofilemanager');
63                         $name = $GLOBALS['phpgw']->db->db_addslashes(base64_decode($_GET['dir']));
64                         if (strlen($name) < 2)
65                                 return false;
66                         $bo->vfs->delete(array(
67                                 'string' => $name,
68                                 'relatives' => array(RELATIVE_NONE)
69                         ));
70
71                         /* Clean the trash */
72                         $GLOBALS['phpgw']->db->query('DELETE FROM phpgw_vfs WHERE directory = \''.$name.'\'',__LINE__,__FILE__);
73                         if ($GLOBALS['phpgw']->db->Error)
74                                 echo "Erro";
75                         else
76                         {               
77                                 $GLOBALS['phpgw']->db->query('DELETE FROM phpgw_vfs_quota WHERE directory = \''.$name.'\'',__LINE__,__FILE__);
78                                 if (!$GLOBALS['phpgw']->db->Error)
79                                         echo lang('directory removed sucessfully');
80                                 else
81                                         echo "Erro";
82                         }
83                         return;
84
85                 }
86
87
88                 function quota(){
89                         $GLOBALS['phpgw_info']['flags'] = array
90                                 (
91                                         'currentapp'    => 'filemanager',
92                                         'noheader'      => False,
93                                         'nonavbar' => False,
94                                         'nofooter'      => False,
95                                         'noappheader'   => False,
96                                         'enable_browser_class'  => True
97                                 );
98
99                         $GLOBALS['phpgw']->common->phpgw_header();
100                        include('load_lang.php');
101                        echo "<script src='".$GLOBALS['phpgw_info']['flags']['currentapp']."/js/connector.js'></script>";
102                        echo "<script src='".$GLOBALS['phpgw_info']['flags']['currentapp']."/js/common_functions.js'></script>";
103                        echo "<script src='".$GLOBALS['phpgw_info']['flags']['currentapp']."/js/config.js'></script>";
104                        $t = $GLOBALS['phpgw']->template;
105                        $t->set_file(array('config_list' => 'config_quota.tpl'));
106                        $t->set_block('config_list','body','body');
107                        $vars[lang_directory]=lang('directory');
108                        $vars[lang_search]=lang('search');
109                        $vars[lang_save]=lang('save');
110
111                        $t->set_var($vars);
112                        $t->pparse('out','body');
113                        $GLOBALS['phpgw']->common->phpgw_footer();
114                        $GLOBALS['phpgw']->common->phpgw_exit();
115
116                 }
117                 function search_dir(){
118                         $GLOBALS['phpgw_info']['flags'] = array
119                                 (
120                                         'currentapp'    => 'filemanager',
121                                         'noheader'      => True,
122                                         'nonavbar' => True,
123                                         'nofooter'      => True,
124                                         'noappheader'   => True,
125                                         'enable_browser_class'  => True
126                                 );
127                         $name = $GLOBALS['phpgw']->db->db_addslashes($_GET['name']);
128                         $GLOBALS['phpgw']->db->query('SELECT DISTINCT directory FROM phpgw_vfs WHERE directory like \'%'.$name.'%\' LIMIT 20',__LINE__,__FILE__);
129                         while ($GLOBALS['phpgw']->db->next_record()){
130                                 $val = $GLOBALS['phpgw']->db->row();
131                                 echo "<option>".$val['directory']."</option>";
132                         }
133                 }
134                 function update_quota(){
135                         $GLOBALS['phpgw_info']['flags'] = array
136                                 (
137                                         'currentapp'    => 'filemanager',
138                                         'noheader'      => True,
139                                         'nonavbar' => True,
140                                         'nofooter'      => True,
141                                         'noappheader'   => True,
142                                         'enable_browser_class'  => True
143                                 );
144                         $name = $GLOBALS['phpgw']->db->db_addslashes(base64_decode($_GET['dir']));
145                         $size = ($_GET['val'])*1;
146                         $GLOBALS['phpgw']->db->query('UPDATE phpgw_vfs_quota SET quota_size = '.$size.' WHERE directory = \''.$name.'\'',__LINE__,__FILE__);
147                         if ($GLOBALS['phpgw']->db->Error)
148                                 echo "Erro";
149                         else
150                                 echo lang('entry updated sucessfully');
151                         return;
152
153                 }
154                 function load_quota(){
155                         $GLOBALS['phpgw_info']['flags'] = array
156                                 (
157                                         'currentapp'    => 'filemanager',
158                                         'noheader'      => True,
159                                         'nonavbar' => True,
160                                         'nofooter'      => True,
161                                         'noappheader'   => True,
162                                         'enable_browser_class'  => True
163                                 );
164                         $name = $GLOBALS['phpgw']->db->db_addslashes(base64_decode($_GET['name']));
165                         $GLOBALS['phpgw']->db->query('SELECT quota_size FROM phpgw_vfs_quota WHERE directory = \''.$name.'\' LIMIT 1',__LINE__,__FILE__);
166                         $GLOBALS['phpgw']->db->next_record();
167                         $val =$GLOBALS['phpgw']->db->row();
168                         echo $val['quota_size'];
169                         return;
170
171                 }
172
173
174        }
175?>
Note: See TracBrowser for help on using the repository browser.