Changeset 1905


Ignore:
Timestamp:
12/29/09 10:14:51 (14 years ago)
Author:
amuller
Message:

Ticket #597 - Melhoria do FM. melhorias na interface, Compartilhamento de grupos

Location:
sandbox/filemanager
Files:
1 added
6 edited

Legend:

Unmodified
Added
Removed
  • sandbox/filemanager/inc/class.uiconfig.inc.php

    r1888 r1905  
    1212                var $public_functions = array( 
    1313                        'search_dir' => True, 
     14                        'search_user' => True, 
    1415                        'update_quota' => True, 
    1516                        'load_quota' => True, 
     
    1718                        'removeFolder' => True, 
    1819                        'reconstructFolder' => True, 
     20                        'set_owner' => True, 
    1921                        'renameFolder' => True, 
     22                        'createFolder' => True, 
     23                        'groups_users' => True, 
    2024                        'folders' => True 
    2125                 ); 
     
    4650                        $vars[lang_remove]=lang('remove'); 
    4751                        $vars[lang_rename]=lang('rename'); 
     52                        $vars[lang_create]=lang('create'); 
    4853                        $vars[lang_reconstruct]=lang('reconstruct'); 
    4954 
     
    5459 
    5560                 } 
     61                 function groups_users(){ 
     62                         $GLOBALS['phpgw_info']['flags'] = array 
     63                                 ( 
     64                                         'currentapp'    => 'filemanager', 
     65                                         'noheader'      => False, 
     66                                         'nonavbar' => False, 
     67                                         'nofooter'      => False, 
     68                                         'noappheader'   => False, 
     69                                         'enable_browser_class'  => True 
     70                                 ); 
     71 
     72                         $GLOBALS['phpgw']->common->phpgw_header(); 
     73                        include('load_lang.php'); 
     74                        echo "<script src='".$GLOBALS['phpgw_info']['flags']['currentapp']."/js/connector.js'></script>"; 
     75                        echo "<script src='".$GLOBALS['phpgw_info']['flags']['currentapp']."/js/common_functions.js'></script>"; 
     76                        echo "<script src='".$GLOBALS['phpgw_info']['flags']['currentapp']."/js/config.js'></script>"; 
     77                        $t = $GLOBALS['phpgw']->template; 
     78                        $t->set_file(array('config_list' => 'config_owner.tpl')); 
     79                        $t->set_block('config_list','body','body'); 
     80                        $vars[lang_users_and_groups]=lang('Users and groups'); 
     81                        $vars[lang_search]=lang('search'); 
     82                        $vars[lang_directory]=lang('directory'); 
     83                        $vars[lang_config]=lang('config'); 
     84 
     85                        $t->set_var($vars); 
     86                        $t->pparse('out','body'); 
     87                        $GLOBALS['phpgw']->common->phpgw_footer(); 
     88                        $GLOBALS['phpgw']->common->phpgw_exit(); 
     89 
     90                 } 
     91 
     92                function createFolder(){ 
     93                         $GLOBALS['phpgw_info']['flags'] = array 
     94                                 ( 
     95                                         'currentapp'    => 'filemanager', 
     96                                         'noheader'      => True, 
     97                                         'nonavbar' => True, 
     98                                         'nofooter'      => True, 
     99                                         'noappheader'   => True, 
     100                                         'enable_browser_class'  => True 
     101                                 ); 
     102                         $bo = CreateObject('filemanager.bofilemanager'); 
     103                         $name = $GLOBALS['phpgw']->db->db_addslashes(base64_decode($_GET['name'])); 
     104                         if (strlen($name) < 2) 
     105                                 return false; 
     106                         $c = CreateObject('phpgwapi.config','filemanager'); 
     107                         $c->read_repository(); 
     108                         $current_config = $c->config_data; 
     109 
     110                         $bo->vfs->override_acl = 1; 
     111 
     112                         if ( $bo->vfs->mkdir(array( 
     113                                 'string' => $name, 
     114                                 'relatives' => array(RELATIVE_NONE) 
     115                         )) ) 
     116                         if ( $bo->vfs->set_quota(array( 
     117                                 'string' => $name, 
     118                                 'relatives' => array(RELATIVE_NONE), 
     119                                 'new_quota' => $current_config['filemanager_quota_size'] 
     120                         )) ) 
     121                         $return = True; 
     122 
     123                         $bo->vfs->override_acl = 0; 
     124                         if ($return){ 
     125                                 echo "Folder created"; 
     126                         } 
     127                         else 
     128                                 echo "Error"; 
     129                 } 
     130 
    56131                 function removeFolder(){ 
    57132                         $GLOBALS['phpgw_info']['flags'] = array 
     
    156231                                 ); 
    157232 
    158                          $GLOBALS['phpgw']->common->phpgw_header(); 
     233                        $GLOBALS['phpgw']->common->phpgw_header(); 
    159234                        include('load_lang.php'); 
    160235                        echo "<script src='".$GLOBALS['phpgw_info']['flags']['currentapp']."/js/connector.js'></script>"; 
     
    185260                                 ); 
    186261                         $name = $GLOBALS['phpgw']->db->db_addslashes($_GET['name']); 
    187                          $GLOBALS['phpgw']->db->query('SELECT DISTINCT directory FROM phpgw_vfs WHERE directory like \'%'.$name.'%\' LIMIT 20',__LINE__,__FILE__); 
     262                         $GLOBALS['phpgw']->db->query('SELECT DISTINCT directory FROM phpgw_vfs WHERE (directory like \'%'.$name.'%\') LIMIT 20',__LINE__,__FILE__); 
    188263                         while ($GLOBALS['phpgw']->db->next_record()){ 
    189264                                 $val = $GLOBALS['phpgw']->db->row(); 
    190265                                 echo "<option>".$val['directory']."</option>"; 
    191266                         } 
    192                  } 
     267                         $GLOBALS['phpgw']->db->query('SELECT directory,name from phpgw_vfs WHERE directory = \'/home\' and name like \'%'.$name.'%\' LIMIT 1',__LINE__,__FILE__); 
     268                         if ($GLOBALS['phpgw']->db->next_record()){ 
     269                                 $val = $GLOBALS['phpgw']->db->row(); 
     270                                 echo "<option>".$val['directory']."/".$val['name']."</option>"; 
     271                         } 
     272                         
     273 
     274                 } 
     275                 function search_user(){ 
     276                         $GLOBALS['phpgw_info']['flags'] = array 
     277                                 ( 
     278                                         'currentapp'    => 'filemanager', 
     279                                         'noheader'      => True, 
     280                                         'nonavbar' => True, 
     281                                         'nofooter'      => True, 
     282                                         'noappheader'   => True, 
     283                                         'enable_browser_class'  => True 
     284                                 ); 
     285                         $account_info = $GLOBALS['phpgw']->accounts->get_list('both',0,'','',$_GET['name'],'all'); 
     286 
     287                         foreach($account_info as $val) 
     288                                 echo "<option value='".$val['account_id']."'>".$val['account_lid']."</option>"; 
     289                 } 
     290                 function set_owner(){ 
     291                         $GLOBALS['phpgw_info']['flags'] = array 
     292                                 ( 
     293                                         'currentapp'    => 'filemanager', 
     294                                         'noheader'      => True, 
     295                                         'nonavbar' => True, 
     296                                         'nofooter'      => True, 
     297                                         'noappheader'   => True, 
     298                                         'enable_browser_class'  => True 
     299                                 ); 
     300                         $name = $GLOBALS['phpgw']->db->db_addslashes(base64_decode($_GET['dir'])); 
     301                         $owner = ($_GET['owner'])*1; 
     302 
     303                         $GLOBALS['phpgw']->db->query('UPDATE phpgw_vfs SET owner_id = '.$owner.' WHERE directory = \''.$name.'\'',__LINE__,__FILE__); 
     304                         if ($GLOBALS['phpgw']->db->Error) 
     305                                 echo "Erro"; 
     306                         else 
     307                         { 
     308                                 $dirs=explode('/',$name); 
     309                                 $GLOBALS['phpgw']->db->query('UPDATE phpgw_vfs SET owner_id = '.$owner.' WHERE directory = \'/'.$dirs[1].'\' and name=\''.$dirs[2].'\'',__LINE__,__FILE__); 
     310                                 if ($GLOBALS['phpgw']->db->Error) 
     311                                         echo "Erro"; 
     312                                 else 
     313                                 { 
     314                                         echo lang('entry updated sucessfully'); 
     315                                 } 
     316                         } 
     317                         return; 
     318                 } 
     319         
    193320                 function update_quota(){ 
    194321                         $GLOBALS['phpgw_info']['flags'] = array 
  • sandbox/filemanager/inc/class.uifilemanager.inc.php

    r1889 r1905  
    408408                        } 
    409409 
    410                         $this->update_groups();  
    411                         $this->groups_applications = array(); 
    412  
    413                         foreach ($this->readable_groups as $value) 
    414                         { 
    415                                 $applications = CreateObject('phpgwapi.applications', $value['account_id']); 
    416                                 $this->groups_applications[$value['account_name']] = $applications->read_account_specific(); 
    417                         } 
    418  
    419410                        /*Check permission*/ 
    420411                        if($this->bo->vfs->acl_check(array( 
     
    582573                        $this->groups_applications = array(); 
    583574 
     575                        $user_groups = $GLOBALS['phpgw']->accounts->membership(); 
     576                        foreach($user_groups as $val){ 
     577                                $account_name = $GLOBALS['phpgw']->accounts->id2name($val['account_id']); 
     578                                $this->readable_groups[$account_name] = array( 
     579                                        'account_id' => $val['account_id'], 
     580                                        'account_name' => $account_name 
     581                                ); 
     582                        } 
     583 
    584584                        foreach ($this->readable_groups as $value) 
    585585                        { 
     
    625625                                else 
    626626                                        $vars[tools_button] = ""; 
    627  
    628 /*                              $this->dirs=$this->all_other_directories(); 
    629                                 foreach($this->dirs as $dir) 
    630                                         if((($dir['directory'] . $dir['name']) != $this->path) && $this->bo->vfs->file_exists(array('string' => $dir['directory'] . $dir['name'],'relatives' => array(RELATIVE_NONE)))) 
    631                                         { 
    632                                                 //FIXME replace the html_form_option function 
    633                                                 $dirs_options .= $this->html_form_option($dir['directory'] . $dir['name'], $dir['directory'] . $dir['name']); 
    634                                         } 
    635                                 $toolbar.='<select name="todir" style="visibility:hidden">'.$dirs_options.'</select>';*/ 
    636627 
    637628                                $vars[toolbar1]=$toolbar; 
     
    12121203                        while(list($num, $group_array) = each($this->readable_groups)) 
    12131204                        { 
    1214                                 /* Don't list directories for groups that don't have access 
     1205                                // Don't list directories for groups that don't have access 
    12151206                                if(!$this->groups_applications[$group_array['account_name']][$this->bo->appname]['enabled']) 
    12161207                                { 
    1217 ]                                       continue; 
    1218                                 }*/ 
     1208                                        continue; 
     1209                                } 
    12191210 
    12201211                                $dirs[] = array('directory' => $this->bo->fakebase, 'name' => $group_array['account_name']); 
  • sandbox/filemanager/inc/hook_admin.inc.php

    r1787 r1905  
    2727                'Site Configuration' => $GLOBALS['phpgw']->link('/index.php','menuaction=admin.uiconfig.index&appname=' . $appname), 
    2828                'Folders management' => $GLOBALS['phpgw']->link('/index.php','menuaction='.$appname.'.uiconfig.folders'), 
    29                 'Quota management' => $GLOBALS['phpgw']->link('/index.php','menuaction='.$appname.'.uiconfig.quota') 
     29                'Quota management' => $GLOBALS['phpgw']->link('/index.php','menuaction='.$appname.'.uiconfig.quota'), 
     30                'Groups and users' => $GLOBALS['phpgw']->link('/index.php','menuaction='.$appname.'.uiconfig.groups_users') 
    3031 
    3132        ); 
  • sandbox/filemanager/js/config.js

    r1888 r1905  
    55function load_quota(el){ 
    66        cExecute('/index.php?menuaction=filemanager.uiconfig.load_quota&name='+base64_encode(el.value),loadq_handler); 
     7} 
     8function set_owner(){ 
     9        var dirName = document.getElementById('search1').value; 
     10        var ownerName = document.getElementById('search2').value; 
     11        cExecute('/index.php?menuaction=filemanager.uiconfig.set_owner&dir='+base64_encode(dirName)+'&owner='+ownerName,alert); 
    712} 
    813function save_quota(){ 
     
    1318function dir_handler(data){ 
    1419        document.getElementById('search1').innerHTML = data; 
     20} 
     21 
     22function user_handler(data){ 
     23        document.getElementById('search2').innerHTML = data; 
    1524} 
    1625var timeO; 
     
    2736        } 
    2837} 
    29  
     38function search_user(el){ 
     39        if (el.value.length < 4){ 
     40                document.getElementById('span_searching1').innerHTML = get_lang('Type at least 4 chars'); 
     41        } 
     42        else 
     43        { 
     44                document.getElementById('span_searching1').innerHTML = ''; 
     45                if (timeO) 
     46                        clearTimeout(timeO); 
     47                timeO = setTimeout('cExecute(\'/index.php?menuaction=filemanager.uiconfig.search_user&name='+el.value+'\',user_handler)',700); 
     48        } 
     49} 
    3050function delete_folder(){ 
    3151        var dirName = document.getElementById('search1').value; 
     
    4767} 
    4868 
     69function create_folder(){ 
     70        var toName = prompt(get_lang('Enter the name of folder you want to create:'),'/home/'); 
     71        if (toName.length > 1){ 
     72                cExecute('/index.php?menuaction=filemanager.uiconfig.createFolder&name='+base64_encode(toName),alert); 
     73        } 
     74} 
     75 
    4976function reconstruct_folder(){ 
    5077        var dirName = document.getElementById('search1').value; 
  • sandbox/filemanager/templates/default/config.tpl

    r1694 r1905  
    2020    </tr> 
    2121    <tr bgcolor="{row_on}"> 
    22     <td>{lang_antivirus_command}</td>     
     22    <td>{lang_antivirus_command}</td>  
    2323    <td> 
    2424    <input size="40" name="newsettings[filemanager_antivirus_command]" value="{value_filemanager_antivirus_command}"> 
  • sandbox/filemanager/templates/default/config_folders.tpl

    r1888 r1905  
    2424                                <input onclick="reconstruct_folder()" type="button" value="{lang_reconstruct}" /> 
    2525                                <input onclick="rename_folder()" type="button" value="{lang_rename}" /> 
     26                                <input onclick="create_folder()" type="button" value="{lang_create}" /> 
    2627                        </td> 
    2728                        <td> 
Note: See TracChangeset for help on using the changeset viewer.