Site control panel
==================

First some initial setup code:

    >>> from zope.component import getUtility
    >>> from Products.CMFCore.interfaces import IPropertiesTool
    >>> from Products.CMFCore.utils import getToolByName
    >>> ptool = getUtility(IPropertiesTool)
    >>> self.loginAsManager()
    >>> types_configlet_url = 'http://nohost/plone/@@types-controlpanel'

Then we change a workflow title, so we can test for UnicodeDecodeErrors:

    >>> wt = getToolByName(self.portal, 'portal_workflow')
    >>> wf = wt['simple_publication_workflow']
    >>> old_title = wf.title
    >>> wf.title = u'Workflow de Noticias'.encode('utf-8')

Viewing the types control panel
-----------------------------

Choose a standard type and hit cancel:

    >>> self.browser.open(types_configlet_url)
    >>> self.browser.getControl(name='type_id').value = ['Link']
    >>> self.browser.getControl('Cancel').click()

We should be back on the Site Setup screen:

    >>> 'plone_control_panel' in self.browser.url
    True

Navigate back to the type control panel and select link again:
    
    >>> self.browser.getLink('Types').click()
    >>> self.browser.getControl(name='type_id').value = ['Link']
    >>> self.browser.getForm(action=types_configlet_url).submit()

Enable allow commenting for the link type

    >>> self.browser.getControl('Allow comments').selected = True
    >>> self.browser.getControl('Apply Changes').click()
    
Navigate back to link type to confirm setting.  Also confirm that the
redirect_links setting is enabled. For easier testing we simplify the
white space:

    >>> self.browser.getLink('Types').click()
    >>> self.browser.getControl(name='type_id').value = ['Link']
    >>> self.browser.getForm(action=types_configlet_url).submit()
    >>> contents = self.simplify_white_space(self.browser.contents)
    >>> 'Globally addable' in contents
    True
    >>> 'Allow comments' in contents
    True
    >>> 'Visible in searches' in contents
    True
    >>> '<input id="redirect_links" type="checkbox" class="noborder" name="redirect_links:boolean" checked="checked" />' in contents
    True
    >>> '<label for="redirect_links">Redirect immediately to link target' in contents
    True

For only the link type, we have a special setting that controls whether the 
view will redirect to the remote url for users without editing permissions:

    >>> self.browser.open(types_configlet_url)
    >>> self.browser.getControl(name='type_id').value = ['News Item']
    >>> self.browser.getForm(action=types_configlet_url).submit()
    >>> '<input id="redirect_links"' in self.browser.contents
    False
    
We'll confirm that we can disable the redirect_links option for the link type:

    >>> self.browser.getControl(name='type_id').value = ['Link']
    >>> self.browser.getForm(action=types_configlet_url).submit()
    >>> '<input id="redirect_links"' in self.browser.contents
    True
    >>> self.browser.getControl(name='redirect_links:boolean').value = False
    >>> self.browser.getControl('Apply Changes').click()
    
Now the redirect links checkbox option is no longer checked:

    >>> self.browser.open(types_configlet_url)
    >>> self.browser.getControl(name='type_id').value = ['Link']
    >>> self.browser.getForm(action=types_configlet_url).submit()
    >>> contents = self.simplify_white_space(self.browser.contents)
    >>> 'Globally addable' in contents
    True
    >>> 'Allow comments' in contents
    True
    >>> 'Visible in searches' in contents
    True
    >>> '<input id="redirect_links" type="checkbox" class="noborder" name="redirect_links:boolean" />' in contents
    True
    >>> '<label for="redirect_links">Redirect immediately to link target' in contents
    True

This change should modify the redirect_links value in site_properties as well:

    >>> ptool.site_properties.redirect_links
    False


No default workflow
-------------------

This references http://dev.plone.org/plone/ticket/11901

Open the Types control panel and set the default workflow to None:
    >>> self.browser.open(types_configlet_url)
    >>> self.browser.getControl(name='new_workflow').value = ['[none]']
    >>> self.browser.getControl(name="form.button.SelectWorkflow").click()
    >>> self.browser.getControl(name="form.button.Save").click()

Now choose a standard type and submit:
    >>> self.browser.getControl(name='type_id').value = ['Link']
    >>> self.browser.getControl(name="form.button.SelectContentType").click()

    >>> self.browser.contents
    '...Globally addable...
    ...Allow comments...
    ...Visible in searches...'
