Example #1
0
class EditMenuItem(MenuItem):
    menu(IDocumentActions)
    title(u'Bearbeiten')
    name('edit')
    order(20)

    @property
    def available(self):
        return getattr(self.context, 'isEditable', False)
Example #2
0
class DeleteMenuItem(MenuItem):
    menu(IDocumentActions)
    title('Entfernen')
    name('delete')
    order(30)

    @property
    def available(self):
        return getattr(self.context, 'isDeletable', False)
Example #3
0
class AddForm(Form):
    title(u'Erstellen')
    _finishedAdd = False

    @action(u'Speichern', identifier="uvcsite.add")
    def handleAdd(self):
        data, errors = self.extractData()
        if errors:
            self.flash('Es sind Fehler aufgetreten')
            return
        obj = self.createAndAdd(data)
        if obj is not None:
            # mark only as finished if we get the new object
            self._finishedAdd = True

    def createAndAdd(self, data):
        obj = self.create(data)
        notify(zope.lifecycleevent.ObjectCreatedEvent(obj))
        self.add(obj)
        return obj

    def create(self, data):
        raise NotImplementedError

    def add(self, object):
        raise NotImplementedError

    def nextURL(self):
        raise NotImplementedError

    def render(self):
        if self._finishedAdd:
            raise HTTPFound(self.nextURL())
            self.request.response.redirect(self.nextURL())
            return ""
        return super(AddForm, self).render()
Example #4
0
class PaintingOwner(grokcore.security.Role):
    grok.name('paint.PaintingOwner')
    grok.title('Painting Owner')
    grokcore.security.permissions('paint.ViewPainting', 'paint.EditPainting',
                                  'paint.ErasePainting')
Example #5
0
class DeleteForm(crud.Delete, Form):
    title(u'Entfernen')
    baseclass()
    actions = crud.Delete.actions
    title = u"Objekt bearbeiten"
Example #6
0
class DisplayMenuItem(MenuItem):
    menu(IContextualActionsMenu)
    title(u'Anzeigen')
    name('index')
    order(10)
Example #7
0
class DefaultView(DisplayForm):
    name('index')
    title(u'Anzeigen')
    baseclass()
    responseFactory = Response
    make_response = make_layout_response
Example #8
0
class DisplayForm(crud.Display, Form):
    title(u'Anzeigen')
    baseclass()
Example #9
0
class EditForm(crud.Edit, Form):
    title(u'Bearbeiten')
    baseclass()
    title = u"Objekt löschen"
Example #10
0
class RoleWithI18nTitle(Role):
    grok.name('RoleWithI18nTitle')
    grok.title(_('RoleWithI18n'))
    grok.description(_('My role with i18n'))