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