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.7 class.uifilem


From: ceb
Subject: [Phpgroupware-cvs] filemanager/inc hook_admin.inc.php, 1.7 class.uifilemanager.inc.php, 1.31 class.bofilemanager.inc.php, 1.23
Date: Sat, 9 Apr 2005 23:56:00 +0200

Update of filemanager/inc

Modified Files:
     Branch: MAIN
            hook_admin.inc.php lines: +3 -2
            class.uifilemanager.inc.php lines: +232 -52
            class.bofilemanager.inc.php lines: +19 -12

Log Message:
update

====================================================
Index: filemanager/inc/hook_admin.inc.php
diff -u filemanager/inc/hook_admin.inc.php:1.6 
filemanager/inc/hook_admin.inc.php:1.7
--- filemanager/inc/hook_admin.inc.php:1.6      Sat Apr  9 00:19:32 2005
+++ filemanager/inc/hook_admin.inc.php  Sat Apr  9 21:56:02 2005
@@ -14,7 +14,8 @@
 // Only Modify the $file and $title variables.....
                $file = Array
                (
-                       'site configuration' => 
$GLOBALS['phpgw']->link('/index.php','menuaction=filemanager.uifilemanager.admin')
+                       'site configuration'            => 
$GLOBALS['phpgw']->link('/index.php','menuaction=filemanager.uifilemanager.admin'),
+                       'edit user menu actions'        => 
$GLOBALS['phpgw']->link('/index.php','menuaction=filemanager.uifilemanager.edit_actions')
                );
 //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.30 
filemanager/inc/class.uifilemanager.inc.php:1.31
--- filemanager/inc/class.uifilemanager.inc.php:1.30    Sat Apr  9 00:19:32 2005
+++ filemanager/inc/class.uifilemanager.inc.php Sat Apr  9 21:56:02 2005
@@ -24,45 +24,43 @@
                        'view'                  => True,
                        'edit'                  => True,
                        'preferences'   => True,
-                       'admin'                 => True
+                       'admin'                 => True,
+                       'edit_actions'  => True
                );

                var $bofilemanager;
-               var $nextmatchs;
                var $browser;
