From 0775c5a6e7deb3907ee65223ec157affffa4eb07 Mon Sep 17 00:00:00 2001 From: pcanterino <> Date: Tue, 31 Mar 2009 17:25:11 +0000 Subject: [PATCH 1/1] Added new template {IF} block ("even") for allowing to change color of the table rows in directory listing for every row with an even number. This allows a better distinction of the rows. --- modules/Command.pm | 13 ++++++++++++- templates/dirlist_dir.htm | 2 +- templates/dirlist_file.htm | 2 +- 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/modules/Command.pm b/modules/Command.pm index a35abd4..dbfea0b 100644 --- a/modules/Command.pm +++ b/modules/Command.pm @@ -6,7 +6,7 @@ package Command; # Execute Dev-Editor's commands # # Author: Patrick Canterino -# Last modified: 2009-03-30 +# Last modified: 2009-03-31 # use strict; @@ -108,6 +108,8 @@ sub exec_show($$) my $dirlist = ''; + my $count = 0; + my $filter1 = $data->{'cgi'}->param('filter') || '*'; # The real wildcard my $filter2 = ($filter1 && $filter1 ne '*') ? $filter1 : ''; # Wildcard for output @@ -116,6 +118,8 @@ sub exec_show($$) unless($virtual eq '/') { + $count++; + my @stat = stat($physical.'/..'); my $udtpl = new Template; @@ -135,6 +139,8 @@ sub exec_show($$) next if($config->{'hide_dot_files'} && substr($dir,0,1) eq '.'); next unless(dos_wildcard_match($filter1,$dir)); + $count++; + my $phys_path = $physical.'/'.$dir; my $virt_path = multi_string($virtual.$dir.'/'); @@ -152,6 +158,7 @@ sub exec_show($$) $dtpl->parse_if_block('forbidden',is_forbidden_file($config->{'forbidden'},$virt_path->{'normal'})); $dtpl->parse_if_block('readable',-r $phys_path && -x $phys_path); $dtpl->parse_if_block('users',$users && -o $phys_path); + $dtpl->parse_if_block('even',($count % 2) == 0); $dirlist .= $dtpl->get_template; } @@ -163,6 +170,8 @@ sub exec_show($$) next if($config->{'hide_dot_files'} && substr($file,0,1) eq '.'); next unless(dos_wildcard_match($filter1,$file)); + $count++; + my $phys_path = $physical.'/'.$file; my $virt_path = multi_string($virtual.$file); @@ -193,6 +202,8 @@ sub exec_show($$) $ftpl->parse_if_block('users',$users && -o $phys_path); + $ftpl->parse_if_block('even',($count % 2) == 0); + $dirlist .= $ftpl->get_template; } diff --git a/templates/dirlist_dir.htm b/templates/dirlist_dir.htm index 29ec634..04fec0b 100644 --- a/templates/dirlist_dir.htm +++ b/templates/dirlist_dir.htm @@ -1,4 +1,4 @@ - + [SUBDIR] {DATE}{IF gmt} (GMT){ENDIF} {IF !forbidden}{IF readable}{DIR_NAME}/{ELSE}{DIR_NAME}/{ENDIF}{ELSE}{DIR_NAME}/{ENDIF} diff --git a/templates/dirlist_file.htm b/templates/dirlist_file.htm index 9a535dd..febadab 100644 --- a/templates/dirlist_file.htm +++ b/templates/dirlist_file.htm @@ -1,4 +1,4 @@ - + {SIZE} {DATE}{IF gmt} (GMT){ENDIF} {IF forbidden}{FILE_NAME}{ELSE}{FILE_NAME}{ENDIF} -- 2.34.1