phpgroupware-cvs
[Top][All Lists]
Advanced

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

[Phpgroupware-cvs] filemanager/inc hook_settings.inc.php, 1.2 class.bofi


From: ceb
Subject: [Phpgroupware-cvs] filemanager/inc hook_settings.inc.php, 1.2 class.bofilemanager.inc.php, 1.9 class.uifilemanager.inc.php, 1.12 hook_preferences.inc.php, 1.13
Date: Thu, 24 Feb 2005 15:08:12 -0000

Update of filemanager/inc

Removed Files:
     Branch: MAIN
            hook_settings.inc.php
Modified Files:
     Branch: MAIN
            class.bofilemanager.inc.php lines: +18 -14
            class.uifilemanager.inc.php lines: +146 -23
            hook_preferences.inc.php lines: +12 -17

Log Message:
updating prefs

====================================================
Index: filemanager/inc/class.bofilemanager.inc.php
diff -u filemanager/inc/class.bofilemanager.inc.php:1.8 
filemanager/inc/class.bofilemanager.inc.php:1.9
--- filemanager/inc/class.bofilemanager.inc.php:1.8     Sat Jan 22 02:22:52 2005
+++ filemanager/inc/class.bofilemanager.inc.php Sat Jan 22 23:48:25 2005
@@ -50,7 +50,7 @@
                var $messages = Array();
                var $renamefiles;
                var $comment_files = Array();
-               var $show_upload_boxes = 5;
+               var $upload_boxes = array();
                var $memberships;
                var $now;
                var $matches;
@@ -135,21 +135,25 @@
                                define('NULL','');
                        }

-                       $this->file_attributes = Array
+                       $this->file_attributes = array
                        (
-                               'name' => 'Filename',
-                               'deletable' => 'Deletable',
-                               'mime_type' => 'MIME Type',
-                               'size' => 'Size',
-                               'created' => 'Created',
-                               'modified' => 'Modified',
-                               'owner' => 'Owner',
-                               'createdby_id' => 'Created by',
-                               'modifiedby_id' => 'Modified by',
-                               'app' => 'Application',
-                               'comment' => 'Comment',
-                               'version' => 'Version'
+                               'name'                  => lang('Filename'),
+                               'deletable'             => lang('Deletable'),
+                               'mime_type'             => lang('MIME Type'),
+                               'size'                  => lang('Size'),
+                               'created'               => lang('Created'),
+                               'modified'              => lang('Modified'),
+                               'owner'                 => lang('Owner'),
+                               'createdby_id'  => lang('Created by'),
+                               'modifiedby_id' => lang('Modified by'),
+                               'app'                   => lang('Application'),
+                               'comment'               => lang('Comment'),
+                               'version'               => lang('Version')
                        );
