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

Revision 1678, 4.6 KB checked in by amuller, 14 years ago (diff)

Ticket #597 - Integração com antivirus, e gestão de quotas

  • 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                 );
18
19                function vfs_functions(){
20                }
21
22                 function quota(){
23                         $GLOBALS['phpgw_info']['flags'] = array
24                                 (
25                                         'currentapp'    => 'filemanager',
26                                         'noheader'      => False,
27                                         'nonavbar' => False,
28                                         'nofooter'      => False,
29                                         'noappheader'   => False,
30                                         'enable_browser_class'  => True
31                                 );
32
33                         $GLOBALS['phpgw']->common->phpgw_header();
34                        echo "<script src='".$GLOBALS['phpgw_info']['flags']['currentapp']."/js/connector.js'></script>";
35                        echo "<script src='".$GLOBALS['phpgw_info']['flags']['currentapp']."/js/common_functions.js'></script>";
36                 
37                        echo "<script type='text/javascript'>
38                                function loadq_handler(data){
39                                        document.getElementById('quota_size').value = data;
40                 }
41                function load_quota(el){
42                        cExecute('/index.php?menuaction=filemanager.uiconfig.load_quota&name='+base64_encode(el.value),loadq_handler);
43                 }
44                function save_quota(){
45                        var dirName = document.getElementById('search1').value;
46                        var Qsize = document.getElementById('quota_size').value;
47                        cExecute('/index.php?menuaction=filemanager.uiconfig.update_quota&dir='+base64_encode(dirName)+'&val='+Qsize,alert);
48                 }
49                function dir_handler(data){
50                        document.getElementById('search1').innerHTML = data;
51                 }
52                function search_dir(el){
53                        if (el.value.length < 4){
54                                document.getElementById('span_searching1').innerHTML = '".lang('Type at least 4 chars')."';
55                 }
56else
57{
58        document.getElementById('span_searching1').innerHTML = '';
59        cExecute('/index.php?menuaction=filemanager.uiconfig.search_dir&name='+el.value,dir_handler);
60                 }
61                 }
62                                </script>";
63                         echo "<b>".lang('Directory')."</b><br><font color='red'><span id='span_searching1'>&nbsp;</span></font><br>".lang('Search').":<input value='' size='30' onkeyup='search_dir(this)' type='text'><br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<select id='search1' style='width:200px;' onclick='load_quota(this)' size='5'></select><br><br>Quota:<input id='quota_size' size='10' type='text'>mb<br><br><input onclick='save_quota()' type=button value=".lang('save').">";
64                 }
65                 function search_dir(){
66                         $GLOBALS['phpgw_info']['flags'] = array
67                                 (
68                                         'currentapp'    => 'filemanager',
69                                         'noheader'      => True,
70                                         'nonavbar' => True,
71                                         'nofooter'      => True,
72                                         'noappheader'   => True,
73                                         'enable_browser_class'  => True
74                                 );
75                         $name = $GLOBALS['phpgw']->db->db_addslashes($_GET['name']);
76                         $GLOBALS['phpgw']->db->query('SELECT DISTINCT directory FROM phpgw_vfs WHERE directory like \'%'.$name.'%\' LIMIT 20',__LINE__,__FILE__);
77                         while ($GLOBALS['phpgw']->db->next_record()){
78                                 $val = $GLOBALS['phpgw']->db->row();
79                                 echo "<option>".$val['directory']."</option>";
80                         }
81                 }
82                 function update_quota(){
83                         $GLOBALS['phpgw_info']['flags'] = array
84                                 (
85                                         'currentapp'    => 'filemanager',
86                                         'noheader'      => True,
87                                         'nonavbar' => True,
88                                         'nofooter'      => True,
89                                         'noappheader'   => True,
90                                         'enable_browser_class'  => True
91                                 );
92                         $name = $GLOBALS['phpgw']->db->db_addslashes(base64_decode($_GET['dir']));
93                         $size = ($_GET['val'])*1;
94                         $GLOBALS['phpgw']->db->query('UPDATE phpgw_vfs_quota SET quota_size = '.$size.' WHERE directory = \''.$name.'\'',__LINE__,__FILE__);
95                         if ($GLOBALS['phpgw']->db->Error)
96                                 echo "Erro";
97                         else
98                                 echo lang('entry updated sucessfully');
99                         return;
100
101                 }
102                 function load_quota(){
103                         $GLOBALS['phpgw_info']['flags'] = array
104                                 (
105                                         'currentapp'    => 'filemanager',
106                                         'noheader'      => True,
107                                         'nonavbar' => True,
108                                         'nofooter'      => True,
109                                         'noappheader'   => True,
110                                         'enable_browser_class'  => True
111                                 );
112                         $name = $GLOBALS['phpgw']->db->db_addslashes(base64_decode($_GET['name']));
113                         $GLOBALS['phpgw']->db->query('SELECT quota_size FROM phpgw_vfs_quota WHERE directory = \''.$name.'\' LIMIT 1',__LINE__,__FILE__);
114                         $GLOBALS['phpgw']->db->next_record();
115                         $val =$GLOBALS['phpgw']->db->row();
116                         echo $val['quota_size'];
117                         return;
118
119                 }
120
121
122        }
123?>
Note: See TracBrowser for help on using the repository browser.