[Mailman-Developers] small addtions for web posting

Steven Hazel cherub@azrael.dyn.cheapnet.net
Thu, 26 Aug 1999 20:40:59 -0500 (CDT)


These simple patches -- submitted in my new insanely generous 30-line
context diff fashion -- will add <MM-Post></MM-Post> anchors to link
to the postmsg script, and use them in the listinfo.html template.

-S

===File mailman/Mailman/HTMLFormatter.py.diff======================
Index: HTMLFormatter.py
===================================================================
RCS file: /home/cherub/cvs/mailman/Mailman/HTMLFormatter.py,v
retrieving revision 1.1
retrieving revision 1.2
diff -c -3 -0 -r1.1 -r1.2
*** HTMLFormatter.py	1999/07/28 20:42:33	1.1
--- HTMLFormatter.py	1999/08/27 01:32:37	1.2
***************
*** 282,386 ****
--- 282,391 ----
                  whom = 'Admin address:'
              # Solicit the user and password.
              container.AddItem(self.RestrictedListMessage('subscribers list',
                                                           self.private_roster)
                                + " <p>Enter your "
                                + string.lower(whom[:-1])
                                + " and password to visit"
                                "  the subscribers list: <p><center> "
                                + whom
                                + " ")
              container.AddItem(self.FormatBox('roster-email'))
              container.AddItem(" Password: "
                                + self.FormatSecureBox('roster-pw')
                                + "&nbsp;&nbsp;")
              container.AddItem(SubmitButton('SubscriberRoster',
  					   'Visit Subscriber List'))
              container.AddItem("</center>")
          return container
  
      def FormatFormStart(self, name, extra=''):
  	base_url = self.GetAbsoluteScriptURL(name)
          if extra:
              full_url = "%s/%s" % (base_url, extra)
          else:
              full_url = base_url
  	return ('<FORM Method=POST ACTION="%s">' % full_url)
  
      def FormatArchiveAnchor(self):
  	return '<a href="%s">' % self.GetBaseArchiveURL()
  
+     def FormatPostAnchor(self):
+         return '<a href="%s">' % self.GetRelativeScriptURL('postmsg')
+ 
      def FormatFormEnd(self):
  	return '</FORM>'
  
      def FormatBox(self, name, size=20):
  	return '<INPUT type="Text" name="%s" size="%d">' % (name, size)
  
      def FormatSecureBox(self, name):
  	return '<INPUT type="Password" name="%s" size="15">' % name
  
      def FormatButton(self, name, text='Submit'):
  	return '<INPUT type="Submit" name="%s" value="%s">' % (name, text)
  
      def FormatReminder(self):
  	if self.send_reminders:
  	    return 'Once a month, your password will be emailed to you as a reminder.'
  	return ''
  
      def ParseTags(self, template, replacements):
  	text = self.SnarfHTMLTemplate(template)
  	parts = regsub.splitx(text, '</?[Mm][Mm]-[^>]*>')
  	i = 1
  	while i < len(parts):
  	    tag = string.lower(parts[i])
  	    if replacements.has_key(tag):
  		parts[i] = replacements[tag]
  	    else:
  		parts[i] = ''
  	    i = i + 2
  	return string.join(parts, '')
  
      # This needs to wait until after the list is inited, so let's build it
      # when it's needed only.
      def GetStandardReplacements(self):
          dmember_len = len(self.GetDigestMembers())
          member_len = len(self.GetMembers())
  	return { 
  	    '<mm-mailman-footer>' : self.GetMailmanFooter(),
  	    '<mm-list-name>' : self.real_name,
  	    '<mm-email-user>' : self._internal_name,
  	    '<mm-list-description>' : self.description,
  	    '<mm-list-info>' : string.join(string.split(self.info, '\n'),
  					   '<br>'),
  	    '<mm-form-end>'  : self.FormatFormEnd(),
  	    '<mm-archive>'   : self.FormatArchiveAnchor(),
  	    '</mm-archive>'  : '</a>',
+             '<mm-post>' : self.FormatPostAnchor(),
+             '</mm-post>' : '</a>',
              '<mm-list-subscription-msg>' : self.FormatSubscriptionMsg(),
              '<mm-restricted-list-message>' : \
              	self.RestrictedListMessage('current archive',
                                             self.archive_private),
  	    '<mm-num-reg-users>' : `member_len`,
  	    '<mm-num-digesters>' : `dmember_len`,
  	    '<mm-num-members>' : (`member_len + dmember_len`),
  	    '<mm-posting-addr>' : '%s' % self.GetListEmail(),
  	    '<mm-request-addr>' : '%s' % self.GetRequestEmail(),
  	    '<mm-owner>' : self.GetAdminEmail(),
  	    '<mm-reminder>' : self.FormatReminder(),
              '<mm-host>' : self.host_name,
  	    }
  
      def GetAllReplacements(self):
          """
          returns standard replaces plus formatted user lists in
          a dict just like GetStandardReplacements.
          """
          d = self.GetStandardReplacements()
          d.update({"<mm-regular-users>": self.FormatUsers(0),
                    "<mm-digest-users>": self.FormatUsers(1)})
          return d
                    
      def InitTemplates(self):
  	def ExtensionFilter(item):
  	    return item[-5:] == '.html'
  
  	files = filter(ExtensionFilter, os.listdir(mm_cfg.TEMPLATE_DIR))
  	Utils.MakeDirTree(self._template_dir)