+                       asort($this->file_attributes);
+
+                       $this->upload_boxes = array(1,5,10,15,20,30);
+

                        if($this->go)
                        {

====================================================
Index: filemanager/inc/class.uifilemanager.inc.php
diff -u filemanager/inc/class.uifilemanager.inc.php:1.11 
filemanager/inc/class.uifilemanager.inc.php:1.12
--- filemanager/inc/class.uifilemanager.inc.php:1.11    Sat Jan 22 02:22:52 2005
+++ filemanager/inc/class.uifilemanager.inc.php Sat Jan 22 23:48:25 2005
@@ -16,16 +16,17 @@
        {
                var $public_functions = array
                (
-                       'index' => True,
-                       'action'        => True,
-                       'help'  => True,
-                       'history'       => True,
-                       'view'  => True,
-                       'view_file'     => True,
-                       'edit'  => True,
-                       'rename' => True,
-                       'edit_comments' => True,
-                       'update'        => True
+                       'index'                 => True,
+                       'action'                => True,
+                       'help'                  => True,
+                       'history'               => True,
+                       'view'                  => True,
+                       'view_file'             => True,
+                       'edit'                  => True,
+                       'rename'                => True,
+                       'edit_comments' => True,
+                       'update'                => True,
+                       'preferences'   => True
                );

                var $bofilemanager;
@@ -68,6 +69,7 @@
                function uifilemanager()
                {
                        $GLOBALS['phpgw_info']['flags']['xslt_app'] = True;
+                       $GLOBALS['phpgw']->xslttpl->add_file('widgets');
                        //$this->actions                        = 
CreateObject('filemanager.uiactions');
                        $this->bofilemanager    = 
CreateObject('filemanager.bofilemanager');
                        //$this->nextmatchs             = 
CreateObject('phpgwapi.nextmatchs');
@@ -614,11 +616,11 @@
                                                         ));

                                        $var[] = array('widget' => array('type' 
=> 'text',
-                                                        'name' => 
'upload_comment[]'
+                                                        'name' => 
'upload_comment[]'
                                                         ));

                                        $var[] = array('widget' => array('type' 
=> 'empty'));
-                                       $table_rows[] = array('table_col' => 
$var);
+                                       $table_rows[] = array('table_col' => 
$var);
                        }
                        $var = array();
                        $var[] = array('widget' => array('type' => 'hidden',
@@ -627,6 +629,8 @@
                                                         ));

                        $table_rows[] = array('table_col' => $var);
+
+                       //_debug_array($table_rows);
                        return array('table_row' => $table_rows);
                }

@@ -710,7 +714,7 @@
                                                                                
        }

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

@@ -780,7 +784,7 @@
                                                                                
        'path'                  => urlencode($this->bofilemanager->path)
                                                                                
)),
                                        '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' => 'img',
+                                       '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(
@@ -789,7 +793,7 @@
                                                                                
                ))
                                                                                
        )),
                                        'help_up'       => 
$this->build_help('up'),
-                                       'img_home'      => array('widget' => 
array('type' => 'img',
+                                       '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(
@@ -797,7 +801,7 @@
                                                                                
                        'path' => urlencode($this->bofilemanager->homedir)
                                                                                
                ))
                                                                                
        )),
-                                       'img_dir'       => array('widget' => 
array('type' => 'img',
+                                       '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',
@@ -806,7 +810,7 @@
                                                                                
        )),
                                        'current_dir'   => 
$this->bofilemanager->path,
                                        'help_home'             => 
$this->build_help('home'),
-                                       'img_upload'    => array('widget' => 
array('type' => 'img',
+                                       '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(
@@ -814,7 +818,7 @@
                                                                                
                        'path'          => urlencode($this->bofilemanager->path)
                                                                                
                ))
                                                                                
        )),
-                                       'img_refresh'   => array('widget' => 
array('type' => 'img',
+                                       '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(
@@ -853,7 +857,7 @@
                                                                                
                                                'maxlength' => '255',
                                                                                
                                                'size' => '15'
                                                                                
        ));
-                                       $data['img_create_file']        = 
array('widget' => array('type' => 'img',
+                                       $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]',
@@ -869,7 +873,7 @@

                                if (count($edit))
                                {
-                                       $data['img_cancel'] = array('widget' => 
array('type' => 'img',
+                                       $data['img_cancel'] = array('widget' => 
array('type' => 'image',
                                                                                
        'src' => 
$GLOBALS['phpgw']->common->image($this->bofilemanager->appname,'button_cancel'),
                                                                                
        'alt' => lang('folder')
                                                ));
@@ -877,7 +881,7 @@
                                                                                
'name' => 'cancel',
                                                                                
'value' => lang('cancel')
                                                ));
-                                       $data['img_ok'] = array('widget' => 
array('type' => 'img',
+                                       $data['img_ok'] = array('widget' => 
array('type' => 'image',
                                                                                
        'src' => 
$GLOBALS['phpgw']->common->image($this->bofilemanager->appname,'button_ok'),
                                                                                
        'alt' => lang('folder')
                                                ));
@@ -916,7 +920,6 @@
                                $data['lang_file']                      = 
lang('file');
                                $data['lang_comment']           = 
lang('comment');

-                               $GLOBALS['phpgw']->xslttpl->add_file('widgets');
                                $GLOBALS['phpgw']->xslttpl->set_var('phpgw', 
array('index' => $data));
                        }
                }
@@ -1084,4 +1087,124 @@
                        }
                }

