def action_send(self, action, data): status = IStatusMessage(self.request) new_path_key = data['path_key'] if self.context.hasProperty('path_key'): old_path_key = self.context.get('path_key', None) if old_path_key and not new_path_key: self.context.manage_delProperties(['path_key']) noLongerProvides(self.context, IPathkey) status.addStatusMessage(_("Succesfully deleted the pathkey.")) elif new_path_key: self.context.manage_changeProperties( {'path_key': new_path_key}) status.addStatusMessage( _("Modification of the pathkey succeeded.")) else: if new_path_key: self.context.manage_addProperty('path_key', new_path_key, 'string') alsoProvides(self.context, IPathkey) status.addStatusMessage(_("Added a new pathkey.")) self.context.reindexObject(idxs=['object_provides']) self.response.redirect(self.context.absolute_url()) return ''
class IPathkeyForm(Interface): """ A pathkey schema """ path_key = Password( title=_(u'Pathkey'), description=_( u'If you want to protect contents of this folder, set a pathkey.'), required=False)
class IPathkeyEnglishForm(Interface): """ English pathkey content """ pathkeyTitle_en = schema.TextLine( title=_(u"Legend text"), description=_(u"You can give custom legend text"), required=False, default=u"Pathkey", ) pathkeyDescription_en = schema.SourceText( title=_(u"Additional description for pathkey requester form"), required=False, default= u"Access restricted by contents owner. Please give correct pathkey to continue.", )
class IPathkeyFinnishForm(Interface): """ Finnish pathkey content """ pathkeyTitle_fi = schema.TextLine( title=_(u"Legend text"), description=_(u"You can give custom legend text"), required=False, default=u"Polkuavain", ) pathkeyDescription_fi = schema.SourceText( title=_(u"Additional description for pathkey requester form"), required=False, default= u"Sisällön omistaja on estänyt pääsyn sisältöön. Anna oikea polkuavain jatkaaksesi.", )
def action_send(self, action, data): status = IStatusMessage(self.request) new_pathkey = data['path_key'] delete_enabled = data['reset_pathkey'] new_pathkey_owner = data['pathkey_owner'] new_pathkey_owner_email = data['pathkey_owner_email'] try: old_pathkey = self.context.path_key except: old_pathkey = None if delete_enabled: self.deletePathkey() status.addStatusMessage(_(u"Succesfully deleted the pathkey.")) elif old_pathkey: if not new_pathkey: self.deletePathkey() status.addStatusMessage(_(u"Succesfully deleted the pathkey and related information.")) elif new_pathkey: self.setPathkeyInfo(new_pathkey, new_pathkey_owner, new_pathkey_owner_email, modify=True) status.addStatusMessage(_("Modification of the pathkey succeeded.")) else: if new_pathkey: self.setPathkeyInfo(new_pathkey, new_pathkey_owner, new_pathkey_owner_email) alsoProvides(self.context, IPathkey) status.addStatusMessage(_("Added a new pathkey and related information about pathkey owner.")) self.context.reindexObject(idxs=['object_provides']) self.response.redirect(self.context.absolute_url()) return ''
def action_send(self, action, data): status = IStatusMessage(self.request) new_path_key = data['path_key'] if self.context.hasProperty('path_key'): old_path_key = self.context.get('path_key', None) if old_path_key and not new_path_key: self.context.manage_delProperties(['path_key']) noLongerProvides(self.context, IPathkey) status.addStatusMessage(_("Succesfully deleted the pathkey.")) elif new_path_key: self.context.manage_changeProperties({'path_key': new_path_key}) status.addStatusMessage(_("Modification of the pathkey succeeded.")) else: if new_path_key: self.context.manage_addProperty('path_key', new_path_key, 'string') alsoProvides(self.context, IPathkey) status.addStatusMessage(_("Added a new pathkey.")) self.context.reindexObject(idxs=['object_provides']) self.response.redirect(self.context.absolute_url()) return ''
class PathkeyControlPanelForm(ControlPanelForm): """ Pathkey control panel """ implements(IPathkeyControlPanelForm) pathkey_finnish = FormFieldsets(IPathkeyFinnishForm) pathkey_finnish.id = 'pathkey_finnish' pathkey_finnish.label = _(u"Additional Finnish content") pathkey_english = FormFieldsets(IPathkeyEnglishForm) pathkey_english.id = 'pathkey_english' pathkey_english.label = _(u"Additional English content") pathkey_listing = FormFieldsets(IPathkeyListing) pathkey_listing.id = 'pathkey_listing' pathkey_listing.label = _(u"List all pathkeys") form_fields = FormFieldsets(pathkey_finnish, pathkey_english, pathkey_listing) form_name = _(u"Pathkey settings") label = _(u"Pathkey settings") description = _( u"Here you can customize the contents of the form requesting pathkey.")
class IPathkeyCheck(Interface): """Pathkey requester interface""" pathkey = Password(title=_(u"Pathkey"), required=True)