============================================================

===File mailman/templates/listinfo.html.diff=======================
Index: listinfo.html
===================================================================
RCS file: /home/cherub/cvs/mailman/templates/listinfo.html,v
retrieving revision 1.1
retrieving revision 1.2
diff -c -3 -0 -r1.1 -r1.2
*** listinfo.html	1999/07/28 20:42:34	1.1
--- listinfo.html	1999/08/27 01:34:27	1.2
***************
*** 1,76 ****
! <!-- $Revision: 1.1 $ -->
  <HTML>
    <HEAD>
      <TITLE><MM-List-Name> Info Page</TITLE>
    
    </HEAD>
    <BODY BGCOLOR="#ffffff">
  
      <MM-Subscribe-Form-Start>
      <P>
        <TABLE COLS="1" BORDER="0" CELLSPACING="4" CELLPADDING="5">
  	<TR>
  	  <TD COLSPAN="2" WIDTH="100%" BGCOLOR="#99CCFF" ALIGN="CENTER">
  	    <B><FONT COLOR="#000000" SIZE="+1"><MM-List-Name> --
  	<MM-List-Description></FONT></B>
  	  </TD>
  	</TR>
  	<tr>
  	    <td colspan="2">
  	      <p>&nbsp;
  	    </td>
  	  </tr>
  	  <tr>
  	    <TD COLSPAN="2" WIDTH="100%" BGCOLOR="#FFF0D0">
  	      <B><FONT COLOR="#000000">About <MM-List-Name></FONT></B>
  	    </TD>
  	  </TR>
  	    <tr>
  	      <td colspan="2">
  		<P><MM-List-Info></P>
  	  <p> To see the collection of prior postings to the list,
  	      visit the <MM-Archive><MM-List-Name>
  		  Archives</MM-Archive>.
  	      <MM-Restricted-List-Message>
  	  </p>
  	</TD>
        </TR>
        <TR>
  	<TD COLSPAN="2" WIDTH="100%" BGCOLOR="#FFF0D0">
  	  <B><FONT COLOR="#000000">Using <MM-List-Name></FONT></B>
  	</TD>
        </TR>
        <tr>
  	<td colspan="2">
  	  To post a message to all the list members, send email to
  	  <A HREF="mailto:<MM-Posting-Addr>"><MM-Posting-Addr></A>.
  
  	  <p>You can subscribe to the list, or change your existing
  	    subscription, in the sections below.
  	</td>
        </tr>
        <TR>
  	<TD COLSPAN="2" WIDTH="100%" BGCOLOR="#FFF0D0">
  	  <B><FONT COLOR="#000000">Subscribing to <MM-List-Name></FONT></B>
  	</TD>
        </TR>
        <tr>
  	<td colspan="2">
  	  <P>
  	    Subscribe to <MM-List-Name> by filling out the following
  	      form.
  	  <MM-List-Subscription-Msg>
  	  <ul>
  	      <TABLE BORDER="0" CELLSPACING="2" CELLPADDING="2"
  		WIDTH="70%" HEIGHT= "112">
  		<TR>
  		  <TD BGCOLOR="#dddddd" WIDTH="55%">Your email address:</TD>
  		  <TD WIDTH="33%"><MM-Subscribe-Box>
  	</TD>
  	<TD WIDTH="12%">&nbsp;</TD></TR>
        <TR>
  	<TD COLSPAN="3"><FONT SIZE=-1>You must enter a
  	    privacy password. This provides only mild security,
  	    but should prevent others from messing with your
  	    subscription.  Do not use valuable passwords!  
  	    <MM-Reminder>
