rejetto forum

Software => HFS ~ HTTP File Server => Bug reports => Topic started by: nodosur on August 26, 2009, 01:34:21 AM

Title: File Listing
Post by: nodosur on August 26, 2009, 01:34:21 AM
 ::)
Please adjust file list
goes all on one line
should do well ordered in the column
missing newline at the end of each line

*****************************************************
so goes:

File List of: http://nodosur.sytes.net/modelos/

File Date      File Size       Hits       Location
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
03/05/2009 17:46:40                 /modelos/DEMOS/04/10/2008 17:20:40     11,46 KB         8      /modelos/democ.html09/10/2008 12:48:38     24,35 KB         11      /modelos/demof.html09/10/2008 12:47:44     16,47 KB         5      /modelos/demoh.html09/10/2008 12:48:12     12,38 KB         6      /modelos/demot.html09/05/2009 18:50:58     24,75 KB         14      /modelos/demow.html- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
5 File(s)
1 Folder(s)
89,40 KB







************************************************
and should go well:

File List of: http://nodosur.sytes.net/modelos/

File Date      File Size       Hits       Location
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
03/05/2009 17:46:40                 /modelos/DEMOS/
04/10/2008 17:20:40     11,46 KB         8      /modelos/democ.html
09/10/2008 12:48:38     24,35 KB         11      /modelos/demof.html
09/10/2008 12:47:44     16,47 KB         5      /modelos/demoh.html
09/10/2008 12:48:12     12,38 KB         6      /modelos/demot.html
09/05/2009 18:50:58     24,75 KB         14      /modelos/demow.html
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
5 File(s)
1 Folder(s)
89,40 KB



**************************************

thanks 1000
Title: Re: File Listing
Post by: bacter on August 26, 2009, 06:13:11 AM
Add a <br /> in your filelist.tpl in the [file] (and [folder]) section after the last element %item-name%

-->
[file]
%item-modified%     %item-size%         %item-dl-count%      %item-folder%%item-name%<br />
Title: Re: File Listing
Post by: rejetto on August 26, 2009, 02:33:56 PM
another (untested) solution may be to put {.mime|text/plain.} on top of it
Title: Re: File Listing
Post by: nodosur on August 27, 2009, 01:45:05 AM
sorry ....   insert the two codes indicate but the result is equal
Title: Re: File Listing
Post by: rejetto on August 27, 2009, 04:04:59 PM
post the template you are using for the file list
Title: Re: File Listing
Post by: nodosur on August 27, 2009, 04:12:45 PM
it is the file filelist.tpl with add-ons indicated

--------------------------------------------------------

{.mime|text/plain.}
%files%
[files]
File List of: http://%host%%folder%

File Date      File Size       Hits       Location
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
%list%- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
%number-files% File(s)
%number-folders% Folder(s)
%total-size%
[file]
%item-modified%     %item-size%         %item-dl-count%      %item-folder%%item-name%<br />
[folder]
%item-modified%                 %item-folder%%item-name%/<br />
Title: Re: File Listing
Post by: nodosur on August 27, 2009, 09:20:32 PM
UPSssssss

change the contents of the indicated listing.tpl but now the list of files appears empty
Title: Re: File Listing
Post by: nodosur on August 27, 2009, 11:02:01 PM
thanks....

re-edit the filelist.tpl with notepad
was tabulated and included some running
Title: little lesson about macros : Re File Listing
Post by: Mars on August 27, 2009, 11:06:12 PM
forget my previous post and use the attached filelist.tpl , before making change , make a copy of the file.

it is not possible here to use some html code to obtain a plain/text, but it is possible by using hfs macros as :

Quote
{.mime|text/plain.}
%files%

[files]
File List of: http://%host%%folder%

File Date{.repeat|13|{: :}.}File Size{.repeat|4|{: :}.}Hits{.repeat|3|{: :}.}Location
{.repeat|60|{:- :}.}
%list%{.repeat|60|- .}
%number-files% File(s)
%number-folders% Folder(s)
%total-size%


[file]
%item-modified%{.repeat|3|{: :}.}%item-size%{.repeat|{.sub|13|{.length|%item-size%.}.}|{: :}.}%item-dl-count%{.repeat|{.sub|7|{.length|%item-dl-count%.}.}|{: :}.}%item-folder%%item-name%

[folder]
%item-modified%{.repeat|3|{: :}.}{.repeat|9|{:-:}.}{.repeat|4|{: :}.}{.repeat|4|{:-:}.}{.repeat|3|{: :}.}%item-folder%%item-name%/

