phpgroupware-cvs
[Top][All Lists]
Advanced

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

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


From: ceb
Subject: [Phpgroupware-cvs] filemanager/inc class.uifilemanager.inc.php, 1.15
Date: Thu, 24 Feb 2005 15:10:33 -0000

Update of filemanager/inc

Modified Files:
     Branch: MAIN
            class.uifilemanager.inc.php lines: +85 -98

Log Message:
update

====================================================
Index: filemanager/inc/class.uifilemanager.inc.php
diff -u filemanager/inc/class.uifilemanager.inc.php:1.14 
filemanager/inc/class.uifilemanager.inc.php:1.15
--- filemanager/inc/class.uifilemanager.inc.php:1.14    Mon Jan 24 00:26:34 2005
+++ filemanager/inc/class.uifilemanager.inc.php Mon Jan 24 17:42:04 2005
@@ -12,7 +12,7 @@
        * @version $Id$
        */

-       define('UI_DEBUG', 0);
+       define('UI_DEBUG',0);

        class uifilemanager
        {
@@ -253,6 +253,14 @@

                        //_debug_array($params);

+                       if($_GET['show_upload_boxes'])
+                       {
+                               
$GLOBALS['phpgw']->preferences->read_repository();
+                               
$GLOBALS['phpgw']->preferences->change('filemanager','show_upload_boxes',$_GET['show_upload_boxes']);
+                               
$GLOBALS['phpgw']->preferences->save_repository();
+                               $this->bofilemanager->show_upload_boxes = 
$_GET['show_upload_boxes'];
+                       }
+
                        if (UI_DEBUG)
                        {
                                echo " Debug mode <br>";
@@ -294,6 +302,13 @@
                                'upload',
                                'download'
                        );
+
+                       $link_data = array
+                       (
+                               'menuaction' => 
$this->bofilemanager->appname.'.ui'.$this->bofilemanager->appname.'.index',
+                               'path'                  => 
urlencode($this->bofilemanager->path)
+                       );
+
                        if (trim(strtolower($this->bofilemanager->cancel)) == 
strtolower(lang('cancel'))) {
                                $this->cancel();
                                exit();
@@ -311,34 +326,23 @@
                                                //echo " bofunction $function ";
                                                $f_function = 'f_'.$action;
                                                $errors = 
implode("\n",$this->bofilemanager->$f_function());
-                                               $var = Array(
-                                                       'menuaction'    => 
$this->bofilemanager->appname.'.ui'.$this->bofilemanager->appname.'.index',
-                                                       'path'  => 
urlencode($this->bofilemanager->path)
-                                               );
+
                                                if($function == 'newfile')
                                                {
-                                                       $var = Array(
-                                                               'menuaction'    
=> $this->bofilemanager->appname.'.ui'.$this->bofilemanager->appname.'.index',
-                                                               'path'          
        => urlencode($this->bofilemanager->path),
-                                                               'createfile'    
=> urlencode($this->bofilemanager->createfile)
-                                                       );
+                                                       
$link_data['createfile'] = urlencode($this->bofilemanager->createfile);
                                                }
                                                elseif(strlen($errors))
                                                {
                                                        $var['errors'] = 
$errors;
                                                }
-                                               
$GLOBALS['phpgw']->redirect_link('/index.php',$var);
                                        }
                                        else
                                        {
-                                               
$GLOBALS['phpgw']->redirect_link('/index.php',Array(
-                                                       'menuaction'    => 
$this->bofilemanager->appname.'.ui'.$this->bofilemanager->appname.'.index',
-                                                       'path'  => 
urlencode($this->bofilemanager->path),
-                                                       'errors' => 
lang('unknown action!')
-                                               ));
+                                               $var['errors'] = lang('unknown 
action!');
                                        }
                                }
                        }
+                       
$GLOBALS['phpgw']->redirect_link('/index.php',$link_data);
                }

                /**TODO : xslt-ise this */
