def remove(self): request = self.request view = request.get('view', '') portal = getToolByName(self.context, 'portal_url').getPortalObject() site = getNavigationRootObject(self.context, portal) ISuggestionsStorage(site).remove_suggestion(id=IUUID(self.context)) IStatusMessage(self.request).addStatusMessage( _("The element has been removed from suggestions")) self.request.response.redirect(self.context.absolute_url() + '/' + view)
def add(self): request = self.request view = request.get('view', '') portal = getToolByName(self.context, 'portal_url').getPortalObject() site = getNavigationRootObject(self.context, portal) ISuggestionsStorage(site).add_suggestion( id=IUUID(self.context), type='uid', view=view, date=datetime.now()) if IFolderish.providedBy(self.context): IStatusMessage(self.request).addStatusMessage( _("The folder has been added to suggestions")) elif IContentish.providedBy(self.context): IStatusMessage(self.request).addStatusMessage( _("The document has been added to suggestions")) else: IStatusMessage(self.request).addStatusMessage( _("The element has been added to suggestions")) self.request.response.redirect(self.context.absolute_url() + '/' + view)
def title(self): return _(u"Suggested content")