-               var $template_dir;
-               var $help_info;
                var $mime_ico = array
                (
-                       'application/pdf' => 'pdf',
-       'application/postscript' => 'postscript',
-       'application/msword' => 'word',
-       'application/vnd.ms-excel' => 'excel',
-       'application/vnd.ms-powerpoint' => 'ppt',
-       'application/x-gzip' => 'tgz',
-       'application/x-bzip' => 'tgz',
-       'application/zip' => 'tgz',
-       'application/x-debian-package' => 'deb',
-       'application/x-rpm' => 'rpm',
-       'application' => 'document',
-       'application/octet-stream' => 'unknown',
-       'audio' => 'sound',
-       'audio/mpeg' => 'sound',
-       'Directory' => 'folder',
-       'exe' => 'exe',
-       'image' => 'image',
-       'text' => 'txt',
-       'text/html' => 'html',
-       'text/plain' => 'txt',
-       'text/xml' => 'html',
-       'text/x-vcalendar' => 'vcalendar',
-       'text/calendar' => 'vcalendar',
-       'text/x-vcard' => 'vcard',
-       'text/x-tex' => 'tex',
-       'unknown' => 'unknown',
-       'video' => 'video',
-       'message' => 'message'
-);
+                       'application/pdf'                               => 
'pdf',
+                       'application/postscript'                => 'postscript',
+                       'application/msword'                    => 'word',
+                       'application/vnd.ms-excel'              => 'excel',
+                       'application/vnd.ms-powerpoint' => 'ppt',
+                       'application/x-gzip'                    => 'tgz',
+                       'application/x-bzip'                    => 'tgz',
+                       'application/zip'                               => 
'tgz',
+                       'application/x-debian-package'  => 'deb',
+                       'application/x-rpm'                             => 
'rpm',
+                       'application'                                   => 
'document',
+                       'application/octet-stream'              => 'unknown',
+                       'audio'                                                 
=> 'sound',
+                       'audio/mpeg'                                    => 
'sound',
+                       'Directory'                                             
=> 'folder',
+                       'exe'                                                   
=> 'exe',
+                       'image'                                                 
=> 'image',
+                       'text'                                                  
=> 'txt',
+                       'text/html'                                             
=> 'html',
+                       'text/plain'                                    => 
'txt',
+                       'text/xml'                                              
=> 'html',
+                       'text/x-vcalendar'                              => 
'vcalendar',
+                       'text/calendar'                                 => 
'vcalendar',
+                       'text/x-vcard'                                  => 
'vcard',
+                       'text/x-tex'                                    => 
'tex',
+                       'unknown'                                               
=> 'unknown',
+                       'video'                                                 
=> 'video',
+                       'message'                                               
=> 'message'
+               );

                function uifilemanager()
                {
@@ -270,6 +268,7 @@
                        switch($type)
                        {
                                case 'config':
+                               case 'actions':
                                        $button = array
                                        (
                                                'type'  => 'submit',
@@ -285,7 +284,14 @@
                                                'value' => lang('cancel')
                                                //'caption' => 
$this->bofilemanager->build_help('cancel')
                                        );
-                                       $var[] = array('align' => 
'right','height' => '50','valign' => 'bottom','widget' => $button);
+                                       if($type == 'actions')
+                                       {
+                                               $var[] = array('align' => 
'right','colspan' => '2','height' => '50','valign' => 'bottom','widget' => 
$button);
+                                       }
+                                       else
+                                       {
+                                               $var[] = array('align' => 
'right','height' => '50','valign' => 'bottom','widget' => $button);
+                                       }
                                        break;
                                case 'menu':
                                        $var['option'][] = array
@@ -929,18 +935,16 @@
                        /*
                        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
-                       */
+                       $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)')
+                       );

                        if ($_POST['save'])
                        {
@@ -972,7 +976,7 @@
                        //$GLOBALS['phpgw_info']['flags']['app_header'] = 
lang('filemanager') . ': ' . lang('preferences');

                        $data = array();
-                       $table_head = array('table_col' => array('colspan' => 
'2','align' => 'left','widget' => array('type' => 'label','caption' => 
lang('display attributes'))));
+                       $table_head = array('table_col' => array('colspan' => 
'2','style' => 'font-weight: bold','widget' => array('type' => 
'label','caption' => lang('display attributes'))));

                        foreach($this->bofilemanager->file_attributes as 
$internal => $title)
                        {
@@ -983,7 +987,7 @@
                        }

                        $var = array();
-                       $var[] = array('class' => 'th','width' => 
'90%','widget' => array('type' => 'label','caption' => lang('other settings')));
+                       $var[] = array('class' => 'th','width' => '90%','style' 
=> 'font-weight: bold','widget' => array('type' => 'label','caption' => 
lang('other settings')));
                        $var[] = array('class' => 'th','widget' => array('type' 
=> 'empty'));
                        $table_rows[] = array('table_col' => $var);

@@ -1110,7 +1114,7 @@
                        $estr .= ',' . lang('unlimited');

                        $data = array();
-                       $table_head = array('table_col' => array('colspan' => 
'2','align' => 'left','widget' => array('type' => 'label','caption' => 
lang('edit quota'))));
+                       $table_head = array('table_col' => array('colspan' => 
'2','style' => 'font-weight: bold','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')));
@@ -1118,7 +1122,7 @@
                        $table_rows[] = array('table_col' => $var);

                        $var = array();
