From cd2ad088bf785d672efafb9d7928a8a17f2c4dde Mon Sep 17 00:00:00 2001 From: Ralf Becker Date: Fri, 20 Jul 2007 07:37:36 +0000 Subject: [PATCH] missing file from Klaus commit and removing the obsolete files, you need to run Admin >> register all hooks --- .../inc/class.filemanager_hooks.inc.php | 151 ++++++++++++++++++ filemanager/inc/hook_deleteaccount.inc.php | 28 ---- filemanager/inc/hook_preferences.inc.php | 23 --- filemanager/inc/hook_settings.inc.php | 99 ------------ filemanager/inc/hook_sidebox_menu.inc.php | 41 ----- filemanager/setup/setup.inc.php | 11 +- 6 files changed, 156 insertions(+), 197 deletions(-) create mode 100644 filemanager/inc/class.filemanager_hooks.inc.php delete mode 100755 filemanager/inc/hook_deleteaccount.inc.php delete mode 100644 filemanager/inc/hook_preferences.inc.php delete mode 100644 filemanager/inc/hook_settings.inc.php delete mode 100755 filemanager/inc/hook_sidebox_menu.inc.php diff --git a/filemanager/inc/class.filemanager_hooks.inc.php b/filemanager/inc/class.filemanager_hooks.inc.php new file mode 100644 index 0000000000..a837994550 --- /dev/null +++ b/filemanager/inc/class.filemanager_hooks.inc.php @@ -0,0 +1,151 @@ + + * @package filemanager + * @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License + * @version $Id$ + */ + +/** + * Class containing admin, preferences and sidebox-menus (used as hooks) + */ +class filemanager_hooks +{ + function all_hooks($args) + { + $appname = 'filemanager'; + $location = is_array($args) ? $args['location'] : $args; + //echo "

admin_prefs_sidebox_hooks::all_hooks(".print_r($args,True).") appname='$appname', location='$location'

\n"; + + if ($location == 'sidebox_menu') + { + $title = $GLOBALS['egw_info']['apps'][$appname]['title'] . ' '. lang('Menu'); + $file = Array( + array( + 'Search', + 'text' => 'Search', + 'link' => $GLOBALS['egw']->link('/index.php',array('menuaction'=>'filemanager.uifilemanager.index', 'action'=>'search')), + ) + ); + display_sidebox($appname,$title,$file); + } + + if ($GLOBALS['egw_info']['user']['apps']['preferences'] && $location != 'admin') + { + $file = array( + 'Filemanager Preferences' => $GLOBALS['egw']->link('/index.php','menuaction=preferences.uisettings.index&appname='.$appname), + 'Grant Access' => $GLOBALS['egw']->link('/index.php','menuaction=preferences.uiaclprefs.index&acl_app='.$appname), + ); + if ($location == 'preferences') + { + display_section($appname,$file); + } + else + { + display_sidebox($appname,lang('Preferences'),$file); + } + } + if ($GLOBALS['egw_info']['user']['apps']['admin'] && $location != 'preferences') + { + $file = Array( + 'Grant Access' => $GLOBALS['egw']->link('/index.php','menuaction=preferences.uiaclprefs.index&acl_app='.$appname), + ); + if ($location == 'admin') + { + display_section($appname,$file); + } + else + { + display_sidebox($appname,lang('Admin'),$file); + } + } + + } + + function settings($args) + { + settype($GLOBALS['settings'],'array'); + + $GLOBALS['settings']['display_attrs'] = array( + 'type' => 'section', + 'title' => 'Display attributes', + 'name' => 'display_attrs', + 'xmlrpc' => True, + 'admin' => False + ); + + $file_attributes = Array( + 'name' => 'File Name', + 'mime_type' => 'MIME Type', + 'size' => 'Size', + 'created' => 'Created', + 'modified' => 'Modified', + 'owner' => 'Owner', + 'createdby_id' => 'Created by', + 'modifiedby_id' => 'Created by', + 'modifiedby_id' => 'Modified by', + 'app' => 'Application', + 'comment' => 'Comment', + 'version' => 'Version' + ); + + foreach($file_attributes as $key => $value) + { + $GLOBALS['settings'][$key] = array( + 'type' => 'check', + 'label' => "$value", + 'name' => $key, + 'xmlrpc' => True, + 'admin' => False + ); + } + + $GLOBALS['settings']['other_settings'] = array( + 'type' => 'section', + 'title' => 'Other settings', + 'name' => 'other_settings', + 'xmlrpc' => True, + 'admin' => False + ); + + $other_checkboxes = array ( + "viewinnewwin" => "View documents in new window", + "viewonserver" => "View documents on server (if available)", + "viewtextplain" => "Unknown MIME-type defaults to text/plain when viewing", + "dotdot" => "Show ..", + "dotfiles" => "Show .files", + ); + + foreach($other_checkboxes as $key => $value) + { + $GLOBALS['settings'][$key] = array( + 'type' => 'check', + 'label' => "$value", + 'name' => $key, + 'xmlrpc' => True, + 'admin' => False + ); + } + + $upload_boxes = array( + '1' => '1', + '5' => '5', + '10' => '10', + '20' => '20', + '30' => '30' + ); + + $GLOBALS['settings']['show_upload_boxes'] = array( + 'label' => 'Default number of upload fields to show', + 'name' => 'show_upload_boxes', + 'values' => $upload_boxes, + 'xmlrpc' => True, + 'admin' => False + ); + + return true; + } +} diff --git a/filemanager/inc/hook_deleteaccount.inc.php b/filemanager/inc/hook_deleteaccount.inc.php deleted file mode 100755 index 0a7a436404..0000000000 --- a/filemanager/inc/hook_deleteaccount.inc.php +++ /dev/null @@ -1,28 +0,0 @@ -vfs->working_id = $account_id; - $ls_array = $GLOBALS['egw']->vfs->ls ($GLOBALS['egw']->vfs->fakebase . "/" . $account_id, array (RELATIVE_NONE)); - while (list ($num, $entry) = each ($ls_array)) - { - $GLOBALS['egw']->vfs->rm ($entry["dir"] . "/" . $entry["name"], array (RELATIVE_NONE)); - } -*/ -?> diff --git a/filemanager/inc/hook_preferences.inc.php b/filemanager/inc/hook_preferences.inc.php deleted file mode 100644 index 70d21b5a48..0000000000 --- a/filemanager/inc/hook_preferences.inc.php +++ /dev/null @@ -1,23 +0,0 @@ - * - * -------------------------------------------- * - * 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..... - $title = $appname; - $file = Array( - 'Preferences' => $GLOBALS['egw']->link('/index.php','menuaction=preferences.uisettings.index&appname=' . $appname) - ); -//Do not modify below this line - display_section($appname,$title,$file); -} -?> diff --git a/filemanager/inc/hook_settings.inc.php b/filemanager/inc/hook_settings.inc.php deleted file mode 100644 index 1790cc8054..0000000000 --- a/filemanager/inc/hook_settings.inc.php +++ /dev/null @@ -1,99 +0,0 @@ - * - * -------------------------------------------- * - * 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) * - \**************************************************************************/ - - /* $Id$ */ - - //ExecMethod('filemanager.bofilemanager.check_set_default_prefs'); - - /*create_section('TESTING'); - - create_check_box('Use new experimental Filemanager?','experimental_new_code','The future filemanager, now for TESTING PURPOSES ONLY, please send bugreports'); - - */ - settype($GLOBALS['settings'],'array'); - - $GLOBALS['settings']['display_attrs'] = array( - 'type' => 'section', - 'title' => 'Display attributes', - 'name' => 'display_attrs', - 'xmlrpc' => True, - 'admin' => False - ); - - $file_attributes = Array( - 'name' => 'File Name', - 'mime_type' => 'MIME Type', - 'size' => 'Size', - 'created' => 'Created', - 'modified' => 'Modified', - 'owner' => 'Owner', - 'createdby_id' => 'Created by', - 'modifiedby_id' => 'Created by', - 'modifiedby_id' => 'Modified by', - 'app' => 'Application', - 'comment' => 'Comment', - 'version' => 'Version' - ); - - foreach($file_attributes as $key => $value) - { - $GLOBALS['settings'][$key] = array( - 'type' => 'check', - 'label' => "$value", - 'name' => $key, - 'xmlrpc' => True, - 'admin' => False - ); - } - - $GLOBALS['settings']['other_settings'] = array( - 'type' => 'section', - 'title' => 'Other settings', - 'name' => 'other_settings', - 'xmlrpc' => True, - 'admin' => False - ); - - $other_checkboxes = array ( - "viewinnewwin" => "View documents in new window", - "viewonserver" => "View documents on server (if available)", - "viewtextplain" => "Unknown MIME-type defaults to text/plain when viewing", - "dotdot" => "Show ..", - "dotfiles" => "Show .files", - ); - - foreach($other_checkboxes as $key => $value) - { - $GLOBALS['settings'][$key] = array( - 'type' => 'check', - 'label' => "$value", - 'name' => $key, - 'xmlrpc' => True, - 'admin' => False - ); - } - - $upload_boxes = array( - '1' => '1', - '5' => '5', - '10' => '10', - '20' => '20', - '30' => '30' - ); - - $GLOBALS['settings']['show_upload_boxes'] = array( - 'label' => 'Default number of upload fields to show', - 'name' => 'show_upload_boxes', - 'values' => $upload_boxes, - 'xmlrpc' => True, - 'admin' => False - ); diff --git a/filemanager/inc/hook_sidebox_menu.inc.php b/filemanager/inc/hook_sidebox_menu.inc.php deleted file mode 100755 index d83c03e9ef..0000000000 --- a/filemanager/inc/hook_sidebox_menu.inc.php +++ /dev/null @@ -1,41 +0,0 @@ - * - * -------------------------------------------- * - * 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$ */ -{ - - /* - This hookfile is for generating an app-specific side menu used in the idots - template set. - - $menu_title speaks for itself - $file is the array with link to app functions - - display_sidebox can be called as much as you like - */ - - $menu_title = $GLOBALS['egw_info']['apps'][$appname]['title'] . ' '. lang('Menu'); - $file = Array( - array( - 'Preferences', - 'text' => 'Filemanager Preferences', - 'link' => $GLOBALS['egw']->link('/index.php','menuaction=preferences.uisettings.index&appname=filemanager'), - ), - array( - 'Search', - 'text' => 'Search', - 'link' => $GLOBALS['egw']->link('/index.php',array('menuaction'=>'filemanager.uifilemanager.index', 'action'=>'search')), - ) - ); - display_sidebox($appname,$menu_title,$file); -} -?> diff --git a/filemanager/setup/setup.inc.php b/filemanager/setup/setup.inc.php index 5d3950b092..d8b3700b47 100755 --- a/filemanager/setup/setup.inc.php +++ b/filemanager/setup/setup.inc.php @@ -13,16 +13,15 @@ $setup_info['filemanager']['name'] = 'filemanager'; $setup_info['filemanager']['title'] = 'Filemanager'; - $setup_info['filemanager']['version'] = '1.5'; + $setup_info['filemanager']['version'] = '1.4'; $setup_info['filemanager']['app_order'] = 6; $setup_info['filemanager']['enable'] = 1; - $setup_info['filemanager']['tables'] =array('egw_vfs'); /* The hooks this app includes, needed for hooks registration */ - $setup_info['filemanager']['hooks']['preferences'] = 'filemanager.admin_prefs_sidebox_hooks.all_hooks'; - $setup_info['filemanager']['hooks']['deleteaccount'] = 'filemanager.admin_prefs_sidebox_hooks.all_hooks'; - $setup_info['filemanager']['hooks'][] = 'settings'; - $setup_info['filemanager']['hooks']['sidebox_menu'] = 'filemanager.admin_prefs_sidebox_hooks.all_hooks'; + $setup_info['filemanager']['hooks']['preferences'] = 'filemanager.filemanager_hooks.all_hooks'; + $setup_info['filemanager']['hooks']['deleteaccount'] = 'filemanager.filemanager_hooks.all_hooks'; + $setup_info['filemanager']['hooks']['settings'] = 'filemanager.filemanager_hooks.settings'; + $setup_info['filemanager']['hooks']['sidebox_menu'] = 'filemanager.filemanager_hooks.all_hooks'; /* Dependencies for this app to work */