phpgroupware-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Phpgroupware-cvs] filemanager/inc hook_preferences.inc.php, 1.15 class.


From: ceb
Subject: [Phpgroupware-cvs] filemanager/inc hook_preferences.inc.php, 1.15 class.bofilemanager.inc.php, 1.11 class.uifilemanager.inc.php, 1.16
Date: Thu, 24 Feb 2005 15:07:20 -0000

Update of filemanager/inc

Modified Files:
     Branch: MAIN
            hook_preferences.inc.php lines: +2 -2
            class.bofilemanager.inc.php lines: +26 -28
            class.uifilemanager.inc.php lines: +103 -102

Log Message:
update

====================================================
Index: filemanager/inc/hook_preferences.inc.php
diff -u filemanager/inc/hook_preferences.inc.php:1.14 
filemanager/inc/hook_preferences.inc.php:1.15
--- filemanager/inc/hook_preferences.inc.php:1.14       Mon Jan 24 00:26:34 2005
+++ filemanager/inc/hook_preferences.inc.php    Tue Jan 25 02:40:30 2005
@@ -9,7 +9,7 @@

        {
                $file = array('Preferences'     => 
$GLOBALS['phpgw']->link('/index.php','menuaction=filemanager.uifilemanager.preferences'),
-                                       'Grant Access'  => 
$GLOBALS['phpgw']->link('/index.php','menuaction=preferences.uiaclprefs.index&acl_app='.$appname))
+                                       'Grant Access'  => 
$GLOBALS['phpgw']->link('/index.php','menuaction=preferences.uiaclprefs.index&acl_app='.$appname));
                //Do not modify below this line
                display_section($appname,$file);
        }

====================================================
Index: filemanager/inc/class.bofilemanager.inc.php
diff -u filemanager/inc/class.bofilemanager.inc.php:1.10 
filemanager/inc/class.bofilemanager.inc.php:1.11
--- filemanager/inc/class.bofilemanager.inc.php:1.10    Sun Jan 23 21:33:14 2005
+++ filemanager/inc/class.bofilemanager.inc.php Tue Jan 25 02:40:30 2005
@@ -60,7 +60,7 @@
                var $comment_files = Array();
                var $show_upload_boxes = 5;
                var $upload_boxes = array();
-               var $memberships;
+               var $memberships = array();
                var $now;
                var $matches;

@@ -244,26 +244,39 @@
                                        . 'pwd: '.$this->vfs->pwd().'<br>';
                        }

-
                        ###
                        # Get their memberships to be used throughout the script
                        ###

-                       $this->memberships = 
$GLOBALS['phpgw']->accounts->membership($this->userinfo['username']);
+                       $groups = 
$GLOBALS['phpgw']->accounts->membership($this->userinfo['username']);

-                       if(!is_array($this->memberships))
+                       if(!is_array($groups))
                        {
-                               settype($this->memberships,'array');
-                               $this->memberships = Array();
+                               $groups = array();
                        }
+                       //_debug_array($groups);
+
+                       ###
+                       # Don't list directories for groups that don't have 
access
+                       ###
+

-                       $group_applications = 
CreateObject('phpgwapi.applications');
-                       while(list($num,$group_array) = 
each($this->memberships))
+                       for($i=0;$i<count($groups);++$i)
                        {
-                               $group_applications->account_id = 
get_account_id($GLOBALS['phpgw']->accounts->name2id($group_array['account_name']));
-                               
$this->membership_applications[$group_array['account_name']] = 
$group_applications->read_account_specific();
+                               $applications = 
CreateObject('phpgwapi.applications',$groups[$i]['account_id']);
+                               $apps = $applications->read_account_specific();
+                               //_debug_array($apps);
+                               if(!$apps[$this->appname])
+                               {
+                                       unset($groups[$i]);
+                               }
+                               unset($applications);
                        }

+                       reset($groups);
+                       $this->memberships = $groups;
+                       //_debug_array($this->memberships);
+
                        ###
                        # We determine if they're in their home directory or a 
