diff --git a/filemanager/inc/class.bophpwebhosting.inc.php b/filemanager/inc/class.bophpwebhosting.inc.php index d7970970e4..46a729d530 100755 --- a/filemanager/inc/class.bophpwebhosting.inc.php +++ b/filemanager/inc/class.bophpwebhosting.inc.php @@ -6,6 +6,10 @@ class bophpwebhosting { + var $public_functions = array( + 'delete' => True + ); + var $so; var $vfs; var $rootdir; @@ -19,6 +23,10 @@ var $file_attributes; var $help_info; + var $delete; + var $rename; + var $go; + var $download = Array(); var $fileman = Array(); var $op; @@ -41,7 +49,6 @@ function bophpwebhosting() { -// error_reporting (4); $this->vfs = CreateObject('phpgwapi.vfs'); $to_decode = Array( @@ -55,29 +62,26 @@ 'op', 'path', 'file', + 'todir', 'sortby', 'fileman', 'messages', 'help_name', 'renamefiles', 'comment_files', - 'show_upload_boxes' + 'show_upload_boxes', + 'submit', + 'delete', + 'go', + 'rename' ); $c_to_decode = count($to_decode); for($i=0;$i<$c_to_decode;$i++) -// @reset($GLOBALS['HTTP_GET_VARS']); -// while(list($name,$data) = each($GLOBALS['HTTP_GET_VARS'])) { $this->initialize_vars($to_decode[$i]); } -// @reset($GLOBALS['HTTP_POST_VARS']); -// while(list($name,$data) = each($GLOBALS['HTTP_POST_VARS'])) -// { -// $this->initialize_vars($name,$data); -// } - $this->rootdir = $this->vfs->basedir; $this->fakebase = $this->vfs->fakebase; $this->appname = $GLOBALS['phpgw_info']['flags']['currentapp']; @@ -106,6 +110,7 @@ $this->file_attributes = Array( 'name' => 'Filename', + 'deletable' => 'Deletable', 'mime_type' => 'MIME Type', 'size' => 'Size', 'created' => 'Created', @@ -208,7 +213,7 @@ # We determine if they're in their home directory or a group's directory, # and set the VFS working_id appropriately ### - if((preg_match ('+^'.$this->fakebase.'\/(.*)(\/|$)+U',$this->path,$this->matches)) && $this->matches[1] != $this->userinfo['account_lid']) + if((preg_match('+^'.$this->fakebase.'\/(.*)(\/|$)+U',$this->path,$this->matches)) && $this->matches[1] != $this->userinfo['account_lid']) { $this->vfs->working_id = $GLOBALS['phpgw']->accounts->name2id($matches[1]); } @@ -216,20 +221,16 @@ { $this->vfs->working_id = $this->userinfo['username']; } - -// $this->load_files(); - - $this->load_help_info(); } function initialize_vars($name) { $var = ($GLOBALS['HTTP_GET_VARS'][$name]?$GLOBALS['HTTP_GET_VARS'][$name]:''); $var = ($GLOBALS['HTTP_POST_VARS'][$name]?$GLOBALS['HTTP_POST_VARS'][$name]:$var); -// if($var) -// { -// $this->$name = $var; -// } + if($this->debug) + { + echo ''."\n"; + } if(is_array($this->$name) && $var) { $temp = Array(); @@ -245,7 +246,6 @@ } } } -// elseif(isset($this->$name) && $var) elseif($var) { $temp = urldecode($var); @@ -323,6 +323,54 @@ return $this->files_array; } + function delete() + { + $numoffiles = count($this->fileman); + for($i=0;$i!=$numoffiles;$i++) + { + if ($this->fileman[$i]) + { + $filesize = $this->vfs->get_size($this->path.SEP.$this->fileman[$i],Array(RELATIVE_USER_NONE)); + if(!$this->vfs->delete($this->path.SEP.$this->fileman[$i],Array(RELATIVE_USER_NONE))) + { + $GLOBALS['phpgw']->common->error_list(Array('Could not delete '.$this->disppath.SEP.$this->fileman[$i])); + } + } + } + if(!$errors) + { + Header('Location: '.$GLOBALS['phpgw']->link('/index.php', + Array( + 'menuaction' => $this->appname.'.ui'.$this->appname.'.index', + 'path' => $this->path + ) + ) + ); + } + else + { + Header('Location: '.$GLOBALS['phpgw']->link('/index.php', + Array( + 'menuaction' => $this->appname.'.ui'.$this->appname.'.index', + 'path' => $this->path, + 'errors' => urlencode($errors) + ) + ) + ); + } + } + + function go() + { + Header('Location: '.$GLOBALS['phpgw']->link('/index.php', + Array( + 'menuaction' => $this->appname.'.ui'.$this->appname.'.index', + 'path' => $this->todir + ) + ) + ); + } + function load_help_info() { $this->help_info = Array( @@ -359,7 +407,7 @@ array ("upload_file", "The full path of the local file to upload. You can type it in or use the Browse.. button to select it. The file will be uploaded to the current directory. You cannot upload directories, only files."), array ("upload_comment", "The inital comment to use for the newly uploaded file. Totally optional and completely arbitrary. You can [edit_comments|create or edit the comment] at any time in the future."), array ("upload_files", "This will upload the files listed in the input boxes above, and store them in the current directory."), - array ("show_upload_fields", "This setting determines how many [upload_files|upload fields] will be shown at once. You can change the default number that will be shown in the [preferences].") + array ("show_upload_fields", "This setting determines how many [upload_files|upload fields] will be shown at once. You can change the default number that will be shown in the preferences.") ); } @@ -378,14 +426,12 @@ if($size<1024) { - $rstring = $left.$size.' B  '.$right; + return $left.$size.' B  '.$right; } else { - $rstring = $left.round($size/1024).' KB'.$right; + return $left.round($size/1024).' KB'.$right; } - return $rstring; -// return($this->eor($rstring,$return)); } ### diff --git a/filemanager/inc/class.uiphpwebhosting.inc.php b/filemanager/inc/class.uiphpwebhosting.inc.php index 7b6d252814..17ca83812a 100755 --- a/filemanager/inc/class.uiphpwebhosting.inc.php +++ b/filemanager/inc/class.uiphpwebhosting.inc.php @@ -5,6 +5,9 @@ var $public_functions = array( 'index' => True, + 'action' => True, + 'help' => True, + 'history' => True, 'view' => True, 'view_file' => True ); @@ -30,7 +33,7 @@ function load_header() { - if(($this->bo->download && (count($this->bo->fileman) > 0)) || ($this->bo->op == 'view' && $this->bo->file) || ($this->bo->op == 'history' && $this->bo->file) || ($this->bo->op == 'help' && $this->bo->help_name)) + if(($this->bo->download && (count($this->bo->fileman) > 0)) || ($this->bo->op == 'view' && $this->bo->file) || ($this->bo->op == 'history' && $this->bo->file) || ($this->bo->op == 'help' && $this->bo->help_name) || ($this->bo->delete && count($this->bo->fileman) > 0) || ($this->bo->go && isset($this->bo->todir))) { } else @@ -162,20 +165,64 @@ } } - function build_help($help_option) + function action() + { + $actions = Array( + 'delete' => lang('Delete'), + 'go' => lang('Go To') + ); + @reset($actions); + while(list($function,$text) = each($actions)) + { + if(isset($this->bo->$function) && !empty($this->bo->$function) && trim($this->bo->$function) == $text) + { + if($this->bo->$function == 'go') + { + echo 'To Dir = '.$this->bo->todir.'
'."\n"; + } + $this->bo->$function(); + } + } + } + + function help() + { + $this->bo->load_help_info(); + @reset($this->bo->help_info); + while(list($num,$help_array) = each($this->bo->help_info)) + { + if ($help_array[0] != $this->bo->help_name) + { + continue; + } + + $help_array[1] = preg_replace("/\[(.*)\|(.*)\]/Ue","\$this->build_help('\\1','\\2')",$help_array[1]); + $help_array[1] = preg_replace("/\[(.*)\]/Ue","\$this->build_help('\\1','\\1')",$help_array[1]); + + echo ''."\n".ucwords(str_replace('_',' ',$help_array[0]))."\n".'
'."\n"; + echo ''."\n".$help_array[1].''; + } + $GLOBALS['phpgw']->common->phpgw_exit (); + } + + function build_help($help_option,$text='') { if($this->bo->settings['show_help']) { - return ''."\n" - . ' '."\n"); + $help .= ' [?]'."\n" - . ' '; + . '" target="_new">'; + $help .= ($text?$text:'[?]'); + $help .= ''; + $help .= ($text?'':"\n".' '); + return $help; } else { @@ -193,6 +240,17 @@ return ''.$text.''; } + function build_upload_choices($number) + { + return $this->link( + Array( + 'menuaction' => $GLOBALS['HTTP_GET_VARS']['menuaction'], + 'path' => $this->bo->path, + 'show_upload_boxes' => $number + ), + $number).'  '; + } + function column_header($internal,$displayed,$link=True) { if($link) @@ -215,6 +273,341 @@ ); } + function display_buttons() + { + $p = CreateObject('phpgwapi.Template',$this->template_dir); + $p->set_file( + Array( + '_buttons' => 'small_table.tpl' + ) + ); + $p->set_block('_buttons','table','table'); + $p->set_block('_buttons','column_headers','column_headers'); + $p->set_block('_buttons','column_headers_normal','column_headers_normal'); + $p->set_block('_buttons','column_rows','column_rows'); + + $var = Array( + 'table_extras' => '', + 'tr_extras' => '', + 'td_extras' => ' align="center" width="25%"' + ); + + $var['column_header'] = ''.$this->build_help('edit'); + $p->set_var($var); + $p->parse('col_headers','column_headers',False); + + $var['column_header'] = ''.$this->build_help('rename'); + $p->set_var($var); + $p->parse('col_headers','column_headers',True); + + $var['column_header'] = ''.$this->build_help('delete'); + $p->set_var($var); + $p->parse('col_headers','column_headers',True); + + $var['column_header'] = ''.$this->build_help('edit_comments'); + $p->set_var($var); + $p->parse('col_headers','column_headers',True); + $p->parse('list','column_rows',True); + + $var['column_header'] = ''.$this->build_help('go_to'); + $p->set_var($var); + $p->parse('col_headers','column_headers',False); + + $var['column_header'] = ''.$this->build_help('copy_to'); + $p->set_var($var); + $p->parse('col_headers','column_headers',True); + + $var['column_header'] = ''.$this->build_help('move_to'); + $p->set_var($var); + $p->parse('col_headers','column_headers',True); + + ### + # First we get the directories in their home directory + ### + + $dirs[] = Array( + 'directory' => $this->bo->fakebase, + 'name' => $this->bo->userinfo['account_lid'] + ); + $ls_array = $this->bo->vfs->ls($this->bo->homedir,Array(RELATIVE_NONE),True,'Directory'); + while(list($num,$dir) = each($ls_array)) + { + $dirs[] = $dir; + } + + ### + # Then we get the directories in their membership's home directories + ### + + reset($this->bo->memberships); + while(list($num,$group_array) = each($this->bo->memberships)) + { + ### + # Don't list directories for groups that don't have access + ### + + if(!$this->bo->membership_applications[$group_array['account_name']][$this->bo->appname]['enabled']) + { + continue; + } + + $dirs[] = Array( + 'directory' => $this->bo->fakebase, + 'name' => $group_array['account_name'] + ); + + $ls_array = $this->bo->vfs->ls($this->bo->fakebase.SEP.$group_array['account_name'],Array(RELATIVE_NONE),True,'Directory'); + while(list($num,$dir) = each($ls_array)) + { + $dirs[] = $dir; + } + } + + $dir_list = ''; + reset($dirs); + while(list($num, $dir) = each($dirs)) + { + if(!$dir['directory']) + { + continue; + } + + ### + # So we don't display // + ### + + if($dir['directory'] != '/') + { + $dir['directory'] .= SEP; + } + + $selected = ''; + if($num == 0) + { + $selected = ' selected'; + } + + ### + # No point in displaying the current directory, or a directory that doesn't exist + ### + + if((($dir['directory'].$dir['name']) != $this->bo->path) && $this->bo->vfs->file_exists($dir['directory'].$dir['name'],Array(RELATIVE_NONE))) + { + $dir_list .= ''; + } + } + + $var['column_header'] = ''.$this->build_help('directory_list'); + $p->set_var($var); + $p->parse('col_headers','column_headers',True); + $p->parse('list','column_rows',True); + $p->set_var('col_headers',''); + + $var = Array( + 'tr_extras' => '', + 'td_extras' => ' colspan="2" align="center" width="50%"' + ); + + if($this->bo->path != '/' && $this->bo->path != $this->bo->fakebase) + { + $var['column_header'] = ''.$this->build_help('download'); + $p->set_var($var); + $p->parse('col_headers','column_headers',True); + + $var['column_header'] = '    '.$this->build_help('create_folder'); + $p->set_var($var); + $p->parse('col_headers','column_headers',True); + $p->parse('list','column_rows',True); + } + + $var['column_header'] = ''.$this->build_help('update'); + $p->set_var($var); + $p->parse('col_headers','column_headers',False); + + if($this->bo->path != '/' && $this->bo->path != $this->bo->fakebase) + { + $var['column_header'] = '    '.$this->build_help('create_file'); + } + else + { + $var['column_header'] = ' '; + } + $p->set_var($var); + $p->parse('col_headers','column_headers',True); + $p->parse('list','column_rows',True); + $p->set_var('col_headers',''); + + if($this->bo->settings['show_command_line']) + { + $var = Array( + 'tr_extras' => '', + 'td_extras' => ' colspan="4" align="center" width="100%"', + 'column_header' => ''.$this->build_help('command_line').'
'.$this->build_help('execute') + ); + $p->set_var($var); + $p->parse('col_headers','column_headers',True); + $p->parse('list','column_rows',True); + $p->set_var('col_headers',''); + } + return $p->fp('output','table'); + } + + function display_summary_info($numoffiles,$usedspace) + { + $p = CreateObject('phpgwapi.Template',$this->template_dir); + $p->set_file( + Array( + '_info' => 'small_table.tpl' + ) + ); + $p->set_block('_info','table','table'); + $p->set_block('_info','column_headers','column_headers'); + $p->set_block('_info','column_headers_normal','column_headers_normal'); + $p->set_block('_info','column_rows','column_rows'); + $this_homedir = ($this->bo->path == $this->bo->homedir || $this->bo->path == $this->bo->fakedir); + $info_columns = 4 + ($this_homedir?2:0); + + $var = Array( + 'table_extras' => ' cols="'.$info_columns.'"', + 'tr_extras' => '', + 'td_extras' => ' colspan="'.$info_columns.'" align="center" width="100%"', + 'column_header' => $this->build_help('file_stats') + ); + $p->set_var($var); + $p->parse('col_headers','column_headers',False); + $p->parse('list','column_rows',True); + $p->set_var('col_headers',''); + + $var = Array( + 'tr_extras' => '', + 'td_extras' => ' align="right"' + ); + + $var['column_header'] = ''.lang('Files').':'; + $p->set_var($var); + $p->parse('col_headers','column_headers_normal',False); + + $var['td_extras'] = ' align="left"'; + $var['column_header'] = $numoffiles; + $p->set_var($var); + $p->parse('col_headers','column_headers_normal',True); + + $var['td_extras'] = ' align="right"'; + $var['column_header'] = ''.lang('Used Space').':'; + $p->set_var($var); + $p->parse('col_headers','column_headers_normal',True); + + $var['td_extras'] = ' align="left"'; + $var['column_header'] = $this->bo->borkb($usedspace); + $p->set_var($var); + $p->parse('col_headers','column_headers_normal',True); + + if($this_homedir) + { + $var['td_extras'] = ' align="right"'; + $var['column_header'] = ''.lang('Unused space').':'; + $p->set_var($var); + $p->parse('col_headers','column_headers_normal',True); + + $var['td_extras'] = ' align="left"'; + $var['column_header'] = $this->bo->borkb($this->bo->userinfo['hdspace'] - $usedspace); + $p->set_var($var); + $p->parse('col_headers','column_headers_normal',True); + } + + $p->parse('list','column_rows',True); + $p->set_var('col_headers',''); + + if($this_homedir) + { + $var['td_extras'] = ' colspan="'.($info_columns / 2).'" align="right" width="50%"'; + $var['column_header'] = ''.lang('Total Files').':'; + $p->set_var($var); + $p->parse('col_headers','column_headers_normal',False); + + $var['td_extras'] = ' colspan="'.($info_columns / 2).'" align="left" width="50%"'; + $var['column_header'] = count($this->bo->vfs->ls($this->bo->path,Array(RELATIVE_NONE))); + $p->set_var($var); + $p->parse('col_headers','column_headers_normal',True); + + $p->parse('list','column_rows',True); + $p->set_var('col_headers',''); + } + return $p->fp('output','table'); + } + + function display_uploads() + { + + $p = CreateObject('phpgwapi.Template',$this->template_dir); + $p->set_file( + Array( + '_uploads' => 'small_table.tpl' + ) + ); + $p->set_block('_uploads','table','table'); + $p->set_block('_uploads','column_headers','column_headers'); + $p->set_block('_uploads','column_headers_normal','column_headers_normal'); + $p->set_block('_uploads','column_rows','column_rows'); + + $var = Array( + 'table_extras' => ' cols="3"', + 'tr_extras' => '' + ); + + $var['td_extras'] = ' align="right" width="45%"'; + $var['column_header'] = ''.lang('File').''.$this->build_help('upload_file'); + $p->set_var($var); + $p->parse('col_headers','column_headers_normal',False); + + $var['td_extras'] = ' align="center" width="10%"'; + $var['column_header'] = ' '; + $p->set_var($var); + $p->parse('col_headers','column_headers_normal',True); + + $var['td_extras'] = ' align="left" width="45%"'; + $var['column_header'] = ''.lang('Comment').''.$this->build_help('upload_comment'); + $p->set_var($var); + $p->parse('col_headers','column_headers_normal',True); + + $p->parse('list','column_rows',True); + + $input_file = ''; + $input_comment = ''; + + $var['tr_extras'] = ''; + $var['td_extras'] = ' colspan="3" align="center"'; + $var['column_header'] = ''."\n".$input_file.$input_comment; + $p->set_var($var); + $p->parse('col_headers','column_headers_normal',False); + $p->parse('list','column_rows',True); + + for($i=1;$i<$this->bo->show_upload_boxes;$i++) + { + $var['column_header'] = $input_file.$input_comment; + $p->set_var($var); + $p->parse('col_headers','column_headers_normal',False); + $p->parse('list','column_rows',True); + } + + $var['column_header'] = ''.$this->build_help('upload_files'); + $p->set_var($var); + $p->parse('col_headers','column_headers_normal',False); + $p->parse('list','column_rows',True); + + $var['column_header'] = lang('Show').'  '.$this->build_upload_choices(5).$this->build_upload_choices(10).$this->build_upload_choices(20).$this->build_upload_choices(30).lang('upload fields').$this->build_help('show_upload_fields'); + $p->set_var($var); + $p->parse('col_headers','column_headers_normal',False); + $p->parse('list','column_rows',True); + + return '
'."\n".$p->fp('output','table').'
'."\n"; + } + function index() { $files_array = $this->bo->load_files(); @@ -230,14 +623,21 @@ ); $p->set_block('_index','index','index'); $p->set_block('_index','column_headers','column_headers'); + $p->set_block('_index','column_headers_normal','column_headers_normal'); $p->set_block('_index','column_rows','column_rows'); - $tr = $this->nextmatchs->alternate_row_color($tr); - $p->set_var('tr_extras',' bgcolor="'.$tr.'" border="0"'); + $GLOBLAS['tr_color'] = $GLOBALS['phpgw_info']['theme']['row_off']; + $p->set_var('tr_extras',' bgcolor="'.$this->nextmatchs->alternate_row_color().'" border="0"'); $var = Array( + 'form_action' => $GLOBALS['phpgw']->link('/index.php', + Array( + 'menuaction' => $this->bo->appname.'.ui'.$this->bo->appname.'.action', + 'path' => urlencode($this->bo->path) + ) + ), 'img_up' => $this->link(Array( 'menuaction' => $this->bo->appname.'.ui'.$this->bo->appname.'.index', - 'path' => $this->bo->lesspath + 'path' => urlencode($this->bo->lesspath) ), $this->image('folder_up.gif',lang('Up'))), 'help_up' => $this->build_help('up'), @@ -263,8 +663,7 @@ $columns++; } } - $tr = $this->nextmatchs->alternate_row_color($tr); - $p->set_var('tr_extras',' bgcolor="'.$tr.'" border="0"'); + $p->set_var('tr_extras',' bgcolor="'.$this->nextmatchs->alternate_row_color().'" border="0"'); $p->parse('col_row','column_rows',True); $p->set_var('colspan',$columns); @@ -315,12 +714,12 @@ $p->set_var($var); $p->parse('col_headers','column_headers',True); } - $tr = $this->nextmatchs->alternate_row_color($tr); - $p->set_var('tr_extras',' bgcolor="'.$tr.'" border="0"'); + $p->set_var('tr_extras',' bgcolor="'.$this->nextmatchs->alternate_row_color().'" border="0"'); $p->parse('col_row','column_rows',True); $p->set_var('col_headers',''); } + $usedspace = 0; reset($files_array); $numoffiles = count($files_array); for($i=0;$i!=$numoffiles;$i++) @@ -333,6 +732,8 @@ $p->set_var($var); $p->parse('col_headers','column_headers'); + $usedspace += $files['size']; + reset($this->bo->file_attributes); while(list($internal,$displayed) = each($this->bo->file_attributes)) { @@ -360,21 +761,24 @@ $var['column_header'] = $this->link( Array( 'menuaction' => $this->bo->appname.'.ui'.$this->bo->appname.'.view', -// 'op' => 'view', 'path' => urlencode($this->bo->path), 'file' => urlencode($files['name']) ), ''.$files['name'].'' ); -// $var['column_header'] = ''.$files['name'].''; break; } break; + case 'deletable': + if ($files['deleteable'] == 'N') + { + $var['column_header'] = $this->image('locked.gif','locked'); + } + else + { + $var['column_header'] = ' '; + } + break; case 'size': $var['column_header'] = $this->bo->borkb($files['size']); $var['td_extras'] = ' align="right"'; @@ -427,12 +831,14 @@ $p->parse('col_headers','column_headers',True); } } - $tr = $this->nextmatchs->alternate_row_color($tr); - $p->set_var('tr_extras',' bgcolor="'.$tr.'" border="0"'); + $p->set_var('tr_extras',' bgcolor="'.$this->nextmatchs->alternate_row_color().'" border="0"'); $p->parse('col_row','column_rows',True); $p->set_var('col_headers',''); } - + + $p->set_var('buttons',$this->display_buttons()); + $p->set_var('info',$this->display_summary_info($numoffiles,$usedspace)); + $p->set_var('uploads',$this->display_uploads()); $p->pfp('output','index'); } @@ -440,7 +846,6 @@ function view() { - if($this->bo->vfs->file_exists($this->bo->path.'/'.$this->bo->file,Array(RELATIVE_NONE))) { $content_type = $this->bo->vfs->file_type($this->bo->path.$this->bo->dispsep.$this->bo->file,Array(RELATIVE_NONE)); @@ -501,6 +906,104 @@ } } + function history() + { + $file = $this->bo->path.$this->bo->dispsep.$this->bo->file; + if($this->bo->vfs->file_exists($file,Array(RELATIVE_NONE))) + { + $col_headers = Array( + 'Date' => 'created', + 'Version' => 'version', + 'Action Performed by' => 'owner_id', + 'Operation' => 'comment' + ); + $p = CreateObject('phpgwapi.Template',$this->template_dir); + $p->set_unknowns('remove'); + + $p->set_file( + Array( + '_history' => 'history.tpl' + ) + ); + $p->set_block('_history','history','history'); + $p->set_block('_history','column_headers','column_headers'); + $p->set_block('_history','column_rows','column_rows'); + + $var = Array( + 'path' => $this->link( + Array( + 'menuaction' => $this->bo->appname.'.ui'.$this->bo->appname.'.index', + 'path' => urlencode($this->bo->path) + ), + $this->bo->path + ), + 'filename' => $this->link( + Array( + 'menuaction' => $this->bo->appname.'.ui'.$this->bo->appname.'.view', + 'path' => urlencode($this->bo->path), + 'file' => urlencode($this->bo->file) + ), + $this->bo->file + ) + ); + $p->set_var($var); + + $GLOBALS['tr_color'] = $GLOBALS['phpgw_info']['theme']['row_off']; + $var = Array( + 'td_extras' => '' + ); + @reset($col_headers); + while(list($label,$field)= each($col_headers)) + { + $var['column_header'] = ''.$label.''; + $p->set_var($var); + $p->parse('col_headers','column_headers',True); + } + $p->set_var('tr_extras',' bgcolor="'.$this->nextmatchs->alternate_row_color().'" border="0"'); + $p->parse('col_row','column_rows',True); + $p->set_var('col_headers',''); + + $journal_array = $this->bo->vfs->get_journal($file,Array(RELATIVE_NONE)); + while(list($num,$journal_entry) = each($journal_array)) + { + @reset($col_headers); + while(list($label,$field)= each($col_headers)) + { + switch($field) + { + case 'owner_id': + $var['column_header'] = ''.$GLOBALS['phpgw']->accounts->id2name($journal_entry[$field]).''; + break; + case 'created': + if($journal_entry[$field] && $journal_entry[$field] != '0000-00-00') + { + $year = substr($journal_entry[$field],0,4); + $month = substr($journal_entry[$field],5,2); + $day = substr($journal_entry[$field],8,2); + $datetime = mktime(0,0,0,$month,$day,$year); + $var['column_header'] = ''.date($GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'],$datetime).''; + } + else + { + $var['column_header'] = ' '; + } + break; + default: + $var['column_header'] = ''.$journal_entry[$field].''; + break; + } + $p->set_var($var); + $p->parse('col_headers','column_headers',True); + } + $p->set_var('tr_extras',' bgcolor="'.$this->nextmatchs->alternate_row_color().'" border="0"'); + $p->parse('col_row','column_rows',True); + $p->set_var('col_headers',''); + } + + $p->pfp('output','history'); + } + } + function view_file() { $file = $this->bo->path.$this->bo->dispsep.$this->bo->file; diff --git a/filemanager/index.php b/filemanager/index.php index 979bfa79ed..662138f41d 100755 --- a/filemanager/index.php +++ b/filemanager/index.php @@ -1206,7 +1206,7 @@ if ($edit) { $fileman[$j]; - $content = $$fileman[$j]; + $content = $fileman[$j]; echo 'fileman['.$j.']: '.$fileman[$j].'
'.$content.'
'; continue; diff --git a/filemanager/templates/default/history.tpl b/filemanager/templates/default/history.tpl new file mode 100755 index 0000000000..9a8e975dd0 --- /dev/null +++ b/filemanager/templates/default/history.tpl @@ -0,0 +1,29 @@ + + + + + + {col_row} +
+ + + + + +
+ Path: {path} + + Filename: {filename} +
+ +
+ + + + {col_headers} + + + + {column_header} + + diff --git a/filemanager/templates/default/index.tpl b/filemanager/templates/default/index.tpl index 2edd7b40a4..172c59b119 100755 --- a/filemanager/templates/default/index.tpl +++ b/filemanager/templates/default/index.tpl @@ -2,6 +2,7 @@ - - {col_row} + {col_row} + + + + + +
+
@@ -17,24 +18,31 @@
- - - {buttons} -
+ {buttons} + +
{info} +
{uploads}
- - {col_headers} + {col_headers} - {column_header} + {column_header} + + {column_header} +