[last line of filelist.tpl, do not remove]
made in Mars ;)

This little tpl will look can be to think about the addicts of the javascript, here it is that of the pure text with the resources of hfs
Title: Re: File Listing
Post by: nodosur on August 28, 2009, 01:02:35 AM
thanks
Title: Re: File Listing
Post by: waskol on October 27, 2009, 10:02:28 AM
Yes, I confirm, you have to add a blank line  ;)

Code: [Select]
%files%
[files]
%folder%
%number-folders%
%number-files%
%list%
[file]
%item-name%

[folder]
%item-name%/

(note the two blank lines)

Attached is the tpl file I use

Note : this tpl file permits a distant webserver to "ask" for a Directory listing (from a php code for instance) :
Code: [Select]
<?php
$httpServer 
"http://WWW.XXX.YYY.ZZZ/RootFolder/"//HFS server address + root folder to "view"
$dir_icon='<img style="border: none;vertical-align: middle;" src="'.CHEMIN.'inc/img/general/dir.gif" alt=" " />';
$up_icon='<img style="border: none;vertical-align: middle;" src="./img/top.gif" alt=" " />';
$file_icons='<img style="border: none;vertical-align: middle;" src="./img/{FileType}.gif" alt=" " />';
$excel_img="excel";
$word_img="word";
$zip_img="zip";
$pdf_img="acrobat";
$txt_img="text";
$uknw_im="unknown";
set_time_limit(160);

function 
MessageErreur($message){
    echo 
"Error, blabla, Thank you !";
}

$workingDir $httpServer;
$dossier_agent='';
$path="./";
if (isset(
$_GET['to']) && $_GET['to'] != '') {
$AFolder=stripslashes(urldecode($_GET['to'])); 
$path=$workingDir.rawurlencode($_GET['to']).'/';
echo "<b>Dossier de : </b>".ucwords(strtolower($AFolder)).'<hr />';  
$lines=array();
$lines=file($path.'~files.lst');            
$cfolder=$lines[0];
$n_folders=$lines[1];
$n_files=$lines[2];
$flist=array();
if($n_files!=0) {
$flist=array_slice($lines3+$n_folders);
sort($flist);
foreach($flist as $fname){   
$ext substr($fnamestrrpos($fname'.') + 1);
if ($ext=="xls"){$FileType="excel";}
elseif ($ext=="doc"){$FileType="word";}
elseif ($ext=="zip"){$FileType="zip";}
elseif ($ext=="pdf"){$FileType="acrobat";}
elseif ($ext=="txt"){$FileType="text";}
else{$FileType="unknown";}
$in = array ('{FileType}');
$out = array ($FileType);
$img str_replace ($in$out$file_icons);
echo '<a href="'.$httpServer.$AFolder.'/'.basename($fname).'" target="_blank">'.$img.' '.ucwords(strtolower(basename($fname))).'</a><br />';
}
}
else {
echo "Folder empty !";
}
echo '<br /><center><div style="text-align: center;"><button onclick="self.location.href=\'javascript:history.go(-1)\'" type="button">Back to folder list</button></div></center>';

}
else {
echo "<b>List of folders :</b><hr />\n";
$nav="";
for ($i="A"$i != "AA"$i++){
$nav.='  <a href="#letter'.$i.'">'.$i.'</a>&nbsp;'."\n";
}
echo $nav.'<br />';                           
$oldfirst=" ";
$lines=file($workingDir.'~files.lst');
$cfolder=$lines[0];
$n_folders=$lines[1];
$n_files=$lines[2];
$flist=array();
if($n_folders!=0){
$flist=array_slice($lines3$n_folders);
for($i=0;$i<$n_folders;$i++){
$s=trim($flist[$i]);
$flist[$i]=substr($s,0,-1);
}

foreach($flist as $fname){
//$fname=substr(
$first $fname[0];
/* Alpha Separator */
if($first!=$oldfirst){
echo '<br /><b><span style="width: 100%; font-size: 18px;">';
echo '<a name="letter'.$first.'" href="#top" title="Back to Top of page">'.$up_icon.'</a>'.$first;
echo '</span></b><hr width="100" />'."\n";
}
$oldfirst=$first;
echo '<a href="pcu.php?to='.urlencode($fname).'">'.$dir_icon.' '.ucwords(strtolower($fname)).'</a><br />'."\n";
}
}
else {
echo "Empty Folder !";
}
}

?>