2001-05-21 03:09:20 +02:00
< ? php
/************************************************************************** \
2004-01-27 19:19:23 +01:00
* eGroupWare *
* http :// www . egroupware . org *
2001-05-21 03:09:20 +02:00
* -------------------------------------------- *
* 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$ */
2004-02-02 05:18:17 +01:00
$GLOBALS [ 'phpgw_info' ][ 'flags' ] = array (
'currentapp' => 'filemanager' ,
'enable_nextmatchs_class' => True ,
'noheader' => True ,
'nonavbar' => True
2001-08-24 09:47:01 +02:00
);
2004-02-02 05:18:17 +01:00
//var_dump($file_attributes);
include ( '../header.inc.php' );
2001-05-21 03:09:20 +02:00
/*
2001-08-24 09:47:01 +02:00
To add an on / off preference , just add it here . Key is internal name , value is displayed name
2001-05-21 03:09:20 +02:00
*/
2002-06-18 08:33:44 +02:00
$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.) " ));
2001-05-21 03:09:20 +02:00
2001-08-24 09:47:01 +02:00
/*
To add a dropdown preferences , add it here . Key is internal name , value key is
displayed name , value values are choices in the dropdown
*/
2002-06-18 08:33:44 +02:00
$other_dropdown = array ( " show_upload_boxes " => array ( lang ( " Default number of upload fields to show " ), " 5 " , " 10 " , " 20 " , " 30 " ));
2001-08-24 09:47:01 +02:00
2001-05-21 03:09:20 +02:00
if ( $submit )
{
2004-02-02 05:18:17 +01:00
$GLOBALS [ 'phpgw' ] -> preferences -> read_repository ();
2001-05-21 03:09:20 +02:00
reset ( $other_checkboxes );
while ( list ( $internal , $displayed ) = each ( $other_checkboxes ))
{
2004-02-02 05:18:17 +01:00
$GLOBALS [ 'phpgw' ] -> preferences -> add ( $GLOBALS [ 'phpgw_info' ][ " flags " ][ " currentapp " ], $internal , $$internal );
2001-05-21 03:09:20 +02:00
}
2001-08-24 09:47:01 +02:00
reset ( $other_dropdown );
while ( list ( $internal , $displayed ) = each ( $other_dropdown ))
{
2004-02-02 05:18:17 +01:00
$GLOBALS [ 'phpgw' ] -> preferences -> add ( $GLOBALS [ 'phpgw_info' ][ " flags " ][ " currentapp " ], $internal , $$internal );
2001-08-24 09:47:01 +02:00
}
2003-11-22 04:05:00 +01:00
reset ( $file_attributes );
while ( list ( $internal , $displayed ) = each ( $file_attributes ))
{
2004-02-02 05:18:17 +01:00
$GLOBALS [ 'phpgw' ] -> preferences -> add ( $GLOBALS [ 'phpgw_info' ][ " flags " ][ " currentapp " ], $internal , $$internal );
2003-11-22 04:05:00 +01:00
}
2004-02-02 05:18:17 +01:00
$GLOBALS [ 'phpgw' ] -> preferences -> save_repository ( True );
2001-05-21 03:09:20 +02:00
2004-02-02 05:18:17 +01:00
Header ( 'Location: ' . $GLOBALS [ 'phpgw' ] -> link ( '/preferences/index.php' ));
$GLOBALS [ 'phpgw' ] -> common -> phpgw_exit ();
2001-05-21 03:09:20 +02:00
}
function display_item ( $field , $data )
{
2004-02-02 05:18:17 +01:00
global $p , $tr_color ;
2001-05-21 03:09:20 +02:00
2004-02-02 05:18:17 +01:00
$tr_color = $GLOBALS [ 'phpgw' ] -> nextmatchs -> alternate_row_color ( $tr_color );
2001-05-21 03:09:20 +02:00
$var = array (
'bg_color' => $tr_color ,
'field' => $field ,
'data' => $data
);
$p -> set_var ( $var );
$p -> parse ( 'row' , 'pref_list' , True );
}
2004-02-02 05:18:17 +01:00
$GLOBALS [ 'phpgw' ] -> common -> phpgw_header ();
2001-05-21 03:09:20 +02:00
echo parse_navbar ();
2004-02-02 05:18:17 +01:00
$p = CreateObject ( 'phpgwapi.Template' , $GLOBALS [ 'phpgw' ] -> common -> get_tpl_dir ( 'filemanager' ));
2001-05-21 03:09:20 +02:00
$templates = array (
'pref' => 'pref.tpl' ,
'pref_colspan' => 'pref_colspan.tpl' ,
2002-02-10 05:19:43 +01:00
'pref_list' => 'pref_list.tpl'
2001-05-21 03:09:20 +02:00
);
$p -> set_file ( $templates );
$var = array (
2003-08-28 16:31:11 +02:00
'title' => lang ( 'FileManager preferences' ),
2004-02-02 05:18:17 +01:00
'action_url' => $GLOBALS [ 'phpgw' ] -> link ( '/' . $GLOBALS [ 'phpgw_info' ][ 'flags' ][ 'currentapp' ] . '/preferences.php' ),
'bg_color' => $GLOBALS [ 'phpgw_info' ][ 'theme' ][ 'th_bg' ],
2001-05-21 03:09:20 +02:00
'submit_lang' => lang ( 'submit' )
);
$p -> set_var ( $var );
$p -> set_var ( 'text' , ' ' );
$p -> parse ( 'row' , 'pref_colspan' , True );
if ( $totalerrors )
{
2004-02-02 05:18:17 +01:00
echo '<p><center>' . $GLOBALS [ 'phpgw' ] -> common -> error_list ( $errors ) . '</center>' ;
2001-05-21 03:09:20 +02:00
}
2003-11-22 04:05:00 +01:00
2001-05-21 03:09:20 +02:00
while ( list ( $internal , $displayed ) = each ( $file_attributes ))
{
unset ( $checked );
2004-02-02 05:18:17 +01:00
if ( $GLOBALS [ 'phpgw_info' ][ " user " ][ " preferences " ][ " filemanager " ][ $internal ])
2001-08-24 09:47:01 +02:00
{
2001-05-21 03:09:20 +02:00
$checked = 1 ;
2001-08-24 09:47:01 +02:00
}
2001-05-21 03:09:20 +02:00
$str .= html_form_input ( " checkbox " , $internal , NULL , NULL , NULL , $checked , NULL , 1 ) . " $displayed " . html_break ( 1 , NULL , 1 );
}
display_item ( lang ( 'Display attributes' ), $str );
2001-08-24 09:47:01 +02:00
reset ( $other_checkboxes );
2001-05-21 03:09:20 +02:00
while ( list ( $internal , $displayed ) = each ( $other_checkboxes ))
{
unset ( $checked );
2004-02-02 05:18:17 +01:00
if ( $GLOBALS [ 'phpgw_info' ][ " user " ][ " preferences " ][ " filemanager " ][ $internal ])
2001-08-24 09:47:01 +02:00
{
2001-05-21 03:09:20 +02:00
$checked = 1 ;
2001-08-24 09:47:01 +02:00
}
2001-05-21 03:09:20 +02:00
$str = html_form_input ( " checkbox " , $internal , NULL , NULL , NULL , $checked , NULL , 1 );
2002-06-18 08:33:44 +02:00
display_item ( $displayed , $str );
2001-05-21 03:09:20 +02:00
}
2001-08-24 09:47:01 +02:00
reset ( $other_dropdown );
while ( list ( $internal , $value_array ) = each ( $other_dropdown ))
{
reset ( $value_array );
unset ( $options );
while ( list ( $num , $value ) = each ( $value_array ))
{
if ( $num == 0 )
{
$displayed = $value ;
continue ;
}
2004-02-02 05:18:17 +01:00
$options .= html_form_option ( $value , $value , $GLOBALS [ 'phpgw_info' ][ " user " ][ " preferences " ][ " filemanager " ][ $internal ] == $value , True );
2001-08-24 09:47:01 +02:00
}
$output = html_form_select_begin ( $internal , True );
$output .= $options ;
$output .= html_form_select_end ( True );
display_item ( $displayed , $output );
}
2001-05-21 03:09:20 +02:00
$p -> pparse ( 'out' , 'pref' );
2004-02-02 05:18:17 +01:00
$GLOBALS [ 'phpgw' ] -> common -> phpgw_footer ();
2001-05-21 03:09:20 +02:00
?>