def handle_save_action(self, action, data): CheckAuthenticator(self.request) if form.applyChanges(self.context, self.form_fields, data, self.adapters): self.status = _Plone("Changes saved.") self._on_save(data) else: self.status = _Plone("No changes made.") setupTool = SetupMultilingualSite() output = setupTool.setupSite(self.context) self.status += output
def handle_cancel_action(self, action, data): IStatusMessage(self.request).addStatusMessage( _Plone("Changes canceled."), type="info") url = getMultiAdapter((self.context, self.request), name='absolute_url')() self.request.response.redirect(url + '/plone_control_panel') return ''
class LanguageControlPanel(BasePanel): """A modified language control panel, allows selecting multiple languages. """ template = ViewPageTemplateFile('templates/controlpanel.pt') form_fields = FormFieldsets(selection, options, policies, extras) label = _("Multilingual Settings") description = _("All the configuration of P.A.M. If you want to set " "the default language to all the content without language " "and move all the content on the root folder to the " "default language folder, go to Extra Options section ") form_name = _("Multilingual Settings") @form.action(_(u'label_save', default=u'Save'), name=u'save') def handle_save_action(self, action, data): CheckAuthenticator(self.request) if form.applyChanges(self.context, self.form_fields, data, self.adapters): self.status = _Plone("Changes saved.") self._on_save(data) else: self.status = _Plone("No changes made.") setupTool = SetupMultilingualSite() output = setupTool.setupSite(self.context) self.status += output @form.action(_Plone(u'label_cancel', default=u'Cancel'), validator=null_validator, name=u'cancel') def handle_cancel_action(self, action, data): IStatusMessage(self.request).addStatusMessage( _Plone("Changes canceled."), type="info") url = getMultiAdapter((self.context, self.request), name='absolute_url')() self.request.response.redirect(url + '/plone_control_panel') return '' isLPinstalled = isLPinstalled