From fc74ba453e3c358ced83052115891c882772b5df Mon Sep 17 00:00:00 2001 From: sim Date: Tue, 4 Mar 2003 01:16:30 +0000 Subject: [PATCH] makes preferences work again (for now) - they aren't ported to xslt, instead they simply use the preferences app and a hook_settings.inc.php to get the job done. --- filemanager/inc/hook_add_def_pref.inc.php | 2 +- filemanager/inc/hook_preferences.inc.php | 15 ++- filemanager/inc/hook_settings.inc.php | 124 ++++++++++++++++++++++ filemanager/setup/setup.inc.php | 5 +- 4 files changed, 134 insertions(+), 12 deletions(-) create mode 100644 filemanager/inc/hook_settings.inc.php diff --git a/filemanager/inc/hook_add_def_pref.inc.php b/filemanager/inc/hook_add_def_pref.inc.php index 5e354453b7..a9104e3a02 100755 --- a/filemanager/inc/hook_add_def_pref.inc.php +++ b/filemanager/inc/hook_add_def_pref.inc.php @@ -3,7 +3,7 @@ global $pref; $pref->change ('filemanager', 'name', True); -$pref->change ('filemanager', 'mime_type', True); +$pref->change ('filemanager', 'mime_type', False); $pref->change ('filemanager', 'size', True); $pref->change ('filemanager', 'created', True); $pref->change ('filemanager', 'modified', True); diff --git a/filemanager/inc/hook_preferences.inc.php b/filemanager/inc/hook_preferences.inc.php index b56245e026..286abb4ce4 100644 --- a/filemanager/inc/hook_preferences.inc.php +++ b/filemanager/inc/hook_preferences.inc.php @@ -1,9 +1,5 @@ * - * -------------------------------------------- * + /**************************************************************************\ * * 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 * @@ -12,12 +8,13 @@ /* $Id$ */ { -// Only Modify the $file and $title variables..... - $title = $appname; + $file = Array( - lang('Preferences') => $GLOBALS['phpgw']->link('/filemanager/preferences.php') + lang('Preferences') => $GLOBALS['phpgw']->link('/preferences/preferences.php',array( + 'appname' =>$appname, + 'type' => 'user')) ); //Do not modify below this line - display_section($appname,$title,$file); + display_section($appname,$file); } ?> diff --git a/filemanager/inc/hook_settings.inc.php b/filemanager/inc/hook_settings.inc.php new file mode 100644 index 0000000000..1050fe0137 --- /dev/null +++ b/filemanager/inc/hook_settings.inc.php @@ -0,0 +1,124 @@ +common->list_templates(); + while (list($var,$value) = each($templates)) + { + $_templates[$var] = $templates[$var]['title']; + } + + $themes = $GLOBALS['phpgw']->common->list_themes(); + while (list(,$value) = each($themes)) + { + $_themes[$value] = $value; + } + + $this->bo = CreateObject('filemanager.bofilemanager'); + $this->pref_type = $GLOBALS['type']; + } + + function display_item($label_name, $preference_name, $s) + { + global $t; + + $_appname = check_app(); + if (is_forced_value($_appname,$preference_name)) + { + return True; + } + + $GLOBALS['phpgw']->nextmatchs->template_alternate_row_color($t); + + $t->set_var('row_name',$label_name); + + switch ($GLOBALS['type']) + { + case 'user': + $t->set_var('row_value',$s ); + break; + case 'default': + $t->set_var('row_value', $s ); + break; + case 'forced': + $t->set_var('row_value', $s); + break; + } + + $t->fp('rows','row',True); + } + + function index() + { + $phpgw_info = $GLOBALS['phpgw_info']; + echo 'Current Preferences '; + //print_r($phpgw_info[$this->pref_type]['preferences']['filemanager']); + + /* + 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 .files"), "show_help" => lang("Show help"), "show_command_line" => lang("Show command line (EXPERIMENTAL. DANGEROUS.)")); + + /* + To add a dropdown preferences, add it here. Key is internal name, value key is + displayed name, value values are choices in the dropdown + */ + //$other_dropdown = array ("show_upload_boxes" => array (, "5", "10", "20", "30")); + + create_select_box(lang("Default number of upload fields to show"), 'show_upload_boxes', array ("5"=>"5", "10"=>'10', "20"=>'20', "30"=>'30')); + $this->display_item(''.lang('File attributes to display:').'','',''); + while (list ($internal, $displayed) = each ($this->bo->file_attributes)) + { + unset ($checked); + + if ($phpgw_info[$this->pref_type]['preferences']['filemanager'][$internal]) + { + $checked = '1'; + $extra = 'checked'; + } + else + { + $checked = '0'; + $extra = ''; + } + $str = ''; + //$this->display_item (lang($displayed), $internal, $str); + create_select_box(lang("$displayed"), $internal, array ("1"=>"yes", "0"=>'no')); + } + $this->display_item ('
','',''); + + reset ($other_checkboxes); + while (list ($internal, $displayed) = each ($other_checkboxes)) + { + unset ($checked); + if ($phpgw_info[$this->pref_type]['preferences']['filemanager'][$internal]) + { + $checked = 1; + $extra = 'checked'; + } + else + { + $checked = 0; + $extra = ''; + } + + $str = ''; + $this->display_item ($displayed, $internal, $str); + } + } + } + + $a = new uipreferences(); + $a->index(); + diff --git a/filemanager/setup/setup.inc.php b/filemanager/setup/setup.inc.php index 1a8b7c769a..292ebda7f8 100755 --- a/filemanager/setup/setup.inc.php +++ b/filemanager/setup/setup.inc.php @@ -12,7 +12,7 @@ /* $Id$ */ $setup_info['filemanager']['name'] = 'filemanager'; - $setup_info['filemanager']['version'] = '0.9.13.005'; + $setup_info['filemanager']['version'] = '0.9.15.001'; $setup_info['filemanager']['app_order'] = 10; $setup_info['filemanager']['enable'] = 1; @@ -21,10 +21,11 @@ $setup_info['filemanager']['hooks'][] = 'admin'; $setup_info['filemanager']['hooks'][] = 'deleteaccount'; $setup_info['filemanager']['hooks'][] = 'preferences'; + $setup_info['filemanager']['hooks'][] = 'settings'; /* Dependencies for this app to work */ $setup_info['filemanager']['depends'][] = array( 'appname' => 'phpgwapi', - 'versions' => array('0.9.13', '0.9.14','0.9.15') + 'versions' => array('0.9.15') ); ?>