rejetto forum
Software => HFS ~ HTTP File Server => Topic started by: luca69 on January 29, 2009, 08:55:11 AM
-
The current template I'm using is generating a Multi-comment files hfs.comments.txt but this has some drawbacks:
- When a new file is uploaded, the hfs.comments.txt file is updated ;D
- When a file is deleted, the hfs.comments.txt is not update :(
--> the hfs.comments.txt grows forever :o
- Add again the same file, but without a user logged in
--> the hfs.comments.txt contains already an entry for this file and the wrong information is shown :'(
Possible solution: I changed the code in the [upload-success] section so that now a single-comment file is generated with the name of the user who uploaded the file.
Old code.
{.if| %user% |{: {.append| %folder-resource%\hfs.comments.txt |{.filename|%item-resource%.}=uploaded by %user% /append.} :}/if.}
New code:
{.if| %user% |{: {.append| %folder-resource%\{.filename|%item-resource%.}.comment |uploaded by %user% /append.} :}/if.}
This solves the first problem (hfs.comments.txt grows forever)
But now, to evaoid the second problem, I should add a function that when a file is deleted, the "single-comment file" is deleted as well.
Any idea how I can do that?
-
how is the file deleted?
-
We also have the same problem with files .md5, how to kill all the files which carry a defined name and its associated files?
-
how is the file deleted?
Using the delete files function of the HFS Web interface ;D
If a someone deletes the files directly on the server, he/she should also delete the comment file ;)
-
We also have the same problem with files .md5, how to kill all the files which carry a defined name and its associated files?
I noticed that looking for a solution of my problem :o
-
yes, it's a problem.
next build will delete F + F.md5 + F.comment
-
yes, it's a problem.
next build will delete F + F.md5 + F.comment
Do not forget to destroy also all the comments of the same file in hfs.comments
I recommend you for it, the systematic setting-up of the management reading writing of files .ini under Windows, it would facilitate the use of comments, and would in certain cases allow to read and to write in the hfs.ini with data personalized by the administrator without that the change of version hfs give certain problems ;)
-
I recommend you for it, the systematic setting-up of the management reading writing of files .ini under Windows,
i didn't understand this :-X
-
yes, it's a problem.
next build will delete F + F.md5 + F.comment
GREAT!!!Thanks a lot rejetto ;D ;D
-
ok, it will also delete from hfs.comments.txt and descript.ion
it took an hour or two to make this -.-
-
ok, it will also delete from hfs.comments.txt and descript.ion
it took an hour or two to make this -.-
:o :o :o :o :o :o
-
I found a nice template from one of our France friends that enables the user to add a comment to each uploaded file.
I think it's a nice (now with build 221 comments are better supported by HFS).
But the code is not working :(
It looks like he changed also the code of HFS and not only the template :o :o :o :o
But let's have a look at the code (you can find the complete template as Attachment):
Original:
[upload-file]
<input name='fileupload%idx%' size='70' type='file'>
{.if |{.and|%user%|{.!=|%user%|anonymous.}.}|
New:
[upload-file]
<input name='%file-upload%' size='70' type='file'>
{.if |{.and|%user%|{.!=|%user%|anonymous.}.}|
{:
{.repeat|2| .}
<input name="%comment-upload%" size=40 type=text>
:}/if.}<br / </a>
......
[upload-success]
Original:
<li><a href='%item-url%'>%item-name%</a>: <b>{.!OK.}</b> --- %item-size% ({.!Speed.} %speed% KB/s)
{.if| %user% |{: {.append| %folder-resource%\hfs.comments.txt | Uploaded by %user%
/append.} :}/if.}
New:
[upload-success]
<li><a href='%item-url%'>%item-name%</a>: <b>{.!OK.}</b> --- %item-size% ({.!Speed.} %speed% KB/s)
{.if| %user% |{: {.append| %folder-resource%\hfs.comments.txt |{.filename|%item-resource%.}={.convert|utf-8|ansi|%item-comment%.} Uploaded by %user%
/append.} :}/if.}
....
But the vars %item-comment% and %file-upload& do not exist ?!?!?
Anyhow is there a way to do the same with build 221 ?!?
-
maybe that template is using modifications made by mars.
in HFS you are supposed to not pass html inputs with such %names%, but with normal names, and read/use them by {.$name.}
what you want to get?
-
maybe that template is using modifications made by mars.
Thank you my friend to have a thought for me ;)
But the vars %item-comment% and %file-upload& do not exist ?!?!?
If it interests rejetto, I can supply all the elements necessary for their implementation in the next version of hfs
-
what's the point in using that symbols instead of {.$name.} ?
-
maybe that template is using modifications made by mars.
in HFS you are supposed to not pass html inputs with such %names%, but with normal names, and read/use them by {.$name.}
what you want to get?
I would like to add in the upload page an additional comment besides each upload field so that the user can enter a comment for each file uploaded.
But in the upload session I could get the file name (this is used to automatically generate the comment "Uploaded by %user%) but I don't know how to get the comment!
-
it took a while.
[special:begin]
{.comment| {.count|upload.} .}
[upload-file]
<input name='fileupload%idx%' size='50' type='file'> comment <input name='filecomment%idx%' size='50'><br>
[upload-success]
<li><a href='%item-url%'>%item-name%</a>: <b>{.!OK.}</b> --- %item-size% ({.!Speed.} %speed% KB/s)
{.set|t|{.postvar|filecomment{.count|upload.}.}.}
{.if| %user% | {: {.set|t| uploaded by %user%. {.^t.} .} :} /if.}
{.if| {.^t.} |{: {.append| %folder-resource%\hfs.comments.txt |{.filename|%item-resource%.}={.^t.}
/append.} :}/if.}
consider that you may already have a [special:begin] and in such case you should append the content, or otherwise it would overwrite your own.
-
-- EDIT: now it works !! But I have one questions:
I did not get the "special:begin" stuff ?!?!It looks like it is only a comment, but it has effects on the counter of uploads ?!?
-
it is actually undocumented yet.
it's just executed before the rest.
we needed it because the main part of the template is built after the list. this may change in the future.
-
it is actually undocumented yet.
it's just executed before the rest.
we needed it because the main part of the template is built after the list. this may change in the future.
:o :o :o :o
Please if you change it in future, remember this topic and manifest it in the release notes so that my template keep working with latest HFS version ;)
-
if i come to ever change it, [special:begin] will be supported for 1-2 years more ;)
-
Do not forget the accented characters.
For poor little "Frenchies" ;) that we are, by eg. :-\ ééé :'( ààà :D ùùù :o
It's better this way:
[special:begin]
{.comment| {.count|upload.} .}
[upload-file]
<input name='fileupload%idx%' size='50' type='file'> comment <input name='filecomment%idx%' size='50'><br>
[upload-success]
<li><a href='%item-url%'>%item-name%</a>: <b>{.!OK.}</b> --- %item-size% ({.!Speed.} %speed% KB/s)
{.set|t|{.postvar|filecomment{.count|upload.}.}.}
{.if| %user% | {: {.set|t| uploaded by %user%. {.^t.} .} :} /if.}
{.if| {.^t.} |{: {.append| %folder-resource%\hfs.comments.txt |{.filename|%item-resource%.}={.convert|utf-8|ansi|{.^t.}.}
/append.} :}/if.}
Edit:
I remember, now, that there are also accented characters in Italian language. ;)
-
mmm...yes...hfs is actually considering comment files as ansi, always. It has actually no way to know a file is utf-8, because most files lack of the "flag" (a header, actually).
a workaround is to keep comment file as utf-8, and change the template around %item-comment% (and maybe also %folder-comment%) with a {.convert|utf-8|ansi|%...%.}
more: i think we should slowly stop using hfs.comments.txt file format. it was introduced before the descript.ion, that is a de-facto standard, and it has some limits.
limit of descript.ion is that AFAIK it is ansi and not utf-8.
(of course HFS may decide to write utf-8 comments in it, but i don't know how other softwares would behave)
anyone knows about it?
-
Do not forget the accented characters.
For poor little "Frenchies" ;) that we are, by eg. :-\ ééé :'( ààà :D ùùù :o
It's better this way:
[special:begin]
{.comment| {.count|upload.} .}
[upload-file]
<input name='fileupload%idx%' size='50' type='file'> comment <input name='filecomment%idx%' size='50'><br>
[upload-success]
<li><a href='%item-url%'>%item-name%</a>: <b>{.!OK.}</b> --- %item-size% ({.!Speed.} %speed% KB/s)
{.set|t|{.postvar|filecomment{.count|upload.}.}.}
{.if| %user% | {: {.set|t| uploaded by %user%. {.^t.} .} :} /if.}
{.if| {.^t.} |{: {.append| %folder-resource%\hfs.comments.txt |{.filename|%item-resource%.}={.convert|utf-8|ansi|{.^t.}.}
/append.} :}/if.}
Edit:
I remember, now, that there are also accented characters in Italian language. ;)
Thanks for the info! I updated my code.