group's directory,
                        # and set the VFS working_id appropriately
@@ -340,15 +353,9 @@
                                //echo 'path: ' . $this->path . "\n";
                                //echo 'fake: ' . $this->fakebase;

-                               if (!$this->vfs->file_exists(array(
-                                       'string' => $this->homedir,
-                                       'relatives' =>Array(RELATIVE_NONE)
-                                       )))
+                               if (!$this->vfs->file_exists(array('string' => 
$this->homedir,'relatives' => array(RELATIVE_NONE))))
                                {
-                                       $this->vfs->mkdir(array(
-                                               'string' => $this->homedir,
-                                               'relatives' => 
Array(RELATIVE_NONE)
-                                               ));
+                                       $this->vfs->mkdir(array('string' => 
$this->homedir,'relatives' => array(RELATIVE_NONE)));
                                }

                                $ls_array = $this->vfs->ls(array(
@@ -362,15 +369,6 @@
                                reset ($this->memberships);
                                while(list($num, $group_array) = 
each($this->memberships))
                                {
-                                       ###
-                                       # If the group doesn't have access to 
this app, we don't show it
-                                       ###
-
-                                       if 
(!$this->membership_applications[$group_array['account_name']][$GLOBALS['appname']]['enabled'])
-                                       {
-                                               continue;
-                                       }
-
                                        if (!$this->vfs->file_exists(array(
                                                'string' => 
$this->fakebase.'/'.$group_array['account_name'],
                                                'relatives' => 
Array(RELATIVE_NONE)

====================================================
Index: filemanager/inc/class.uifilemanager.inc.php
diff -u filemanager/inc/class.uifilemanager.inc.php:1.15 
filemanager/inc/class.uifilemanager.inc.php:1.16
--- filemanager/inc/class.uifilemanager.inc.php:1.15    Mon Jan 24 17:42:04 2005
+++ filemanager/inc/class.uifilemanager.inc.php Tue Jan 25 02:40:30 2005
@@ -489,8 +489,11 @@
                                        $ls_array = 
$this->bofilemanager->vfs->ls(array(
                                        'string' => 
$this->bofilemanager->homedir,
                                        'relatives' => Array(RELATIVE_NONE),
-                                       'nofiles' => True,
+                                       'checksubdirs'  => True,
                                        'mime_type' => 'Directory'));
+
+                                       //_debug_array($ls_array);
+
                                        while(list($num,$dir) = each($ls_array))
                                        {
                                                $dirs[] = $dir;
@@ -503,15 +506,6 @@
                                        
reset($this->bofilemanager->memberships);
                                        while(list($num,$group_array) = 
each($this->bofilemanager->memberships))
                                        {
-                                               ###
-                                               # Don't list directories for 
groups that don't have access
-                                               ###
-
-                                               
if(!$this->bofilemanager->membership_applications[$group_array['account_name']][$this->bofilemanager->appname]['enabled'])
-                                               {
-                                                       continue;
-                                               }
-
                                                $dirs[] = Array(
                                                'directory' => 
$this->bofilemanager->fakebase,
                                                'name' => 
$group_array['account_name']
@@ -520,7 +514,7 @@
                                                $ls_array = 
$this->bofilemanager->vfs->ls(array(
                                                'string' => 
$this->bofilemanager->fakebase.SEP.$group_array['account_name'],
                                                'relatives' => 
Array(RELATIVE_NONE),
-                                               'nofiles' => True,
+                                               'checksubdirs'  => True,
                                                'mime_type' => 'Directory'
                                                ));
                                                while(list($num,$dir) = 
each($ls_array))
@@ -557,10 +551,10 @@
                                                # No point in displaying the 
current directory, or a directory that doesn't exist
                                                ###

-                                               
if((($dir['directory'].$dir['name']) != $this->bofilemanager->path) && 
$this->bofilemanager->vfs->file_exists(array(
-                                               'string' => 
$dir['directory'].$dir['name'],
-                                               'relatives' => 
Array(RELATIVE_NONE)
-                                               )))
+                                               
if(($dir['directory'].$dir['name']) != $this->bofilemanager->path) //&& 
$this->bofilemanager->vfs->file_exists(array(
+                                               //'string' => 
$dir['directory'].$dir['name'],
+                                               //'relatives' => 
Array(RELATIVE_NONE)
+                                               //)))
                                                {
                                                        $var['option'][] = 
array('value'=> urlencode($dir['directory'].$dir['name']),
                                                        'selected' => $selected,
@@ -707,6 +701,25 @@
                        $usage = 0;
                        $files_array = $this->dirs_first($files_array);

+                       $file_attributes[] = '';
+                       @reset($this->bofilemanager->file_attributes);
+
+                       //_debug_array($this->bofilemanager->settings);
+
+                       foreach($this->bofilemanager->file_attributes as 
$attribute => $translation)
+                       {
+                               if 
(!is_array($this->bofilemanager->settings)||$this->bofilemanager->settings[$attribute])
+                               {
+
+                                       $file_attributes[] = array('widget'=> 
array('type' => 'link','caption' => lang($attribute),
+                                                                               
                                                'href' =>  
$GLOBALS['phpgw']->link('/index.php', array(
+                                                                               
                                                'menuaction'    => 
$this->bofilemanager->appname.'.ui'.$this->bofilemanager->appname.'.index',
+                                                                               
                                                
'path'=>$this->bofilemanager->path,
+                                                                               
                                                'sortby' => $attribute))));
+                               }
+                       }
+                       //_debug_array($file_attributes);
+
                        $file_output = array();
                        for($i=0;$i<count($files_array);$i++)
                        {
@@ -715,7 +728,6 @@

                                if (!count($edit) )
                                {
-                                       $file_attributes[] = '';
                                        $file_output[$i]['checkbox'] = 
array('widget' => array( 'type' => 'checkbox',
                                                                        'name' 
=> 'fileman[]',
                                                                        'value' 
=> $file['name']
@@ -798,33 +810,23 @@

                                                        }
                                                }
-                                               $file_attributes[] = 
array('widget'=> array(
-                                                                       'type' 
=> 'link',
-                                                                       
'caption' => $displayed,
-                                                                       'href' 
=>  $GLOBALS['phpgw']->link('/index.php', array(
-                                                                               
'menuaction'    => 
$this->bofilemanager->appname.'.ui'.$this->bofilemanager->appname.'.index',
-                                                                               
'path'=>$this->bofilemanager->path,
-                                                                               
'sortby' => $internal
-                                                                       ))
-                                                               ));
                                        }
                                }
+                       }

-                               //_debug_array($file_attributes);
-
-                               $data = array
+                       $data = array
+                       (
+                               'summary' =>  array
+                               (
+                                       'file_count' => count($files_array),
+                                       'usage' => $usage
+                               ),
+                               'files' => array
                                (
-                                       'summary' =>  array
-                                       (
-                                               'file_count' => 
count($files_array),
-                                               'usage' => $usage
-                                       ),
-                                       'files' => array
-                                       (
                                                'file_attributes'       => 
$file_attributes,
                                                'file'                          
=> $file_output
-                                       ),
-                                       'form'  => array('action'       => 
$GLOBALS['phpgw']->link('/index.php',array(
+                               ),
+                               'form'  => array('action'       => 
$GLOBALS['phpgw']->link('/index.php',array(
                                                                                
                        'menuaction'    => 
$this->bofilemanager->appname.'.ui'.$this->bofilemanager->appname.'.action',
                                                                                
                                'path'                  => 
urlencode($this->bofilemanager->path))),
                                                                                
'id'    => 'form_files',
@@ -832,8 +834,8 @@
                                                                        
'method'        => 'POST',
                                                                        
'enctype'       => 'multipart/form-data'
                                                                        ),
-                                       'error'         => 
(isset($this->bofilemanager->errors) && 
is_array(unserialize(base64_decode($this->bofilemanager->errors)))?$GLOBALS['phpgw']->common->error_list(unserialize(base64_decode($this->bofilemanager->errors)),'Results'):''),
-                                       'img_up'        => array('widget' => 
array('type' => 'image',
+                               'error'         => 
(isset($this->bofilemanager->errors) && 
is_array(unserialize(base64_decode($this->bofilemanager->errors)))?$GLOBALS['phpgw']->common->error_list(unserialize(base64_decode($this->bofilemanager->errors)),'Results'):''),
+                               'img_up'        => array('widget' => 
array('type' => 'image',
                                                                                
        'src' => 
$GLOBALS['phpgw']->common->image($this->bofilemanager->appname,'up'),
                                                                                
        'title' => lang('up'),
                                                                                
        'link' => $GLOBALS['phpgw']->link('/index.php',Array(
@@ -841,8 +843,8 @@
                                                                                
                        'path'          => 
urlencode($this->bofilemanager->lesspath)
                                                                                
                ))
                                                                                
        )),
-                                       'help_up'       => 
$this->build_help('up'),
-                                       'img_home'      => array('widget' => 
array('type' => 'image',
+                               'help_up'       => $this->build_help('up'),
+                               'img_home'      => array('widget' => 
array('type' => 'image',
                                                                                
        'src' => 
$GLOBALS['phpgw']->common->image($this->bofilemanager->appname,'folder_home'),
                                                                                
        'title' => lang('go to your home directory'),
                                                                                
        'link' => $GLOBALS['phpgw']->link('/index.php',Array(
@@ -850,9 +852,9 @@
                                                                                
                        'path' => urlencode($this->bofilemanager->homedir)
                                                                                
                ))
                                                                                
        )),
-                                       'current_dir'   => 
$this->bofilemanager->path,
-                                       'help_home'             => 
$this->build_help('home'),
-                                       'img_upload'    => array('widget' => 
array('type' => 'image',
+                               'current_dir'   => $this->bofilemanager->path,
+                               'help_home'             => 
$this->build_help('home'),
+                               'img_upload'    => array('widget' => 
array('type' => 'image',
                                                                                
        'src' => 
$GLOBALS['phpgw']->common->image($this->bofilemanager->appname,'1uparrow'),
                                                                                
        'title' => lang('upload files'),
                                                                                
        'link' => $GLOBALS['phpgw']->link('/index.php',Array(
@@ -860,7 +862,7 @@
                                                                                
                        'path'          => urlencode($this->bofilemanager->path)
                                                                                
                ))
                                                                                
        )),
-                                       'img_refresh'   => array('widget' => 
array('type' => 'image',
+                               'img_refresh'   => array('widget' => 
array('type' => 'image',
                                                                                
        'src' => 
$GLOBALS['phpgw']->common->image($this->bofilemanager->appname,'reload'),
                                                                                
        'title' => lang('refresh'),
                                                                                
        'link' => $GLOBALS['phpgw']->link('/index.php',Array(
@@ -878,105 +880,104 @@
                                                'label'                 => 
lang('phpgroupware files'),
                                                'link_label'    => lang('add 
mozilla/netscape sidebar tab')
                                        )*/
-                               );
+                       );

-                               if($this->bofilemanager->path != '/' && 
$this->bofilemanager->path != $this->bofilemanager->fakebase)
-                               {
-                                       $data['create_folder']  = 
array('widget' => array('type' => 'text',
+                       if($this->bofilemanager->path != '/' && 
$this->bofilemanager->path != $this->bofilemanager->fakebase)
+                       {
+                               $data['create_folder']  = array('widget' => 
array('type' => 'text',
                                                                                
                                                'name' => 'createdir',
                                                                                
                                                'maxlength' => '255',
                                                                                
                                                'size' => '15'
                                                                                
        ));
-                                       $data['img_create_folder']      = 
array('widget' => array('type' => 'image',
+                               $data['img_create_folder']      = 
array('widget' => array('type' => 'image',
                                                                                
                                                        'src' => 
$GLOBALS['phpgw']->common->image($this->bofilemanager->appname,'folder_new'),
                                                                                
                                                        'title' => lang('create 
folder'),
                                                                                
                                                        'name'  => 
'params[newdir]',
                                                                                
                                                        'value' => 'newdir',
                                                                                
                                                        'caption' => 
$this->build_help('create_folder')
                                                                                
                ));
-                                       $data['lang_create_folder']     = 
lang('create folder');
-                                       $data['create_file']            = 
array('widget' => array('type' => 'text',
+                               $data['lang_create_folder']     = lang('create 
folder');
+                               $data['create_file']            = 
array('widget' => array('type' => 'text',
                                                                                
                                                'name' => 'createfile',
                                                                                
                                                'maxlength' => '255',
                                                                                
                                                'size' => '15'
                                                                                
        ));
-                                       $data['img_create_file']        = 
array('widget' => array('type' => 'image',
+                               $data['img_create_file']        = 
array('widget' => array('type' => 'image',
                                                                                
                                                        'src' => 
$GLOBALS['phpgw']->common->image($this->bofilemanager->appname,'filenew'),
                                                                                
                                                        'title' => lang('create 
file'),
                                                                                
                                                        'name'  => 
'params[newfile]',
                                                                                
                                                        'value' => 'newfile',
                                                                                
                                                        'caption' => 
$this->build_help('create_file')
                                                                                
                ));
-                                       $data['lang_create_file']       = 
lang('create file');
-                               }
+                               $data['lang_create_file']       = lang('create 
file');
+                       }

-                               if (strlen($this->bofilemanager->errors))
-                               {
-                                       $data['errors'] = 
$this->bofilemanager->errors;
-                               }
+                       if (strlen($this->bofilemanager->errors))
+                       {
+                               $data['errors'] = $this->bofilemanager->errors;
+                       }

-                               if (count($edit))
-                               {
-                                       $data['img_cancel'] = array('widget' => 
array('type' => 'image',
+                       if (count($edit))
+                       {
+                               $data['img_cancel'] = array('widget' => 
array('type' => 'image',
                                                                                
        'src' => 
$GLOBALS['phpgw']->common->image($this->bofilemanager->appname,'button_cancel'),
                                                                                
        'alt' => lang('folder')
                                                ));
-                                       $data['button_cancel'] = array('widget' 
=> array('type' => 'submit',
+                               $data['button_cancel'] = array('widget' => 
array('type' => 'submit',
                                                                                
'name' => 'cancel',
                                                                                
'value' => lang('cancel')
                                                ));
-                                       $data['img_ok'] = array('widget' => 
array('type' => 'image',
+                               $data['img_ok'] = array('widget' => 
array('type' => 'image',
                                                                                
        'src' => 
$GLOBALS['phpgw']->common->image($this->bofilemanager->appname,'button_ok'),
                                                                                
        'alt' => lang('folder')
                                                ));
-                                       $data['button_ok'] = array('widget' => 
array('type' => 'submit',
-                                                                               
'name' => 'submit',
-                                                                               
'value' => lang('ok')
+                               $data['button_ok'] = array('widget' => 
array('type' => 'submit',
+                                                                       'name' 
=> 'submit',
+                                                                       'value' 
=> lang('ok')
+                                       ));
+                               @reset($edit);
+                               while( list($file,$prop) = each($edit))
+                               {
+                                       $data['fileman'][] = array('widget' => 
array('type'=>'hidden',
+                                                                       'name' 
=> 'fileman[]',
+                                                                       'value' 
=> $file
                                                ));
-                                       @reset($edit);
-                                       while( list($file,$prop) = each($edit))
-                                       {
-                                               $data['fileman'][] = 
array('widget' => array('type'=>'hidden',
-                                                                               
'name' => 'fileman[]',
-                                                                               
'value' => $file
-                                                       ));
-                                       }
-                                       @reset($edit); list($file,$prop) = 
each($edit);
-                                       $data['action'] = array('widget' => 
array('type'=>'hidden',
-                                                                               
'name' => 'apply_edit_'.$prop,
-                                                                               
'value' => 1
-                                                       ));
                                }
+                               @reset($edit); list($file,$prop) = each($edit);
+                               $data['action'] = array('widget' => 
array('type'=>'hidden',
+                                                                       'name' 
=> 'apply_edit_'.$prop,
+                                                                       'value' 
=> 1
+                                               ));
+                       }

-                               @reset($this->bofilemanager->file_attributes);
-                               //$data['settings'] = 
$this->bofilemanager->settings;
-                               //$data['display_settings'] = 
$GLOBALS['phpgw_info']['theme'];
+                       @reset($this->bofilemanager->file_attributes);
+                       //$data['settings'] = $this->bofilemanager->settings;
+                       //$data['display_settings'] = 
$GLOBALS['phpgw_info']['theme'];

-                               $js             = 
"document.getElementById('file_menu').selectedIndex>5?(document.getElementById('menu_todir').disabled=false):document.getElementById('form_files').submit()";
-                               $js_dir = 
"document.getElementById('form_files').submit()";
+                       $js             = 
"document.getElementById('file_menu').selectedIndex>5?(document.getElementById('menu_todir').disabled=false):document.getElementById('form_files').submit()";
+                       $js_dir = 
"document.getElementById('form_files').submit()";

-                               if(!count($edit))
-                               {
-                                       $data['menu'] = array('widget' => 
array('type' => 'select','name' => 'params[menu]', 'id' => 
'file_menu','onChange' => $js,'options' => $this->display_buttons('menu')));
-                                       $data['dir_menu'] = array('widget' => 
array('type' => 'select','name' => 'todir', 'id' => 'menu_todir','onChange' => 
$js_dir,'disabled' => True,'options' => $this->display_buttons('dir_menu')));
-                                       $data['uploads'] = 
$this->display_uploads();
-                               }
+                       if(!count($edit))
+                       {
+                               $data['menu'] = array('widget' => array('type' 
=> 'select','name' => 'params[menu]', 'id' => 'file_menu','onChange' => 
$js,'options' => $this->display_buttons('menu')));
+                               $data['dir_menu'] = array('widget' => 
array('type' => 'select','name' => 'todir', 'id' => 'menu_todir','onChange' => 
$js_dir,'disabled' => True,'options' => $this->display_buttons('dir_menu')));
+                               $data['uploads'] = $this->display_uploads();
+                       }

-                               $data['lang_show']                      = 
lang('show');
-                               $data['lang_upload_fields']     = lang('upload 
fields');
-                               $data['lang_upload_files']      = lang('upload 
files');
-                               $data['lang_file']                      = 
lang('file');
-                               $data['lang_comment']           = 
lang('comment');
+                       $data['lang_show']                      = lang('show');
+                       $data['lang_upload_fields']     = lang('upload fields');
+                       $data['lang_upload_files']      = lang('upload files');
+                       $data['lang_file']                      = lang('file');
+                       $data['lang_comment']           = lang('comment');

-                               foreach($this->bofilemanager->upload_boxes as 
$box)
-                               {
-                                       $data['show_upload_boxes'][] = 
array('widget' => array('type' => 'link','caption' => $box,
+                       foreach($this->bofilemanager->upload_boxes as $box)
+                       {
+                               $data['show_upload_boxes'][] = array('widget' 
=> array('type' => 'link','caption' => $box,
                                                                                
                                                                        'href' 
=> $GLOBALS['phpgw']->link('/index.php',array(
                                                                                
                                                                                
'menuaction' => 
$this->bofilemanager->appname.'.ui'.$this->bofilemanager->appname.'.action',
                                                                                
                                                                                
'show_upload_boxes' => $box))));
-                               }
-                               $GLOBALS['phpgw']->xslttpl->set_var('phpgw', 
array('index' => $data));
                        }
+                       $GLOBALS['phpgw']->xslttpl->set_var('phpgw', 
array('index' => $data));
                }

                function cancel()






reply via email to

[Prev in Thread] Current Thread [Next in Thread]