phpgroupware-cvs
[Top][All Lists]
Advanced

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

[Phpgroupware-cvs] filemanager/inc hook_admin.inc.php, 1.5 class.uifilem


From: ceb
Subject: [Phpgroupware-cvs] filemanager/inc hook_admin.inc.php, 1.5 class.uifilemanager.inc.php, 1.13 class.bofilemanager.inc.php, 1.10
Date: Thu, 24 Feb 2005 15:08:59 -0000

Update of filemanager/inc

Modified Files:
     Branch: MAIN
            hook_admin.inc.php lines: +19 -0
            class.uifilemanager.inc.php lines: +154 -45
            class.bofilemanager.inc.php lines: +16 -6

Log Message:
finished prefs + admin

====================================================
Index: filemanager/inc/hook_admin.inc.php
diff -u filemanager/inc/hook_admin.inc.php:1.4 
filemanager/inc/hook_admin.inc.php:1.5
--- filemanager/inc/hook_admin.inc.php:1.4      Tue Jan 18 16:47:53 2005
+++ filemanager/inc/hook_admin.inc.php  Sun Jan 23 21:33:14 2005
@@ -1,3 +1,22 @@
 <?php
+       
/**************************************************************************\
+       * phpGroupWare - filemanager administration                             
   *
+       * http://www.phpgroupware.org                                           
   *
+       * --------------------------------------------                          
   *
+       *  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$ */

+       {
+// Only Modify the $file and $title variables.....
+               $file = Array
+               (
+                       'edit quota' => 
$GLOBALS['phpgw']->link('/index.php','menuaction=filemanager.uifilemanager.admin')
+               );
+//Do not modify below this line
+               display_section($appname,$appname,$file);
+       }
 ?>

