Changes to gnats/contrib/tkgnats/tkeditpr.tcl

Michael Richardson <[email protected]> Mon, 31 Mar 2003 21:48:39 -0500
Newsgroups gmane.comp.bug-tracking.gnats.patches
Message-ID <[email protected]>
Index: gnats/contrib/tkgnats/tkeditpr.tcl
diff -c gnats/contrib/tkgnats/tkeditpr.tcl:1.5 gnats/contrib/tkgnats/tkeditpr.tcl:1.6
*** gnats/contrib/tkgnats/tkeditpr.tcl:1.5	Wed Dec 18 23:17:54 2002
--- gnats/contrib/tkgnats/tkeditpr.tcl	Mon Mar 31 21:48:28 2003
***************
*** 165,170 ****
--- 165,171 ----
  proc real_file_report {} {
      global TkGnats Tkeditpr flds frm errorCode whyText
      flush_singletext $Tkeditpr(singletextflds)
+     flush_singletext $Tkeditpr(shorttextflds)
      flush_multitext
  
      #
***************
*** 174,180 ****
      headingMsg "Checking fields..." 0
  
      # Check mandatory fields for non-blank input
!     foreach f [concat $Tkeditpr(radioflds) $Tkeditpr(listboxflds) $Tkeditpr(singletextflds) $Tkeditpr(multitextflds)] {
          if {[check_suppressed_field $f]} {
              continue
          }
--- 175,181 ----
      headingMsg "Checking fields..." 0
  
      # Check mandatory fields for non-blank input
!     foreach f [concat $Tkeditpr(radioflds) $Tkeditpr(listboxflds) $Tkeditpr(singletextflds) $Tkeditpr(multitextflds) $Tkeditpr(shorttextflds)] {
          if {[check_suppressed_field $f]} {
              continue
          }
***************
*** 238,244 ****
          }
      }
  
!     foreach f $Tkeditpr(singletextflds) {
  	# Check that singletext text fields do not have a | char. (not allowed in gnats index)
          if {[string first "|" $frm($f)] >= 0} {
              Msg " '|' is an illegal character for the '[get_field_alias $f]' field!"
--- 239,245 ----
          }
      }
  
!     foreach f [concat $Tkeditpr(singletextflds) $Tkeditpr(shorttextflds)] {
  	# Check that singletext text fields do not have a | char. (not allowed in gnats index)
          if {[string first "|" $frm($f)] >= 0} {
              Msg " '|' is an illegal character for the '[get_field_alias $f]' field!"
***************
*** 334,340 ****
          # Send to the responsible person, original sender and the X-GNATS-Notify list
          merge_into_list mail_list $responsible_addr    $TkGnats(EmailAddr)
          merge_into_list mail_list $flds(Reply-To)      $TkGnats(EmailAddr)
!         merge_into_list mail_list $frm(X-GNATS-Notify) $TkGnats(EmailAddr)
          if {$frm(>Responsible) != $flds(>Responsible)} {
              # Mail to the old responsible person too
              merge_into_list mail_list $old_responsible_addr $TkGnats(EmailAddr)
--- 335,343 ----
          # Send to the responsible person, original sender and the X-GNATS-Notify list
          merge_into_list mail_list $responsible_addr    $TkGnats(EmailAddr)
          merge_into_list mail_list $flds(Reply-To)      $TkGnats(EmailAddr)
! 	if {[info exists $frm(X-GNATS-Notify)]} {
! 	    merge_into_list mail_list $frm(X-GNATS-Notify) $TkGnats(EmailAddr)
! 	}
          if {$frm(>Responsible) != $flds(>Responsible)} {
              # Mail to the old responsible person too
              merge_into_list mail_list $old_responsible_addr $TkGnats(EmailAddr)
***************
*** 427,437 ****
  #puts "prefix before:$flds($tag)"
              set lines [split $flds($tag) \n]
              set idx   [lsearch -regexp $lines "^X-GNATS-Notify:"]
!             set repto "X-GNATS-Notify: [lindex [split $frm(X-GNATS-Notify) ,] 0]"
!             foreach addr [lrange [split $frm(X-GNATS-Notify) ,] 1 end] {
!                 append repto ", [string trim $addr]"
!             }
!             set lines [lreplace $lines $idx [expr $idx + $flds(_prefix_len_X-GNATS-Notify) - 1] $repto\n]
              #set frm($tag) "[string trim [join $lines \n]]\n"
              set frm($tag) [join $lines \n]
  #puts "prefix after:$flds($tag)"
--- 430,443 ----
  #puts "prefix before:$flds($tag)"
              set lines [split $flds($tag) \n]
              set idx   [lsearch -regexp $lines "^X-GNATS-Notify:"]
! 	    
! 	    if {[info exists frm(X-GNATS-Notify)]} {
!                 set repto "X-GNATS-Notify: [lindex [split $frm(X-GNATS-Notify) ,] 0]"
! 		foreach addr [lrange [split $frm(X-GNATS-Notify) ,] 1 end] {
! 		    append repto ", [string trim $addr]"
! 		}
! 		set lines [lreplace $lines $idx [expr $idx + $flds(_prefix_len_X-GNATS-Notify) - 1] $repto\n]
! 	    }
              #set frm($tag) "[string trim [join $lines \n]]\n"
              set frm($tag) [join $lines \n]
  #puts "prefix after:$flds($tag)"
***************
*** 440,446 ****
              #
              # Taken care of above with the mail header
              #
!             unset still_left($tag)
          } {>Unformatted} {
              #
              # Taken care of later in the function...
--- 446,454 ----
              #
              # Taken care of above with the mail header
              #
! 	    if {[info exists still_left($tag)]} {
! 		unset still_left($tag)
! 	    }
          } {>Unformatted} {
              #
              # Taken care of later in the function...
***************
*** 467,473 ****
              #   Single line text fields are whitespace trimmed to a leading
              #   tab and a trailing newline
              #
!             case $tag $Tkeditpr(singletextflds) {
                  #puts $fout "$tag:\t[string trim [textget $tag] "\t\n "]"
                  puts $fout "$tag:\t[string trim $frm($tag) "\t\n "]"
              } [concat >Category >Responsible >Submitter-Id $Tkeditpr(radioflds)] {
--- 475,481 ----
              #   Single line text fields are whitespace trimmed to a leading
              #   tab and a trailing newline
              #
!             case $tag [concat $Tkeditpr(singletextflds) $Tkeditpr(shorttextflds)] {
                  #puts $fout "$tag:\t[string trim [textget $tag] "\t\n "]"
                  puts $fout "$tag:\t[string trim $frm($tag) "\t\n "]"
              } [concat >Category >Responsible >Submitter-Id $Tkeditpr(radioflds)] {
***************
*** 698,714 ****
  
      # listboxes and radio (enumerated) fields
      foreach tag [concat $Tkeditpr(listboxflds) $Tkeditpr(radioflds)] {
!         set  flds($tag) [string trim $flds($tag) "\t\n "]
          #unset frm($tag)
          catch {set frm($tag) $flds($tag)}
      }
  
      # now the 1 line textual flds
      foreach tag $Tkeditpr(singletextflds) {
!         set flds($tag) [string trim $flds($tag) "\t\n "]
          textset $tag $flds($tag)
      }
  
      # now the multi line textual flds
      foreach tag $Tkeditpr(multitextflds) {
          if {[info exists flds($tag)]} {
--- 706,741 ----
  
      # listboxes and radio (enumerated) fields
      foreach tag [concat $Tkeditpr(listboxflds) $Tkeditpr(radioflds)] {
! 	if {[info exists flds($tag)]} {
! 	    set flds($tag) [string trim $flds($tag) "\t\n "]
! 	} {
! 	    set flds($tag) ""
! 	}
          #unset frm($tag)
          catch {set frm($tag) $flds($tag)}
      }
  
      # now the 1 line textual flds
      foreach tag $Tkeditpr(singletextflds) {
! 	if {[info exists flds($tag)]} {
! 	    set flds($tag) [string trim $flds($tag) "\t\n "]
! 	} {
! 	    set flds($tag) ""
! 	}
          textset $tag $flds($tag)
      }
  
+     # now the 1 line textual flds
+     foreach tag $Tkeditpr(shorttextflds) {
+ 	if {[info exists flds($tag)]} {
+ 	    set flds($tag) [string trim $flds($tag) "\t\n "]
+ 	} {
+ 	    set flds($tag) ""
+ 	}
+ 	#puts stderr "Setting $tag to $flds($tag)"
+ 	textset $tag $flds($tag) .eboxs.shortones
+     }
+ 
      # now the multi line textual flds
      foreach tag $Tkeditpr(multitextflds) {
          if {[info exists flds($tag)]} {
***************
*** 736,742 ****
  proc edit_email_originator {} {
      global Tkeditpr flds frm
      flush_singletext $Tkeditpr(singletextflds)
!     email_originator [ftrim $frm(X-GNATS-Notify)] \
              [ftrim $frm(>Responsible)] [ftrim $flds(Reply-To)] \
              [ftrim $frm(>Category)]/$Tkeditpr(prid) [ftrim $frm(>Synopsis)]
  }
--- 763,775 ----
  proc edit_email_originator {} {
      global Tkeditpr flds frm
      flush_singletext $Tkeditpr(singletextflds)
!     flush_singletext $Tkeditpr(shorttextflds)
! 
!     set gn ""
!     if {[info exists $frm(X-GNATS-Notify)]} {
! 	set gn [ftrim $frm(X-GNATS-Notify)]
!     }
!     email_originator $gn \
              [ftrim $frm(>Responsible)] [ftrim $flds(Reply-To)] \
              [ftrim $frm(>Category)]/$Tkeditpr(prid) [ftrim $frm(>Synopsis)]
  }
***************
*** 776,787 ****
          >Submitter-Id
          >Responsible
      }
      
      set Tkeditpr(singletextflds) {
          >Originator
-         X-GNATS-Notify
-         >Release
          >Synopsis
      }
  
      if {$TkGnats(ReleaseBased)} {
--- 809,825 ----
          >Submitter-Id
          >Responsible
      }
+ 
+     set Tkeditpr(shorttextflds) {
+ 	>Release
+ 	>Cost
+ 	>XrefPR
+     }
      
      set Tkeditpr(singletextflds) {
          >Originator
          >Synopsis
+ 	>IPsec-barf-location
      }
  
      if {$TkGnats(ReleaseBased)} {
***************
*** 792,803 ****
          >Description
          >How-To-Repeat
          >Environment
!         >Organization
          >Fix
          >Audit-Trail
          >Unformatted
          >Release-Note
- 	>Cost
      }
      
      # List of entry widgets for traverse key binding
--- 830,841 ----
          >Description
          >How-To-Repeat
          >Environment
! 	>IPsec-look
          >Fix
          >Audit-Trail
+         >Organization
          >Unformatted
          >Release-Note
      }
      
      # List of entry widgets for traverse key binding
***************
*** 932,941 ****
              incr nboxes
          }
      }
      if {$nboxes > 1} {
          pack .eboxs -side top  -anchor w -pady 2 -padx  0 -fill x
      }
!     
      foreach f $Tkeditpr(singletextflds) {
          if {[check_suppressed_field $f] == 1} {
              continue
--- 970,988 ----
              incr nboxes
          }
      }
+     frame .eboxs.shortones -relief groove -borderwidth 2
+     foreach f $Tkeditpr(shorttextflds) {
+         if {[check_suppressed_field $f] == 1} {
+             continue
+         }
+ 	lappend Tkeditpr(tlist) [singletext .eboxs.shortones $f 20 "" 14]
+     }
+     pack .eboxs.shortones -side left 
+ 
      if {$nboxes > 1} {
          pack .eboxs -side top  -anchor w -pady 2 -padx  0 -fill x
      }
! 
      foreach f $Tkeditpr(singletextflds) {
          if {[check_suppressed_field $f] == 1} {
              continue