@@ -697,111 +701,104 @@

                function index()
                {
-                       if($_GET['show_upload_boxes'])
-                       {
-                               
$GLOBALS['phpgw']->preferences->read_repository();
-                               
$GLOBALS['phpgw']->preferences->change('filemanager','show_upload_boxes',$_GET['show_upload_boxes']);
-                               
$GLOBALS['phpgw']->preferences->save_repository();
-                               $this->bofilemanager->show_upload_boxes = 
$_GET['show_upload_boxes'];
-                       }
-
                        $files_array = $this->bofilemanager->load_files();

                        //_debug_array($files_array);
                        $usage = 0;
                        $files_array = $this->dirs_first($files_array);
-                       if(count($files_array) || $this->bofilemanager->cwd)
+
+                       $file_output = array();
+                       for($i=0;$i<count($files_array);$i++)
                        {
-                               $file_output = array();
-                               for($i=0;$i!=count($files_array);$i++)
+                               $file = $files_array[$i];
+                               $usage += $file['size'];
+
+                               if (!count($edit) )
                                {
-                                       $file = $files_array[$i];
-                                       $usage += $file['size'];
-                                               if (!count($edit) )
-                                               {
-                                                       
$file_attributes['checkbox'] = '';
-                                                       
$file_output[$i]['checkbox'] = array('widget' => array( 'type' => 'checkbox',
+                                       $file_attributes[] = '';
+                                       $file_output[$i]['checkbox'] = 
array('widget' => array( 'type' => 'checkbox',
                                                                        'name' 
=> 'fileman[]',
                                                                        'value' 
=> $file['name']
                                                                ));
-                                       }
-                                       
@reset($this->bofilemanager->file_attributes);
-                                       while(list($internal,$displayed) = 
each($this->bofilemanager->file_attributes))
+                               }
+                               @reset($this->bofilemanager->file_attributes);
+                               while(list($internal,$displayed) = 
each($this->bofilemanager->file_attributes))
+                               {
+                                       if 
(!is_array($this->bofilemanager->settings)||$this->bofilemanager->settings[$internal])
                                        {
-                                               if 
(!is_array($this->bofilemanager->settings)||$this->bofilemanager->settings[$internal])
+                                               if 
($internal==$edit[$file['name']])
                                                {
-                                                       if 
($internal==$edit[$file['name']])
-                                                       {
-                                                               
$file_output[$i][$internal] = array('widget' => array('type' => 'text',
+                                                       
$file_output[$i][$internal] = array('widget' => array('type' => 'text',
                                                                        'name' 
=> 'changes['.$file['name'].']',
                                                                        'value' 
=> $file[$internal]
                                                                        ));
-                                                       }
-                                                       else
+                                               }
+                                               else
+                                               {
+                                                       switch($internal)
                                                        {
-                                                               
switch($internal)
-                                                               {
-                                                                       case 
'owner_id':
-                                                                       case 
'owner':
-                                                                       case 
'createdby_id':
-                                                                       case 
'modifiedby_id':
-                                                                               
$name = $GLOBALS['phpgw']->accounts->id2name($file[$internal]) ;
-                                                                               
$file_output[$i][$internal] = $name ? $name: '';
-                                                                               
break;
-                                                                       case 
'created':
-                                                                       case 
'modified':
-                                                                               
//Convert ISO 8601 date format used by DAV into something people can read
-                                                                               
$file_output[$i][$internal] =  
$this->bofilemanager->convert_date($file[$internal]);
-                                                                               
break;
-                                                                       case 
'name':
-                                                                               
$mime_parts = explode('/',$file['mime_type']);
-                                                                               
        $file_icon = $this->mime_ico[$file['mime_type']];
-                                                                               
        if (!$file_icon) {
-                                                                               
                $file_icon = ( $this->mime_ico[$mime_parts[0]]) ?  
$this->mime_ico[$mime_parts[0]] :  $this->mime_ico['unknown'];
-                                                                               
                if (strpos($file['name'],'.exe') !== false) $file_icon =  
$this->mime_ico['exe'];
-                                                                               
        }
+                                                               case 'owner_id':
+                                                               case 'owner':
+                                                               case 
'createdby_id':
+                                                               case 
'modifiedby_id':
+                                                                       $name = 
$GLOBALS['phpgw']->accounts->id2name($file[$internal]) ;
+                                                                       
$file_output[$i][$internal] = $name ? $name: '';
+                                                                       break;
+                                                               case 'created':
+                                                               case 'modified':
+                                                                       
//Convert ISO 8601 date format used by DAV into something people can read
+                                                                       
$file_output[$i][$internal] =  
$this->bofilemanager->convert_date($file[$internal]);
+                                                                       break;
+                                                               case 'name':
+                                                                       
$mime_parts = explode('/',$file['mime_type']);
+                                                                       
$file_icon = $this->mime_ico[$file['mime_type']];
+                                                                       if 
(!$file_icon)
+                                                                       {
+                                                                               
$file_icon = ( $this->mime_ico[$mime_parts[0]]) ?  
$this->mime_ico[$mime_parts[0]] :  $this->mime_ico['unknown'];
+                                                                               
if (strpos($file['name'],'.exe') !== false) $file_icon =  
$this->mime_ico['exe'];
+                                                                       }

-                                                                               
        $file_output[$i]['name']['icon'] = array(
+                                                                       
$file_output[$i]['name']['icon'] = array(
                                                                                
                'widget' => array( 'type' => 'image',
                                                                                
                'src' => 
$GLOBALS['phpgw']->common->image($this->bofilemanager->appname,$file_icon)
                                                                                
                        ));

-                                                                               
if ($file['mime_type']=='Directory')
-                                                                               
{
-                                                                               
        $href = array('menuaction'      => 
$this->bofilemanager->appname.'.ui'.$this->bofilemanager->appname.'.index',
+                                                                       if 
($file['mime_type']=='Directory')
+                                                                       {
+                                                                               
$href = array('menuaction'      => 
$this->bofilemanager->appname.'.ui'.$this->bofilemanager->appname.'.index',
                                                                                
                        'path'          => 
$this->bofilemanager->path.SEP.$file['name']
                                                                                
                        );
-                                                                               
}
-                                                                               
else
-                                                                               
{
-                                                                               
        $href = Array( 'menuaction'     => 
$this->bofilemanager->appname.'.ui'.$this->bofilemanager->appname.'.view',
+                                                                       }
+                                                                       else
+                                                                       {
+                                                                               
$href = Array( 'menuaction'     => 
$this->bofilemanager->appname.'.ui'.$this->bofilemanager->appname.'.view',
                                                                                
                                        'path'          => 
urlencode($this->bofilemanager->path),
                                                                                
                                        'file'          => 
urlencode($file['name'])
                                                                                
                                );

-                                                                               
}
-                                                                               
$file_output[$i]['name']['link'] = array(
+                                                                       }
+                                                                       
$file_output[$i]['name']['link'] = array(
                                                                                
                "widget"=> array(
                                                                                
                                'type' => 'link',
                                                                                
                                'caption' => $file['name'],
                                                                                
                                'href' =>  
$GLOBALS['phpgw']->link('/index.php', $href)
                                                                                
                ));
-                                                                               
if ($mime_parts[0] == 'text')
-                                                                               
        {
+                                                                       if 
($mime_parts[0] == 'text')
+                                                                       {
                                                                                
                $href['menuaction'] = 
$this->bofilemanager->appname.'.ui'.$this->bofilemanager->appname.'.action';
                                                                                
                $href['uiaction'] = 'edit';
                                                                                
                $file_output[$i]['name']['edit'] = array('widget' => array( 
'type' => 'img',
                                                                                
                                'src' => 
$GLOBALS['phpgw']->common->image($this->bofilemanager->appname,'pencil'),
                                                                                
                                'link' =>  
$GLOBALS['phpgw']->link('/index.php', $href)
                                                                                
                                ));
-                                                                               
        }
-                                                                               
break;
-                                                                       default:
-                                                                               
$file_output[$i][$internal] = $file[$internal];
+                                                                       }
+                                                                       break;
+                                                               default:
+                                                                       
$file_output[$i][$internal] = $file[$internal];

-                                                               }
                                                        }
-                                                       
$file_attributes[$internal] = array("widget"=> array(
+                                               }
+                                               $file_attributes[] = 
array('widget'=> array(
                                                                        'type' 
=> 'link',
                                                                        
'caption' => $displayed,
                                                                        'href' 
=>  $GLOBALS['phpgw']->link('/index.php', array(
@@ -810,10 +807,11 @@
                                                                                
'sortby' => $internal
                                                                        ))
                                                                ));
-                                               }
                                        }
                                }

+                               //_debug_array($file_attributes);
+
                                $data = array
                                (
                                        'summary' =>  array
@@ -852,13 +850,6 @@
                                                                                
                        'path' => urlencode($this->bofilemanager->homedir)
                                                                                
                ))
                                                                                
        )),
-                                       'img_dir'       => array('widget' => 
array('type' => 'image',
-                                                                               
        'src' => 
$GLOBALS['phpgw']->common->image($this->bofilemanager->appname,'folder_large'),
-                                                                               
        'title' => lang('folder'),                                              
'link' => $GLOBALS['phpgw']->link('/index.php',Array(
-                                                                               
        'menuaction'    => 
$this->bofilemanager->appname.'.ui'.$this->bofilemanager->appname.'.index',
-                                                                               
        'path' => urlencode($this->bofilemanager->path)
-                                                                               
                ))
-                                                                               
        )),
                                        'current_dir'   => 
$this->bofilemanager->path,
                                        'help_home'             => 
$this->build_help('home'),
                                        'img_upload'    => array('widget' => 
array('type' => 'image',
@@ -979,15 +970,11 @@

                                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.'.index',
-                                                                               
                                                                                
'path' => urlencode($this->bofilemanager->path),
-                                                                               
                                                                                
'show_upload_boxes' => $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));
                        }
                }






reply via email to

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