====================================================
Index: filemanager/inc/class.uifilemanager.inc.php
diff -u filemanager/inc/class.uifilemanager.inc.php:1.12 
filemanager/inc/class.uifilemanager.inc.php:1.13
--- filemanager/inc/class.uifilemanager.inc.php:1.12    Sat Jan 22 23:48:25 2005
+++ filemanager/inc/class.uifilemanager.inc.php Sun Jan 23 21:33:14 2005
@@ -1,7 +1,9 @@
 <?php
        /***
-       * phpGroupWare filemanager
-       * @author Mark A Peters (Skeeter) <address@hidden>
+       * phpGroupWare Filemanager
+       * based on phpWebhosting, written by Jason Wies (Zone)
+       * @author Jason Wies (Zone)
+       * @author Mark A Peters (skeeter) <address@hidden>
        * @author Jonathon Sim <address@hidden>
        * @author Bettina Gille <address@hidden>
        * @copyright Copyright (C) 2000-2005 Free Software Foundation, Inc 
http://www.fsf.org/
@@ -26,7 +28,8 @@
                        'rename'                => True,
                        'edit_comments' => True,
                        'update'                => True,
-                       'preferences'   => True
+                       'preferences'   => True,
+                       'admin'                 => True
                );

                var $bofilemanager;
@@ -385,10 +388,31 @@
                        }
                }

-               function display_buttons()
+               function display_buttons($type = 'config')
                {
                        $var = array();

+                       switch($type)
+                       {
+                               case 'config':
+                                       $button = array
+                                       (
+                                               'type'  => 'submit',
+                                               'name'  => 'save',
+                                               'value' => lang('save'),
+                                               'caption' => 
$this->build_help('save')
+                                       );
+                                       $var[] = array('height' => 
'50','valign' => 'bottom','widget' => $button);
+                                       $button = array
+                                       (
+                                               'type'  => 'submit',
+                                               'name' => 'cancel',
+                                               'value' => lang('cancel'),
+                                               'caption' => 
$this->build_help('cancel')
+                                       );
+                                       $var[] = array('align' => 
'right','height' => '50','valign' => 'bottom','widget' => $button);
+                                       break;
+                               default:
                        $button['type'] = 'submit';
                        $button['name'] = 'uiaction_edit';
                        $button['value'] = lang('edit');
@@ -549,6 +573,8 @@
                                                                                
        ));
                                $var[] = array('widget' => array( 'type' => 
'seperator' ));
                        }
+                               break;
+                       }
                        return $var;
                }
 /*
@@ -629,8 +655,6 @@
                                                         ));

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

@@ -639,7 +663,7 @@
                        $dirs = array();
                        $files = array();
                        $result = array();
-
+
                        for($i=0;$i!=count($files_array);$i++)
                        {
                                $file = $files_array[$i];
@@ -657,6 +681,14 @@

                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);
@@ -845,7 +877,7 @@
                                                                                
                                                'maxlength' => '255',
                                                                                
                                                'size' => '15'
                                                                                
        ));
-                                       $data['img_create_folder']      = 
array('widget' => array('type' => 'img',
+                                       $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]',
@@ -910,7 +942,7 @@

                                if(!count($edit))
                                {
-                                       $data['buttons'] = array('button' => 
$this->display_buttons());
+                                       $data['buttons'] = array('button' => 
$this->display_buttons('bla'));
                                        $data['uploads'] = 
$this->display_uploads();
                                }

@@ -920,6 +952,17 @@
                                $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,
+                                                                               
                                                                '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
+                                                                               
                ))));
+                               }
+
                                $GLOBALS['phpgw']->xslttpl->set_var('phpgw', 
array('index' => $data));
                        }
                }
@@ -1087,7 +1130,6 @@
                        }
                }

-
                function preferences()
                {
                        /*
@@ -1109,25 +1151,20 @@
                        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)
+                                       
$GLOBALS['phpgw']->preferences->read_repository();
+                                       
$GLOBALS['phpgw']->preferences->delete('filemanager','');
+
+                                       foreach($values as $key => $value)
                                        {
-                                               //echo 'drin'; //ROFL!
-                                               
$GLOBALS['phpgw']->preferences->change('filemanager',$value,(isset($value)?$value:''));
+                                               
$GLOBALS['phpgw']->preferences->change('filemanager',$key,($key == 
'show_upload_boxes')?$value:$key);
                                        }
+                                       
$GLOBALS['phpgw']->preferences->save_repository();
                                }
-                               
$GLOBALS['phpgw']->preferences->save_repository();
-
                                
$GLOBALS['phpgw']->redirect_link('/preferences/index.php');
                                $GLOBALS['phpgw']->common->phpgw_exit();
                        }
@@ -1140,11 +1177,6 @@

                        //$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'))));

@@ -1178,33 +1210,110 @@
                        $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);
+                       $table_footer = array('table_col' => 
$this->display_buttons());

-                       $var = array();
-                       $button = array
-                       (
-                               'type'  => 'submit',
-                               'name'  => 'save',
-                               'value' => lang('save'),
-                               'caption' => $this->build_help('save')
-                       );
-                       $var[] = array('widget' => $button);
-                       $button = array
+                       $data = array
                        (
-                               'type'  => 'submit',
-                               'name' => 'cancel',
-                               'value' => lang('cancel'),
-                               'caption' => $this->build_help('cancel')
+                               'error'                 => '',
+                               'action_url'    => 
$GLOBALS['phpgw']->link('/index.php','menuaction=filemanager.uifilemanager.preferences'),
+                               'table'                 => array('width' => 
'50%','table_head' => $table_head ,'table_row' => $table_rows,'table_footer' => 
$table_footer)
                        );
-                       $var[] = array('widget' => $button);
+                       //_debug_array($data);
+                       
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('config' => $data));
+               }
+
+               function admin()
+               {
+                       $val = $_POST['set_quota'];
+
+                       $config = CreateObject('phpgwapi.config','filemanager');
+                       $config->read_repository();
+
+                       // Check if the Values match the following pattern 
0,1,10,unlimited
+                       if (empty($val) || ereg("^[ 0-9]+(,[ 0-9]+)*$",$val))
+                       {
+                               if ($_POST['save'])
+                               {
+                                       $config->value('set_quota', '0,' . $val 
. ',unlimited');
+                                       $config->save_repository();
+                                       
$GLOBALS['phpgw']->redirect_link('/admin/index.php');
+                               }
+                       }
+                       else
+                       {
+                               $error = lang('erroneous input! check quota 
value!');
+                       }
+
+                       if ($_POST['cancel'])
+                       {
+                               
$GLOBALS['phpgw']->redirect_link('/admin/index.php');
+                       }
+
+                       $GLOBALS['phpgw_info']['flags']['app_header'] = 
lang('filemanager') . ': ' . lang('admin');
+
+                       if ($config->config_data)
+                       {
+                               $items = $config->config_data;
+                               $quota = $items['set_quota'];
+                               unset($config);
+                       }
+
+                       if (!$quota)
+                       {
+                               $str .= '1,10';
+                       }
+                       else
+                       {
+                               $quota_str = '';
+                               $tok = strtok ($quota,",");
+
+                               if ($tok=='0')
+                               {
+                                       $tok = strtok (',');
+                               }
+                               while ($tok)
+                               {
+                                       if (strstr($tok,'unlimited'))
+                                       {
+                                               $tok = strtok (',');
+                                       }
+                                       else
+                                       {
+                                               if ($quota_str=='')
+                                               {
+                                                       $quota_str .= $tok;
+                                               }
+                                               else
+                                               {
+                                                       $quota_str .= ','.$tok;
+                                               }
+                                               $tok = strtok (',');
+                                       }
+                               }
+                               $str .= $quota_str;
+                       }
+
+                       $sstr = '0,';
+                       $estr .= ', ' . lang('unlimited');
+
+                       $data = array();
+                       $table_head = array('table_col' => array('colspan' => 
'2','align' => 'left','widget' => array('type' => 'label','caption' => 
lang('edit quota'))));
+
+                       $var = array();
+                       $var[] = array('widget' => array('type' => 
'label','width' => '80%','caption' => lang('Enter comma separated Quota value 
in MB')));
+                       $var[] = array('widget' => array('type' => 
'text','name' => 'set_quota','value' => $str,'caption_start' => $sstr,'caption' 
=> $estr));
                        $table_rows[] = array('table_col' => $var);

+                       $table_footer = array('table_col' => 
$this->display_buttons());
+
                        $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)
+                               'error'                 => $error,
+                               'action_url'    => 
$GLOBALS['phpgw']->link('/index.php','menuaction=filemanager.uifilemanager.admin'),
+                               'table'                 => array('width' => 
'50%','table_head' => $table_head ,'table_row' => $table_rows,'table_footer' => 
$table_footer)
                        );
                        //_debug_array($data);
-                       
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('preferences' => $data));
+                       
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('config' => $data));
                }
        }
 ?>

====================================================
Index: filemanager/inc/class.bofilemanager.inc.php
diff -u filemanager/inc/class.bofilemanager.inc.php:1.9 
filemanager/inc/class.bofilemanager.inc.php:1.10
--- filemanager/inc/class.bofilemanager.inc.php:1.9     Sat Jan 22 23:48:25 2005
+++ filemanager/inc/class.bofilemanager.inc.php Sun Jan 23 21:33:14 2005
@@ -1,8 +1,16 @@
 <?php
-
-
-
-
+       /***
+       * phpGroupWare Filemanager
+       * based on phpWebhosting, written by Jason Wies (Zone)
+       * @author Jason Wies (Zone)
+       * @author Mark A Peters (skeeter) <address@hidden>
+       * @author Jonathon Sim <address@hidden>
+       * @author Bettina Gille (ceb) <address@hidden>
+       * @copyright Copyright (C) 2000-2005 Free Software Foundation, Inc 
http://www.fsf.org/
+       * @license http://www.gnu.org/licenses/gpl.html GNU General Public 
License
+       * @package filemanager
+       * @version $Id$
+       */

        class bofilemanager
        {
@@ -50,6 +58,7 @@
                var $messages = Array();
                var $renamefiles;
                var $comment_files = Array();
+               var $show_upload_boxes = 5;
                var $upload_boxes = array();
                var $memberships;
                var $now;
@@ -152,9 +161,10 @@
                        );
                        asort($this->file_attributes);

-                       $this->upload_boxes = array(1,5,10,15,20,30);
-
+                       $this->upload_boxes = array(1,5,10,15,20,25,30);

+                       $this->show_upload_boxes = 
$GLOBALS['phpgw_info']['user']['preferences']['filemanager']['show_upload_boxes']?
+                                                                               
$GLOBALS['phpgw_info']['user']['preferences']['filemanager']['show_upload_boxes']:5;
                        if($this->go)
                        {
                                $this->path = $this->todir;






reply via email to

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