[Checkins] SVN: zope3org/trunk/src/zorg/ Removed dependencies on zorg.ajax.livepage

Uwe Oestermeier uwe_oestermeier at iwm-kmrc.de
Fri May 26 04:02:15 EDT 2006


Log message for revision 68302:
  Removed dependencies on zorg.ajax.livepage

Changed:
  U   zope3org/trunk/src/zorg/ajax/configure.zcml
  U   zope3org/trunk/src/zorg/wikification/browser/README.txt
  D   zope3org/trunk/src/zorg/wikification/browser/comment.py
  U   zope3org/trunk/src/zorg/wikification/browser/configure.zcml
  U   zope3org/trunk/src/zorg/wikification/browser/templates/wiki_image.pt
  U   zope3org/trunk/src/zorg/wikification/browser/wikilink.py

-=-
Modified: zope3org/trunk/src/zorg/ajax/configure.zcml
===================================================================
--- zope3org/trunk/src/zorg/ajax/configure.zcml	2006-05-26 07:45:39 UTC (rev 68301)
+++ zope3org/trunk/src/zorg/ajax/configure.zcml	2006-05-26 08:02:14 UTC (rev 68302)
@@ -9,74 +9,5 @@
 		name="zorgajax"
 		directory="./javascript"
 		/>
-	
-  
-  <page
-        name="input"
-        for="zorg.ajax.interfaces.ILivePage"
-        class="zorg.ajax.livepage.Input"
-        permission="zope.Public">
-
-  </page>
-  
-  <page
-        name="output"
-        for="zorg.ajax.interfaces.ILivePage"
-        class="zorg.ajax.livepage.Output"
-        permission="zope.Public">
-
-  </page>
-  
-  <pages
-        for="*"
-        class="zorg.ajax.livepage.LivePage"
-        permission="zope.Public">
-            
-        <page 
-            name="livepage"
-            attribute="render" />
-                        
-        <page 
-            name="liveExample"
-            attribute="render" />
-                        
-  </pages>
-  
-  <pages
-        for="*"
-        class="zorg.ajax.livepage.LiveChanges"
-        permission="zope.Public">
-    
-        <page 
-            name="streamEvents"
-            attribute="streamEvents" />
-                        
-  </pages>
-  
-  
- 
-  <zope:class class="zorg.ajax.livepage.IterBuffer">
-    
-	<require
-		permission="zope.Public"
-		attributes="next __iter__"/>   
-			
-  </zope:class>
-  
-
- <zope:class class="twisted.web2.wsgi.FileWrapper">
-    
-	<require
-		permission="zope.Public"
-		attributes="next __iter__"/>   
-			
-  </zope:class>
-  
-  
-  <zope:subscriber
-        for="zope.app.event.interfaces.IObjectEvent"
-        handler="zorg.ajax.livepage.livePageSubscriber"
-        />
               
-              
 </configure>

Modified: zope3org/trunk/src/zorg/wikification/browser/README.txt
===================================================================
--- zope3org/trunk/src/zorg/wikification/browser/README.txt	2006-05-26 07:45:39 UTC (rev 68301)
+++ zope3org/trunk/src/zorg/wikification/browser/README.txt	2006-05-26 08:02:14 UTC (rev 68302)
@@ -165,7 +165,10 @@
                 </tr>
     <BLANKLINE>
                 <tr>
-                    <td>&nbsp;		
+                    <td>&nbsp;
+                        <input type="hidden" name="scope"
+                               id="scope" value="on">        
+    <BLANKLINE>
                     </td>
                     <td>
                         <input name="entry_submit" type="submit" value="Submit">

