Tada:
http://trac-hacks.org/wiki/AttachmentNumMacro

Don't forget to set up the default settings in the trac.ini file.

Martin

On Nov 12, 10:55 am, wackazong <[EMAIL PROTECTED]> wrote:
> Hi there,
>
> this sounds like what I was phantasizing about.
>
> A macro of the form [[Attachment(1)]] would be perfect for me. I use
> the ticket system also to manage the datasheets of my hardware parts I
> use in this project of mine. Each ticket is a part with a
> corresponding datasheet. There is only one datasheet per part, and
> therefore something like [[Attachment(1)]] would be perfect. I created
> a custom text field named pdf, which accepts WikiFormatting according
> to patch #1791. Then I would just need to put the macro in this field,
> and could then directly access the attachment from a report. So far, I
> am doing it with [[raw-attachment:nameofdatasheet.pdf]]. Works, but I
> have to enter the right filename everytime. If anybody cares to
> implement something like this (I do not think I could do it in a
> reasonable amount of time), the link has to go via the "raw-
> attachment" TracLink, otherwise it will not take you to the pdf
> directly. Ah, and "render unsafe content" or whatever it is called in
> the trac.ini file has to be enabled.
>
> Best, ALEXander.
>
> On 12 Nov., 11:41, "Martin S." <[EMAIL PROTECTED]> wrote:
>
> > You could just link to the not-yet existing attachment when creating
> > the ticket and then attach it.
>
> > But ff your really want to do it like you said, I would need to code a
> > link formatter plug-in. IMHO a macro ala
> > [[Attachment(1)]] would be easier here.
>
> > Do you want to always link to the first (or n-th) attachment even if
> > it changes, i.e. the original one gets deleted and the second one
> > becomes the first one, or a new one is attached, or should it only
> > link to the original one and become dangling if that attachment gets
> > deleted?
> > In the second case a macro must substitute itself by changing the Trac
> > DB entry of the wiki or ticket. This would then really be a "dirty
> > hack".
>
> > Martin
>
> > On Nov 11, 11:12 am, wackazong <[EMAIL PROTECTED]> wrote:
>
> > > Hi!
>
> > > I would like to know whether it would be possible to do the following:
>
> > > 1) Create a ticket
> > > 2) Attach a file with the name "somedatasheet.pdf"
> > > 3) In the description of the ticket, use Wiki Code like this
>
> > > [[raw-attachment:$FIRSTATTACHMENTNAME]]
>
> > > Where $FIRSTATTACHMENTNAME is then automatically replaced with the
> > > filename of the first attachment, so that when I look at the
> > > description after rendering, I get a link that takes me to the file.
>
> > > Would be great! But I can imagine that it requires some python. Dirty
> > > hacks welcome! :)
>
> > > ALEXander.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Trac 
Users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/trac-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to