Skip to content

Commit

Permalink
Merge c43a8b4 into f3edb74
Browse files Browse the repository at this point in the history
  • Loading branch information
Ben Cole committed Jan 9, 2015
2 parents f3edb74 + c43a8b4 commit b6c5dcf
Show file tree
Hide file tree
Showing 7 changed files with 112 additions and 4 deletions.
2 changes: 2 additions & 0 deletions CHANGES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ Changelog

- Rename old importstep-handler marker from netsight-windowsauthplugin.
[fredvd]
- Added WorkspaceContainer content type
[wengole]

1.1 (2014-07-14)
----------------
Expand Down
1 change: 1 addition & 0 deletions src/ploneintranet/workspace/profiles/default/types.xml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?xml version="1.0"?>
<object name="portal_types" meta_type="Plone Types Tool">
<object name="ploneintranet.workspace.workspacefolder" meta_type="Dexterity FTI" />
<object name="ploneintranet.workspace.workspacecontainer" meta_type="Dexterity FTI" />
</object>
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,6 @@
<property name="allowed_content_types"
purge="False">
<element value="ploneintranet.workspace.workspacefolder" />
<element value="ploneintranet.workspace.workspacecontainer" />
</property>
</object>
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
<?xml version="1.0"?>
<object name="ploneintranet.workspace.workspacecontainer"
meta_type="Dexterity FTI"
i18n:domain="ploneintranet.workspace" xmlns:i18n="http://xml.zope.org/namespaces/i18n">

<!-- Basic metadata -->
<property name="title" i18n:translate="">Workspace Folder</property>
<property name="description"
i18n:translate="">A container for workspaces</property>
<property name="icon_expr">string:${portal_url}/folder_icon.png</property>
<property name="factory">ploneintranet.workspace.workspacecontainer</property>
<property name="global_allow">False</property>
<property name="filter_content_types">True</property>
<property name="allowed_content_types">
<element value="ploneintranet.workspace.workspacefolder" />
</property>
<property name="allow_discussion">False</property>

<!-- schema and class used for content items -->
<property name="schema">ploneintranet.workspace.workspacecontainer.IWorkspaceContainer</property>
<property name="klass">ploneintranet.workspace.workspacecontainer.WorkspaceContainer</property>

<property name="behaviors">
<element value="plone.app.content.interfaces.INameFromTitle" />
<element value="plone.app.dexterity.behaviors.metadata.IBasic"/>
</property>

<!-- View information -->
<property name="link_target"></property>
<property name="immediate_view">view</property>
<property name="default_view">view</property>
<property name="view_methods">
<element value="view"/>
</property>
<property name="default_view_fallback">False</property>
<property name="add_permission">cmf.AddPortalContent</property>


<!-- Method aliases -->
<alias from="(Default)" to="(dynamic view)" />
<alias from="view" to="(selected layout)" />
<alias from="edit" to="@@edit" />
<alias from="sharing" to="@@sharing" />

<!-- Actions -->
<action title="View" action_id="view" category="object" condition_expr=""
url_expr="string:${object_url}/" visible="True">
<permission value="View" />
</action>
<action title="Edit" action_id="edit" category="object" condition_expr=""
url_expr="string:${object_url}/edit" visible="True">
<permission value="Modify portal content" />
</action>
</object>
32 changes: 32 additions & 0 deletions src/ploneintranet/workspace/tests/test_content_type.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,3 +116,35 @@ def test_add_admin_to_workspace(self):
member_ids = pgroups.getGroup().getMemberIds()
self.assertIn(user.getId(),
member_ids)

def test_add_workspacecontainer(self):
"""
Check that WorkspaceContainer can be added to site root
"""
self.login_as_portal_owner()
api.content.create(
self.portal,
'ploneintranet.workspace.workspacecontainer',
'workspaces',
title='Workspaces'
)
self.assertIn('workspaces', self.portal)

def test_cannot_add_workspacecontainer_inside_workspace(self):
"""
Check that WorkspaceContainer cannot be added inside a workspace
"""
self.login_as_portal_owner()
ws = api.content.create(
self.portal,
'ploneintranet.workspace.workspacefolder',
'workspace-1',
title='Workspace 1'
)
self.assertRaises(
InvalidParameterError,
api.content.create,
ws,
'ploneintranet.workspace.workspacecontainer',
'workspace-container',
)
9 changes: 5 additions & 4 deletions src/ploneintranet/workspace/workspace.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
from zope.interface import implements
from plone import api
from plone.memoize.view import memoize
from Products.Five.browser import BrowserView
from interfaces import IWorkspaceState
from ploneintranet.workspace.utils import parent_workspace
from plone import api
from zope.interface import implements

from .interfaces import IWorkspaceState
from .utils import parent_workspace


class WorkspaceView(BrowserView):
Expand Down
17 changes: 17 additions & 0 deletions src/ploneintranet/workspace/workspacecontainer.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
from five import grok
from plone.dexterity.content import Container
from plone.directives import form
from plone.namedfile.interfaces import IImageScaleTraversable


class IWorkspaceContainer(form.Schema, IImageScaleTraversable):
"""
Marker interface for WorkspaceContainer
"""


class WorkspaceContainer(Container):
"""
A folder to contain WorkspaceFolders
"""
grok.implements(IWorkspaceContainer)

0 comments on commit b6c5dcf

Please sign in to comment.