CHANGES MADE TO COREBlog 1.1 We haven't tested it with earlier versions, these changes should work, but be carefull, because line numbers may change and the patch files may don't work. All these changes are included in the COREBlog11-CodeSyntax.tgz file. To use these changes, you must install: COREBlog 1.1 and make the changes below OR install the already patched COREBlog11-CodeSyntax.tgz we provide. Localizer (http://www.localizer.org), we use 1.0.1, but should work with older and newer versions. ImageMagick 5.5.7.11 (http://www.imagemagick.org/script/binary-releases.php or http://www.imagemagick.org/script/resources.php) or PIL (Python Image Library - http://www.pythonware.com/products/pil/) for images in entries Photo 1.2.3 http://www.zope.org/Members/rbickers/Photo/ 1- Entry date changing: Documented at coreblog-en mailing list. Message available at: http://www.mail-archive.com/coreblog-en%40postaria.com/msg00090.html and at COREBlog bug collector: http://www.zope.org/Members/ats/COREBlog/Collector.2003-10-11.2831/102 2- Images in entries using entry editing form: (Original recipe by Brady Davis and Jeffrey Hicks) ---------------------------- Begin Recipe ----------------------------> Tested with -------------------------------- * COREBlog 0.53b * Photo 1.2.3 http://www.zope.org/Members/rbickers/Photo/ * ImageMagick 5.5.7.11 * Zope 2.6.2 * Python Version 2.1.3 [by CodeSyntax: We have tested it with COREBlog 1.1 and Zope 2.6.1b1 ] Recipe --------------------------------- 1. Backup your stuff 2. In COREBLog product folder on fileystem in import modules sections of Entry.py add: from OFS.ObjectManager import ObjectManager 3. Scroll down and change the class Entry definition to extend ObjectManager as follows: class Entry(ObjectBase, ObjectManager, Management.Tabs,Undo.UndoSupport): 4. Scroll down and add this list item to the manage_options list {'label':'Images','icon':'', 'action':'manage_images', 'target': 'manage_main'}, 5. Scroll down and add these statements near the other similar HTMLFile statements security.declareProtected(ManageCOREBlog, 'manage_other') manage_images = HTMLFile('dtml/manage_addImage',globals()) 6. Scroll down and add the following methods and security statements inside the class body [by CodeSyntax: BE CAREFULL WITH INDENTATION !!] security.declareProtected(AddCOREBlogEntries, 'manage_addImageScript') def manage_addImageScript(self): context = self if context.REQUEST.has_key('pic1'): file = context.REQUEST['pic1'] name = context.ZopeTime().strftime('img_%b_%d_%Y_%M_%S') context.manage_addProduct['Photo'].manage_addPhoto(name,name,file) photo = getattr(context,name) for property in ['placement','border','display_size','zoom','caption']: photo.manage_addProperty(property, context.REQUEST[property], 'string') if context.REQUEST.has_key('deletebox'): ids = context.REQUEST['deletebox'] context.manage_delObjects(ids) return '' security.declareProtected(View, 'images_top') def images_top(self): """ images_top method """ photos = self.objectValues('Photo') results = '' for p in photos: placement = p.getProperty('placement') if placement.find('top')>=0: if placement.find('left')>=0: float = 'float: left; margin-right: 1em; margin-bottom: .5em;' else: float = 'float: right; margin-left: 1em; margin-bottom: .5em;' tag1 = p.tag(display=p.getProperty('display_size'), alt=p.getProperty('caption'), css_class=None, style='border: %s; %s') tag2 = tag1%(p.getProperty('border'), float) zoom = p.getProperty('zoom') if zoom.find('no zoom') >= 0: tag3 = tag2 else: tag3 = '%s'%(p.absolute_url(),zoom,tag2) results = '%s%s'%(results, tag3) return results security.declareProtected(View, 'images_bottom') def images_bottom(self): """ images bottom method """ photos = self.objectValues('Photo') results = '' for p in photos: placement = p.getProperty('placement') if placement.find('bottom')>=0: tag1 = p.tag(display=p.getProperty('display_size'), alt=p.getProperty('caption'), css_class=None, style='border: %s;') tag2 = tag1%(p.getProperty('border'),) zoom = p.getProperty('zoom') if zoom.find('no zoom') >= 0: tag3 = tag2 else: tag3 = '%s'%(p.absolute_url(),zoom,tag2) results = '
Add and manage images