diff --git a/context_processors.py b/context_processors.py index 603f78b..912b63f 100644 --- a/context_processors.py +++ b/context_processors.py @@ -23,6 +23,7 @@ if list.host_name == domainname: domain_lists.append(list) except: + raise Exception("No Domain Found or HTTP_HOST missing in reqeust") pass #in case there is not http_host (e.g. during testing) #return a Dict with the key used in templates diff --git a/forms.py b/forms.py index 98279d8..04597a8 100644 --- a/forms.py +++ b/forms.py @@ -732,6 +732,19 @@ label = _('Posting Address'), required = False, ) + def __init__(self,settings,visible_section,visible_option, *args, **kwargs): + super(ListSettings, self).__init__(*args, **kwargs) + if visible_option in self.layout: + self.layout = [["Option",visible_option]] + #debug + if visible_section: + sections=[] + for section in self.layout: + sections.append(section[0]) + if visible_section in sections: + for section in self.layout: + if section[0] == visible_section: + self.layout = [section] class Meta: """Class to handle the automatic insertion of fieldsets and divs. diff --git a/templates/mailman-django/base.html b/templates/mailman-django/base.html index 7d22eaf..4df888a 100644 --- a/templates/mailman-django/base.html +++ b/templates/mailman-django/base.html @@ -40,6 +40,8 @@ {% block content %}{% endblock %} + REGRESSION: + {% block links %}{% endblock %} diff --git a/templates/mailman-django/lists/settings.html b/templates/mailman-django/lists/settings.html index 8ba887d..174090a 100644 --- a/templates/mailman-django/lists/settings.html +++ b/templates/mailman-django/lists/settings.html @@ -2,14 +2,14 @@ {% load i18n %} {% block links%} -{% url list_info fqdn_listname as url_list_info %} -{% url list_delete fqdn_listname as url_list_delete %} -{% url mass_subscribe fqdn_listname as url_mass_subscription %} + {% url list_info fqdn_listname as url_list_info %} + {% url list_delete fqdn_listname as url_list_delete %} + {% url mass_subscribe fqdn_listname as url_mass_subscription %} -{% blocktrans %} -You can also subscribe or unsubscribe a user to the list "the normal way" or delete the list. If you wish to mass subscribe users to this list, please click here. -{% endblocktrans %} + {% blocktrans %} + You can also subscribe or unsubscribe a user to the list "the normal way" or delete the list. If you wish to mass subscribe users to this list, please click here. + {% endblocktrans %} {% endblock %} {% block content %} @@ -26,7 +26,6 @@ {% endif %}
- {{ form.as_div }}
diff --git a/templates/mailman-django/menu/administration.html b/templates/mailman-django/menu/administration.html index 4706959..e3328cc 100644 --- a/templates/mailman-django/menu/administration.html +++ b/templates/mailman-django/menu/administration.html @@ -13,15 +13,17 @@ {% trans "New List" %} + {% if fqdn_listname %}
  • - - {% trans "Delete List" %} + + {% trans "Delete List #TODO:really delete dialog" %}
  • - + {% trans "Administrivia" %} + {% endif %}
    {% endblock%} diff --git a/views.py b/views.py index 1e86aa1..b29b12a 100644 --- a/views.py +++ b/views.py @@ -287,39 +287,55 @@ return render_to_response('mailman-django/errors/generic.html', {'message': "Unexpected error:"+ str(e)}) -@login_required +#@login_required #debug def list_settings(request, fqdn_listname = None, template = 'mailman-django/lists/settings.html'): """ View and edit the settings of a list. The function requires the user to be logged in and have the permissions necessary to perform the action. + + Use ?section= + or ?option= + to show only parts of the settings """ message = "" + #check for GET values + try: + visible_section=request.GET["section"] + except: + visible_section=None + try: + visible_option=request.GET["option"] + except: + visible_option=None + #Create the Connection try: c = Client('http://localhost:8001/3.0', API_USER, API_PASS) the_list = c.get_list(fqdn_listname) except Exception, e: return HttpResponse(e) - + #Save a Form Processed by POST if request.method == 'POST': - form = ListSettings(request.POST) + form = ListSettings(request.POST,visible_section,visible_option) if form.is_valid(): the_list.update_config(request.POST) message = "The list has been updated." + #Provide a form with existing values else: #raise Exception(the_list.settings)#debug - #testdict = {} - #for key,item in the_list.settings.items()#debug + testdict = {} + #raise Exception(the_list.settings)#debug + #for key,item in dict(the_list.settings).items():#debug # testdict[key]=item - form = ListSettings()#testdict)#the_list.settings) + form = ListSettings(testdict,visible_section,visible_option)#the_list.settings) #TODO # USE different Forms for each fieldset NO META SETTINGS !! - # querry settings when creating the fields not passing the whole settings + # querry settings when creating the fields not parsing the whole settings # - raise Exception(form)#debug + #raise Exception(form)#debug return render_to_response(template, {'form': form, 'message': message, 'fqdn_listname': the_list.settings['fqdn_listname']})