|
|
| <prev next> |
Choosing A Webhost: |
CMFBoard/skins/cmfboard forum_message_view1.pt,NONE,1.1 forum_quote.py,NONE: msg#00114web.zope.plone.collective.cvs
Update of /cvsroot/collective/CMFBoard/skins/cmfboard In directory sc8-pr-cvs1:/tmp/cvs-serv16386/skins/cmfboard Modified Files: discussion_reply.py forum_add_reply.py forum_add_topic_form.pt forum_blog_widget.pt forum_message_flat.pt forum_topic.pt forum_topic_flat.pt forum_topic_full_thread.pt forum_topic_thread.pt forum_topic_widget.pt forum_view.pt validate_add_reply.py validate_discussion_reply.py viewThreadsAtBottom.pt Added Files: forum_message_view1.pt forum_quote.py forum_reply_form.pt forum_topic_nested.pt Log Message: * almost all work for threding is done Index: validate_discussion_reply.py =================================================================== RCS file: /cvsroot/collective/CMFBoard/skins/cmfboard/validate_discussion_reply.py,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- validate_discussion_reply.py 24 Oct 2003 09:12:14 -0000 1.2 +++ validate_discussion_reply.py 31 Oct 2003 22:28:26 -0000 1.3 @@ -15,10 +15,23 @@ if form.has_key('cancel'): return ('cancel', {}, {'portal_status_message':'Reply creation canceled.'}) + validator = context.portal_form.createForm() +validator.addField('title', 'String', required=1) validator.addField('content', 'String', required=1) - errors = validator.validate(context.REQUEST) + +talkback = context.portal_discussion.getDiscussionFor(context) + +imagefile = request.get('image', '') +if hasattr(imagefile, 'filename'): + if talkback.image_size < len(imagefile.read()): + errors['image']='Max size exceeded.' + +file = request.get('file', '') +if hasattr(file, 'filename'): + if talkback.file_size < len(file.read()): + errors['file']='Max size exceeded.' if errors: return ('failure', errors, {'portal_status_message':'Please correct the indicated errors.'}) Index: forum_topic_widget.pt =================================================================== RCS file: /cvsroot/collective/CMFBoard/skins/cmfboard/forum_topic_widget.pt,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- forum_topic_widget.pt 31 Oct 2003 11:41:29 -0000 1.5 +++ forum_topic_widget.pt 31 Oct 2003 22:28:26 -0000 1.6 @@ -4,92 +4,56 @@ </head> <body> - <div metal:define-macro="message"> - <table width="100%" class="ftable"> - <tr class="shadedarker" tal:define="creator msg/Creator" - tal:attributes="class python:test(idx.next()%2,'shadedark','shadelight')"> - <td class="cell3d" style="font-size:smaller;" valign="top"> - <span i18n:translate="" tal:omit-tag="">By</span>: - <span tal:replace="creator">Creation User</span><br /> - <span tal:replace="python:here.get_user_role(creator, 'Unavailable')">User Role</span><br /> - <span i18n:translate="" tal:omit-tag="">Postings</span>: - <span tal:replace="python:here.get_user_property(creator, 'fc_posts', 'n/a')">0</span><br /> - </td> - <td valign="top" class="cell3d"> - <img src="fcImages/topic.gif" height="10" width="17" border="0" - alt="Regular Topic" i18n:attributes="alt" - tal:attributes="src here/fcImages/topic.gif/absolute_url" /> - <span i18n:translate="" tal:omit-tag="">Posted</span>: - <span tal:replace="python:toPortalTime(msg.CreationDate(),1)">Creation Date/Time</span> - <i> - <tal:block tal:condition="python:mtool.checkPermission('Manage forum topic', here)"> - [<a class="fcMenu" href="portal_form/base_edit" title="Edit Topic" - i18n:translate="" i18n:attributes="title" - tal:attributes="href python:'%s/%s'%(msg.absolute_url(), - msg.getTypeInfo().getActionById('edit'))">Edit</a>] - [<a class="fcMenu" title="Delete Topic" - tal:attributes="title python: - test(msg.Type()=='Forum Message', 'Delete Reply', 'Delete Topic'); - href string:${topic/absolute_url}/manage_deleteReply?ids=${msg/getId}" - i18n:translate="" i18n:attributes="title">Delete</a>] - </tal:block> - - <tal:block tal:condition="replyable">[ - <a href="#add_comment" class="fcMenu" - tal:attributes="onclick python:'quote(\'%s\');;return false;;'%(here.forum_quote_format(msg.content, creator))" - title="Reply w/Quote" i18n:translate="" i18n:attributes="title">Reply w/Quote</a> ] - </tal:block> - </i> - - <hr style="width:98%;height:1px;" noshade="noshade" /> - <table border="0" width="100%" cellspacing="0" cellpadding="0"> - <tr valign="top"> - <td> - <p id="id" tal:attributes="id msg/getId" - tal:content="structure msg/Content">Parsed Topic Content Here</p> - - <div> - <a target="_blank" tal:attributes="href msg/image/absolute_url" - tal:condition="python:hasattr(msg, 'image') and - msg.image.getSize() and not hasattr(msg,'image_thumbnail')"> - <img tal:replace="structure here/fcImages/mime_img.gif" src="mime_img.gif" /> - <small i18n:translate="label_view_attached_image">view attached image</small> - </a> - <a tal:attributes="href msg/file/absolute_url" tal:condition="msg/file/getSize"> - <img tal:replace="structure here/fcImages/mime_text.gif" src="mime_text.gif" /> - <small i18n:translate="label_view_attached_image">view attached file</small></a> - </div> - </td> - <td align="right" tal:condition="python:msg.hasImage()"> - <a target="_blank" tal:attributes="href msg/image/absolute_url" - tal:condition="msg/image/getSize"> - <img tal:replace="structure - python:msg.image_thumbnail.tag(title='view attached image')" - src="mime_img.gif" /> - </a> - </td> - </tr> - </table> - </td> - </tr> - </table> + <metal:block metal:define-macro="topic_links"> + <!-- change hit counter --> + <div tal:define="is_subs here/isSubscribed"> + <tal:block tal:condition="is_subs"> + <span tal:omit-tag="" i18n:translate="label_unsibscribe">You are currently <b>subscribed</b> to this topic thread</span> | + <a href="forum_unsubscribe" i18n:attributes="title" + title="Unsubscribe to This Topic" i18n:translate="">Unsubscribe</a> | + </tal:block> + <tal:block tal:condition="python:not(is_subs or mtool.isAnonymousUser())"> + <span i18n:translate="label_sibscribe" + tal:omit-tag="">You are currently <b>Not subscribed</b> to this topic thread</span> | + <a href="forum_subscribe" title="Subscribe to this Thread" i18n:attributes="title" + i18n:translate="">Subscribe</a> | + </tal:block> - <ul tal:on-error="nothing" - tal:define="children python:msg.getRefs('children')"> - <li tal:repeat="child children"> - <tal:block tal:define="msg nocall:child" tal:omit-tag=""> - <tal:block metal:use-macro="here/forum_topic_widget/macros/message"> - <a tal:content="child/title_or_id" tal:attributes="href child/absolute_url"></a> - by <tal:block tal:content="child/Creator"></tal:block> on <tal:block tal:content="python:toPortalTime(child.modified(), 1)"></tal:block> - </tal:block> + <tal:block tal:condition="replyable" > + <a href="" i18n:translate="" + onclick="document.forms['blog_form'].content.focus();;return false;;">Add Reply</a> | </tal:block> - </li> - </ul> - </div> + <a href="../" title="Go Back" i18n:translate="">Back</a> + <ul class="menuBar"> + <li class="menuButton"> + <a href="#" onclick="return buttonClick(event,'viewModeMenu')" + onmouseover="buttonMouseover(event,'viewModeMenu')" i18n:translate="" + tal:content="view_mode"> + </a> - <table metal:define-macro="topic" tal:omit-tag=""> + <ul class="menu" id="viewModeMenu" onmouseover="menuMouseover(event)"> + <li class="menuItem"> + <a i18n:translate="flat" tal:attributes="href + string:forum_change_view_mode?mode=flat&redirect=${request/URL}">Flat</a> + </li> + <li class="menuItem"> + <a i18n:translate="nested" tal:attributes="href + string:forum_change_view_mode?mode=nested&redirect=${request/URL}">Nested</a> + </li> + <li class="menuItem"> + <a i18n:translate="thread" tal:attributes="href + string:forum_change_view_mode?mode=thread&redirect=${request/URL}">Thread</a> + </li> + <li class="menuItem"> + <a i18n:translate="full_thread" tal:attributes="href + string:forum_change_view_mode?mode=full_thread&redirect=${request/URL}">Full thread</a> + </li> + </ul> + </li> + </ul> + </div> + </metal:block> - </table> </body> </html> Index: forum_add_reply.py =================================================================== RCS file: /cvsroot/collective/CMFBoard/skins/cmfboard/forum_add_reply.py,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- forum_add_reply.py 31 Oct 2003 11:41:29 -0000 1.3 +++ forum_add_reply.py 31 Oct 2003 22:28:26 -0000 1.4 @@ -15,12 +15,16 @@ file = '' try: - context.manage_addReply(title=title, content=content, - reply_to=reply_to,image=image, file=file, - message_icon=message_icon) + new_context = context.manage_addReply( + title=title, content=content, + reply_to=reply_to,image=image, file=file, + message_icon=message_icon) msg = 'Reply added' + mode = context.forum_get_view_mode() + if mode in ('flat', 'nested'): + new_context = context except Exception, e: msg = str(e) -return ( 'success', context, { 'portal_status_message': msg } ) +return ( 'success', new_context, { 'portal_status_message': msg } ) Index: forum_topic.pt =================================================================== RCS file: /cvsroot/collective/CMFBoard/skins/cmfboard/forum_topic.pt,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- forum_topic.pt 31 Oct 2003 11:41:29 -0000 1.4 +++ forum_topic.pt 31 Oct 2003 22:28:26 -0000 1.5 @@ -14,74 +14,37 @@ replyable python:mtool.checkPermission('Add forum topic reply', here); review_state python:here.portal_workflow.getInfoFor(here, 'review_state', ''); toPortalTime nocall:here/toPortalTime; - topic here/Topic;view_mode here/forum_get_view_mode;"> + idx Iterator;hits here/Hits; + topic here/Topic;view_mode here/forum_get_view_mode; + base nocall:here; global reply_to nocall:here"> <script type="text/javascript" language="javascript"> <!-- - function quote(blockquote, uid) { + function quote(blockquote, uid, title) { var blockquote; var blog_form = document.forms['blog_form']; var reply_to = blog_form['reply_to']; var current_content = blog_form['content']; + var title_ob = blog_form['title']; var new_content = current_content.value + blockquote; current_content.value = new_content; current_content.focus(); reply_to.value = uid; + title_ob.value = title return false; } //--> </script> - <h2 tal:content="here/Title"></h2> - - <!-- change hit counter --> - <div tal:define="is_subs here/isSubscribed"> - <tal:block tal:condition="is_subs"> - <span tal:omit-tag="" i18n:translate="label_unsibscribe">You are currently <b>subscribed</b> to this topic thread</span> | - <a href="forum_unsubscribe" i18n:attributes="title" - title="Unsubscribe to This Topic" i18n:translate="">Unsubscribe</a> | - </tal:block> - <tal:block tal:condition="python:not(is_subs or mtool.isAnonymousUser())"> - <span i18n:translate="label_sibscribe" - tal:omit-tag="">You are currently <b>Not subscribed</b> to this topic thread</span> | - <a href="forum_subscribe" title="Subscribe to this Thread" i18n:attributes="title" - i18n:translate="">Subscribe</a> | - </tal:block> - - <tal:block tal:condition="replyable" > - <a href="" i18n:translate="" - onclick="document.forms['blog_form'].content.focus();;return false;;">Add Reply</a> | + <h2> + <tal:block tal:content="structure + python:getattr(here.fcImages.icons, topic.message_icon)" + tal:on-error="structure string:•"> </tal:block> - <a href="../" title="Go Back" i18n:translate="">Back</a> - - <ul class="menuBar"> - <li class="menuButton"> - <a href="#" onclick="return buttonClick(event,'viewModeMenu')" - onmouseover="buttonMouseover(event,'viewModeMenu')" i18n:translate="" - tal:content="view_mode"> - </a> - - <ul class="menu" id="viewModeMenu" onmouseover="menuMouseover(event)"> - <li class="menuItem"> - <a i18n:translate="flat" tal:attributes="href - string:forum_change_view_mode?mode=flat&redirect=${request/URL}">Flat</a> - </li> - <li class="menuItem"> - <a i18n:translate="nested" tal:attributes="href - string:forum_change_view_mode?mode=nested&redirect=${request/URL}">Nested</a> - </li> - <li class="menuItem"> - <a i18n:translate="thread" tal:attributes="href - string:forum_change_view_mode?mode=thread&redirect=${request/URL}">Thread</a> - </li> - <li class="menuItem"> - <a i18n:translate="full_thread" tal:attributes="href - string:forum_change_view_mode?mode=full_thread&redirect=${request/URL}">Full thread</a> - </li> - </ul> - </li> - </ul> - </div> + <a tal:content="topic/Title" + tal:attributes="href topic/absolute_url"></a></h2> + + <metal:block metal:use-macro="here/forum_topic_widget/macros/topic_links" /> <br /> <tal:block tal:condition="python:view_mode=='flat'"> @@ -89,7 +52,7 @@ </tal:block> <tal:block tal:condition="python:view_mode=='nested'"> - <metal:block metal:use-macro="here/forum_topic_flat/macros/topic_view" /> + <metal:block metal:use-macro="here/forum_topic_nested/macros/topic_view" /> </tal:block> <tal:block tal:condition="python:view_mode=='thread'"> Index: forum_topic_flat.pt =================================================================== RCS file: /cvsroot/collective/CMFBoard/skins/cmfboard/forum_topic_flat.pt,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- forum_topic_flat.pt 31 Oct 2003 11:41:29 -0000 1.1 +++ forum_topic_flat.pt 31 Oct 2003 22:28:26 -0000 1.2 @@ -2,20 +2,19 @@ <body> <metal:block metal:define-macro="topic_view"> - <table cellspacing="0" cellpadding="0" width="100%" class="ftable" - tal:define="hits here/Hits;idx Iterator;"> - <tr class="shadedarker"> - <th class="cell3d" width="10%" i18n:translate="">Author</th> - <th class="cell3d" width="90%" i18n:translate="">Topic</th> - </tr> - <tr tal:define="msg nocall:topic" tal:omit-tag=""> - <td metal:use-macro="here/forum_message_flat/macros/message"></td> - </tr> + <table cellspacing="0" cellpadding="0" width="100%" class="ftable"> + <tr class="shadedarker"> + <th class="cell3d" width="10%" i18n:translate="">Author</th> + <th class="cell3d" width="90%" i18n:translate="">Topic</th> + </tr> + <tr tal:define="msg nocall:topic" tal:omit-tag=""> + <td metal:use-macro="here/forum_message_flat/macros/message"></td> + </tr> - <tr tal:condition="not:python:topic.getRefs('children')"> - <td class="cell3d" colspan="2" style="text-align:center;" i18n:translate=""> - This topic contains no replies</td> - </tr> + <tr tal:condition="not:python:topic.getRefs('children')"> + <td class="cell3d" colspan="2" style="text-align:center;" i18n:translate=""> + This topic contains no replies</td> + </tr> </table> </metal:block> Index: forum_blog_widget.pt =================================================================== RCS file: /cvsroot/collective/CMFBoard/skins/cmfboard/forum_blog_widget.pt,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- forum_blog_widget.pt 31 Oct 2003 11:41:29 -0000 1.3 +++ forum_blog_widget.pt 31 Oct 2003 22:28:26 -0000 1.4 @@ -1,4 +1,4 @@ -<html i18n:domain="CMFBoard"> +\<html i18n:domain="CMFBoard"> <head> <title tal:content="template/title">The title</title> </head> @@ -18,7 +18,8 @@ tal:attributes="action action"> <a name="add_comment"> </a> - <input type="hidden" name="reply_to" tal:attributes="value here/UID" /> + <input type="hidden" name="reply_to" + tal:attributes="value reply_to/UID" /> <tal:block tal:define="preview python:request.get('preview_text','')" tal:condition="preview"> @@ -62,7 +63,7 @@ <td i18n:translate="label_title">Title</td> <td> <input type="text" name="title" value="" style="width: 100%" - tal:attributes="value python:request.get('title', here.Title())"/> + tal:attributes="value python:request.get('title', 'Re: %s'%base.Title())"/> </td> </tr> <tr> Index: discussion_reply.py =================================================================== RCS file: /cvsroot/collective/CMFBoard/skins/cmfboard/discussion_reply.py,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- discussion_reply.py 21 Oct 2003 07:56:18 -0000 1.1 +++ discussion_reply.py 31 Oct 2003 22:28:26 -0000 1.2 @@ -4,12 +4,20 @@ ##bind namespace= ##bind script=script ##bind subpath=traverse_subpath -##parameters=title, content +##parameters=title, content, reply_to='', image=None, file=None, message_icon='' ##title=Add reply ## +if not(hasattr(image, 'filename') and (image.filename != '')): + image = '' + +if not(hasattr(file, 'filename') and (file.filename != '')): + file = '' + talkback = context.portal_discussion.getDiscussionFor(context) -talkback.manage_addReply(title, content) +talkback.manage_addReply(title, content, + reply_to=reply_to,image=image, file=file, + message_icon=message_icon) return ( 'success', context, { 'portal_status_message': context.REQUEST.get('portal_status_message', --- NEW FILE: forum_message_view1.pt --- <html i18n:domain="CMFBoard"> <head> <title tal:content="template/title">The title</title> </head> <body> <metal:block metal:define-macro="message"> <div class="box"> <div class="body"> <div class="even" tal:define="creator msg/Creator"> <span tal:omit-tag="" tal:content="structure python:getattr(here.fcImages.icons, msg.message_icon)" tal:on-error="structure string: • "> </span> <b tal:content="msg/Title"></b> <nobr> <span i18n:translate="" tal:omit-tag="">by</span> <span tal:replace="msg/Creator">Creation User</span> (<span tal:replace="python:msg.get_user_role(creator, 'Unavailable')">User Role</span>) on <span tal:replace="python:toPortalTime(msg.CreationDate(),1)">Creation Date/Time</span> </nobr> <br /> <div> <div tal:omit-tag="" tal:condition="python:mtool.checkPermission('Manage forum topic',msg)"> [<a class="fcMenu" href="portal_form/base_edit" title="Edit Topic" i18n:translate="" i18n:attributes="title" tal:attributes="href python:'%s/%s'%(msg.absolute_url(), msg.getTypeInfo().getActionById('edit'))">Edit</a>] [<a class="fcMenu" title="Delete Topic" tal:attributes="title python: test(msg.Type()=='Forum Message', 'Delete Reply', 'Delete Topic'); href string:${topic/absolute_url}/manage_deleteReply?ids=${msg/getId}" i18n:translate="" i18n:attributes="title">Delete</a>] </div> <div tal:omit-tag="" tal:condition="replyable">[ <a tal:condition="exists:external_reply" tal:attributes="href string:${msg/absolute_url}/forum_reply_form" title="Reply w/Quote" i18n:translate="" i18n:attributes="title">Reply w/Quote</a> <a href="#add_comment" tal:condition="not:exists:external_reply" class="fcMenu" tal:attributes="onclick python:'quote(\'%s\',\'%s\',\'Re: %s\');;return false;;'%(here.forum_quote_format(msg.content, creator),msg.UID(),here.forum_quote(msg.Title()))" title="Reply w/Quote" i18n:translate="" i18n:attributes="title">Reply w/Quote</a> ] </div> </div> </div> </div> <table border="0" width="100%" cellspacing="0" cellpadding="0"> <tr valign="top"> <td> <p id="id" tal:attributes="id msg/getId" tal:content="structure msg/Content"> Parsed Topic Content Here</p> <div> <a target="_blank" tal:attributes="href msg/image/absolute_url" tal:condition="python:hasattr(msg, 'image') and msg.image.getSize() and not hasattr(msg,'image_thumbnail')"> <img tal:replace="structure here/fcImages/mime_img.gif" src="mime_img.gif" /> <small i18n:translate="label_view_attached_image">view attached image</small> </a> <a tal:attributes="href msg/file/absolute_url" tal:condition="msg/file/getSize"> <img tal:replace="structure here/fcImages/paperclip.gif" src="mime_text.gif" /> <small i18n:translate="label_view_attached_image">view attached file</small></a> </div> </td> <td align="right" tal:condition="python:msg.hasImage()"> <a target="_blank" tal:attributes="href msg/image/absolute_url" tal:condition="msg/image/getSize"> <img tal:replace="structure python:msg.image_thumbnail.tag(title='view attached image')" src="mime_img.gif" /> </a> </td> </tr> </table> <tal:block tal:condition="not:exists:one_msg"> <ul metal:use-macro="here/forum_topic_thread/macros/tree"></ul> </tal:block> </div> </metal:block> </body> </html> Index: viewThreadsAtBottom.pt =================================================================== RCS file: /cvsroot/collective/CMFBoard/skins/cmfboard/viewThreadsAtBottom.pt,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -r1.7 -r1.8 --- viewThreadsAtBottom.pt 31 Oct 2003 11:41:29 -0000 1.7 +++ viewThreadsAtBottom.pt 31 Oct 2003 22:28:26 -0000 1.8 @@ -17,29 +17,37 @@ <tal:block tal:define="discussion python:here.portal_discussion.getDiscussionFor(here); - msg nocall:discussion" + topic nocall:discussion; base nocall:discussion; + show_first python:1;external_reply show_first; + replyable python:mtool.checkPermission('Add forum topic reply',topic);" tal:condition="python:mtool.checkPermission('View', discussion)"> + + <form name="reply" + action="" + method="post" + tal:condition="replyable" + tal:attributes="action string:${here/absolute_url}/discussion_reply_form"> + + <input class="standalone" + type="submit" + value="Add Comment" + i18n:attributes="value" + /> + </form> + <a name="comments"> </a> - <metal:block metal:use-macro="here/forum_topic_threaded/macros/tree"></metal:block> + <style type="text/css" + tal:content="string:@import url($portal_url/forum_styles.css);"> + </style> + + <metal:block metal:use-macro="here/forum_topic_thread/macros/topic_view"></metal:block> - <span style="float:right"> - <img tal:replace="structure here/discussionitem_icon.gif" /> - <a href="" tal:attributes="href discussion/absolute_url"> - <span tal:replace="discussion/replies"></span> - <span tal:omit-tag="" i18n:translate="">comments</span> - </a> - <tal:block - tal:condition="python:mtool.checkPermission('Add forum topic reply', discussion)"> - | <a tal:attributes="href string:${discussion/absolute_url}/#add_comment"> - add comment - </a> - </tal:block> - </span> <span style="float: right" tal:condition="python:discussion is None"> <a href="" tal:attributes="href string:${here/portal_discussion/absolute_url}/portal_form/discussion_tool_edit_form"> you need configure discussion tool</a> </span> + </tal:block> </metal:block> </div> Index: validate_add_reply.py =================================================================== RCS file: /cvsroot/collective/CMFBoard/skins/cmfboard/validate_add_reply.py,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- validate_add_reply.py 24 Oct 2003 09:12:14 -0000 1.1 +++ validate_add_reply.py 31 Oct 2003 22:28:26 -0000 1.2 @@ -11,25 +11,20 @@ request = context.REQUEST form = request.form -errors = {} -content = request.get('content', '') +validator = context.portal_form.createForm() +validator.addField('title', 'String', required=1) +validator.addField('content', 'String', required=1) +errors = validator.validate(context.REQUEST) -image = request.get('image', '') -len_image = 0 -if hasattr(image, 'filename'): - len_image = len(image.read()) - if context.image_size < len_image: +imagefile = request.get('image', '') +if hasattr(imagefile, 'filename'): + if context.image_size < len(imagefile.read()): errors['image']='Max size exceeded.' file = request.get('file', '') -len_file = 0 if hasattr(file, 'filename'): - len_file = len(file.read()) - if context.file_size < len_file: + if context.file_size < len(file.read()): errors['file']='Max size exceeded.' - -if not (content or len_image or len_file): - errors['empty'] = "Can't add empty reply" if errors: return ('failure', errors, {'portal_status_message':'Please correct the indicated errors.'}) Index: forum_add_topic_form.pt =================================================================== RCS file: /cvsroot/collective/CMFBoard/skins/cmfboard/forum_add_topic_form.pt,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- forum_add_topic_form.pt 31 Oct 2003 11:41:29 -0000 1.3 +++ forum_add_topic_form.pt 31 Oct 2003 22:28:26 -0000 1.4 @@ -11,6 +11,7 @@ tal:define="mtool nocall:here/portal_membership; review_state python:here.portal_workflow.getInfoFor(here, 'review_state', ''); errors python:request.get('errors', {}); add_topic python:1; + title python:''; "> <metal:block metal:use-macro="here/forum_widgets/macros/forum_links"></metal:block> @@ -74,7 +75,7 @@ <td tal:define="error errors/title|nothing"> <div class="field" tal:attributes="class python:test(error, 'field error', 'field')"> <input type="text" name="title" value="" style="width: 350px" - tal:attributes="value python:request.get('title', '')"/> + tal:attributes="value python:request.get('title', title)"/> <div tal:condition="error" i18n:translate="" tal:content="error"> </div> </div> --- NEW FILE: forum_reply_form.pt --- <html metal:use-macro="here/main_template/macros/master"> <head> <title tal:content="template/title">The title Yeah</title> <metal:block metal:fill-slot="head_slot" tal:define="dummy python:request.set('disable_border',1)"> <link rel="Stylesheet" type="text/css" tal:attributes="href string:$portal_url/forum_styles.css"> </metal:block> </head> <body> <div metal:fill-slot="main" i18n:domain="CMFBoard" tal:define="mtool nocall:here/portal_membership;topic nocall:here; idx Iterator; replyable python:mtool.checkPermission('Add forum topic reply', here); review_state python:here.portal_workflow.getInfoFor(here, 'review_state', ''); toPortalTime nocall:here/toPortalTime; topic here/Topic;view_mode here/forum_get_view_mode; base nocall:here; global reply_to nocall:here; msg nocall:base; errors python:request.get('errors', {}); "> <script type="text/javascript" language="javascript"> <!-- function quote(blockquote, uid, title) { var blockquote; var blog_form = document.forms['blog_form']; var reply_to = blog_form['reply_to']; var current_content = blog_form['content']; var title_ob = blog_form['title']; var new_content = current_content.value + blockquote; current_content.value = new_content; current_content.focus(); reply_to.value = uid; title_ob.value = title return false; } //--> </script> <h1 i18n:translate="heading_add_reply">Add Reply</h1> <metal:block metal:use-macro="here/forum_topic_widget/macros/topic_links" /> <p i18n:translate="description_add_reply"> You can add a comment by filling out the form below. To see how the posting will look before submitting it, click 'Preview Comment'. </p> <div class="group"> <span class="legend">test</span> <table cellspacing="0" cellpadding="0" width="100%" class="ftable"> <tr tal:define="msg nocall:base; one_msg python:1;" tal:omit-tag=""> <td metal:use-macro="here/forum_message_flat/macros/message"></td> </tr> </table> <br /> <tal:block tal:define="action python:here.portal_form_url(template.id)"> <h3 style="text-align:center;" tal:condition="python:review_state=='locked'" i18n:translate=""> Reviewer Locked Flag Override in Effect, You can respond to this thread even though locked flag is set</h3> <span metal:use-macro="here/forum_blog_widget/macros/blog_form"> Response Widget Here </span> </tal:block> </div> </div> </body> </html> Index: forum_topic_full_thread.pt =================================================================== RCS file: /cvsroot/collective/CMFBoard/skins/cmfboard/forum_topic_full_thread.pt,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- forum_topic_full_thread.pt 31 Oct 2003 11:41:29 -0000 1.1 +++ forum_topic_full_thread.pt 31 Oct 2003 22:28:26 -0000 1.2 @@ -1,20 +1,16 @@ <html> <body> <metal:block metal:define-macro="topic_view"> - <table cellspacing="0" cellpadding="0" width="100%" class="ftable" - tal:define="hits here/Hits;idx Iterator;"> - <tr class="shadedarker"> - <th class="cell3d" width="10%" i18n:translate="">Author</th> - <th class="cell3d" width="90%" i18n:translate="">Topic</th> - </tr> - <tr tal:define="msg nocall:here; one_msg python:1;" tal:omit-tag=""> - <td metal:use-macro="here/forum_message_flat/macros/message"></td> - </tr> - <tr tal:condition="not:python:topic.getBRefs('parent')"> - <td class="cell3d" colspan="2" style="text-align:center;" i18n:translate=""> - This topic contains no replies</td> - </tr> + <table cellspacing="0" cellpadding="0" width="100%" class="ftable"> + <tr tal:define="msg nocall:here; one_msg python:1;" tal:omit-tag=""> + <td metal:use-macro="here/forum_message_flat/macros/message"></td> + </tr> + + <tr tal:condition="not:python:topic.getBRefs('parent')"> + <td class="cell3d" colspan="2" style="text-align:center;" i18n:translate=""> + This topic contains no replies</td> + </tr> </table> <ul tal:define="msg nocall:topic"> @@ -26,29 +22,21 @@ <a tal:omit-tag="python:msg.getId() == here.getId()" tal:content="msg/Title" tal:attributes="href msg/absolute_url"></a> - </b>- <span tal:replace="msg/Creator"></span> + </b> + <a tal:attributes="href msg/file/absolute_url" + tal:condition="msg/file/getSize" title="View attached file" + i18n:attributes="title" target="_blank"> + <img tal:replace="structure here/fcImages/paperclip.gif" src="mime_text.gif" /></a> + <a tal:attributes="href msg/image/absolute_url" + tal:condition="msg/hasImage" title="View attached image" + i18n:attributes="title" target="_blank"> + <img tal:replace="structure here/fcImages/mime_img.gif" src="mime_text.gif" /></a> + - <span tal:replace="msg/Creator"></span> + - <span tal:replace="python:toPortalTime(msg.modified(),1)"></span> <ul metal:use-macro="here/forum_topic_thread/macros/tree"></ul> </ul> </metal:block> - <metal:block metal:define-macro="tree" - tal:define="toPortalTime nocall:here/toPortalTime"> - <ul> - <tal:block tal:repeat="msg msg/getChildren"> - <tal:block tal:content="structure - python:getattr(here.fcImages.icons, msg.message_icon)" - tal:on-error="structure string: • "> - </tal:block> - <b tal:omit-tag="python:msg.getId() != here.getId()"> - <a tal:omit-tag="python:msg.getId() == here.getId()" - tal:content="msg/Title" - tal:attributes="href string:${msg/absolute_url}/forum_topic"></a> - </b> - <span tal:replace="msg/Creator"></span> - - <span tal:replace="python:toPortalTime(msg.modified(),1)"></span> - <ul metal:use-macro="here/forum_topic_thread/macros/tree"></ul> - </tal:block> - </ul> - </metal:block> </body> </html> --- NEW FILE: forum_quote.py --- ## Script (Python) "forum_quote" ##bind container=container ##bind context=context ##bind namespace= ##bind script=script ##bind subpath=traverse_subpath ##parameters=raw_text ##title= ## from Products.PythonScripts.standard import html_quote rval = html_quote(raw_text) rval = rval.replace('\n', '\\n') rval = rval.replace('\r', '') rval = rval.replace("'", "\\'") return rval --- NEW FILE: forum_topic_nested.pt --- <html> <body> <metal:block metal:define-macro="topic_view" tal:define="one_msg python:1;"> <table tal:omit-tag=""> <tr tal:define="msg nocall:here; one_msg python:1;" tal:omit-tag=""> <td metal:use-macro="here/forum_message_view1/macros/message"></td> </tr> <tr tal:condition="not:python:topic.getBRefs('parent')"> <td class="cell3d" colspan="2" style="text-align:center;" i18n:translate=""> This topic contains no replies</td> </tr> </table> <metal:block tal:define="msg nocall:here"> <ul metal:use-macro="here/forum_topic_nested/macros/tree"></ul> </metal:block> </metal:block> <metal:block metal:define-macro="tree"> <ul> <tal:block tal:repeat="msg msg/getChildren"> <table tal:omit-tag=""> <tr tal:omit-tag=""> <td metal:use-macro="here/forum_message_view1/macros/message"></td> </tr> </table> <ul metal:use-macro="here/forum_topic_nested/macros/tree"></ul> </tal:block> </ul> </metal:block> </body> </html> Index: forum_topic_thread.pt =================================================================== RCS file: /cvsroot/collective/CMFBoard/skins/cmfboard/forum_topic_thread.pt,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- forum_topic_thread.pt 31 Oct 2003 11:41:29 -0000 1.1 +++ forum_topic_thread.pt 31 Oct 2003 22:28:26 -0000 1.2 @@ -1,51 +1,57 @@ <html> <body> - <metal:block metal:define-macro="topic_view"> - <table cellspacing="0" cellpadding="0" width="100%" class="ftable" - tal:define="hits here/Hits;idx Iterator;"> - <tr class="shadedarker"> - <th class="cell3d" width="10%" i18n:translate="">Author</th> - <th class="cell3d" width="90%" i18n:translate="">Topic</th> - </tr> - <tr tal:define="msg nocall:here; one_msg python:1;" tal:omit-tag=""> - <td metal:use-macro="here/forum_message_flat/macros/message"></td> - </tr> + <metal:block metal:define-macro="topic_view" + tal:define="global parent base/getParent;"> + <table cellspacing="0" cellpadding="0" width="100%" class="ftable" + tal:condition="python:not(parent) and not(exists('show_first'))"> + <tr tal:define="msg nocall:base; one_msg python:1;" tal:omit-tag=""> + <td metal:use-macro="here/forum_message_flat/macros/message"></td> + </tr> + </table> + <br /> - <tr tal:condition="not:python:topic.getBRefs('parent')"> - <td class="cell3d" colspan="2" style="text-align:center;" i18n:translate=""> - This topic contains no replies</td> - </tr> + <table tal:omit-tag="" tal:condition="not:nocall:parent" + tal:repeat="msg base/getChildren"> + <tr tal:omit-tag=""> + <td metal:use-macro="here/forum_message_view1/macros/message"></td> + </tr> </table> - <ul tal:define="msg nocall:topic"> - <tal:block tal:content="structure - python:getattr(here.fcImages.icons, msg.message_icon)" - tal:on-error="structure string: • "> - </tal:block> - <b tal:omit-tag="python:msg is not here"> - <a tal:omit-tag="python:msg.getId() == here.getId()" - tal:content="msg/Title" tal:attributes="href - msg/absolute_url"></a> - </b>- <span tal:replace="msg/Creator"></span> - <ul metal:use-macro="here/forum_topic_thread/macros/tree"></ul> - </ul> + <table tal:condition="nocall:parent" tal:omit-tag=""> + <tal:block tal:define="global reply_to nocall:parent" /> + <tr tal:omit-tag="" tal:repeat="msg parent/getChildren"> + <td metal:use-macro="here/forum_message_view1/macros/message"></td> + </tr> + </table> + <tr tal:condition="not:python:topic.getBRefs('parent')"> + <td class="cell3d" colspan="2" style="text-align:center;" i18n:translate=""> + This topic contains no replies</td> + </tr> </metal:block> - <metal:block metal:define-macro="tree" - tal:define="toPortalTime nocall:here/toPortalTime"> + <metal:block metal:define-macro="tree"> <ul> <tal:block tal:repeat="msg msg/getChildren"> <tal:block tal:content="structure python:getattr(here.fcImages.icons, msg.message_icon)" - tal:on-error="structure string: • "> + tal:on-error="structure string: •"> </tal:block> - <b tal:omit-tag="python:msg.getId() != here.getId()"> - <a tal:omit-tag="python:msg.getId() == here.getId()" + <b tal:omit-tag="python:msg.getId() != base.getId()"> + <a tal:omit-tag="python:msg.getId() == base.getId()" tal:content="msg/Title" tal:attributes="href string:${msg/absolute_url}/forum_topic"></a> - </b> - <span tal:replace="msg/Creator"></span> - - <span tal:replace="python:toPortalTime(msg.modified(),1)"></span> + </b> + <a tal:attributes="href msg/file/absolute_url" + tal:condition="msg/file/getSize" title="View attached file" + i18n:attributes="title" target="_blank"> + <img tal:replace="structure here/fcImages/paperclip.gif" src="mime_text.gif" /></a> + <a tal:attributes="href msg/image/absolute_url" + tal:condition="msg/hasImage" title="View attached image" + i18n:attributes="title" target="_blank"> + <img tal:replace="structure here/fcImages/mime_img.gif" src="mime_text.gif" /></a> + - <span tal:replace="msg/Creator"></span> + - <span tal:replace="python:toPortalTime(msg.modified(),1)"></span> <ul metal:use-macro="here/forum_topic_thread/macros/tree"></ul> </tal:block> </ul> Index: forum_view.pt =================================================================== RCS file: /cvsroot/collective/CMFBoard/skins/cmfboard/forum_view.pt,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- forum_view.pt 31 Oct 2003 11:41:29 -0000 1.5 +++ forum_view.pt 31 Oct 2003 22:28:26 -0000 1.6 @@ -11,6 +11,10 @@ tal:define="mtool nocall:here/portal_membership; review_state python:here.portal_workflow.getInfoFor(here, 'review_state', ''); topics python:here.forum_get_topics(here); + l python:len(topics); + Batch python:modules['Products.CMFPlone'].Batch; + b_start python:request.get('b_start', 0); + batch python:Batch(topics, 20, int(b_start), orphan=0); toPortalTime nocall:here/toPortalTime;"> <script type="text/javascript" language="javascript"> @@ -30,6 +34,8 @@ <metal:block metal:use-macro="here/forum_widgets/macros/forum_links"></metal:block> <br /> + + <div metal:use-macro="here/batch_macros/macros/navigation"></div> <table cellspacing="0" cellpadding="0" width="100%" class="ftable" tal:condition="topics"> <tr class="shadedarker"> @@ -43,7 +49,7 @@ </tr> <!-- Main Table Constructor for forum expansion: Begin //--> - <tal:block tal:repeat="topic topics"> + <tal:block tal:repeat="topic batch"> <tr valign="middle" tal:define="ob topic/getObject;hits ob/hits;msg ob/LastReply; review_state topic/review_state; @@ -112,18 +118,19 @@ <div tal:condition="not:topics"><br /> <span tal:omit-tag="" i18n:translate="">No Entries Found</span><br /></div> + <div metal:use-macro="here/batch_macros/macros/navigation"></div> <br /> <table cellspacing="0" cellpadding="0" width="100%"> - <tr> - <td style="text-align:right;"> - <span metal:use-macro="here/forum_widgets/macros/search_form"></span> - <span metal:use-macro="here/forum_widgets/macros/jump_forum"></span> - </td> - </tr> + <tr> + <td style="text-align:right;"> + <span metal:use-macro="here/forum_widgets/macros/search_form"></span> + <span metal:use-macro="here/forum_widgets/macros/jump_forum"></span> + </td> + </tr> </table> </metal:block> - + </body> </html> Index: forum_message_flat.pt =================================================================== RCS file: /cvsroot/collective/CMFBoard/skins/cmfboard/forum_message_flat.pt,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- forum_message_flat.pt 31 Oct 2003 11:41:29 -0000 1.1 +++ forum_message_flat.pt 31 Oct 2003 22:28:26 -0000 1.2 @@ -10,18 +10,21 @@ <td class="cell3d" style="font-size:smaller;" valign="top"> <span i18n:translate="" tal:omit-tag="">By</span>: <span tal:replace="creator">Creation User</span><br /> - <span tal:replace="python:here.get_user_role(creator, 'Unavailable')">User Role</span><br /> + <span tal:replace="python:topic.get_user_role(creator, 'Unavailable')">User Role</span><br /> <span i18n:translate="" tal:omit-tag="">Postings</span>: - <span tal:replace="python:here.get_user_property(creator, 'fc_posts', 'n/a')">0</span><br /> + <span tal:replace="python:topic.get_user_property(creator, 'fc_posts', 'n/a')">0</span><br /> </td> <td valign="top" class="cell3d"> - <img src="fcImages/topic.gif" height="10" width="17" border="0" - alt="Regular Topic" i18n:attributes="alt" - tal:attributes="src here/fcImages/topic.gif/absolute_url" /> + <span tal:omit-tag="" tal:content="structure + python:getattr(here.fcImages.icons, msg.message_icon)" + tal:on-error="structure string:•"> + </span> + <b tal:content="msg/Title"></b><br /> + <span i18n:translate="" tal:omit-tag="">Posted</span>: <span tal:replace="python:toPortalTime(msg.CreationDate(),1)">Creation Date/Time</span> <i> - <tal:block tal:condition="python:mtool.checkPermission('Manage forum topic', here)"> + <tal:block tal:condition="python:mtool.checkPermission('Manage forum topic', msg)"> [<a class="fcMenu" href="portal_form/base_edit" title="Edit Topic" i18n:translate="" i18n:attributes="title" tal:attributes="href python:'%s/%s'%(msg.absolute_url(), @@ -34,10 +37,11 @@ </tal:block> <tal:block tal:condition="replyable">[ - <a href="#add_comment" class="fcMenu" - tal:attributes="onclick python:'quote(\'%s\',\'%s\');;return false;;'%(here.forum_quote_format(msg.content, creator),msg.UID())" - title="Reply w/Quote" i18n:translate="" i18n:attributes="title">Reply w/Quote</a> ] - </tal:block> + <a href="#add_comment" class="fcMenu" + tal:attributes="onclick + python:'quote(\'%s\',\'%s\',\'Re: %s\');;return false;;'%(here.forum_quote_format(msg.content,creator), msg.UID(), here.forum_quote(msg.Title()))" + title="Reply w/Quote" i18n:translate="" i18n:attributes="title">Reply w/Quote</a> ] + </tal:block> </i> <hr style="width:98%;height:1px;" noshade="noshade" /> @@ -55,7 +59,7 @@ <small i18n:translate="label_view_attached_image">view attached image</small> </a> <a tal:attributes="href msg/file/absolute_url" tal:condition="msg/file/getSize"> - <img tal:replace="structure here/fcImages/mime_text.gif" src="mime_text.gif" /> + <img tal:replace="structure here/fcImages/paperclip.gif" src="mime_text.gif" /> <small i18n:translate="label_view_attached_image">view attached file</small></a> </div> </td> ------------------------------------------------------- This SF.net email is sponsored by: SF.net Giveback Program. Does SourceForge.net help you be more productive? Does it help you create better code? SHARE THE LOVE, and help us help YOU! Click Here: http://sourceforge.net/donate/
|
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| Previous by Date: | CMFBoard/skins/cmfboard/fcImages paperclip.gif,NONE,1.1, Nikolay |
|---|---|
| Previous by Thread: | CMFBoard/skins/cmfboard/fcImages paperclip.gif,NONE,1.1, Nikolay |
| Indexes: | [Date] [Thread] [Top] [All Lists] |
Free MagazinesCisco NewsReceive a free quarterly e-newsletter with exclusive articles on how Cisco IT uses its own products and solutions to enable the business. subscribe Systems Management News, the newspaper for IT systems administration and data center managers! Each issue of Systems Management News is chock-full of news and analysis to help you understand what's happening in your field. subscribe The Enterprise Newsweekly eWeek is the essential technology information source for builders of e-business. subscribe Oracle Magazine Oracle Magazine contains technology strategy articles, sample code, tips, Oracle and partner news, how to articles for developers and DBAs, and more. Oracle (NASDAQ: ORCL) is the world's largest enterprise software company. subscribe Total Telecom Total Telecom is "The Economist of the communications industry". subscribe |