This is version . It is not the current version, and thus it cannot be edited.
[Back to current version]   [Restore this version]

Moved from Ideas.

7.05.2003 - Free Set of metadata for Attachments MichiEmde#

Wouldn't it be a good idea, if some more metadata for attachments (e.g. comments, data origin, keywords...) are available? (Or am I the only one who needs this??)

We need it desperatly!
Also, it would be great if there was some way to define mime-types for attachments, so they would open in the default app.
- YishayMor
The mime type should be set by the servlet container - JSPWiki should not touch it. We use the standard servlet API for determining a MIME type. --JanneJalkanen

Not hard-coded of course, I suggest a free selectable set of metadata.

So everybody who wants to use this feature only has to insert a few lines (input tags) in UploadTemplate.jsp:

For example right after the "<form action="attach" [...]" could be added some fields like these:

<b>Metadata for uploaded file:</b>
     <div class="attachments" align="center">
       myFieldName1: <input type="text"   name="data1" size="30" />
                     <input type="hidden" name="nameofdata1" value="myFieldName1" /><br />
       myFieldName2: <input type="text"   name="data2" size="30" />
                     <input type="hidden" name="nameofdata2" value="myFieldName2" /><br />
     [...]
     </div>
   <hr />

I suggest only two simple conventions:

  1. Names of the input tags are hard-coded as e.g. data1, data2, ..., datan
  2. Their real names are defined in hidden fields as e.g. nameofdata1, nameofdata2, ..., nameofdatan

Finally the resulted key value pairs (value of 'nameofdatan' as key, value of 'datan' as value) should be displayed in that version table (PageInfo "Page revision history")

The metadata can be stored in the already existing attachment.properties file in the attachments-dir. Same way as now author names are saved: version_no.key=value

I think this feature would be very useful with lots of applications... (at least in mine :))

-- This is exactly the type of stuff that I want to support with XmlStorage and and XmlPageProvider. Once you add metadat, you need to able to manage them ....-- PhilippeO

XML has nothing to do with this. The current CVS branch already supports free-form metadata for both pages and attachments, but none of the PageProviders do, yet. The original idea was to put all the relevant metadata on the WikiPage itself, anyway, and let the WikiAttachments just be, well, attachments.

-- JanneJalkanen

-- I don't think that metadata should be written on the pages themself. Metadata are only usefull, if they have a more or less unchangeable set of terms (keys). What's the problem with that simple implementation I suggested or with any other free-form for metadata? I mean, nobody needs to use it!
--MichiEmde

Well, you are just suggesting a free-form metadata but are saying that it is only useful if the names have been fixed... Unfortunately, building a set of keys that is useful to most people is not easy. And I do not wish to add any code complexity over features that are only needed by a few people. For those occasions, I would recommend that people would branch their own version of JSPWiki.

-- JanneJalkanen

I am not quite sure, if I made it clear enough...
You will agree that metadata are only usefull, if they are fixed (Otherwise no way to compare entries...). That means the admins of one single JSPWiki installation must be enabled to define a set of metadata. Just the way we all adapt the templates however we want to (layout and other stuff). But only in this single installation metadata are fixed. Nobody needs to define metadata in his installation, but can, if he wants to!

Of course, I can make my own branch of JSPWiki. And that's exactly what I did: I added a ~Metadata.jsp and a MetadataBean.class. And metadata will be written now in a File named metadata.properties within the myPage-att/myAttach-dir using your properties convention (version_no.key=value).
But I will get in trouble, whenever JSPWiki will change these conventions in future, and that's what I wanted to prevent!
So I thought it was a better idea to provide some kind of metadata support in general...

--MichiEmde

This should actually be fully compatible with future JSPWiki development; at least I can't see any reason why it should break. In the current CVS version, you should be able to use Attachment.getAttribute()/setAttribute() to store your metadata, which your provider can then store and load at will. It is then up to the template to allow editing/showing of this metadata.

--Janne Jalkanen, 27-May-2003

Thanks for help and advice. But I can't find the mentioned getter and setter methods in Attachment. I tried different versions, even the very latest: It's always a file from 2003-03-02. Gimme some more advice, please...

--MichiEmde, 28-May-2003


Add new attachment

Only authorized users are allowed to upload new attachments.

List of attachments

Kind Attachment Name Size Version Date Modified Author Change note
txt
r.txt 1.0 kB 1 15-May-2006 11:43 203.99.213.11
« This particular version was published on 28-May-2003 11:08 by MichiEmde.