@@ -533,15 +533,23 @@ def show_results(mlist, doc, category, subcat, cgidata):
533533 'realname' : mlist .real_name ,
534534 'label' : label
535535 })
536- doc .AddItem (Center (Header (2 , _ (
537- '%(realname)s mailing list administration<br>%(label)s Section' ) % {
538- 'realname' : mlist .real_name ,
539- 'label' : label
540- })))
541- doc .AddItem ('<hr>' )
542- # Now we need to craft the form that will be submitted, which will contain
543- # all the variable settings, etc. This is a bit of a kludge because we
544- # know that the autoreply and members categories supports file uploads.
536+
537+ # Use ParseTags for the main content
538+ replacements = {
539+ 'realname' : mlist .real_name ,
540+ 'label' : label ,
541+ 'adminurl' : adminurl ,
542+ 'admindburl' : mlist .GetScriptURL ('admindb' ),
543+ 'listinfourl' : mlist .GetScriptURL ('listinfo' ),
544+ 'edithtmlurl' : mlist .GetScriptURL ('edithtml' ),
545+ 'archiveurl' : mlist .GetBaseArchiveURL (),
546+ 'rmlisturl' : mlist .GetScriptURL ('rmlist' ) if mm_cfg .OWNERS_CAN_DELETE_THEIR_OWN_LISTS and mlist .internal_name () != mm_cfg .MAILMAN_SITE_LIST else None
547+ }
548+
549+ output = mlist .ParseTags ('admin_results.html' , replacements , mlist .preferred_language )
550+ doc .AddItem (output )
551+
552+ # Now we need to craft the form that will be submitted
545553 encoding = None
546554 if category in ('autoreply' , 'members' ):
547555 encoding = 'multipart/form-data'
@@ -556,127 +564,19 @@ def show_results(mlist, doc, category, subcat, cgidata):
556564 'adminurl' : adminurl ,
557565 'category' : category
558566 }, encoding = encoding , mlist = mlist , contexts = AUTH_CONTEXTS )
559- # This holds the two columns of links
560- linktable = Table (valign = 'top' , width = '100%' )
561- linktable .AddRow ([Center (Bold (_ ("Configuration Categories" ))),
562- Center (Bold (_ ("Other Administrative Activities" )))])
563- # The `other links' are stuff in the right column.
564- otherlinks = UnorderedList ()
565- otherlinks .AddItem (Link (mlist .GetScriptURL ('admindb' ),
566- _ ('Tend to pending moderator requests' )))
567- otherlinks .AddItem (Link (mlist .GetScriptURL ('listinfo' ),
568- _ ('Go to the general list information page' )))
569- otherlinks .AddItem (Link (mlist .GetScriptURL ('edithtml' ),
570- _ ('Edit the public HTML pages and text files' )))
571- otherlinks .AddItem (Link (mlist .GetBaseArchiveURL (),
572- _ ('Go to list archives' )).Format () +
573- '<br> <br>' )
574- # We do not allow through-the-web deletion of the site list!
575- if mm_cfg .OWNERS_CAN_DELETE_THEIR_OWN_LISTS and \
576- mlist .internal_name () != mm_cfg .MAILMAN_SITE_LIST :
577- otherlinks .AddItem (Link (mlist .GetScriptURL ('rmlist' ),
578- _ ('Delete this mailing list' )).Format () +
579- _ (' (requires confirmation)<br> <br>' ))
580- otherlinks .AddItem (Link ('%s/logout' % adminurl ,
581- # BAW: What I really want is a blank line, but
582- # adding an won't do it because of the
583- # bullet added to the list item.
584- '<FONT SIZE="+2"><b>%s</b></FONT>' %
585- _ ('Logout' )))
586- # These are links to other categories and live in the left column
587- categorylinks_1 = categorylinks = UnorderedList ()
588- categorylinks_2 = ''
589- categorykeys = list (categories .keys ())
590- half = len (categorykeys ) / 2
591- counter = 0
592- subcat = None
593- for k in categorykeys :
594- label = _ (categories [k ][0 ])
595- url = '%s/%s' % (adminurl , k )
596- if k == category :
597- # Handle subcategories
598- subcats = mlist .GetConfigSubCategories (k )
599- if subcats :
600- subcat = Utils .GetPathPieces ()[- 1 ]
601- for k , v in subcats :
602- if k == subcat :
603- break
604- else :
605- # The first subcategory in the list is the default
606- subcat = subcats [0 ][0 ]
607- subcat_items = []
608- for sub , text in subcats :
609- if sub == subcat :
610- text = Bold ('[%s]' % text ).Format ()
611- subcat_items .append (Link (url + '/' + sub , text ))
612- categorylinks .AddItem (
613- Bold (label ).Format () +
614- UnorderedList (* subcat_items ).Format ())
615- else :
616- formatted_label = '[%s]' % label
617- categorylinks .AddItem (Link (url , Bold (formatted_label )))
618- else :
619- categorylinks .AddItem (Link (url , label ))
620- counter += 1
621- if counter >= half :
622- categorylinks_2 = categorylinks = UnorderedList ()
623- counter = - len (categorykeys )
624- # Make the emergency stop switch a rude solo light
625- etable = Table ()
626- # Add all the links to the links table...
627- etable .AddRow ([categorylinks_1 , categorylinks_2 ])
628- etable .AddRowInfo (etable .GetCurrentRowIndex (), valign = 'top' )
629- if mlist .emergency :
630- label = _ ('Emergency moderation of all list traffic is enabled' )
631- etable .AddRow ([Center (
632- Link ('?VARHELP=general/emergency' , Bold (label )))])
633- color = mm_cfg .WEB_ERROR_COLOR
634- etable .AddCellInfo (etable .GetCurrentRowIndex (), 0 ,
635- colspan = 2 , bgcolor = color )
636- linktable .AddRow ([etable , otherlinks ])
637- # ...and add the links table to the document.
638- form .AddItem (linktable )
639- form .AddItem ('<hr>' )
640- form .AddItem (
641- _ (f'''Make your changes in the following section, then submit them
642- using the <em>Submit Your Changes</em> button below.''' )
643- + '<p>' )
644-
645- # The members and passwords categories are special in that they aren't
646- # defined in terms of gui elements. Create those pages here.
567+
568+ # Add the form content based on category
647569 if category == 'members' :
648- # Figure out which subcategory we should display
649- subcat = Utils .GetPathPieces ()[- 1 ]
650- if subcat not in ('list' , 'add' , 'remove' , 'change' , 'sync' ):
651- subcat = 'list'
652- # Add member category specific tables
653570 form .AddItem (membership_options (mlist , subcat , cgidata , doc , form ))
654571 form .AddItem (Center (submit_button ('setmemberopts_btn' )))
655- # In "list" subcategory, we can also search for members
656- if subcat == 'list' :
657- form .AddItem ('<hr>\n ' )
658- table = Table (width = '100%' )
659- table .AddRow ([Center (Header (2 , _ ('Additional Member Tasks' )))])
660- table .AddCellInfo (table .GetCurrentRowIndex (), 0 , colspan = 2 ,
661- bgcolor = mm_cfg .WEB_HEADER_COLOR )
662- # Add a blank separator row
663- table .AddRow ([' ' , ' ' ])
664- # Add a section to set the moderation bit for all members
665- table .AddRow ([_ (f"""<li>Set everyone's moderation bit, including
666- those members not currently visible""" )])
667- table .AddCellInfo (table .GetCurrentRowIndex (), 0 , colspan = 2 )
668- table .AddRow ([RadioButtonArray ('allmodbit_val' ,
669- (_ ('Off' ), _ ('On' )),
670- mlist .default_member_moderation ),
671- SubmitButton ('allmodbit_btn' , _ ('Set' ))])
672- form .AddItem (table )
673572 elif category == 'passwords' :
674573 form .AddItem (Center (password_inputs (mlist )))
675574 form .AddItem (Center (submit_button ()))
676575 else :
677576 form .AddItem (show_variables (mlist , category , subcat , cgidata , doc ))
678577 form .AddItem (Center (submit_button ()))
679- # And add the form
578+
579+ # Add the form to the document
680580 doc .AddItem (form )
681581 doc .AddItem (mlist .GetMailmanFooter ())
682582
0 commit comments