rejetto forum

Comments: name of user that uploads the file

luca69 · 24 · 4462

0 Members and 1 Guest are viewing this topic.

Offline luca69

  • Occasional poster
  • *
    • Posts: 95
    • View Profile
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!
Life is what happens to you while you are busy making other plans


Offline rejetto

  • Administrator
  • Tireless poster
  • *****
    • Posts: 13308
    • View Profile
it took a while.

Code: [Select]
[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.


Offline luca69

  • Occasional poster
  • *
    • Posts: 95
    • View Profile
 -- 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 ?!?
« Last Edit: February 13, 2009, 12:20:26 PM by luca69 »
Life is what happens to you while you are busy making other plans


Offline rejetto

  • Administrator
  • Tireless poster
  • *****
    • Posts: 13308
    • View Profile
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.


Offline luca69

  • Occasional poster
  • *
    • Posts: 95
    • View Profile
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  ;)
Life is what happens to you while you are busy making other plans


Offline rejetto

  • Administrator
  • Tireless poster
  • *****
    • Posts: 13308
    • View Profile
if i come to ever change it, [special:begin] will be supported for 1-2 years more ;)


Offline SilentPliz

  • Operator
  • Tireless poster
  • *****
    • Posts: 1297
  • ....... chut ! shh!
    • View Profile
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.  ;)
« Last Edit: February 14, 2009, 05:38:17 AM by SilentPliz »


Offline rejetto

  • Administrator
  • Tireless poster
  • *****
    • Posts: 13308
    • View Profile
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?
« Last Edit: February 15, 2009, 01:29:46 PM by rejetto »


Offline luca69

  • Occasional poster
  • *
    • Posts: 95
    • View Profile
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.
Life is what happens to you while you are busy making other plans