diff --git a/plone/app/controlpanel/configure.zcml b/plone/app/controlpanel/configure.zcml
index 4274453..cac245b 100644
--- a/plone/app/controlpanel/configure.zcml
+++ b/plone/app/controlpanel/configure.zcml
@@ -7,15 +7,6 @@
-
-
diff --git a/plone/app/controlpanel/form.py b/plone/app/controlpanel/form.py
deleted file mode 100644
index 8c82f3f..0000000
--- a/plone/app/controlpanel/form.py
+++ /dev/null
@@ -1,57 +0,0 @@
-from zope.interface import implements
-from zope.component import getMultiAdapter
-from zope.event import notify
-
-from plone.fieldsets.form import FieldsetsEditForm
-from zope.formlib import form
-
-from Products.CMFPlone import PloneMessageFactory as _
-from Products.Five.browser import BrowserView
-from Products.Five.browser.pagetemplatefile import ViewPageTemplateFile
-from Products.statusmessages.interfaces import IStatusMessage
-
-from plone.app.form.validators import null_validator
-
-from plone.app.controlpanel.events import ConfigurationChangedEvent
-from plone.app.controlpanel.interfaces import IPloneControlPanelView
-from plone.app.controlpanel.interfaces import IPloneControlPanelForm
-
-from plone.protect import CheckAuthenticator
-
-
-class ControlPanelView(BrowserView):
- """A simple view to be used as a basis for control panel screens."""
-
- implements(IPloneControlPanelView)
-
-
-class ControlPanelForm(FieldsetsEditForm):
- """A simple form to be used as a basis for control panel screens."""
-
- implements(IPloneControlPanelForm)
- template = ViewPageTemplateFile('control-panel.pt')
-
- @form.action(_(u'label_save', default=u'Save'), name=u'save')
- def handle_edit_action(self, action, data):
- CheckAuthenticator(self.request)
- if form.applyChanges(self.context, self.form_fields, data,
- self.adapters):
- self.status = _("Changes saved.")
- notify(ConfigurationChangedEvent(self, data))
- self._on_save(data)
- else:
- self.status = _("No changes made.")
-
- @form.action(_(u'label_cancel', default=u'Cancel'),
- validator=null_validator,
- name=u'cancel')
- def handle_cancel_action(self, action, data):
- IStatusMessage(self.request).addStatusMessage(_("Changes canceled."),
- type="info")
- url = getMultiAdapter((self.context, self.request),
- name='absolute_url')()
- self.request.response.redirect(url + '/plone_control_panel')
- return ''
-
- def _on_save(self, data=None):
- pass
diff --git a/plone/app/controlpanel/widgets.py b/plone/app/controlpanel/widgets.py
deleted file mode 100644
index 2cc6c0f..0000000
--- a/plone/app/controlpanel/widgets.py
+++ /dev/null
@@ -1,301 +0,0 @@
-from zope.formlib.itemswidgets import MultiSelectWidget
-from zope.formlib.itemswidgets import DropdownWidget
-from zope.formlib.widget import renderElement
-from zope.component import queryMultiAdapter
-from zope.schema.interfaces import ITitledTokenizedTerm
-
-from Products.CMFPlone import PloneMessageFactory as _
-from plone.app.form.widgets import MultiCheckBoxWidget
-
-
-class DropdownChoiceWidget(DropdownWidget):
- """ """
-
- def __init__(self, field, request):
- """Initialize the widget."""
- super(DropdownChoiceWidget, self).__init__(field,
- field.vocabulary, request)
-
-
-class MultiCheckBoxVocabularyWidget(MultiCheckBoxWidget):
- """ """
-
- def __init__(self, field, request):
- """Initialize the widget."""
- super(MultiCheckBoxVocabularyWidget, self).__init__(field,
- field.value_type.vocabulary, request)
-
-
-class MultiCheckBoxColumnsWidget(MultiCheckBoxWidget):
- """ """
-
- how_many_columns = 2 # two by default
-
- def __init__(self, field, request):
- """Initialize the widget."""
- super(MultiCheckBoxColumnsWidget, self).__init__(field,
- field.value_type.vocabulary, request)
-
- def renderItemsWithValues(self, values):
- """Render the list of possible values, with those found in
- `values` being marked as selected.
-
- This code is mostly taken from from zope.formlib.itemswidgets
- import ItemsEditWidgetBase licensed under the ZPL 2.1.
- """
-
- cssClass = self.cssClass
-
- # multiple items with the same value are not allowed from a
- # vocabulary, so that need not be considered here
- rendered_items = []
- count = 0
-
- # XXX remove the inline styles!
- rendered_items.append('
')
-
- # Handle case of missing value
- missing = self._toFormValue(self.context.missing_value)
-
- if self._displayItemForMissingValue and not self.context.required:
- if missing in values:
- render = self.renderSelectedItem
- else:
- render = self.renderItem
-
- missing_item = render(count,
- self.translate(self._messageNoValue),
- missing,
- self.name,
- cssClass)
- rendered_items.append(missing_item)
- count += 1
-
- length = len(self.vocabulary)
- cc = self.how_many_columns
- breaks = [length % cc == 0 and length / cc or length / cc + 1]
- for b in range(2, cc):
- breaks.append(breaks[0] * b)
-
- # Render normal values
- for term in self.vocabulary:
- item_text = self.textForValue(term)
-
- if term.value in values:
- render = self.renderSelectedItem
- else:
- render = self.renderItem
-
- rendered_item = render(count,
- item_text,
- term.token,
- self.name,
- cssClass)
-
- rendered_items.append(rendered_item)
- count += 1
-
- if count in breaks:
- rendered_items.append('
')
-
- rendered_items.append('
')
-
- return rendered_items
-
-
-class MultiCheckBoxThreeColumnWidget(MultiCheckBoxColumnsWidget):
- """ """
- how_many_columns = 3
-
-
-class LanguageTableWidget(MultiCheckBoxWidget):
- """ """
-
- _joinButtonToMessageTemplate = u"""
-%s | %s | %s |
-
"""
-
- _table_start_template = u"""
-
-
-
- %s |
- %s |
- %s |
-
-
-
- """
-
- _table_end_template = u"""
"""
-
- def associateLabelWithInputControl(self):
- return None
-
- def __init__(self, field, request):
- """Initialize the widget."""
- super(LanguageTableWidget, self).__init__(field,
- field.value_type.vocabulary, request)
- # TODO: This is a bit hairy, but seems to work fine.
- context = self.context.context.context
- portal_state = queryMultiAdapter((context, request),
- name=u'plone_portal_state')
- self.languages = portal_state.locale().displayNames.languages
- self.territories = portal_state.locale().displayNames.territories
-
- def renderValue(self, value):
- return ''.join(self.renderItems(value))
-
- def renderItemsWithValues(self, values):
- """Render the list of possible values, with those found in
- `values` being marked as selected.
-
- This code is mostly taken from from zope.formlib.itemswidgets
- import ItemsEditWidgetBase licensed under the ZPL 2.1.
- """
-
- cssClass = self.cssClass
-
- # multiple items with the same value are not allowed from a
- # vocabulary, so that need not be considered here
- rendered_items = []
- count = 0
-
- rendered_items.append(self._table_start_template % (
- self.translate(_(u'heading_allowed_languages',
- default=u'Allowed languages')),
- self.translate(_(u'heading_language_allowed',
- default=u'Allowed?')),
- self.translate(_(u'heading_language',
- default=u'Language')),
- self.translate(_(u'heading_language_code',
- default=u'Code'))
- ))
-
- # Handle case of missing value
- missing = self._toFormValue(self.context.missing_value)
-
- if self._displayItemForMissingValue and not self.context.required:
- if missing in values:
- render = self.renderSelectedItem
- else:
- render = self.renderItem
-
- missing_item = render(count,
- self.translate(self._messageNoValue),
- missing,
- self.name,
- cssClass)
- rendered_items.append(missing_item)
- count += 1
-
- # Render normal values
- vocabulary = [(self.textForValue(term), term) for
- term in self.vocabulary]
-
- # Sort by translated name, this is lame and needs proper collation
- # support, but we don't have that yet.
- vocabulary.sort()
-
- for item_text, term in vocabulary:
- if term.value in values:
- render = self.renderSelectedItem
- else:
- render = self.renderItem
-
- css = count % 2 and cssClass + 'even' or cssClass + 'odd'
- rendered_item = render(count,
- item_text,
- term.token,
- self.name,
- css)
-
- rendered_items.append(rendered_item)
- count += 1
-
- rendered_items.append(self._table_end_template)
-
- return rendered_items
-
- def renderItem(self, index, text, value, name, cssClass):
- id = '%s.%s' % (name, index)
- el = renderElement('input',
- type="checkbox",
- cssClass=cssClass,
- name=name,
- id=id,
- value=value)
- return self._joinButtonToMessageTemplate % (cssClass, el, text, value)
-
- def renderSelectedItem(self, index, text, value, name, cssClass):
- id = '%s.%s' % (name, index)
- el = renderElement('input',
- type="checkbox",
- cssClass=cssClass,
- name=name,
- id=id,
- value=value,
- checked="checked")
- return self._joinButtonToMessageTemplate % (cssClass, el, text, value)
-
- def textForValue(self, term):
- """Extract a string from the `term`.
-
- The `term` must be a vocabulary tokenized term.
- """
- if ITitledTokenizedTerm.providedBy(term):
- if '-' in term.value:
- code, territory = term.value.split('-')
- territory = territory.upper()
- result = self.languages.get(code, None)
- # If we don't have a translation for the language, return the
- # English one and don't bother with the country name
- if result is None or result == code:
- return term.title
- territory = self.territories.get(territory, territory)
- result = "%s (%s)" % (result, territory)
- else:
- result = self.languages.get(term.value, None)
- # If we don't have a translation for the language, return the
- # default English text, rather than the language code
- if result is None or result == term.value:
- return term.title
- return result
- return term.token
-
-
-class MultiSelectTupleWidget(MultiSelectWidget):
- """Provide a selection list for the tuple to be selected."""
-
- def _toFieldValue(self, input):
- value = super(MultiSelectWidget, self)._toFieldValue(input)
- if isinstance(value, list):
- value = tuple(value)
- return value
-
-
-class AllowedTypesWidget(MultiCheckBoxWidget):
- """ A widget for activating and deactivating mimetypes with special
- considerations for types
- whose transformation is not installed locally.
-
- a format can have the following states:
-
- 1. active (i.e. selected and deselectable)
- 2. inactive (i.e. not selected but selectable)
- 3. deactivated (i.e. not selected and not selectable)
- 4. default (i.e. selected and not deselectable)
-
- TODO:
- * computation of state for each format
- * rendering of those states
- """
-
- def __init__(self, field, request):
- """Initialize the widget."""
- super(AllowedTypesWidget, self).__init__(field,
- field.value_type.vocabulary, request)