+
+               function preferences()
+               {
+                       /*
+                       To add an on/off preference, just add it here.  Key is 
internal name, value is displayed name
+                       */
+                       $other_checkboxes = array("viewinnewwin" => lang("View 
documents in new window"),
+                                                               "viewonserver" 
=> lang("View documents on server (if available)"),
+                                                               "viewtextplain" 
=> lang("Unknown MIME-type defaults to text/plain when viewing"),
+                                                               "dotdot" => 
lang('Show ..'),
+                                                               "dotfiles" => 
lang('Show dotfiles'),
+                                                               "show_help" => 
lang('Show help'),
+                                                               
"show_command_line" => lang('Show command line (EXPERIMENTAL. DANGEROUS)'));
+
+                       /*
+                        To add a input field preferences, add it here.  Key is 
internal name, value key is
+                       displayed name, value values are choices in the dropdown
+                       */
+
+                       if ($_POST['save'])
+                       {
+                               $values = $_POST['values'];
+                               //$select_values = $_POST['select_values'];
+
+                               //_debug_array($_POST);
+
+                               $repository = 
$GLOBALS['phpgw']->preferences->read();
+
+                               
$GLOBALS['phpgw']->preferences->read_repository();
+                               
$GLOBALS['phpgw']->preferences->delete('filemanager','');
+
+                               if(is_array($values))
+                               {
+                                       foreach($values as $value)
+                                       {
+                                               //echo 'drin'; //ROFL!
+                                               
$GLOBALS['phpgw']->preferences->change('filemanager',$value,(isset($value)?$value:''));
+                                       }
+                               }
+                               
$GLOBALS['phpgw']->preferences->save_repository();
+
+                               
$GLOBALS['phpgw']->redirect_link('/preferences/index.php');
+                               $GLOBALS['phpgw']->common->phpgw_exit();
+                       }
+
+                       if ($_POST['cancel'])
+                       {
+                               
$GLOBALS['phpgw']->redirect_link('/preferences/index.php');
+                               $GLOBALS['phpgw']->common->phpgw_exit();
+                       }
+
+                       //$GLOBALS['phpgw_info']['flags']['app_header'] = 
lang('filemanager') . ': ' . lang('preferences');
+
+                       if ($totalerrors)
+                       {
+                               echo '<p><center>' . 
$GLOBALS['phpgw']->common->error_list($errors) . '</center>';
+                       }
+
+                       $data = array();
+                       $table_head = array('table_col' => array('colspan' => 
'2','align' => 'left','widget' => array('type' => 'label','caption' => 
lang('display attributes'))));
+
+                       foreach($this->bofilemanager->file_attributes as 
$internal => $title)
+                       {
+                               $var = array();
+                               $var[] = array('width' => '90%','widget' => 
array('type' => 'label','caption' => $title));
+                               $var[] = array('widget' => array('type' => 
'checkbox','name' => 'values[' . $internal . ']','value' => 
$GLOBALS['phpgw_info']['user']['preferences']['filemanager'][$internal]?True:False));
+                               $table_rows[] = array('table_col' => $var);
+                       }
+
+                       $var = array();
+                       $var[] = array('class' => 'th','width' => 
'90%','widget' => array('type' => 'label','caption' => lang('other settings')));
+                       $var[] = array('class' => 'th','widget' => array('type' 
=> 'empty'));
+                       $table_rows[] = array('table_col' => $var);
+
+                       reset ($other_checkboxes);
+                       foreach($other_checkboxes as $internal => $title)
+                       {
+                               $var = array();
+                               $var[] = array('width' => '90%','widget' => 
array('type' => 'label','caption' => $title));
+                               $var[] = array('widget' => array('type' => 
'checkbox','name' => 'values[' . $internal . ']','value' => 
$GLOBALS['phpgw_info']['user']['preferences']['filemanager'][$internal]?True:False));
+                               $table_rows[] = array('table_col' => $var);
+                       }
+
+                       foreach($this->bofilemanager->upload_boxes as $internal)
+                       {
+                               $options[] = array('option' => array('value' => 
$internal,'caption' => $internal,'selected' => 
$GLOBALS['phpgw_info']['user']['preferences']['filemanager']['show_upload_boxes']==$internal?True:False));
+                       }
+                       $var = array();
+                       $var[] = array('width' => '90%','widget' => 
array('type' => 'label','caption' => lang('Default number of upload fields to 
show')));
+                       $var[] = array('widget' => array('type' => 
'select','name' => 'values[show_upload_boxes]','options' => $options));
+                       $table_rows[] = array('table_col' => $var);
+
+                       $var = array();
+                       $button = array
+                       (
+                               'type'  => 'submit',
+                               'name'  => 'save',
+                               'value' => lang('save'),
+                               'caption' => $this->build_help('save')
+                       );
+                       $var[] = array('widget' => $button);
+                       $button = array
+                       (
+                               'type'  => 'submit',
+                               'name' => 'cancel',
+                               'value' => lang('cancel'),
+                               'caption' => $this->build_help('cancel')
+                       );
+                       $var[] = array('widget' => $button);
+                       $table_rows[] = array('table_col' => $var);
+
+                       $data = array
+                       (
+                               'action_url'    => 
$GLOBALS['phpgw']->link('/index.php','menuaction=filemanager.uifilemanager.preferences'),
+                               'table'                 => array('width' => 
'50%','table_head' => $table_head ,'table_row' => $table_rows)
+                       );
+                       //_debug_array($data);
+                       
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('preferences' => $data));
+               }
        }
+?>

====================================================
Index: filemanager/inc/hook_preferences.inc.php
diff -u filemanager/inc/hook_preferences.inc.php:1.12 
filemanager/inc/hook_preferences.inc.php:1.13
--- filemanager/inc/hook_preferences.inc.php:1.12       Tue Jan 18 16:47:53 2005
+++ filemanager/inc/hook_preferences.inc.php    Sat Jan 22 23:48:25 2005
@@ -1,21 +1,16 @@
 <?php
-  /**************************************************************************\ 
                  *
-  *  This program is free software; you can redistribute it and/or modify it *
-  *  under the terms of the GNU General Public License as published by the   *
-  *  Free Software Foundation; either version 2 of the License, or (at your  *
-  *  option) any later version.                                              *
-  \**************************************************************************/
+       
/*************************************************************************\
+       * This program is free software; you can redistribute it and/or modify 
it *
+       * under the terms of the GNU General Public License as published by the 
  *
+       * Free Software Foundation; either version 2 of the License, or (at 
your  *
+       * option) any later version.                                            
  *
+       
\*************************************************************************/
+       /* $Id$ */

-  /* $Id$ */
-{
+       {
+               $file = array('Preferences' => 
$GLOBALS['phpgw']->link('/index.php','menuaction=filemanager.uifilemanager.preferences'));

-       $file = Array(
-                       'Preferences' => 
$GLOBALS['phpgw']->link('/preferences/preferences.php',array(
-                               'appname' =>$appname,
-                               'type' => 'user')
-                       )
-       );
-//Do not modify below this line
-       display_section($appname,$file);
-}
+               //Do not modify below this line
+               display_section($appname,$file);
+       }
 ?>






reply via email to

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