old_contents: #!/usr/bin/env python
  # -*- coding: utf-8 -*-
  ##
  ## Author: Adriano Monteiro Marques <adriano@umitproject.org>
  ##
  ## Copyright (C) 2011 S2S Network Consultoria e Tecnologia da Informacao LTDA
  ##
  ## This program is free software: you can redistribute it and/or modify
  ## it under the terms of the GNU Affero General Public License as
  ## published by the Free Software Foundation, either version 3 of the
  ## License, or (at your option) any later version.
  ##
  ## This program is distributed in the hope that it will be useful,
  ## but WITHOUT ANY WARRANTY; without even the implied warranty of
  ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  ## GNU Affero General Public License for more details.
  ##
  ## You should have received a copy of the GNU Affero General Public License
  ## along with this program.  If not, see <http://www.gnu.org/licenses/>.
  ##
  
  import datetime
  from django import forms
  
  from suggestions.models import WebsiteSuggestion
  from suggestions.models import ServiceSuggestion
  
  from ajax_select import make_ajax_field
  
  
  EVENT_TYPE = (
      ('censor', 'Censor'),
      ('throttling', 'Throttling'),
      ('offline', 'Offline'),
  )
  
  class SuggestWebsiteForm(forms.Form):
      website = forms.CharField(max_length=300, required=True)
      location = make_ajax_field(WebsiteSuggestion, 'location_id', 'location', label='Location')
  
  class SuggestServiceForm(forms.Form):
      host_name = forms.CharField(max_length=300, required=True)
      service_name = forms.CharField(max_length=20, required=True)
      port = forms.IntegerField(required=True)
      location = forms.CharField(max_length=300, required=False)
  
  class WebsiteEventForm(forms.Form):
      website = forms.CharField(max_length=300, required=True)
      location = forms.CharField(max_length=300, required=True)
      first_detection = forms.DateTimeField(initial=datetime.date.today, required=False)
      event_type = forms.ChoiceField(choices=EVENT_TYPE, required=False)
  
  class ServiceEventForm(forms.Form):
      service = forms.CharField(max_length=300, required=True)
      location = forms.CharField(max_length=300, required=True)
      first_detection = forms.DateTimeField(initial=datetime.date.today, required=False)
      event_type = forms.ChoiceField(choices=EVENT_TYPE, required=False)
  
new_contents: #!/usr/bin/env python
  # -*- coding: utf-8 -*-
  ##
  ## Author: Adriano Monteiro Marques <adriano@umitproject.org>
  ##
  ## Copyright (C) 2011 S2S Network Consultoria e Tecnologia da Informacao LTDA
  ##
  ## This program is free software: you can redistribute it and/or modify
  ## it under the terms of the GNU Affero General Public License as
  ## published by the Free Software Foundation, either version 3 of the
  ## License, or (at your option) any later version.
  ##
  ## This program is distributed in the hope that it will be useful,
  ## but WITHOUT ANY WARRANTY; without even the implied warranty of
  ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  ## GNU Affero General Public License for more details.
  ##
  ## You should have received a copy of the GNU Affero General Public License
  ## along with this program.  If not, see <http://www.gnu.org/licenses/>.
  ##
  
  import datetime
  from django import forms
  
  from suggestions.models import WebsiteSuggestion
  from suggestions.models import ServiceSuggestion
  
  from ajax_select import make_ajax_field
  
  
  EVENT_TYPE = (
      ('censor', 'Censor'),
      ('throttling', 'Throttling'),
      ('offline', 'Offline'),
  )
  
  LOCATION_HELP_TEXT = ("Where do you think it is being blocked? "
                        "Leave empty if you want a world-wide check.")
  
  WEBSITE_HELP_TEXT = ("The website you think we should check.")
  
  SERVICE_NAME_HELP_TEXT = ("Service name. Eg: ssh, ftp, pop3, imap...")
  
  HOST_NAME_HELP_TEXT = ("Address through which we can reach this service, "
                         "without the protocol part. Eg: ftp.test.com instead "
                         "ftp://ftp.test.com")
  
  PORT_HELP_TEXT = ("Port number through which the service should be accessed.")
  
  
  class SuggestWebsiteForm(forms.Form):
      website = forms.CharField(max_length=300, required=True,
                                help_text=WEBSITE_HELP_TEXT)
      location = make_ajax_field(WebsiteSuggestion, 'location_id', 'location',
                                 label='Location', help_text=LOCATION_HELP_TEXT)
  
  class SuggestServiceForm(forms.Form):
      host_name = forms.CharField(max_length=300, required=True,
                                  help_text=HOST_NAME_HELP_TEXT)
      service_name = forms.CharField(max_length=20, required=True,
                                     help_text=SERVICE_NAME_HELP_TEXT)
      port = forms.IntegerField(required=True, help_text=PORT_HELP_TEXT)
      location = forms.CharField(max_length=300, required=False,
                                 help_text=LOCATION_HELP_TEXT)
  
  class WebsiteEventForm(forms.Form):
      website = forms.CharField(max_length=300, required=True)
      location = forms.CharField(max_length=300, required=True)
      first_detection = forms.DateTimeField(initial=datetime.date.today, required=False)
      event_type = forms.ChoiceField(choices=EVENT_TYPE, required=False)
  
  class ServiceEventForm(forms.Form):
      service = forms.CharField(max_length=300, required=True)
      location = forms.CharField(max_length=300, required=True)
      first_detection = forms.DateTimeField(initial=datetime.date.today, required=False)
      event_type = forms.ChoiceField(choices=EVENT_TYPE, required=False)
  
subject: Set help texts for suggestion forms.