from zope import interface from zope.component import getUtility, queryUtility, getSiteManager from memphis import form, config, view, storage from memphis.contenttype import pagelets from memphis.contenttype.form import AddContentForm from memphis.contenttype.interfaces import _, IContent, IContentType, IDCDescriptive, IAddContentForm, IEditContentForm config.action(view.registerDefaultView, "index.html", IContent) config.action( view.registerActions, ("index.html", IContent, _("View"), _("View content."), 10), ("edit.html", IContent, _("Edit"), _("Edit content."), 20), ) class AddContent(form.EditForm, AddContentForm, view.View): interface.implements(IAddContentForm) view.pyramidView("", IContentType) fields = form.Fields() validate = AddContentForm.validate @property def label(self): return "Add content: %s" % self.context.title
from pyramid import url from memphis import config, view from memphis.contenttype import pagelets from memphis.contenttype.interfaces import \ _, IContained, IContainer, \ IContentType, IContentContainer, IDCTimes, IDCDescriptive config.action( view.registerDefaultView, 'listing.html', IContentContainer) config.action( view.registerActions, ('listing.html', IContentContainer, _('Listing'), _('Container listing.'), 11)) class Listing(view.Pagelet): view.pagelet( pagelets.IListing, IContentContainer, template = view.template('memphis.contenttype:templates/listing.pt')) def update(self): self.url = url.resource_url(IContained(self.context), self.request) self.container = IContainer(self.context) try: self.hasitems = self.container.keys().next() except StopIteration: self.hasitems = False
from zope.component import getSiteManager, queryUtility, getUtilitiesFor from memphis import form, config, view, storage from memphisttw import schema from memphis.contenttype.interfaces import _ from memphis.contenttype.interfaces import ISchemaType, IBehaviorType from memphis.contenttype.interfaces import IContent, IContentTypeSchema config.action( view.registerDefaultView, 'index.html', IContentTypeSchema) config.action( view.registerActions, ('index.html', IContentTypeSchema, _('View'), _('View content type'), 10), ('edit.html', IContentTypeSchema, _('Edit'), _('Edit content type'), 20), ('schemas.html', IContentTypeSchema, _('Schemas'), _('Content type schemas'), 30), ('behaviors.html', IContentTypeSchema, _('Behaviors'), _('Content type behaviors'), 40), ('actions.html', IContentTypeSchema, _('Actions'), _('Content type actions'), 50)) class ContentTypeView(view.View): view.pyramidView( 'index.html', IContentTypeSchema, template = view.template( 'memphis.contenttype:templates/contenttype.pt'))