-                       $var[] = array('class' => 'th','colspan' => 
'2','widget' => array('type' => 'label','caption' => lang('user menu action 
scripts')));
+                       $var[] = array('style' => 'font-weight: bold','colspan' 
=> '2','widget' => array('type' => 'label','caption' => lang('user menu action 
scripts')));
                        $table_rows[] = array('table_col' => $var);

                        $var = array();
@@ -1127,7 +1131,7 @@
                        $table_rows[] = array('table_col' => $var);

                        $var = array();
-                       $var[] = array('class' => 'th','colspan' => 
'2','widget' => array('type' => 'label','caption' => lang('periodically check 
for new files')));
+                       $var[] = array('style' => 'font-weight: bold','colspan' 
=> '2','widget' => array('type' => 'label','caption' => lang('periodically 
check for new files')));
                        $table_rows[] = array('table_col' => $var);

                        $var = array();
@@ -1156,5 +1160,181 @@
                        //_debug_array($data);
                        
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('config' => $data));
                }
+
+               function edit_actions()
+               {
+                       $config = CreateObject('phpgwapi.config','filemanager');
+                       $config->read_repository();
+
+                       if ($config->config_data)
+                       {
+                               $items = $config->config_data;
+
+                               if($items['user_scripts'])
+                               {
+                                       $user_scripts = $items['user_scripts'];
+                                       reset($user_scripts);
+                                       //_debug_array($user_scripts);
+                               }
+                       }
+
+                       if($_POST['save'])
+                       {
+                               $values = $_POST['values'];
+
+                               //_debug_array($values);
+
+                               if(is_array($values['menu_disabled']))
+                               {
+                                       
$config->value('menu_disabled',$values['menu_disabled']);
+                               }
+
+                               if(strlen($values['scriptname'])>0 && 
strlen($values['scripttitle'])>0)
+                               {
+                                       if(is_array($user_scripts))
+                                       {
+                                               $count = count($user_scripts);
+                                               $user_scripts[$count] = array
+                                               (
+                                                       'name' => 
$values['scriptname'],
+                                                       'title' => 
$values['scripttitle']
+                                               );
+                                       }
+                                       else
+                                       {
+                                               $user_scripts[0] = array
+                                               (
+                                                       'name'  => 
$values['scriptname'],
+                                                       'title' => 
$values['scripttitle']
+                                               );
+                                       }
+                                       
$config->value('user_scripts',$user_scripts);
+                               }
+                               $config->save_repository();
+                               unset($items);
+                       }
+                       elseif($_GET['delete_script'])
+                       {
+                               $script_nr = intval($_GET['script']);
+                               unset($user_scripts[$script_nr]);
+                               reset($user_scripts);
+                               $i = 0;
+                               foreach($user_scripts as $key => $uscript)
+                               {
+                                       $nscript[$i] = $uscript;
+                                       ++$i;
+                               }
+                               //_debug_array($nscript);
+                               $config->value('user_scripts',$nscript);
+                               $config->save_repository();
+                               unset($items);
+                       }
+
+                       if ($_POST['cancel'])
+                       {
+                               
$GLOBALS['phpgw']->redirect_link('/admin/index.php');
+                       }
+
+                       $GLOBALS['phpgw_info']['flags']['app_header'] = 
lang('filemanager') . ': ' . lang('admin');
+
+                       $config->read_repository();
+                       if ($config->config_data)
+                       {
+                               $items          = $config->config_data;
+                               $disabled       = $items['menu_disabled'];
+                               $uscripts       = $items['user_scripts'];
+                               //_debug_array($disabled);
+                               if(!is_array($disabled))
+                               {
+                                       $disabled = array();
+                               }
+                               if(!is_array($uscripts))
+                               {
+                                       $uscripts = array();
+                               }
+                               unset($config);
+                       }
+
+                       $data = array();
+                       $table_head = array('table_col' => array('colspan' => 
'3','style' => 'font-weight: bold','widget' => array('type' => 
'label','caption' => lang('deactivate menu actions'))));
+
+                       $actions = array
+                       (
+                               'edit'                  => lang('Edit'),
+                               'rename'                => lang('Rename'),
+                               'delete'                => lang('Delete'),
+                               'edit_comments' => lang('Edit comments')
+                       );
+
+                       foreach($actions as $action => $trans)
+                       {
+                               $checked = False;
+                               if(in_array($action,$disabled))
+                               {
+                                       $checked = True;
+                               }
+                               $var = array();
+                               $var[] = array('colspan' => '2','width' => 
'90%','widget' => array('type' => 'label','caption' => $trans));
+                               $var[] = array('align' => 'center','widget' => 
array('type' => 'checkbox','name' => 'values[menu_disabled][]','value' => 
$action, 'checked' => $checked));
+                               $table_rows[] = array('table_col' => $var);
+                       }
+
+                       $var = array();
+                       $var[] = array('class' => 'th','style' => 'font-weight: 
bold','colspan' => '3','widget' => array('type' => 'label','caption' => 
lang('additional menu actions')));
+                       $table_rows[] = array('table_col' => $var);
+
+                       $var = array();
+                       $var[] = array('widget' => array('type' => 
'label','caption' => lang('script')));
+                       $var[] = array('widget' => array('type' => 
'label','caption' => lang('user menu action')));
+                       $var[] = array('widget' => array('type' => 'empty'));
+                       $table_rows[] = array('table_col' => $var);
+
+                       reset($uscripts);
+                       $i = 0;
+                       foreach($uscripts as $uscript)
+                       {
+                               $delete_link = array('widget' => array( 'type' 
=> 'image',
+                                                                               
                                'src' => 
$GLOBALS['phpgw']->common->image('phpgwapi','delete'),
+                                                                               
                                'link' =>  
$GLOBALS['phpgw']->link('/index.php','menuaction=filemanager.uifilemanager.edit_actions&delete_script=1&script='
 . $i)));
+                               $var = array();
+                               $var[] = array('widget' => array('type' => 
'label','caption' => $uscript['name']));
+                               $var[] = array('widget' => array('type' => 
'label','caption' => $uscript['title']));
+                               $var[] = $delete_link;
+                               $table_rows[] = array('table_col' => $var);
+                               ++$i;
+                       }
+
+                       $scripts = 
$this->bofilemanager->get_dirfiles($items['script_path']);
+                       $options[] = array('option' => array('value' => 
'','caption' => lang('select script')));
+                       if(is_array($scripts))
+                       {
+                               foreach($scripts as $null => $script)
+                               {
+                                       $options[] = array('option' => 
array('value' => $script,'caption' => $script));
+                               }
+                       }
+
+                       $var = array();
+                       $var[] = array('widget' => array('type' => 
'text','name' => 'values[scripttitle]'));
+                       $var[] = array('widget' => array('type' => 
'select','name' => 'values[scriptname]','options' => $options));
+                       $var[] = array('widget' => array('type' => 'empty'));
+                       $table_rows[] = array('table_col' => $var);
+
+                       $table_footer = array('table_col' => 
$this->display_buttons('actions'));
+
+                       if(is_array($error))
+                       {
+                               $errormsg = explode('<br />',$error);
+                       }
+
+                       $data = array
+                       (
+                               'error'                 => $errormsg,
+                               'action_url'    => 
$GLOBALS['phpgw']->link('/index.php','menuaction=filemanager.uifilemanager.edit_actions'),
+                               '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('config' => $data));
+               }
        }
 ?>

====================================================
Index: filemanager/inc/class.bofilemanager.inc.php
diff -u filemanager/inc/class.bofilemanager.inc.php:1.22 
filemanager/inc/class.bofilemanager.inc.php:1.23
--- filemanager/inc/class.bofilemanager.inc.php:1.22    Sat Apr  9 00:19:32 2005
+++ filemanager/inc/class.bofilemanager.inc.php Sat Apr  9 21:56:02 2005
@@ -1182,21 +1182,28 @@
                        }
                }

-               function get_dirfiles()
+               function get_dirfiles($basedir = '')
                {
-                       $basedir = $this->basedir . $this->path;
-                       $dir = opendir($basedir);
+                       if($basedir = '')
+                       {
+                               $basedir = $this->basedir . $this->path;
+                       }

                        $files  = array();
-                       $i              = 0;
-                       while ($file = readdir($dir))
+                       if(is_dir($basedir))
                        {
-                               if ($file != '.' && $file != '..')
+                               $dir    = opendir($basedir);
+                               $i              = 0;
+                               while ($file = readdir($dir))
                                {
-                                       $files[$i] = $file;
-                                       ++$i;
-                       }
-               }
+                                       if ($file != '.' && $file != '..')
+                                       {
+                                               $files[$i] = $file;
+                                               ++$i;
+                               }
+                       }
+                               closedir($dir);
+                       }
                        return $files;
                }







reply via email to

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