public inbox for gnats-devel@sourceware.org
 help / color / mirror / Atom feed
* faking an append-only field
@ 2002-08-01 12:33 Mike Hoolehan
  2002-08-01 14:07 ` Dirk Bergstrom
  0 siblings, 1 reply; 3+ messages in thread
From: Mike Hoolehan @ 2002-08-01 12:33 UTC (permalink / raw)
  To: Help-gnats

With the gnats 4 beta, I'm attempting to mimic the audit trail behavior I'm
used to in bugzilla (basically an append-only field).  Here's my attempt,
that works mostly:


field "Add-To-Audit-Trail" {
    description "Add a log entry to Audit Trail"
    multitext
    on-change {
        add-audit-trail
        audit-trail-format {
        format "--------- Comments by %s on %s ---------\n %s\n\n"
        fields { "$EditUserEmailAddr" "$CurrentDate" "$NewValue" }
        }
    }   
    on-change { 
        set-field "Add-To-Audit-Trail" { "\n" }
    }
}   
    
Then I just made the original Audit-Trail field 'read-only'.   

This strategy works correctly except after the PR has just been created 
and the PR is edited the first time.  Even if the user doesn't change the 
"Add-To-Audit-Trail" field on the gnatsweb interface, the on-change 
stuff is being run (It inserts the "Comments by" line with no $NewValue
showing up).  I've experimented with conditional 'on-change' using
regexes, but nothing seemed to help.  

So the specific question is:  How do I prevent the on-change stuff for this
field from being run the first time a PR is edited?  But if you have any
better ideas on how to implement what I want, I'll take those too.

This may just be an artifact of gnatsweb, in which case I'm sorry for
posting to the wrong list.

Thanks,
Mike 

_______________________________________________
Help-gnats mailing list
Help-gnats@gnu.org
http://mail.gnu.org/mailman/listinfo/help-gnats

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: faking an append-only field
  2002-08-01 12:33 faking an append-only field Mike Hoolehan
@ 2002-08-01 14:07 ` Dirk Bergstrom
  2002-08-04  4:01   ` Mike Hoolehan
  0 siblings, 1 reply; 3+ messages in thread
From: Dirk Bergstrom @ 2002-08-01 14:07 UTC (permalink / raw)
  To: Mike Hoolehan; +Cc: Help-gnats

On 8/1/2002 11:27 AM, Mike Hoolehan expounded at length upon:
> With the gnats 4 beta, I'm attempting to mimic the audit trail behavior I'm
> used to in bugzilla (basically an append-only field).  Here's my attempt,
> that works mostly:
> field "Add-To-Audit-Trail" {
[snip]
> }   
> Then I just made the original Audit-Trail field 'read-only'.   

man, that's pretty slick!

> This strategy works correctly except after the PR has just been created 
> and the PR is edited the first time.  Even if the user doesn't change the 
> "Add-To-Audit-Trail" field on the gnatsweb interface, the on-change 
> stuff is being run.  I've experimented with conditional 'on-change' using
> regexes, but nothing seemed to help.  

i'm pretty sure that the problem arises because add-to-audit-trail is
not actually in the PR after it's created (ie. it's not an initial-entry
field).  this means that after the first edit, the value in the field
has "changed", because it's gone from the empty string to a single
newline (or something like that).

you might be able to fix this by setting a default value of " " for the
field, or whatever value gnatsweb seems to be sticking in there.  adding
it to the initial-entry list might also solve the problem, but that's an
ugly fix.

hope this helps.

-- 
Dirk Bergstrom                   dirk@juniper.net
Computer Geek                     v: 707.433.0564
Juniper Networks Inc.             f: 707.433.0769

"it *looks* like a nail; lemme grab my hammer..."


_______________________________________________
Help-gnats mailing list
Help-gnats@gnu.org
http://mail.gnu.org/mailman/listinfo/help-gnats

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: faking an append-only field
  2002-08-01 14:07 ` Dirk Bergstrom
@ 2002-08-04  4:01   ` Mike Hoolehan
  0 siblings, 0 replies; 3+ messages in thread
From: Mike Hoolehan @ 2002-08-04  4:01 UTC (permalink / raw)
  To: Dirk Bergstrom; +Cc: Help-gnats

Perfect!  Thanks, that was a good idea.  For anyone else interested then,
the following changes to a dbconfig file will make a nice bugzilla-ish 
appending audit trail.

First, set the Audit-Trail field to read-only.  Then add this:

field "Add-To-Audit-Trail" {
   description "Add a log entry to Audit Trail"
   multitext { default "\n" }
   on-change  {
        add-audit-trail
        audit-trail-format {
        format "---- Comments by %s on %s ----\n %s\n\n" #whatever you like
        fields { "$EditUserEmailAddr" "$CurrentDate" "$NewValue" }
        }
    }
    on-change {
        set-field "Add-To-Audit-Trail" { "\n" }
    }
}

Mike


On (01/08/02 11:54), Dirk Bergstrom wrote:
> On 8/1/2002 11:27 AM, Mike Hoolehan expounded at length upon:
> > With the gnats 4 beta, I'm attempting to mimic the audit trail behavior I'm
> > used to in bugzilla (basically an append-only field).  Here's my attempt,
> > that works mostly:
> > field "Add-To-Audit-Trail" {
> [snip]
> > }   
> > Then I just made the original Audit-Trail field 'read-only'.   
> 
> man, that's pretty slick!
> 
> > This strategy works correctly except after the PR has just been created 
> > and the PR is edited the first time.  Even if the user doesn't change the 
> > "Add-To-Audit-Trail" field on the gnatsweb interface, the on-change 
> > stuff is being run.  I've experimented with conditional 'on-change' using
> > regexes, but nothing seemed to help.  
> 
> i'm pretty sure that the problem arises because add-to-audit-trail is
> not actually in the PR after it's created (ie. it's not an initial-entry
> field).  this means that after the first edit, the value in the field
> has "changed", because it's gone from the empty string to a single
> newline (or something like that).
> 
> you might be able to fix this by setting a default value of " " for the
> field, or whatever value gnatsweb seems to be sticking in there.  adding
> it to the initial-entry list might also solve the problem, but that's an
> ugly fix.
> 
> hope this helps.
> 
> -- 
> Dirk Bergstrom                   dirk@juniper.net
> Computer Geek                     v: 707.433.0564
> Juniper Networks Inc.             f: 707.433.0769
> 
> "it *looks* like a nail; lemme grab my hammer..."
> 
> 
> _______________________________________________
> Help-gnats mailing list
> Help-gnats@gnu.org
> http://mail.gnu.org/mailman/listinfo/help-gnats

_______________________________________________
Help-gnats mailing list
Help-gnats@gnu.org
http://mail.gnu.org/mailman/listinfo/help-gnats

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2002-08-01 19:33 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-08-01 12:33 faking an append-only field Mike Hoolehan
2002-08-01 14:07 ` Dirk Bergstrom
2002-08-04  4:01   ` Mike Hoolehan

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).