Warning message added to discussion control panel that shows up if there are unmigrated comments.
This commit is contained in:
		
							parent
							
								
									c76ef0523e
								
							
						
					
					
						commit
						58663fb492
					
				@ -8,11 +8,14 @@ Changelog
 | 
			
		||||
  a view in the url to properly display comments.
 | 
			
		||||
  [eleddy]
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
- Make comments and controlpanel views more robust, so they don't break if no
 | 
			
		||||
  workflow is assigned to the 'Discussion Item' content type.
 | 
			
		||||
  [timo]
 | 
			
		||||
 | 
			
		||||
- Warning message added to discussion control panel that shows up if there are
 | 
			
		||||
  unmigrated comments.
 | 
			
		||||
  [timo]
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
2.1.4 (2012-02-29)
 | 
			
		||||
------------------
 | 
			
		||||
 | 
			
		||||
@ -61,6 +61,25 @@
 | 
			
		||||
        </dd>
 | 
			
		||||
    </dl>
 | 
			
		||||
 | 
			
		||||
    <dl class="portalMessage warning"
 | 
			
		||||
        tal:condition="view/unmigrated_comments_warning">
 | 
			
		||||
        <dt i18n:translate="">
 | 
			
		||||
            Warning
 | 
			
		||||
        </dt>
 | 
			
		||||
        <dd i18n:translate="text_unmigrated_comments">
 | 
			
		||||
            You have comments that have not been migrated to the new
 | 
			
		||||
            commenting system that has been introduced in Plone 4.1.
 | 
			
		||||
            Please
 | 
			
		||||
            <tal:link i18n:name="label_comments_migration_link">
 | 
			
		||||
                <a href=""
 | 
			
		||||
                   i18n:translate="text_comments_migration_link"
 | 
			
		||||
                   tal:attributes="href string:${portal_url}/@@comment-migration"
 | 
			
		||||
                >migrate your comments</a>
 | 
			
		||||
            </tal:link>
 | 
			
		||||
            to fix this.
 | 
			
		||||
        </dd>
 | 
			
		||||
    </dl>
 | 
			
		||||
 | 
			
		||||
    <div metal:use-macro="context/global_statusmessage/macros/portal_message">
 | 
			
		||||
      Portal status message
 | 
			
		||||
    </div>
 | 
			
		||||
 | 
			
		||||
@ -4,6 +4,8 @@ from Acquisition import aq_base, aq_inner
 | 
			
		||||
 | 
			
		||||
from Products.CMFCore.utils import getToolByName
 | 
			
		||||
 | 
			
		||||
from Products.CMFCore.interfaces._content import IDiscussionResponse
 | 
			
		||||
 | 
			
		||||
from Products.Five.browser.pagetemplatefile import ViewPageTemplateFile
 | 
			
		||||
 | 
			
		||||
from Products.statusmessages.interfaces import IStatusMessage
 | 
			
		||||
@ -155,6 +157,15 @@ class DiscussionSettingsControlPanel(controlpanel.ControlPanelFormWrapper):
 | 
			
		||||
            return
 | 
			
		||||
        return True
 | 
			
		||||
 | 
			
		||||
    def unmigrated_comments_warning(self):
 | 
			
		||||
        """Returns true if site contains unmigrated comments.
 | 
			
		||||
        """
 | 
			
		||||
        catalog = getToolByName(aq_inner(self.context), 'portal_catalog', None)
 | 
			
		||||
        count_comments_old = catalog.searchResults(
 | 
			
		||||
            object_provides=IDiscussionResponse.__identifier__)
 | 
			
		||||
        if count_comments_old:
 | 
			
		||||
            return True
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
def notify_configuration_changed(event):
 | 
			
		||||
    """Event subscriber that is called every time the configuration changed.
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user