[Mailman-Developers] admindb.py patch

Ricardo Kustner ricardo@rixhq.nu
Sun, 13 Feb 2000 16:59:35 +0100


I know i've posted this before, but this time i've made
a few little changes... below is a patch to Mailman/Cgi/admindb.py
which
1) seperates the heldmsg header from the body
2) puts the header in a separate 3 row textarea
3) moves the "approve/reject/discard" line to the below the message,
   since that's much more convinient when approving many messages

this way you can immediately start reading the message instead of
having to scroll down the header lines first.


ps: maybe the header/body seperate code should be moved to a 
function instead...


Ricardo.

*** /usr/local/cvs/mailman/Mailman/Cgi/admindb.py	Mon Nov 15 23:29:46 1999
--- admindb.py	Sun Feb 13 16:47:07 2000
***************
*** 195,201 ****
      form.AddItem(Center(Header(2, msg)))
      try:
          fp = open(os.path.join(mm_cfg.DATA_DIR, filename))
!         text = fp.read(mm_cfg.ADMINDB_PAGE_TEXT_LIMIT)
          fp.close()
      except IOError, (code, msg):
          if code == ENOENT:
--- 195,211 ----
      form.AddItem(Center(Header(2, msg)))
      try:
          fp = open(os.path.join(mm_cfg.DATA_DIR, filename))
! 	msg_header = ""
! 	msg_body = ""
! 	for line in fp.readlines(mm_cfg.ADMINDB_PAGE_TEXT_LIMIT):
! 		if msg_body == "":
! 			if line != "\n":
! 				msg_header = msg_header + line
! 			else:
! 				msg_body = line
! 		else:
! 			msg_body = msg_body + line	
! 
          fp.close()
      except IOError, (code, msg):
          if code == ENOENT:
***************
*** 214,223 ****
      t.AddRow([Bold('Reason:'), reason])
      t.AddRow([Bold('Subject:'), subject])
      t.AddRow([
-         Bold('Action:'),
-         RadioButtonArray(id, ("Approve", "Reject", "Discard (eg, spam)"))
-         ])
-     t.AddRow([
  	Bold('If you reject this post, explain (optional):'),
  	TextArea('comment-%d' % id, rows=4, cols=60,
                   text=("Please do *not* post administrative requests"
--- 224,229 ----
***************
*** 229,236 ****
          ])
      row, col = t.GetCurrentRowIndex(), t.GetCurrentCellIndex()
      t.AddCellInfo(row, col, colspan=3)
      t.AddRow([Bold('Message Excerpt:'),
!               TextArea('fulltext-%d' % id, text, rows=10, cols=60)])
      row, col = t.GetCurrentRowIndex(), t.GetCurrentCellIndex()
      t.AddCellInfo(row, col, colspan=3)
      form.AddItem(t)
--- 235,247 ----
          ])
      row, col = t.GetCurrentRowIndex(), t.GetCurrentCellIndex()
      t.AddCellInfo(row, col, colspan=3)
+     t.AddRow([Bold('Message Header:'), TextArea('header-%d' % id, msg_header, rows=3, cols=60)])
      t.AddRow([Bold('Message Excerpt:'),
!               TextArea('fulltext-%d' % id, msg_body, rows=10, cols=60)])
!     t.AddRow([
!         Bold('Action:'),
!         RadioButtonArray(id, ("Approve", "Reject", "Discard (eg, spam)"))
!         ])
      row, col = t.GetCurrentRowIndex(), t.GetCurrentCellIndex()
      t.AddCellInfo(row, col, colspan=3)
      form.AddItem(t)


--