def manage_addPhotoGallery(context, id, title, REQUEST=None): """Add an Inline Viewer""" v = PhotoGallery(id) v.title = unicode(title, 'UTF-8') context._setObject(id, v) add_and_edit(context, id, REQUEST) return ''
def manage_addSimpleMember(self, id, REQUEST=None): """Add a Simple Member.""" user = SimpleMember(id) self._setObject(id, user) user = self._getOb(id) user.manage_addLocalRoles(id, ['ChiefEditor']) add_and_edit(self, id, REQUEST) return ''
def manage_addVersionCleanUp(self, id, max_age, number_to_keep=None, pub_path=None, REQUEST=None): """Add a VersionCleanUp object.""" if not Id(self, id).isValid(): return object = VersionCleanUp(id, max_age, number_to_keep, pub_path) self._setObject(id, object) add_and_edit(self, id, REQUEST, 'manage_workspace') return ''
def manage_addCustomizationMarker(self, name, REQUEST=None): """Add a Customization Marker. """ marker = CustomizationMarker(name) self._setObject(name, marker) add_and_edit(self, name, REQUEST) return ""
def manage_addMyArticle(self, id, title, REQUEST=None): """Custom factory to show off that you can provide your own factory. """ article = Article(id) self._setObject(id, article) article = getattr(self, id) # For test only article.customCreation = True # As well we should create a version, and other stuff ... add_and_edit(self, id, REQUEST)
def manage_addCSBase(class_ref, context, id, title, postCreationHook=None, REQUEST=None): """Add a code source object""" if id in context.objectIds(): return u"""<p><a href="%s/manage_main">back</a></p><p><b>Object with id '%s' exists yet.</b></p>""" %(context.absolute_url(), id) cs = class_ref(id) cs.title = unicode(title, 'UTF-8') context._setObject(id, cs) if postCreationHook: postCreationHook(cs) add_and_edit(context, id, REQUEST, screen='editCodeSource') return ''
def manage_addOpenIDMember(self, identity_url, REQUEST=None): """Add a OpenID Member. """ utility = getUtility(IUserConverter, name="openid") converter = utility() userid = converter.convert(identity_url) user = SilvaOpenIDMember(identity_url, userid) self._setObject(userid, user) user = getattr(self, userid) user.manage_addLocalRoles(id, ['ChiefEditor']) add_and_edit(self, userid, REQUEST) return ''
def manage_addCodeSource( context, id, title=None, script_id=None, fs_location=None,REQUEST=None): """Add a CodeSource object """ cs = CodeSource(id, script_id, fs_location) if title is not None: title = unicode(title, cs.management_page_charset) cs.set_title(title) context._setObject(id, cs) cs = context._getOb(id) cs.set_form(ZMIForm('form', 'Parameters form', unicode_mode=1)) add_and_edit(context, id, REQUEST, screen='editCodeSource') return ''
def manage_addSQLSource(context, id, title=None, REQUEST=None): """Add a SQLSource object """ source = SQLSource(id) title = unicode(title, source.management_page_charset) source.title = title context._setObject(id, source) source = context._getOb(id) source._set_statement('SELECT <dtml-var columns> FROM <dtml-var table>') # parameters form reset_parameter_form(source) reset_table_layout(source) add_and_edit(context, id, REQUEST, screen='editSQLSource') return ''
def manage_addCodeSource(context, id, title=None, script_id=None, fs_location=None, REQUEST=None): """Add a CodeSource object """ cs = CodeSource(id, script_id, fs_location) if title is not None: title = unicode(title, cs.management_page_charset) cs.set_title(title) context._setObject(id, cs) cs = context._getOb(id) cs.set_form(ZMIForm('form', 'Parameters form', unicode_mode=1)) add_and_edit(context, id, REQUEST, screen='editCodeSource') return ''
def manage_addRoot(self, id, title, REQUEST=None): """Add a Silva root. """ if not title: title = id if not isinstance(title, str): title = str(title, 'latin1') id = str(id) container = self.Destination() # We suppress events are no local utility is present event # handlers all fails. root = Root(id) setattr(root, '__initialization__', True) container._setObject(id, root) root = container._getOb(id) # This root is the new local site where all local utilities (Silva # services) will be installed. make_site(root) setSite(root) setHooks() try: notify(InstallRootServicesEvent(root)) notify(InstallRootEvent(root)) root.set_title(title) delattr(root, '__initialization__') notify(ObjectCreatedEvent(root)) if REQUEST is not None: add_and_edit(self, id, REQUEST) except: # If there is an error, reset the local site. This prevent # more confusion. setSite(None) setHooks() raise return root
def manage_addRoot(self, id, title, REQUEST=None): """Add a Silva root. """ if not title: title = id if not isinstance(title, unicode): title = unicode(title, 'latin1') id = str(id) container = self.Destination() # We suppress events are no local utility is present event # handlers all fails. root = Root(id) setattr(root, '__initialization__', True) container._setObject(id, root) root = container._getOb(id) # This root is the new local site where all local utilities (Silva # services) will be installed. make_site(root) setSite(root) setHooks() try: notify(InstallRootServicesEvent(root)) notify(InstallRootEvent(root)) root.set_title(title) delattr(root, '__initialization__') notify(ObjectCreatedEvent(root)) if REQUEST is not None: add_and_edit(self, id, REQUEST) except: # If there is an error, reset the local site. This prevent # more confusion. setSite(None) setHooks() raise return root
def manage_addServiceSearchReplace( self, id='service_search_replace', title='', REQUEST=None): """add service to the ZODB""" id = self._setObject(id, ServiceSearchReplace(id, unicode(title, 'UTF-8'))) add_and_edit(self, id, REQUEST) return ''