Deleted: zope3org/trunk/src/zorg/wikification/browser/comment.py
===================================================================
--- zope3org/trunk/src/zorg/wikification/browser/comment.py	2006-05-26 07:45:39 UTC (rev 68301)
+++ zope3org/trunk/src/zorg/wikification/browser/comment.py	2006-05-26 08:02:14 UTC (rev 68302)
@@ -1,138 +0,0 @@
-##############################################################################
-#
-# Copyright (c) 2005 Zope Corporation and Contributors.
-# All Rights Reserved.
-#
-# This software is subject to the provisions of the Zope Public License,
-# Version 2.1 (ZPL).  A copy of the ZPL should accompany this distribution.
-# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
-# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
-# FOR A PARTICULAR PURPOSE.
-#
-##############################################################################
-"""
-
-$Id: comment.py 38895 2005-10-07 15:09:36Z dominikhuber $
-"""
-__docformat__ = 'restructuredtext'
-
-import zope
-
-from zope.interface import implements
-from zope.component import adapts
-from zope.app import zapi
-from zope.publisher.browser import TestRequest
-from zope.app.pagetemplate.viewpagetemplatefile import ViewPageTemplateFile
-from zope.app.publisher.browser import BrowserView
-from zope.app.dublincore.interfaces import IZopeDublinCore
-
-from zope.app.event.interfaces import IObjectModifiedEvent
-from zope.app.event.interfaces import ISequence
-
-
-from zorg.comment import IComments
-from zorg.comment.browser.comment import getFullName
-
-from zorg.ajax.page import PageElement
-from zorg.ajax.interfaces import IAjaxUpdateable
-
-from zorg.ajax.livepage import LivePage
-from zorg.ajax.livepage import LivePageClient
-from zorg.ajax.livepage import clients
-
-from zorg.wikification.browser.wikipage import WikiPage
-        
-class CommentsList(PageElement) :
-    """ A simple list view for comments. 
-    """
-
-    implements(IAjaxUpdateable)
-    
-    _comment = ViewPageTemplateFile("./templates/comment.pt")
-        
-    def __init__(self, page) :
-        super(CommentsList, self).__init__(page)
-        self.comments = IComments(self.context)
-        
-    def render(self, method=None, parameter=None) :
-    
-        result = ['<div id="comments">']
-        
-        comments = self.comments
-        for key, value in comments.items() :
-            info = self.info = dict()
-            dc = IZopeDublinCore(value)
-            info['key'] = key
-            info['who'] = ", ".join(getFullName(x) for x in dc.creators)
-            info['when'] = dc.created
-            info['text'] = unicode(value.data, encoding="utf-8")
-            
-            result.append(self._comment())
-        
-        result.append('</div>')
-        
-        return "".join(result)
-        
-        
-class LiveComments(WikiPage, LivePage) :
-    """ A view that shows all added comments 'live', i.e. the view
-        is updated in all browsers as soon as the server side
-        list of comments changes.
-        
-        
-        XXX: has to be rewritten since LivePages are now in zorg.live
-       
-    """
-    
-    _comments = ViewPageTemplateFile("./templates/comments.pt")
-    
-    def __init__(self, context, request) :
-        super(LiveComments, self).__init__(context, request)
-        self.comments = CommentsList(self)
-    
-    def online(self) :
-        global clients
-        members = set()
-        for client in clients :
-            members.add(client.principal.title)
-        return sorted(members)
-                                    
-    def notify(cls, event) :
-        if IObjectModifiedEvent.providedBy(event) :
-            for desc in event.descriptions :
-                if ISequence.providedBy(desc) :
-                    if IComments == desc.interface :
-                        page = LiveComments(event.object, TestRequest())
-                        html = page.innerPart("comments")
-                        response = 'update comments\n%s' % (html)
-                        cls.sendResponse(response)
-
-    notify = classmethod(notify)
-    
-    def render(self) :
-        return self._comments()
-        
-
-
-
-class AddComment(WikiPage) :
-    """ A simple add view for comments. Allows the user to type comments
-        and submit them.
-        
-    """
-    
-    def __init__(self, context, request) :
-        super(AddComment, self).__init__(context, request)
-        self.title = u"Add Comment"
-        
-    def nextURL(self) :
-        url = zapi.absoluteURL(self.context, self.request)
-        return url + "/@@wikiaddcomment.html"
-         
-    def addComment(self, text) :
-        comments = IComments(self.context)
-        comments.addComment(text)
-        
-        self.request.response.redirect(self.nextURL())
-        

Modified: zope3org/trunk/src/zorg/wikification/browser/configure.zcml
===================================================================
--- zope3org/trunk/src/zorg/wikification/browser/configure.zcml	2006-05-26 07:45:39 UTC (rev 68301)
+++ zope3org/trunk/src/zorg/wikification/browser/configure.zcml	2006-05-26 08:02:14 UTC (rev 68302)
@@ -56,37 +56,6 @@
         attribute="wikiCommandForm"
         permission="zope.View"
         />
-
-    <pages  
-      for="zorg.comment.IAttributeAnnotableComments"
-      class="zorg.wikification.browser.comment.LiveComments"
-      permission="zope.View">
-                        
-      <page 
-            name="wikicomment.html"
-            attribute="render"
-            title="Comments"
-            menu="zmi_views" />
-            
-            
-    </pages>
-      
-    <pages		
-     
-      for="zorg.comment.IAttributeAnnotableComments"
-      class="zorg.wikification.browser.comment.AddComment"
-      permission="zope.View">
-      
-      <page  
-            name="wikiaddcomment.html"
-            template="./templates/add_comment.pt" />
-            
-      <page
-            name="wikisubmitcomment.html"
-            attribute="addComment" />
-            
-    </pages>
-      
                
     <pages
       class=".wikipage.EditWikiPage"