--- 1,80 ----
! <!-- $Revision: 1.2 $ -->
  <HTML>
    <HEAD>
      <TITLE><MM-List-Name> Info Page</TITLE>
    
    </HEAD>
    <BODY BGCOLOR="#ffffff">
  
      <MM-Subscribe-Form-Start>
      <P>
        <TABLE COLS="1" BORDER="0" CELLSPACING="4" CELLPADDING="5">
  	<TR>
  	  <TD COLSPAN="2" WIDTH="100%" BGCOLOR="#99CCFF" ALIGN="CENTER">
  	    <B><FONT COLOR="#000000" SIZE="+1"><MM-List-Name> --
  	<MM-List-Description></FONT></B>
  	  </TD>
  	</TR>
  	<tr>
  	    <td colspan="2">
  	      <p>&nbsp;
  	    </td>
  	  </tr>
  	  <tr>
  	    <TD COLSPAN="2" WIDTH="100%" BGCOLOR="#FFF0D0">
  	      <B><FONT COLOR="#000000">About <MM-List-Name></FONT></B>
  	    </TD>
  	  </TR>
  	    <tr>
  	      <td colspan="2">
  		<P><MM-List-Info></P>
  	  <p> To see the collection of prior postings to the list,
  	      visit the <MM-Archive><MM-List-Name>
  		  Archives</MM-Archive>.
  	      <MM-Restricted-List-Message>
  	  </p>
  	</TD>
        </TR>
        <TR>
  	<TD COLSPAN="2" WIDTH="100%" BGCOLOR="#FFF0D0">
  	  <B><FONT COLOR="#000000">Using <MM-List-Name></FONT></B>
  	</TD>
        </TR>
        <tr>
  	<td colspan="2">
  	  To post a message to all the list members, send email to
  	  <A HREF="mailto:<MM-Posting-Addr>"><MM-Posting-Addr></A>.
+ 
+ 	  <p> If you are a subscriber, you can post a message to the 
+ 	      mailing list <MM-Post>here</MM-Post>.
+ 	  </p>
  
  	  <p>You can subscribe to the list, or change your existing
  	    subscription, in the sections below.
  	</td>
        </tr>
        <TR>
  	<TD COLSPAN="2" WIDTH="100%" BGCOLOR="#FFF0D0">
  	  <B><FONT COLOR="#000000">Subscribing to <MM-List-Name></FONT></B>
  	</TD>
        </TR>
        <tr>
  	<td colspan="2">
  	  <P>
  	    Subscribe to <MM-List-Name> by filling out the following
  	      form.
  	  <MM-List-Subscription-Msg>
  	  <ul>
  	      <TABLE BORDER="0" CELLSPACING="2" CELLPADDING="2"
  		WIDTH="70%" HEIGHT= "112">
  		<TR>
  		  <TD BGCOLOR="#dddddd" WIDTH="55%">Your email address:</TD>
  		  <TD WIDTH="33%"><MM-Subscribe-Box>
  	</TD>
  	<TD WIDTH="12%">&nbsp;</TD></TR>
        <TR>
  	<TD COLSPAN="3"><FONT SIZE=-1>You must enter a
  	    privacy password. This provides only mild security,
  	    but should prevent others from messing with your
  	    subscription.  Do not use valuable passwords!  
  	    <MM-Reminder>
============================================================