ó
Aü½cc           @   så   d  Z  d d l Z d d l Z d d l Z d d l m Z d d l m Z d d l m Z d d l m Z d d l m	 Z	 d d l
 Td d	 l m Z e	 j Z e	 j e j ƒ d
 „  Z d d „ Z d „  Z e d k rá e ƒ  n  d S(   sA   Produce listinfo page, primary web entry-point to mailing lists.
iÿÿÿÿN(   t   mm_cfg(   t   Utils(   t   MailList(   t   Errors(   t   i18n(   t   *(   t   syslogc          C   sb  t  j ƒ  }  |  s t ƒ  d  S|  d j ƒ  } y t j | d d ƒ} WnN t j k
 r– } t  j | ƒ } d GHt t d ƒ ƒ t	 d d | | ƒ d  SXt
 j ƒ  } y | j d ƒ } Wnp t k
 r(t ƒ  } | j t j ƒ | j t d t d	 ƒ ƒ ƒ | j t t d
 ƒ ƒ ƒ d GH| j ƒ  GHd  SXt  j | ƒ sD| j } n  t j | ƒ t | | ƒ d  S(   Ni    t   locks   Status: 404 Not Founds&   No such list <em>%(safelistname)s</em>t   errors   listinfo: No such list "%s": %st   languagei   t   Errors   Invalid options to CGI script.s   Status: 400 Bad Request(   R   t   GetPathPiecest   listinfo_overviewt   lowerR   R   t   MMListErrort   websafet   _R   t   cgit   FieldStoraget   getfirstt	   TypeErrort   Documentt   set_languageR    t   DEFAULT_SERVER_LANGUAGEt   AddItemt   Headert   Boldt   Formatt
   IsLanguaget   preferred_languageR   t   list_listinfo(   t   partst   listnamet   mlistt   et   safelistnamet   cgidataR	   t   doc(    (    s3   /export/web/mailman/mailman/Mailman/Cgi/listinfo.pyt   main)   s8    	t    c         C   sÚ  t  j ƒ  } t ƒ  } | j t j ƒ t d ƒ } | j | ƒ t d d d d ƒ } | j	 t
 t d | ƒ ƒ g ƒ | j | j ƒ  d d d d t j ƒg  } t  j ƒ  } | j ƒ  xÅ | D]½ } y t j | d	 d ƒ} Wn t j k
 rò qº n X| j rº t j rC| j j d
 | ƒ d k rC| j j d | ƒ d k rCqº qw| j | j d ƒ | j t  j | j ƒ  ƒ f ƒ qº qº W|  rœt |  d d d d ƒ}	 n t t d ƒ d d ƒ}	 |	 g }
 t t j t d ƒ ƒ j  ƒ  } | s÷|
 j! t d ƒ ƒ n |
 j t d ƒ ƒ |  rt d ƒ pd } t  j" ƒ  } |
 j! t d ƒ t t  j# d ƒ t d ƒ ƒ t d ƒ t d | | ƒ d f ƒ | j	 t$ t% |
 ƒ g ƒ | j t& | j ƒ  d ƒ d d d ƒ| r¡| j	 d d g ƒ | j	 t' t t d  ƒ d d ƒƒ t' t t d! ƒ d d ƒƒ g ƒ d" } xƒ | D]x \ } } } | j	 t | t' | ƒ ƒ | p^t( t d# ƒ ƒ g ƒ | r“t j) r“| j* | j ƒ  d t j) ƒn  | } q"Wn  | j+ | ƒ | j+ d$ ƒ | j+ t, ƒ  ƒ | j  ƒ  GHd  S(%   Ns   %(hostname)s Mailing Listst   borderi    t   widths   100%i   t   colspant   bgcolorR   s   /%s/iÿÿÿÿs   /%s:t   listinfot   colort   ff5060t   sizes   +1s   Welcome!s   +2t   Mailmansh   <p>There currently are no publicly-advertised
            %(mailmanlink)s mailing lists on %(hostname)s.s÷   <p>Below is a listing of all the public mailing lists on
            %(hostname)s.  Click on a list name to get more information about
            the list, or to subscribe, unsubscribe, and change the preferences
            on your subscription.t   rightR'   sÒ    To visit the general information page for an unadvertised list,
        open a URL similar to this one, but with a '/' and the %(adj)s
        list name appended.
        <p>List administrators, you can visit t   admins   the list admin overview pagesw    to find the management interface for your list.
         <p>If you are having trouble using the lists, please contact s   mailto:s   .<p>s   &nbsp;t   Listt   Descriptioni   s   [no description available]s   <hr>(-   R   t
   get_domainR   R   R    R   R   t   SetTitlet   Tablet   AddRowt   CenterR   t   AddCellInfot   GetCurrentRowIndext   WEB_HEADER_COLORt
   list_namest   sortR   R   t   MMUnknownListErrort
   advertisedt   VIRTUAL_HOST_OVERVIEWt   web_page_urlt   findt   appendt   GetScriptURLt	   real_nameR   t   GetDescriptiont   FontAttrt   Linkt   MAILMAN_URLR   t   extendt   get_site_emailt	   ScriptURLt   applyt	   Containert   maxR   t   Italict   WEB_HIGHLIGHT_COLORt
   AddRowInfoR   t   MailmanLogo(   t   msgt   hostnameR%   t   legendt   tableR@   t	   listnamest   nameR!   t   greetingt   welcomet   mailmanlinkt   adjt	   siteownert	   highlightt   urlRF   t   description(    (    s3   /export/web/mailman/mailman/Mailman/Cgi/listinfo.pyR   Q   s†    	

		 	

%!"c      	   C   sË  t  ƒ  } | j | ƒ |  j | ƒ } |  j s9 |  j rd d | d <d | d <d | d <d | d <n4 |  j ƒ  | d <|  j ƒ  | d <d | d <d | d <|  j ƒ  | d <|  j ƒ  | d	 <|  j	 d
 d d ƒ| d <|  j
 d d t d ƒ ƒ| d <|  j d ƒ | d <|  j d ƒ | d <|  j d ƒ | d <t j r‡t t t j ƒ  ƒ ƒ } t j j d t j j d t j j d d ƒ ƒ ƒ } | j d ƒ d k r«| j d d ƒ d } n | j d d ƒ d } t t j t ƒ r)d  t j k r)t j |  | t j ƒ \ } } } t d! ƒ }	 d" |	 | | f | d# <n d } | d c d$ | | t j t j d | d | d |  j ƒ  d | ƒ j ƒ  f 7<n  |  j d% ƒ | d& <|  j  | ƒ | d' <|  j d( ƒ | d) <|  j! | ƒ | d* <t" d+ t d, ƒ ƒ j# ƒ  | d- <t$ |  j% ƒ  ƒ d k rd }
 n |  j
 d. d t d/ ƒ ƒ}
 |
 | d0 <|  j d1 ƒ | d2 <|  j	 d3 d d ƒ| d4 <t j& r–t d5 ƒ } d6 | | t j& f | d7 <n
 d | d7 <| j' |  j( d8 | | ƒ ƒ | j# ƒ  GHd  S(9   NR'   s   <mm-digest-radio-button>s   <mm-undigest-radio-button>s   <!-- s   <mm-digest-question-start>s    -->s   <mm-digest-question-end>s   <mm-plain-digests-button>s   <mm-mime-digests-button>t   emailR/   i   s   <mm-subscribe-box>s   email-buttont   textt	   Subscribes   <mm-subscribe-button>t   pws   <mm-new-password-box>s   pw-confs   <mm-confirm-password>t	   subscribes   <mm-subscribe-form-start>t   HTTP_FORWARDED_FORt   HTTP_X_FORWARDED_FORt   REMOTE_ADDRs   w.x.y.zt   .i    i   t   :t   ensY   Please answer the following question to prove that
                    you are not a bot:s7   <tr><td BGCOLOR="#dddddd">%s<br>%s</td><td>%s</td></tr>s   <mm-captcha-ui>s=   <input type="hidden" name="sub_form_token" value="%s:%s:%s">