Modified: zope3org/trunk/src/zorg/wikification/browser/templates/wiki_image.pt
===================================================================
--- zope3org/trunk/src/zorg/wikification/browser/templates/wiki_image.pt	2006-05-26 07:45:39 UTC (rev 68301)
+++ zope3org/trunk/src/zorg/wikification/browser/templates/wiki_image.pt	2006-05-26 08:02:14 UTC (rev 68302)
@@ -58,6 +58,38 @@
                         <span tal:replace="view/unicodeLabel">Name</span>&quot;.
                 </td>   
             </tr>
+            <tr> 
+                <td valign="top" class="wiki-field">
+                    Image width: 
+                </td>
+                <td valign="top" class="wiki-field">
+                    <input style="float:left;" id="maxwidth" name="maxwidth" 
+                            type="text" size="5" value="200" 
+                            tal:attributes="value string:${view/maxwidth}" />
+                            
+                    <div>Maximum width of the image in pixel.<br/>
+                    Smaller images will be shown in original size.<br/>
+                    We recommend 40 pixel for thumbnails, <br/>
+                    100 for small, 200 for medium size images.</div>
+                </td>   
+            </tr>
+            <tr> 
+                <td valign="top" class="wiki-field">
+                    Image align: 
+                </td>
+                <td valign="top" class="wiki-field">
+                    <select id="alignment" name="alignment">
+                        <optgroup label="Options">
+                            <option label="-- Not set --" value="" selected>-- Not Set --</option>
+                            <option label="Top" value="top" >Top</option>
+                            <option label="Middle" value="middle">Middle</option>
+                            <option label="Bottom" value="bottom" >Bottom</option>
+                            <option label="Left" value="left">Left</option>
+                            <option label="Right" value="right" >Right</option>
+                        </optgroup>
+                    </select>
+                </td>   
+            </tr>
             <tr>
                 <td>&nbsp;
                     <input tal:condition="view/isUnique" type="hidden" 

Modified: zope3org/trunk/src/zorg/wikification/browser/wikilink.py
===================================================================
--- zope3org/trunk/src/zorg/wikification/browser/wikilink.py	2006-05-26 07:45:39 UTC (rev 68301)
+++ zope3org/trunk/src/zorg/wikification/browser/wikilink.py	2006-05-26 08:02:14 UTC (rev 68302)
@@ -28,6 +28,7 @@
 from zope.app.pagetemplate.viewpagetemplatefile import ViewPageTemplateFile
 from zope.app.dublincore.interfaces import IZopeDublinCore
 from zope.app.file import File
+from zope.app.file.image import Image
 from zope.app.folder import Folder
 from zope.app.file.interfaces import IFile
 from zope.app.event.objectevent import ObjectCreatedEvent
@@ -767,6 +768,9 @@
         if not contenttype :
             contenttype = contenttypes.guess_content_type(filename)[0]
      
+        return self._addFile(name, data, contenttype)
+       
+    def _addFile(self, name, data, contenttype) :
         return self._addObject(name, File(data, contenttype))
         
 class UploadImagePlaceholder(UploadFilePlaceholder) :
@@ -774,10 +778,31 @@
     
     title = u"Upload Image"
     _form = ViewPageTemplateFile("./templates/wiki_image.pt")
+    maxwidth = 200
     
+    def _addFile(self, name, data, contenttype) :
+        self._image = Image(data)
+        return self._addObject(name, self._image)
+    
     def performSubstitution(self) :
+    
+        alignment = self.page.parameter('alignment', type=str, default='')
+        
+        try :
+            maxwidth = self.page.parameter('maxwidth', 
+                                            type=int, default=self.maxwidth)
+        except ValueError :
+            maxwidth = self.maxwidth
+            
         name = self.apply()
-        self.new_link = '<img src="%s"/>' % (name)
+        width, height = self._image.getImageSize()
+        if width > maxwidth :
+            height = (height * maxwidth) / width
+            width = maxwidth
+         
+        alt = IZopeDublinCore(self._image).title.encode('utf-8')
+        pat = '<img src="%s" alt="%s" width="%s" height="%s" align="%s"/>'
+        self.new_link = pat % (name, alt, width, height, alignment)
         return self.new_link
 
     



More information about the Checkins mailing list