rejetto forum

Comments: name of user that uploads the file

luca69 · 24 · 4408

0 Members and 1 Guest are viewing this topic.

Offline luca69

  • Occasional poster
  • *
    • Posts: 95
    • View Profile
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.
Code: [Select]
{.if| %user% |{: {.append| %folder-resource%\hfs.comments.txt |{.filename|%item-resource%.}=uploaded by %user% /append.} :}/if.}

New code:
Code: [Select]
{.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?
« Last Edit: January 29, 2009, 09:01:15 AM by luca69 »
Life is what happens to you while you are busy making other plans


Offline rejetto

  • Administrator
  • Tireless poster
  • *****
    • Posts: 13304
    • View Profile

Offline Mars

  • Operator
  • Tireless poster
  • *****
    • Posts: 1995
    • View Profile
We also have the same problem with files .md5, how to kill all the files which carry a defined name and its associated files?


Offline luca69

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


Offline luca69

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


Offline rejetto

  • Administrator
  • Tireless poster
  • *****
    • Posts: 13304
    • View Profile
yes, it's a problem.
next build will delete F + F.md5 + F.comment


Offline Mars

  • Operator
  • Tireless poster
  • *****
    • Posts: 1995
    • View Profile
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 ;)


Offline rejetto

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


Offline luca69

  • Occasional poster
  • *
    • Posts: 95
    • View Profile
yes, it's a problem.
next build will delete F + F.md5 + F.comment


GREAT!!!Thanks a lot rejetto  ;D ;D
Life is what happens to you while you are busy making other plans


Offline rejetto

  • Administrator
  • Tireless poster
  • *****
    • Posts: 13304
    • View Profile
ok, it will also delete from hfs.comments.txt and descript.ion
it took an hour or two to make this -.-


Offline luca69

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


Offline luca69

  • Occasional poster
  • *
    • Posts: 95
    • View Profile
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):

Code: [Select]
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|&nbsp;.}
  <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 ?!?
Life is what happens to you while you are busy making other plans


Offline rejetto

  • Administrator
  • Tireless poster
  • *****
    • Posts: 13304
    • 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?


Offline Mars

  • Operator
  • Tireless poster
  • *****
    • Posts: 1995
    • View Profile
Quote
maybe that template is using modifications made by mars.

Thank you my friend to have a thought for me ;)

Quote
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



Offline rejetto

  • Administrator
  • Tireless poster
  • *****
    • Posts: 13304
    • View Profile
what's the point in using that symbols instead of {.$name.} ?