t   rosters   <mm-roster-form-start>s   <mm-roster-option>t   optionss   <mm-options-form-start>s   <mm-editing-options>t   UserOptionss   Edit Optionss   <mm-info-button>s   displang-buttons   View this page ins   <mm-displang-box>R,   s   <mm-lang-form-start>t   fullnames   <mm-fullname-box>s   This form requires JavaScript.sï   <tr><td>&nbsp;</td><td>
            <noscript>%s</noscript>
            <script src="https://www.google.com/recaptcha/api.js?hl=%s">
            </script>
            <div class="g-recaptcha" data-sitekey="%s"></div>
            </td></tr>s   <mm-recaptcha-ui>s   listinfo.html()   t   HeadlessDocumentR   t   GetStandardReplacementst
   digestablet   nondigestablet   FormatDigestButtont   FormatUndigestButtont   FormatPlainDigestsButtont   FormatMimeDigestsButtont	   FormatBoxt   FormatButtonR   t   FormatSecureBoxt   FormatFormStartR    t   SUBSCRIBE_FORM_SECRETt   strt   intt   timet   ost   environt   getRC   t   rsplitt
   isinstancet   CAPTCHASt   dictR   t   captcha_displayt   sha_newt   internal_namet	   hexdigestt   FormatRosterOptionForUsert   FormatEditingOptiont   SubmitButtonR   t   lent   GetAvailableLanguagest   RECAPTCHA_SITE_KEYR   t	   ParseTags(   R!   t   langR%   t   replacementst   nowt   remotet   captcha_questiont   captcha_boxt   captcha_idxt   pre_questiont   displangt   noscript(    (    s3   /export/web/mailman/mailman/Mailman/Cgi/listinfo.pyR   °   s~    	




	!!	
(	
	
t   __main__(   t   __doc__R‚   R   R   R0   R    R   R   R   R   t   Mailman.htmlformatt   Mailman.Logging.SyslogR   R   R   R   R&   R   R   t   __name__(    (    (    s3   /export/web/mailman/mailman/Mailman/Cgi/listinfo.pyt   <module>   s"   
		(_	l