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 = '
%s%s
'%(results, tag3) return results security.declarePrivate('getId') def getId(self): return self.id 7. Save. 8. Create new file in Filesystem Products/COREBLog/dtml. Save the file as manageAddImage.dtml Copy and paste the source code found in the APPENDIX after step 11. 9. Restart Zope or Refresh the COREBlog product from the Zope Management Interface (ZMI) 10. From ZMI customize "entry_body" COREBlog skin. Insert dtml statements and around your body. Below I show a clip of code to show where I inserted my statements. [by CodeSyntax: this change is already made in the entry_body DTML Method in the ZEXP]

11. You should be done. Enjoy. # APPENDIX # manageAddImage.dtml

Add and manage images

Image
Placement in entry
Display Size
Zoom Size
Border
Caption
 
Del
Image
Position
Display size
Zoom
Border
Caption
">
    3- The so called 'weofije' bug: Excerpts for RSS entries are created cutting the original text, and instead of adding '...' or something like that, COREBlog adds 'weofije'. So, we changed it to add just '...' Open utility.py file and search get_string_part method. Change 'weofije' by '...' 4- Redirections: As we've created new forms for entry adding/editing, we've change some COREBlog redirections to redirect correctly to our forms. We know this is not the best way to do this so I hope we will change this for future releases. You will find these changes searching for 'webetik' in COREBlog source code. 5- There is another patch we'd like to include: create XHTML with COREBlog. If you write or
or
in entries COREBlog "cleans" them using stripogram utility. There is a patch for that script, documented at http://www.randynetwork.com/blog/32 but we don't know japanese ;)