. First cut of the Externalised UI Actions

- XML Config for UI actions: web-client-config-actions.xml
   - commented examples are included in the config, I will write up a Wiki page to document it properly :)
 - Named groups of actions can also be reused across screens (where as previously individual ActionLink components had to be coded up for each screen by hand in the JSP)
 - Individual Actions can be reused across action groups or defined against a specific action group
 - UI actions for Browse (Create, More, Document and Space actions), Document and Space details pages now externalised into config
 - Refactoring of other JSPs to use externalised config - big reduction in hand coded JSF tags and code duplication between pages
. Document Details and Space Details pages now have Actions panel on the right hand side instead of an Actions drop-down menu
. Several unreported minor bugs fixed where actions conditions or listeners were inconsistent between browse and details pages

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@2553 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Kevin Roast
2006-03-17 18:07:47 +00:00
parent dd70d72198
commit 5d3872279f
37 changed files with 2013 additions and 500 deletions

View File

@@ -18,9 +18,9 @@
<evaluator>org.alfresco.web.action.evaluator.EditDocHttpEvaluator</evaluator>
<!-- label and tooltip can be provided as text or preferable I18N message Id -->
<label>Edit</label>
<label-msg>edit</label-msg>
<label-id>edit</label-id>
<tooltip>My Tooltip</tooltip>
<tooltip-msg>tooltip</tooltip-msg>
<tooltip-id>tooltip</tooltip-id>
<!-- various presentation attributes - generally it is better to provide these as part of the
parent 'actions' definition to give a consistent look-and-feel to a group of actions -->
<show-link>false</show-link>
@@ -28,7 +28,7 @@
<style-class>inlineAction</style-class>
<image>/images/icons/edit_icon.gif</image>
<!-- action, ActionLister, href and target action attributes supported -->
<actionListener>#{CheckinCheckoutBean.editFile}</actionListener>
<action-listener>#{CheckinCheckoutBean.editFile}</action-listener>
<action>editDocument</action>
<href>http://...</href>
<target>new</target>
@@ -36,7 +36,7 @@
<!-- it is assumed that the context object for the action will have an appropriate getter method
to reflect the value of the param e.g. getId() for a param value of "id" -->
<params>
<param name="id">id</param>
<param name="id">#{actionContext.id}</param>
</params>
</action>
@@ -46,11 +46,11 @@
<permission allow="true">Write</permission>
</permissions>
<evaluator>org.alfresco.web.action.evaluator.EditDocHttpEvaluator</evaluator>
<label-msg>edit</label-msg>
<label-id>edit</label-id>
<image>/images/icons/edit_icon.gif</image>
<action-listener>#{CheckinCheckoutBean.editFile}</action-listener>
<params>
<param name="id">id</param>
<param name="id">#{actionContext.id}</param>
</params>
<!-- can also specify style, class etc. but this is better done in 'actions' element -->
</action>
@@ -61,10 +61,10 @@
<permission allow="true">Write</permission>
</permissions>
<evaluator>org.alfresco.web.action.evaluator.EditDocWebDavEvaluator</evaluator>
<label-msg>edit</label-msg>
<label-id>edit</label-id>
<image>/images/icons/edit_icon.gif</image>
<!-- NOTE: uses the special 'actioncontext' object supplied by the parent actions component -->
<onclick>javascript:openDoc('#{actioncontext.webdavUrl}');</onclick>
<!-- NOTE: uses the special 'actionContext' object supplied by the parent actions component -->
<onclick>javascript:openDoc('#{actionContext.webdavUrl}');</onclick>
</action>
<!-- Edit document using CIFS access -->
@@ -73,33 +73,394 @@
<permission allow="true">Write</permission>
</permissions>
<evaluator>org.alfresco.web.action.evaluator.EditDocCIFSEvaluator</evaluator>
<label-msg>edit</label-msg>
<label-id>edit</label-id>
<image>/images/icons/edit_icon.gif</image>
<!-- NOTE: uses the special 'actioncontext' object supplied by the parent actions component -->
<href>#{actioncontext.cifsPath}</href>
<!-- NOTE: uses the special 'actionContext' object supplied by the parent actions component -->
<href>#{actionContext.cifsPath}</href>
<target>cifs</target>
</action>
<!-- TODO: need an overridden version of this actions in the Forums actions XML
as the checkin evaluator has additional logic needed for Forums -->
<!-- Checkin document -->
<action id="checkin_doc">
<evaluator>org.alfresco.web.action.evaluator.CheckinDocEvaluator</evaluator>
<label-id>checkin</label-id>
<image>/images/icons/CheckIn_icon.gif</image>
<action-listener>#{CheckinCheckoutBean.setupContentAction}</action-listener>
<action>checkinFile</action>
<params>
<param name="id">#{actionContext.id}</param>
</params>
</action>
<!-- Checkout document -->
<!--<action id="checkout_doc">
<permissions>
<permission allow="true">CheckOut</permission>
</permissions>
<action id="checkout_doc">
<evaluator>org.alfresco.web.action.evaluator.CheckoutDocEvaluator</evaluator>
<label-msg>checkout</label-msg>
<label-id>checkout</label-id>
<image>/images/icons/CheckOut_icon.gif</image>
<action-listener>#{CheckinCheckoutBean.setupContentAction}</action-listener>
<action>checkoutFile</action>
<params>
<param name="id">id</param>
<param name="id">#{actionContext.id}</param>
</params>
</action>-->
</action>
<!-- Cancel checkout document -->
<action id="cancelcheckout_doc">
<evaluator>org.alfresco.web.action.evaluator.CancelCheckoutDocEvaluator</evaluator>
<label-id>undocheckout</label-id>
<image>/images/icons/undo_checkout.gif</image>
<action-listener>#{CheckinCheckoutBean.setupContentAction}</action-listener>
<action>undoCheckoutFile</action>
<params>
<param name="id">#{actionContext.id}</param>
</params>
</action>
<!-- TODO: move to Forums actions XML - override the document/space_browse groups? -->
<!-- Discuss document or space e.g. jump to Forums view for this node -->
<action id="discuss_node">
<evaluator>org.alfresco.web.action.evaluator.DiscussNodeEvaluator</evaluator>
<label-id>discuss</label-id>
<image>/images/icons/forum-16.gif</image>
<action-listener>#{ForumsBean.discuss}</action-listener>
<params>
<param name="id">#{actionContext.id}</param>
</params>
</action>
<!-- TODO: move to Forums actions XML - override the document/space_browse groups? -->
<!-- Discuss document or space e.g. jump to Forums view for this node -->
<action id="create_forum_node">
<permissions>
<permission allow="true">CreateChildren</permission>
</permissions>
<evaluator>org.alfresco.web.action.evaluator.CreateForumNodeEvaluator</evaluator>
<label-id>start_discussion</label-id>
<image>/images/icons/create_forum.gif</image>
<action-listener>#{CreateDiscussionDialog.startWizard}</action-listener>
<params>
<param name="id">#{actionContext.id}</param>
</params>
</action>
<!-- View document details -->
<action id="details_doc">
<label-id>view_details</label-id>
<image>/images/icons/View_details.gif</image>
<action-listener>#{BrowseBean.setupContentAction}</action-listener>
<action>dialog:showDocDetails</action>
<params>
<param name="id">#{actionContext.id}</param>
</params>
</action>
<!-- View space details -->
<action id="details_space">
<label-id>view_details</label-id>
<image>/images/icons/View_details.gif</image>
<action-listener>#{BrowseBean.setupSpaceAction}</action-listener>
<action>dialog:showSpaceDetails</action>
<params>
<param name="id">#{actionContext.id}</param>
</params>
</action>
<!-- Preview document in template -->
<action id="preview_doc">
<label-id>preview</label-id>
<image>/images/icons/preview.gif</image>
<action-listener>#{BrowseBean.setupContentAction}</action-listener>
<action>previewContent</action>
<params>
<param name="id">#{actionContext.id}</param>
</params>
</action>
<!-- Preview space in template -->
<action id="preview_space">
<label-id>preview</label-id>
<image>/images/icons/preview.gif</image>
<action-listener>#{BrowseBean.setupSpaceAction}</action-listener>
<action>previewSpace</action>
<params>
<param name="id">#{actionContext.id}</param>
</params>
</action>
<!-- Delete document -->
<action id="delete_doc">
<permissions>
<permission allow="true">Delete</permission>
</permissions>
<evaluator>org.alfresco.web.action.evaluator.DeleteDocEvaluator</evaluator>
<label-id>delete</label-id>
<image>/images/icons/delete.gif</image>
<action-listener>#{BrowseBean.setupContentAction}</action-listener>
<action>dialog:deleteFile</action>
<params>
<param name="id">#{actionContext.id}</param>
</params>
</action>
<!-- Delete space -->
<action id="delete_space">
<permissions>
<permission allow="true">Delete</permission>
</permissions>
<label-id>delete</label-id>
<image>/images/icons/delete.gif</image>
<action-listener>#{BrowseBean.setupDeleteAction}</action-listener>
<action>dialog:deleteSpace</action>
<params>
<param name="id">#{actionContext.id}</param>
</params>
</action>
<!-- Update document -->
<action id="update_doc">
<permissions>
<permission allow="true">Write</permission>
</permissions>
<evaluator>org.alfresco.web.action.evaluator.UpdateDocEvaluator</evaluator>
<label-id>update</label-id>
<image>/images/icons/update.gif</image>
<action-listener>#{CheckinCheckoutBean.setupContentAction}</action-listener>
<action>updateFile</action>
<params>
<param name="id">#{actionContext.id}</param>
</params>
</action>
<!-- 'Approve' workflow step for document -->
<action id="approve_doc">
<evaluator>org.alfresco.web.action.evaluator.ApproveDocEvaluator</evaluator>
<label>#{actionContext["app:approveStep"]}</label>
<image>/images/icons/approve.gif</image>
<action-listener>#{DocumentDetailsBean.approve}</action-listener>
<action>browse</action>
<params>
<param name="id">#{actionContext.id}</param>
</params>
</action>
<!-- 'Reject' workflow step for document -->
<action id="reject_doc">
<evaluator>org.alfresco.web.action.evaluator.RejectDocEvaluator</evaluator>
<label>#{actionContext["app:rejectStep"]}</label>
<image>/images/icons/reject.gif</image>
<action-listener>#{DocumentDetailsBean.reject}</action-listener>
<action>browse</action>
<params>
<param name="id">#{actionContext.id}</param>
</params>
</action>
<!-- 'Approve' workflow step for document details page -->
<action id="approve_doc_details">
<evaluator>org.alfresco.web.action.evaluator.ApproveDocEvaluator</evaluator>
<label>#{actionContext.properties["app:approveStep"]}</label>
<image>/images/icons/approve.gif</image>
<action-listener>#{DocumentDetailsBean.approve}</action-listener>
<action>browse</action>
<params>
<param name="id">#{actionContext.id}</param>
</params>
</action>
<!-- 'Reject' workflow step for document details page-->
<action id="reject_doc_details">
<evaluator>org.alfresco.web.action.evaluator.RejectDocEvaluator</evaluator>
<label>#{actionContext.properties["app:rejectStep"]}</label>
<image>/images/icons/reject.gif</image>
<action-listener>#{DocumentDetailsBean.reject}</action-listener>
<action>browse</action>
<params>
<param name="id">#{actionContext.id}</param>
</params>
</action>
<!-- Cut a document or space to the clipboard -->
<action id="cut_node">
<permissions>
<permission allow="true">Delete</permission>
</permissions>
<label-id>cut</label-id>
<image>/images/icons/cut.gif</image>
<action-listener>#{ClipboardBean.cutNode}</action-listener>
<params>
<param name="id">#{actionContext.id}</param>
</params>
</action>
<!-- Copy a document or space to the clipboard -->
<action id="copy_node">
<label-id>copy</label-id>
<image>/images/icons/copy.gif</image>
<action-listener>#{ClipboardBean.copyNode}</action-listener>
<params>
<param name="id">#{actionContext.id}</param>
</params>
</action>
<!-- Paste All clipboard items into a space -->
<action id="paste_all">
<permissions>
<permission allow="true">Write</permission>
</permissions>
<label-id>paste_all</label-id>
<image>/images/icons/paste.gif</image>
<action-listener>#{ClipboardBean.pasteAll}</action-listener>
</action>
<!-- Create content -->
<action id="create_content">
<permissions>
<permission allow="true">CreateChildren</permission>
</permissions>
<label-id>create_content</label-id>
<image>/images/icons/new_content.gif</image>
<action>createContent</action>
<action-listener>#{CreateContentWizard.startWizard}</action-listener>
</action>
<!-- Create space -->
<action id="create_space">
<permissions>
<permission allow="true">CreateChildren</permission>
</permissions>
<label-id>new_space</label-id>
<image>/images/icons/create_space.gif</image>
<action>createSpace</action>
<action-listener>#{NewSpaceDialog.startWizard}</action-listener>
</action>
<!-- Create Advanced Space Wizard -->
<action id="create_space_wizard">
<permissions>
<permission allow="true">CreateChildren</permission>
</permissions>
<label-id>advanced_space_wizard</label-id>
<image>/images/icons/create_space.gif</image>
<action>createAdvancedSpace</action>
<action-listener>#{NewSpaceWizard.startWizard}</action-listener>
</action>
<!-- Manage Space Users -->
<action id="manage_space_users">
<permissions>
<permission allow="true">ChangePermissions</permission>
</permissions>
<label-id>manage_invited_users</label-id>
<image>/images/icons/invite.gif</image>
<action>dialog:manageInvitedUsers</action>
<action-listener>#{BrowseBean.setupSpaceAction}</action-listener>
<params>
<param name="id">#{actionContext.id}</param>
</params>
</action>
<!-- Manage Space Rules -->
<action id="manage_space_rules">
<permissions>
<permission allow="true">Write</permission>
</permissions>
<label-id>manage_rules</label-id>
<image>/images/icons/rule.gif</image>
<action>dialog:manageRules</action>
<action-listener>#{BrowseBean.setupSpaceAction}</action-listener>
<params>
<param name="id">#{actionContext.id}</param>
</params>
</action>
<!-- Take Ownership of document -->
<action id="take_ownership_doc">
<permissions>
<permission allow="true">TakeOwnership</permission>
</permissions>
<label-id>take_ownership</label-id>
<image>/images/icons/take_ownership.gif</image>
<action-listener>#{DocumentDetailsBean.takeOwnership}</action-listener>
</action>
<!-- Take Ownership of space -->
<action id="take_ownership_space">
<permissions>
<permission allow="true">TakeOwnership</permission>
</permissions>
<label-id>take_ownership</label-id>
<image>/images/icons/take_ownership.gif</image>
<action-listener>#{SpaceDetailsBean.takeOwnership}</action-listener>
</action>
<!-- Manage Content Users -->
<action id="manage_content_users">
<permissions>
<permission allow="true">ChangePermissions</permission>
</permissions>
<label-id>manage_content_users</label-id>
<image>/images/icons/invite.gif</image>
<action>dialog:manageContentUsers</action>
<action-listener>#{BrowseBean.setupContentAction}</action-listener>
<params>
<param name="id">#{actionContext.id}</param>
</params>
</action>
<!-- Create Shortcut -->
<action id="create_shortcut">
<evaluator>org.alfresco.web.action.evaluator.ShortcutNodeEvaluator</evaluator>
<label-id>create_shortcut</label-id>
<image>/images/icons/shortcut.gif</image>
<action-listener>#{UserShortcutsBean.createShortcut}</action-listener>
<params>
<param name="id">#{actionContext.id}</param>
</params>
</action>
<!-- Run Other Action (e.g. repo action) -->
<action id="run_action">
<label-id>other_action</label-id>
<image>/images/icons/action.gif</image>
<action>createAction</action>
<action-listener>#{NewActionWizard.startWizard}</action-listener>
</action>
<!-- Import into Space -->
<action id="import_space">
<permissions>
<permission allow="true">Write</permission>
</permissions>
<label-id>import</label-id>
<image>/images/icons/import.gif</image>
<action>dialog:import</action>
<action-listener>#{BrowseBean.setupSpaceAction}</action-listener>
<params>
<param name="id">#{actionContext.id}</param>
</params>
</action>
<!-- Export from Space -->
<action id="export_space">
<label-id>export</label-id>
<image>/images/icons/export.gif</image>
<action>dialog:export</action>
<action-listener>#{BrowseBean.setupSpaceAction}</action-listener>
<params>
<param name="id">#{actionContext.id}</param>
</params>
</action>
<!-- the 'actions' elements define unique blocks of actions that reference the actions
as defined above and can override or supply display elements for the group of actions -->
<!-- the element is allow responsible for making the context Node object available with name
of 'actioncontext' so the actions can access it directly to get properties -->
<!-- the component is responsible for making the context Node object available with name
of 'actionContext' so the actions can access it directly to get properties -->
<!-- TODO: add overriden doc browse actions for forum module? -->
<!-- Actions for a document in the Browse screen -->
<action-group id="document_browse">
<show-link>false</show-link>
<style-class>inlineAction</style-class>
@@ -107,19 +468,115 @@
<action idref="edit_doc_http" />
<action idref="edit_doc_webdav" />
<action idref="edit_doc_cifs" />
<action idref="checkout_doc" />
<action idref="checkin_doc" />
<action idref="discuss_node" />
<action idref="details_doc" />
<action idref="preview_doc" />
<action id="specific_checkout_doc">
<!-- Example action defined inline rather than by reference
<action id="example2_checkout_doc">
<permissions>
<permission allow="true">CheckOut</permission>
</permissions>
<label-msg>checkout</label-msg>
<evaluator>org.alfresco.web.action.evaluator.CheckoutDocEvaluator</evaluator>
<label-id>checkout</label-id>
<image>/images/icons/CheckOut_icon.gif</image>
<action-listener>#{CheckinCheckoutBean.setupContentAction}</action-listener>
<action>checkoutFile</action>
</action>
</action>-->
</action-group>
<!-- Actions Menu for a document in the Browse screen -->
<action-group id="document_browse_menu">
<action idref="delete_doc" />
<action idref="update_doc" />
<action idref="cancelcheckout_doc" />
<action idref="approve_doc" />
<action idref="reject_doc" />
<action idref="cut_node" />
<action idref="copy_node" />
<action idref="create_forum_node" />
</action-group>
<!-- Actions for a space in the Browse screen -->
<action-group id="space_browse">
<show-link>false</show-link>
<style-class>inlineAction</style-class>
<action idref="preview_space" />
<action idref="discuss_node" />
<action idref="cut_node" />
<action idref="copy_node" />
<action idref="details_space" />
</action-group>
<!-- Actions Menu for a space in the Browse screen -->
<action-group id="space_browse_menu">
<action idref="delete_space" />
<action idref="create_forum_node" />
</action-group>
<!-- Actions Menu for Create in Browse screen -->
<action-group id="browse_create_menu">
<action idref="create_content" />
<action idref="create_space" />
<action idref="create_space_wizard" />
</action-group>
<!-- Actions Menu for More Actions in Browse screen -->
<action-group id="browse_actions_menu">
<action idref="details_space" />
<action idref="delete_space" />
<action idref="cut_node" />
<action idref="copy_node" />
<action idref="paste_all" />
<action idref="manage_space_users" />
<action idref="manage_space_rules" />
</action-group>
<!-- Actions Menu for Document Details screen -->
<action-group id="doc_details_actions">
<action idref="checkout_doc" />
<action idref="checkin_doc" />
<action idref="cancelcheckout_doc" />
<action idref="approve_doc_details" />
<action idref="reject_doc_details" />
<action idref="edit_doc_http" />
<!-- TODO: add these once the appropriate props (webdavUrl and cifsPath) are added
to the node bean as resolvers (probably need to change valuebindings also)
<action idref="edit_doc_webdav" />
<action idref="edit_doc_cifs" />
-->
<action idref="update_doc" />
<action idref="cut_node" />
<action idref="copy_node" />
<action idref="delete_doc" />
<action idref="take_ownership_doc" />
<action idref="manage_content_users" />
<action idref="create_shortcut" />
<action idref="discuss_node" />
<action idref="create_forum_node" />
<action idref="preview_doc" />
<action idref="run_action" />
</action-group>
<!-- Actions Menu for Space Details screen -->
<action-group id="space_details_actions">
<action idref="cut_node" />
<action idref="copy_node" />
<action idref="delete_space" />
<action idref="import_space" />
<action idref="export_space" />
<action idref="create_shortcut" />
<action idref="take_ownership_space" />
<action idref="manage_space_rules" />
<action idref="discuss_node" />
<action idref="create_forum_node" />
<action idref="preview_space" />
</action-group>
</actions>
</config>

View File

@@ -30,5 +30,13 @@ import org.alfresco.web.bean.repository.Node;
*/
public interface ActionEvaluator
{
/**
* The evaluator should decide if the action precondition is valid based on the appropriate
* logic and the properties etc. of the Node context and return the result.
*
* @param node Node context for the action
*
* @return result of whether the action can proceed.
*/
public boolean evaluate(Node node);
}

View File

@@ -0,0 +1,43 @@
/*
* Copyright (C) 2005 Alfresco, Inc.
*
* Licensed under the Mozilla Public License version 1.1
* with a permitted attribution clause. You may obtain a
* copy of the License at
*
* http://www.alfresco.org/legal/license.txt
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
* either express or implied. See the License for the specific
* language governing permissions and limitations under the
* License.
*/
package org.alfresco.web.action.evaluator;
import org.alfresco.model.ContentModel;
import org.alfresco.service.cmr.security.PermissionService;
import org.alfresco.web.action.ActionEvaluator;
import org.alfresco.web.bean.repository.Node;
/**
* UI Action Evaluator - 'Approve' workflow step for document.
*
* @author Kevin Roast
*/
public final class ApproveDocEvaluator implements ActionEvaluator
{
/**
* @see org.alfresco.web.action.ActionEvaluator#evaluate(org.alfresco.web.bean.repository.Node)
*/
public boolean evaluate(Node node)
{
return (node.getProperties().get("app:approveStep") != null &&
node.isLocked() == false &&
node.hasAspect(ContentModel.ASPECT_WORKING_COPY) == false);
}
}
/*
<a:booleanEvaluator value='#{r["app:approveStep"] != null && r.workingCopy == false && r.locked == false}'>
*/

View File

@@ -0,0 +1,42 @@
/*
* Copyright (C) 2005 Alfresco, Inc.
*
* Licensed under the Mozilla Public License version 1.1
* with a permitted attribution clause. You may obtain a
* copy of the License at
*
* http://www.alfresco.org/legal/license.txt
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
* either express or implied. See the License for the specific
* language governing permissions and limitations under the
* License.
*/
package org.alfresco.web.action.evaluator;
import org.alfresco.model.ContentModel;
import org.alfresco.service.cmr.security.PermissionService;
import org.alfresco.web.action.ActionEvaluator;
import org.alfresco.web.bean.repository.Node;
/**
* UI Action Evaluator - Cancel checkout document.
*
* @author Kevin Roast
*/
public final class CancelCheckoutDocEvaluator implements ActionEvaluator
{
/**
* @see org.alfresco.web.action.ActionEvaluator#evaluate(org.alfresco.web.bean.repository.Node)
*/
public boolean evaluate(Node node)
{
return (node.hasPermission(PermissionService.CANCEL_CHECK_OUT) &&
node.hasAspect(ContentModel.ASPECT_WORKING_COPY));
}
}
/*
<a:booleanEvaluator value="#{r.cancelCheckOut == true}">
*/

View File

@@ -0,0 +1,42 @@
/*
* Copyright (C) 2005 Alfresco, Inc.
*
* Licensed under the Mozilla Public License version 1.1
* with a permitted attribution clause. You may obtain a
* copy of the License at
*
* http://www.alfresco.org/legal/license.txt
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
* either express or implied. See the License for the specific
* language governing permissions and limitations under the
* License.
*/
package org.alfresco.web.action.evaluator;
import org.alfresco.model.ContentModel;
import org.alfresco.service.cmr.security.PermissionService;
import org.alfresco.web.action.ActionEvaluator;
import org.alfresco.web.bean.repository.Node;
/**
* UI Action Evaluator - Checkin document.
*
* @author Kevin Roast
*/
public final class CheckinDocEvaluator implements ActionEvaluator
{
/**
* @see org.alfresco.web.action.ActionEvaluator#evaluate(org.alfresco.web.bean.repository.Node)
*/
public boolean evaluate(Node node)
{
return (node.hasPermission(PermissionService.CHECK_IN) &&
node.hasAspect(ContentModel.ASPECT_WORKING_COPY) == true);
}
}
/*
<a:booleanEvaluator value="#{r.checkIn == true}">
*/

View File

@@ -0,0 +1,43 @@
/*
* Copyright (C) 2005 Alfresco, Inc.
*
* Licensed under the Mozilla Public License version 1.1
* with a permitted attribution clause. You may obtain a
* copy of the License at
*
* http://www.alfresco.org/legal/license.txt
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
* either express or implied. See the License for the specific
* language governing permissions and limitations under the
* License.
*/
package org.alfresco.web.action.evaluator;
import org.alfresco.model.ContentModel;
import org.alfresco.service.cmr.security.PermissionService;
import org.alfresco.web.action.ActionEvaluator;
import org.alfresco.web.bean.repository.Node;
/**
* UI Action Evaluator - Checkout document.
*
* @author Kevin Roast
*/
public final class CheckoutDocEvaluator implements ActionEvaluator
{
/**
* @see org.alfresco.web.action.ActionEvaluator#evaluate(org.alfresco.web.bean.repository.Node)
*/
public boolean evaluate(Node node)
{
return (node.hasPermission(PermissionService.CHECK_OUT) &&
(node.isLocked() == false &&
node.hasAspect(ContentModel.ASPECT_WORKING_COPY) == false));
}
}
/*
<a:booleanEvaluator value="#{r.locked == false && r.workingCopy == false}">
*/

View File

@@ -0,0 +1,42 @@
/*
* Copyright (C) 2005 Alfresco, Inc.
*
* Licensed under the Mozilla Public License version 1.1
* with a permitted attribution clause. You may obtain a
* copy of the License at
*
* http://www.alfresco.org/legal/license.txt
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
* either express or implied. See the License for the specific
* language governing permissions and limitations under the
* License.
*/
package org.alfresco.web.action.evaluator;
import org.alfresco.model.ContentModel;
import org.alfresco.model.ForumModel;
import org.alfresco.web.action.ActionEvaluator;
import org.alfresco.web.bean.repository.Node;
/**
* UI Action Evaluator - Create a forum around a node.
*
* @author Kevin Roast
*/
public final class CreateForumNodeEvaluator implements ActionEvaluator
{
/**
* @see org.alfresco.web.action.ActionEvaluator#evaluate(org.alfresco.web.bean.repository.Node)
*/
public boolean evaluate(Node node)
{
return (node.hasAspect(ForumModel.ASPECT_DISCUSSABLE) == false &&
node.isLocked() == false);
}
}
/*
<a:booleanEvaluator value="#{r.beingDiscussed == false && r.locked == false}">
*/

View File

@@ -0,0 +1,41 @@
/*
* Copyright (C) 2005 Alfresco, Inc.
*
* Licensed under the Mozilla Public License version 1.1
* with a permitted attribution clause. You may obtain a
* copy of the License at
*
* http://www.alfresco.org/legal/license.txt
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
* either express or implied. See the License for the specific
* language governing permissions and limitations under the
* License.
*/
package org.alfresco.web.action.evaluator;
import org.alfresco.model.ContentModel;
import org.alfresco.web.action.ActionEvaluator;
import org.alfresco.web.bean.repository.Node;
/**
* UI Action Evaluator - Delete document.
*
* @author Kevin Roast
*/
public final class DeleteDocEvaluator implements ActionEvaluator
{
/**
* @see org.alfresco.web.action.ActionEvaluator#evaluate(org.alfresco.web.bean.repository.Node)
*/
public boolean evaluate(Node node)
{
return (node.isLocked() == false &&
node.hasAspect(ContentModel.ASPECT_WORKING_COPY) == false);
}
}
/*
<a:booleanEvaluator value="#{r.locked == false && r.workingCopy == false}">
*/

View File

@@ -0,0 +1,41 @@
/*
* Copyright (C) 2005 Alfresco, Inc.
*
* Licensed under the Mozilla Public License version 1.1
* with a permitted attribution clause. You may obtain a
* copy of the License at
*
* http://www.alfresco.org/legal/license.txt
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
* either express or implied. See the License for the specific
* language governing permissions and limitations under the
* License.
*/
package org.alfresco.web.action.evaluator;
import org.alfresco.model.ContentModel;
import org.alfresco.model.ForumModel;
import org.alfresco.web.action.ActionEvaluator;
import org.alfresco.web.bean.repository.Node;
/**
* UI Action Evaluator - Discuss a node.
*
* @author Kevin Roast
*/
public final class DiscussNodeEvaluator implements ActionEvaluator
{
/**
* @see org.alfresco.web.action.ActionEvaluator#evaluate(org.alfresco.web.bean.repository.Node)
*/
public boolean evaluate(Node node)
{
return (node.hasAspect(ForumModel.ASPECT_DISCUSSABLE) == true);
}
}
/*
<a:booleanEvaluator value="#{r.beingDiscussed == true}">
*/

View File

@@ -19,16 +19,16 @@ package org.alfresco.web.action.evaluator;
import javax.faces.context.FacesContext;
import org.alfresco.model.ContentModel;
import org.alfresco.service.cmr.lock.LockService;
import org.alfresco.web.action.ActionEvaluator;
import org.alfresco.web.app.Application;
import org.alfresco.web.bean.repository.Node;
import org.alfresco.web.bean.repository.Repository;
/**
* UI Action Evaluator - Edit document via CIFS.
*
* @author Kevin Roast
*/
public class EditDocCIFSEvaluator implements ActionEvaluator
public final class EditDocCIFSEvaluator implements ActionEvaluator
{
/**
* @see org.alfresco.web.action.ActionEvaluator#evaluate(org.alfresco.web.bean.repository.Node)
@@ -41,11 +41,8 @@ public class EditDocCIFSEvaluator implements ActionEvaluator
if (node.hasAspect(ContentModel.ASPECT_INLINEEDITABLE) == false &&
"webdav".equals(Application.getClientConfig(fc).getEditLinkType()))
{
LockService lockService =
Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getLockService();
if (Repository.isNodeOwner(node, lockService) == true ||
(node.isLocked() == false && node.hasAspect(ContentModel.ASPECT_WORKING_COPY)))
if (node.isWorkingCopyOwner() == true ||
(node.isLocked() == false && node.hasAspect(ContentModel.ASPECT_WORKING_COPY) == false))
{
return true;
}

View File

@@ -19,16 +19,16 @@ package org.alfresco.web.action.evaluator;
import javax.faces.context.FacesContext;
import org.alfresco.model.ContentModel;
import org.alfresco.service.cmr.lock.LockService;
import org.alfresco.web.action.ActionEvaluator;
import org.alfresco.web.app.Application;
import org.alfresco.web.bean.repository.Node;
import org.alfresco.web.bean.repository.Repository;
/**
* UI Action Evaluator - Edit document via HTTP or inline edit.
*
* @author Kevin Roast
*/
public class EditDocHttpEvaluator implements ActionEvaluator
public final class EditDocHttpEvaluator implements ActionEvaluator
{
/**
* @see org.alfresco.web.action.ActionEvaluator#evaluate(org.alfresco.web.bean.repository.Node)
@@ -42,11 +42,8 @@ public class EditDocHttpEvaluator implements ActionEvaluator
if (node.hasAspect(ContentModel.ASPECT_INLINEEDITABLE) == true ||
"http".equals(Application.getClientConfig(fc).getEditLinkType()))
{
LockService lockService =
Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getLockService();
if (Repository.isNodeOwner(node, lockService) == true ||
(node.isLocked() == false && node.hasAspect(ContentModel.ASPECT_WORKING_COPY)))
if (node.isWorkingCopyOwner() == true ||
(node.isLocked() == false && node.hasAspect(ContentModel.ASPECT_WORKING_COPY) == false))
{
return true;
}

View File

@@ -19,16 +19,16 @@ package org.alfresco.web.action.evaluator;
import javax.faces.context.FacesContext;
import org.alfresco.model.ContentModel;
import org.alfresco.service.cmr.lock.LockService;
import org.alfresco.web.action.ActionEvaluator;
import org.alfresco.web.app.Application;
import org.alfresco.web.bean.repository.Node;
import org.alfresco.web.bean.repository.Repository;
/**
* UI Action Evaluator - Edit document via Webdav.
*
* @author Kevin Roast
*/
public class EditDocWebDavEvaluator implements ActionEvaluator
public final class EditDocWebDavEvaluator implements ActionEvaluator
{
/**
* @see org.alfresco.web.action.ActionEvaluator#evaluate(org.alfresco.web.bean.repository.Node)
@@ -41,11 +41,8 @@ public class EditDocWebDavEvaluator implements ActionEvaluator
if (node.hasAspect(ContentModel.ASPECT_INLINEEDITABLE) == false &&
"cifs".equals(Application.getClientConfig(fc).getEditLinkType()))
{
LockService lockService =
Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getLockService();
if (Repository.isNodeOwner(node, lockService) == true ||
(node.isLocked() == false && node.hasAspect(ContentModel.ASPECT_WORKING_COPY)))
if (node.isWorkingCopyOwner() == true ||
(node.isLocked() == false && node.hasAspect(ContentModel.ASPECT_WORKING_COPY) == false))
{
return true;
}

View File

@@ -0,0 +1,43 @@
/*
* Copyright (C) 2005 Alfresco, Inc.
*
* Licensed under the Mozilla Public License version 1.1
* with a permitted attribution clause. You may obtain a
* copy of the License at
*
* http://www.alfresco.org/legal/license.txt
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
* either express or implied. See the License for the specific
* language governing permissions and limitations under the
* License.
*/
package org.alfresco.web.action.evaluator;
import org.alfresco.model.ContentModel;
import org.alfresco.service.cmr.security.PermissionService;
import org.alfresco.web.action.ActionEvaluator;
import org.alfresco.web.bean.repository.Node;
/**
* UI Action Evaluator - 'Reject' workflow step for document.
*
* @author Kevin Roast
*/
public final class RejectDocEvaluator implements ActionEvaluator
{
/**
* @see org.alfresco.web.action.ActionEvaluator#evaluate(org.alfresco.web.bean.repository.Node)
*/
public boolean evaluate(Node node)
{
return (node.getProperties().get("app:rejectStep") != null &&
node.isLocked() == false &&
node.hasAspect(ContentModel.ASPECT_WORKING_COPY) == false);
}
}
/*
<a:booleanEvaluator value='#{r["app:rejectStep"] != null && r.workingCopy == false && r.locked == false}'>
*/

View File

@@ -0,0 +1,45 @@
/*
* Copyright (C) 2005 Alfresco, Inc.
*
* Licensed under the Mozilla Public License version 1.1
* with a permitted attribution clause. You may obtain a
* copy of the License at
*
* http://www.alfresco.org/legal/license.txt
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
* either express or implied. See the License for the specific
* language governing permissions and limitations under the
* License.
*/
package org.alfresco.web.action.evaluator;
import javax.faces.context.FacesContext;
import org.alfresco.web.action.ActionEvaluator;
import org.alfresco.web.app.servlet.FacesHelper;
import org.alfresco.web.bean.NavigationBean;
import org.alfresco.web.bean.repository.Node;
/**
* UI Action Evaluator - Create a shortcut to a node.
*
* @author Kevin Roast
*/
public final class ShortcutNodeEvaluator implements ActionEvaluator
{
/**
* @see org.alfresco.web.action.ActionEvaluator#evaluate(org.alfresco.web.bean.repository.Node)
*/
public boolean evaluate(Node node)
{
NavigationBean nav =
(NavigationBean)FacesHelper.getManagedBean(FacesContext.getCurrentInstance(), "NavigationBean");
return (nav.getIsGuest() == false);
}
}
/*
rendered="#{NavigationBean.isGuest == false}"
*/

View File

@@ -0,0 +1,42 @@
/*
* Copyright (C) 2005 Alfresco, Inc.
*
* Licensed under the Mozilla Public License version 1.1
* with a permitted attribution clause. You may obtain a
* copy of the License at
*
* http://www.alfresco.org/legal/license.txt
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
* either express or implied. See the License for the specific
* language governing permissions and limitations under the
* License.
*/
package org.alfresco.web.action.evaluator;
import org.alfresco.model.ContentModel;
import org.alfresco.web.action.ActionEvaluator;
import org.alfresco.web.bean.repository.Node;
/**
* UI Action Evaluator - Update document content.
*
* @author Kevin Roast
*/
public final class UpdateDocEvaluator implements ActionEvaluator
{
/**
* @see org.alfresco.web.action.ActionEvaluator#evaluate(org.alfresco.web.bean.repository.Node)
*/
public boolean evaluate(Node node)
{
return (node.isWorkingCopyOwner() == true ||
(node.isLocked() == false &&
node.hasAspect(ContentModel.ASPECT_WORKING_COPY) == false));
}
}
/*
<a:booleanEvaluator value="#{(r.locked == false && r.workingCopy == false) || r.owner == true}">
*/

View File

@@ -17,6 +17,11 @@
*/
package org.alfresco.web.app;
import java.util.ArrayList;
import java.util.List;
import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
import javax.faces.event.PhaseEvent;
import javax.faces.event.PhaseId;
import javax.faces.event.PhaseListener;
@@ -33,13 +38,18 @@ public class DebugPhaseListener implements PhaseListener
{
private static final Log logger = LogFactory.getLog(DebugPhaseListener.class);
public int indent = 0;
public static final String INDENT = " ";
/**
* @see javax.faces.event.PhaseListener#afterPhase(javax.faces.event.PhaseEvent)
*/
public void afterPhase(PhaseEvent event)
{
if (logger.isDebugEnabled())
logger.debug("********** Exiting phase: " + event.getPhaseId().toString());
{
printComponentTree(FacesContext.getCurrentInstance().getViewRoot());
}
}
/**
@@ -47,8 +57,6 @@ public class DebugPhaseListener implements PhaseListener
*/
public void beforePhase(PhaseEvent event)
{
if (logger.isDebugEnabled())
logger.debug("********** Entering phase: " + event.getPhaseId().toString());
}
/**
@@ -56,7 +64,41 @@ public class DebugPhaseListener implements PhaseListener
*/
public PhaseId getPhaseId()
{
return PhaseId.ANY_PHASE;
return PhaseId.RENDER_RESPONSE;
}
public void printComponentTree(UIComponent comp){
printComponentInfo(comp);
List complist = comp.getChildren();
if (complist.size()>0)
indent++;
for (int i = 0; i < complist.size(); i++) {
UIComponent uicom = (UIComponent) complist.get(i);
printComponentTree(uicom);
if (i+1 == complist.size())
indent--;
}
}
public void printComponentInfo(UIComponent comp){
if (comp.getId() == null){
logger.debug("UIViewRoot" + " " + "(" + comp.getClass().getName() + ")");
} else {
logger.debug(getIndent() + "|");
logger.debug(getIndent() + comp.getId() + " " + "(" + comp.getClass().getName() + ")");
}
}
public String getIndent()
{
String indent = "";
for (int i=0; i<this.indent; i++)
{
indent += INDENT;
}
return indent;
}
}

View File

@@ -783,7 +783,7 @@ public class BrowseBean implements IContextListener
public NodePropertyResolver resolverOwner = new NodePropertyResolver() {
public Object get(Node node) {
return Repository.isNodeOwner(node, lockService);
return getDocument().isWorkingCopyOwner();
}
};

View File

@@ -1087,7 +1087,7 @@ public class DocumentDetailsBean
FacesContext context = FacesContext.getCurrentInstance();
String msg = Application.getMessage(context, MSG_SUCCESS_OWNERSHIP);
FacesMessage facesMsg = new FacesMessage(FacesMessage.SEVERITY_INFO, msg, msg);
context.addMessage(event.getComponent().getClientId(context), facesMsg);
context.addMessage("document-details:document-props", facesMsg);
// commit the transaction
tx.commit();
@@ -1193,7 +1193,7 @@ public class DocumentDetailsBean
*/
public boolean isOwner()
{
return Repository.isNodeOwner(getDocument(), this.lockService);
return getDocument().isWorkingCopyOwner();
}
/**

View File

@@ -324,7 +324,7 @@ public class SpaceDetailsBean
FacesContext context = FacesContext.getCurrentInstance();
String msg = Application.getMessage(context, MSG_SUCCESS_OWNERSHIP);
FacesMessage facesMsg = new FacesMessage(FacesMessage.SEVERITY_INFO, msg, msg);
context.addMessage(event.getComponent().getClientId(context), facesMsg);
context.addMessage("space-details:space-props", facesMsg);
// commit the transaction
tx.commit();

View File

@@ -35,6 +35,7 @@ import org.alfresco.service.cmr.security.AccessStatus;
import org.alfresco.service.cmr.security.PermissionService;
import org.alfresco.service.namespace.QName;
import org.alfresco.service.namespace.RegexQNamePattern;
import org.alfresco.web.app.Application;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -57,6 +58,7 @@ public class Node implements Serializable
private Set<QName> aspects = null;
private Map<String, Boolean> permissions;
private Boolean locked = null;
private Boolean workingCopyOwner = null;
protected QNameNodeMap<String, Object> properties;
protected boolean propsRetrieved = false;
protected ServiceRegistry services = null;
@@ -404,6 +406,32 @@ public class Node implements Serializable
return this.locked.booleanValue();
}
/**
* @return whether a the Node is a WorkingCopy owned by the current User
*/
public final boolean isWorkingCopyOwner()
{
if (this.workingCopyOwner == null)
{
this.workingCopyOwner = Boolean.FALSE;
if (hasAspect(ContentModel.ASPECT_WORKING_COPY))
{
Object obj = getProperties().get(ContentModel.PROP_WORKING_COPY_OWNER);
if (obj instanceof String)
{
User user = Application.getCurrentUser(FacesContext.getCurrentInstance());
if ( ((String)obj).equals(user.getUserName()))
{
this.workingCopyOwner = Boolean.TRUE;
}
}
}
}
return workingCopyOwner.booleanValue();
}
/**
* Resets the state of the node to force re-retrieval of the data
*/
@@ -413,6 +441,7 @@ public class Node implements Serializable
this.type = null;
this.path = null;
this.locked = null;
this.workingCopyOwner = null;
this.properties.clear();
this.propsRetrieved = false;
this.aspects = null;

View File

@@ -219,34 +219,6 @@ public final class Repository
return locked;
}
/**
* Return whether a WorkingCopy Node is owned by the current User
*
* @param node The Node wrapper to test against
* @param lockService The LockService to use
*
* @return whether a WorkingCopy Node is owned by the current User
*/
public static Boolean isNodeOwner(Node node, LockService lockService)
{
Boolean locked = Boolean.FALSE;
if (node.hasAspect(ContentModel.ASPECT_WORKING_COPY))
{
Object obj = node.getProperties().get("workingCopyOwner");
if (obj instanceof String)
{
User user = Application.getCurrentUser(FacesContext.getCurrentInstance());
if ( ((String)obj).equals(user.getUserName()))
{
locked = Boolean.TRUE;
}
}
}
return locked;
}
/**
* Return the human readable form of the specified node Path. Fast version of the method that
* simply converts QName localname components to Strings.

View File

@@ -72,11 +72,18 @@ public class ActionsConfigElement extends ConfigElementAdapter
ActionsConfigElement existingElement = (ActionsConfigElement)configElement;
ActionsConfigElement combinedElement = new ActionsConfigElement();
combinedElement.actionDefs.putAll(this.actionDefs);
combinedElement.actionDefs.putAll(existingElement.actionDefs);
combinedElement.actionGroups.putAll(this.actionGroups);
combinedElement.actionGroups.putAll(existingElement.actionGroups);
//
// TODO: implement to allow override of config elements
// TODO: do we need to check all groups here and update ActionDefinition references incase they
// have changed? e.g. if an actiondef ID is overriden, a group using it will not know!
//
return null;
return combinedElement;
}
/*package*/ void addActionDefinition(ActionDefinition actionDef)
@@ -173,7 +180,7 @@ public class ActionsConfigElement extends ConfigElementAdapter
public String LabelMsg;
public String Tooltip;
public String TooltipMsg;
public boolean ShowLink;
public boolean ShowLink = true;
public String Style;
public String StyleClass;
public String Image;
@@ -181,6 +188,7 @@ public class ActionsConfigElement extends ConfigElementAdapter
public String Action;
public String Href;
public String Target;
public String Onclick;
}

View File

@@ -39,14 +39,15 @@ public class ActionsElementReader implements ConfigElementReader
public static final String ELEMENT_PERMISSION = "permission";
public static final String ELEMENT_EVALUATOR = "evaluator";
public static final String ELEMENT_LABEL = "label";
public static final String ELEMENT_LABELMSG = "label-msg";
public static final String ELEMENT_LABELMSG = "label-id";
public static final String ELEMENT_TOOLTIP = "tooltip";
public static final String ELEMENT_TOOLTIPMSG = "tooltip-msg";
public static final String ELEMENT_TOOLTIPMSG = "tooltip-id";
public static final String ELEMENT_SHOWLINK = "show-link";
public static final String ELEMENT_STYLE = "style";
public static final String ELEMENT_STYLECLASS = "style-class";
public static final String ELEMENT_IMAGE = "image";
public static final String ELEMENT_ACTIONLISTENER = "action-listener";
public static final String ELEMENT_ONCLICK = "onclick";
public static final String ELEMENT_HREF = "href";
public static final String ELEMENT_TARGET = "target";
public static final String ELEMENT_PARAMS = "params";
@@ -250,6 +251,7 @@ public class ActionsElementReader implements ConfigElementReader
actionDef.Target = actionElement.elementTextTrim(ELEMENT_TARGET);
actionDef.Action = actionElement.elementTextTrim(ELEMENT_ACTION);
actionDef.ActionListener = actionElement.elementTextTrim(ELEMENT_ACTIONLISTENER);
actionDef.Onclick = actionElement.elementTextTrim(ELEMENT_ONCLICK);
actionDef.Image = actionElement.elementTextTrim(ELEMENT_IMAGE);
actionDef.Style = actionElement.elementTextTrim(ELEMENT_STYLE);
actionDef.StyleClass = actionElement.elementTextTrim(ELEMENT_STYLECLASS);

View File

@@ -28,6 +28,7 @@ public final class ComponentConstants
public static final String JAVAX_FACES_PANEL = "javax.faces.Panel";
public static final String JAVAX_FACES_CHECKBOX = "javax.faces.Checkbox";
public static final String JAVAX_FACES_SELECT_BOOLEAN = "javax.faces.SelectBoolean";
public static final String JAVAX_FACES_PARAMETER = "javax.faces.Parameter";
/**
* Private constructor

View File

@@ -27,6 +27,7 @@ import javax.faces.event.ActionEvent;
import org.alfresco.web.ui.common.Utils;
import org.alfresco.web.ui.common.component.UIActionLink;
import org.alfresco.web.ui.common.component.UIMenu;
import org.alfresco.web.ui.repo.component.UIActions;
/**
* @author kevinr
@@ -78,10 +79,17 @@ public class ActionLinkRenderer extends BaseRenderer
UIActionLink link = (UIActionLink)component;
if (isInMenu(link) == true)
UIComponent verticalContiner = getVerticalContainer(link);
if (verticalContiner != null)
{
// render as menu item
out.write( renderMenuAction(context, link) );
int padding = link.getPadding();
if (verticalContiner instanceof UIActions)
{
padding = ((UIActions)verticalContiner).getVerticalSpacing();
}
// render as menu item style action link
out.write( renderMenuAction(context, link, padding) );
}
else
{
@@ -239,7 +247,7 @@ public class ActionLinkRenderer extends BaseRenderer
*
* @return action link HTML
*/
private String renderMenuAction(FacesContext context, UIActionLink link)
private String renderMenuAction(FacesContext context, UIActionLink link, int padding)
{
StringBuilder buf = new StringBuilder(256);
@@ -252,7 +260,6 @@ public class ActionLinkRenderer extends BaseRenderer
}
buf.append("</td><td");
int padding = link.getPadding();
if (padding != 0)
{
buf.append(" style=\"padding:")
@@ -314,23 +321,24 @@ public class ActionLinkRenderer extends BaseRenderer
// Private helpers
/**
* Return true if the action link is present within a UIMenu component container
* Return any vertically rendered container component the action link is present within
*
* @param link The ActionLink to test
*
* @return true if the action link is present within a UIMenu component
* @return UIComponent vertically rendered component
*/
private static boolean isInMenu(UIActionLink link)
private static UIComponent getVerticalContainer(UIActionLink link)
{
UIComponent parent = link.getParent();
while (parent != null)
{
if (parent instanceof UIMenu)
if (parent instanceof UIMenu ||
(parent instanceof UIActions && ((UIActions)parent).getVerticalSpacing() != 0))
{
break;
}
parent = parent.getParent();
}
return (parent != null);
return parent;
}
}

View File

@@ -355,42 +355,6 @@ public class RichListRenderer extends BaseRenderer
public void renderListBefore(FacesContext context, UIRichList richList, UIColumn[] columns)
throws IOException
{
// ResponseWriter out = context.getResponseWriter();
// render column headers as labels
// TODO: add "showHeaders" to RichList to allow hiding of header facets for some view modes
/*
out.write("<tr");
outputAttribute(out, richList.getAttributes().get("headerStyleClass"), "class");
out.write('>');
for (int i=0; i<columns.length; i++)
{
UIColumn column = columns[i];
if (column.isRendered() == true)
{
out.write("<th");
outputAttribute(out, column.getAttributes().get("width"), "width");
outputAttribute(out, column.getAttributes().get("style"), "style");
outputAttribute(out, column.getAttributes().get("styleClass"), "class");
out.write('>');
// output the header facet if any
UIComponent header = column.getHeader();
if (header != null)
{
header.encodeBegin(context);
header.encodeChildren(context);
header.encodeEnd(context);
}
}
// we don't render child controls for the header row
out.write("</th>");
}
out.write("</tr>");
*/
this.rowIndex = 0;
}

View File

@@ -0,0 +1,587 @@
/*
* Copyright (C) 2005 Alfresco, Inc.
*
* Licensed under the Mozilla Public License version 1.1
* with a permitted attribution clause. You may obtain a
* copy of the License at
*
* http://www.alfresco.org/legal/license.txt
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
* either express or implied. See the License for the specific
* language governing permissions and limitations under the
* License.
*/
package org.alfresco.web.ui.repo.component;
import java.io.IOException;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.ResourceBundle;
import javax.faces.component.NamingContainer;
import javax.faces.component.UIComponent;
import javax.faces.component.UIParameter;
import javax.faces.context.FacesContext;
import javax.faces.context.ResponseWriter;
import javax.faces.el.ValueBinding;
import org.alfresco.config.Config;
import org.alfresco.web.app.Application;
import org.alfresco.web.bean.repository.Node;
import org.alfresco.web.config.ActionsConfigElement;
import org.alfresco.web.config.ActionsConfigElement.ActionDefinition;
import org.alfresco.web.config.ActionsConfigElement.ActionGroup;
import org.alfresco.web.ui.common.ComponentConstants;
import org.alfresco.web.ui.common.ConstantMethodBinding;
import org.alfresco.web.ui.common.Utils;
import org.alfresco.web.ui.common.component.SelfRenderingComponent;
import org.alfresco.web.ui.common.component.UIActionLink;
import org.alfresco.web.ui.repo.component.evaluator.ActionInstanceEvaluator;
import org.alfresco.web.ui.repo.component.evaluator.PermissionEvaluator;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.myfaces.taglib.UIComponentTagUtils;
/**
* @author kevinr
*/
public class UIActions extends SelfRenderingComponent
{
// ------------------------------------------------------------------------------
// Component implementation
private static final String ATTR_VALUE = "value";
private static Log logger = LogFactory.getLog(UIActions.class);
private static final String ATTR_SHOWLINK = "showLink";
private static final String ATTR_STYLECLASS = "styleClass";
private static final String ATTR_STYLE = "style";
private static final String ACTION_CONTEXT = "actionContext";
private static final String RENDERER_ACTIONLINK = "org.alfresco.faces.ActionLinkRenderer";
private static final String COMPONENT_ACTIONLINK = "org.alfresco.faces.ActionLink";
private static final String COMPONENT_PERMISSIONEVAL = "org.alfresco.faces.PermissionEvaluator";
private static final String COMPONENT_ACTIONEVAL = "org.alfresco.faces.ActionInstanceEvaluator";
private final static Class ACTION_CLASS_ARGS[] = {javax.faces.event.ActionEvent.class};
/**
* @see javax.faces.component.UIComponent#getFamily()
*/
public String getFamily()
{
return "org.alfresco.faces.Controls";
}
/**
* @see javax.faces.component.StateHolder#restoreState(javax.faces.context.FacesContext, java.lang.Object)
*/
public void restoreState(FacesContext context, Object state)
{
Object values[] = (Object[])state;
// standard component attributes are restored by the super class
super.restoreState(context, values[0]);
this.value = (String)values[1];
this.showLink = (Boolean)values[2];
this.verticalSpacing = (Integer)values[3];
}
/**
* @see javax.faces.component.StateHolder#saveState(javax.faces.context.FacesContext)
*/
public Object saveState(FacesContext context)
{
Object values[] = new Object[4];
// standard component attributes are saved by the super class
values[0] = super.saveState(context);
values[1] = this.value;
values[2] = this.showLink;
values[3] = this.verticalSpacing;
return (values);
}
/**
* @see javax.faces.component.UIComponentBase#encodeBegin(javax.faces.context.FacesContext)
*/
public void encodeBegin(FacesContext context) throws IOException
{
if (isRendered() == false)
{
return;
}
if (logger.isDebugEnabled())
logger.debug("encodeBegin() for <r:actions/> Id: " + getId() + " groupId: " + getValue());
// put the context object into the requestMap so it is accessable
// by any child component value binding expressions
Map requestMap = getFacesContext().getExternalContext().getRequestMap();
requestMap.put(ACTION_CONTEXT, getContext());
if (getChildCount() != 0)
{
if (logger.isDebugEnabled())
logger.debug("---already built component tree for actions.");
return;
}
ResponseWriter out = context.getResponseWriter();
String groupId = getValue();
if (groupId != null && groupId.length() != 0)
{
Config config = Application.getConfigService(context).getConfig("Actions");
if (config != null)
{
// find the Actions specific config element
ActionsConfigElement actionConfig =
(ActionsConfigElement)config.getConfigElement(ActionsConfigElement.CONFIG_ELEMENT_ID);
if (actionConfig != null)
{
// and lookup our ActionGroup by Id
ActionGroup actionGroup = actionConfig.getActionGroup(groupId);
if (actionGroup != null)
{
// render the action group component tree
if (logger.isDebugEnabled())
logger.debug("-constructing ActionGroup: " + groupId);
buildActionGroup(context, actionGroup);
}
else
{
logger.warn("Unable to find specified Action Group config ID: " + groupId);
}
}
}
}
}
/**
* @see javax.faces.component.UIComponentBase#getRendersChildren()
*/
public boolean getRendersChildren()
{
return true;
}
/**
* @see javax.faces.component.UIComponentBase#encodeChildren(javax.faces.context.FacesContext)
*/
public void encodeChildren(FacesContext context) throws IOException
{
ResponseWriter out = context.getResponseWriter();
int verticalSpacing = getVerticalSpacing();
if (verticalSpacing != 0)
{
out.write("<table cellspacing='");
out.write(verticalSpacing);
out.write("'");
if (getAttributes().get(ATTR_STYLE) != null)
{
outputAttribute(out, getAttributes().get(ATTR_STYLE), ATTR_STYLE);
}
if (getAttributes().get(ATTR_STYLECLASS) != null)
{
outputAttribute(out, getAttributes().get(ATTR_STYLECLASS), "class");
}
out.write(">");
}
for (Iterator i=getChildren().iterator(); i.hasNext(); /**/)
{
UIComponent child = (UIComponent)i.next();
Utils.encodeRecursive(context, child);
}
if (verticalSpacing != 0)
{
out.write("</table>");
}
}
/**
* @see javax.faces.component.UIComponentBase#encodeEnd(javax.faces.context.FacesContext)
*/
public void encodeEnd(FacesContext context) throws IOException
{
if (logger.isDebugEnabled())
logger.debug("encodeEnd() for <r:actions/> Id: " + getId());
Map requestMap = getFacesContext().getExternalContext().getRequestMap();
requestMap.remove(ACTION_CONTEXT);
}
/**
* Build an action group as reusable UIActionLink components.
*
* @param context
* @param actionGroup
*/
private void buildActionGroup(FacesContext context, ActionGroup actionGroup)
throws IOException
{
javax.faces.application.Application facesApp = context.getApplication();
Node node = getContext();
ResourceBundle messages = Application.getBundle(context);
// get overriding display attributes
String style = (String)getAttributes().get(ATTR_STYLE);
String styleClass = (String)getAttributes().get(ATTR_STYLECLASS);
Boolean showLink = null;
if (getAttributes().get(ATTR_SHOWLINK) != null)
{
showLink = (Boolean)getAttributes().get(ATTR_SHOWLINK);
}
// process each ActionDefinition in the order they were defined
for (ActionDefinition actionDef : actionGroup)
{
if (logger.isDebugEnabled())
logger.debug("---processing ActionDefinition: " + actionDef.getId());
UIComponent currentParent = this;
// build a permissions evaluator component to wrap the actionlink
PermissionEvaluator permEval = null;
List<String> allow = actionDef.getAllowPermissions();
if (allow != null && allow.size() != 0)
{
// found some permissions to test
permEval = (PermissionEvaluator)facesApp.createComponent(COMPONENT_PERMISSIONEVAL);
String condition = allow.get(0);
if (allow.size() != 1)
{
for (int i=1; i<allow.size(); i++)
{
condition += "," + allow.get(i);
}
}
permEval.setAllow(condition);
}
List<String> deny = actionDef.getDenyPermissions();
if (deny != null && deny.size() != 0)
{
if (permEval == null)
{
permEval = (PermissionEvaluator)facesApp.createComponent(COMPONENT_PERMISSIONEVAL);
}
String condition = deny.get(0);
if (deny.size() != 1)
{
for (int i=1; i<deny.size(); i++)
{
condition += "," + deny.get(i);
}
}
permEval.setDeny(condition);
}
if (permEval != null)
{
// add the permission evaluator component and walk down the hierarchy
permEval.setId(createUniqueId());
permEval.setValueBinding(ATTR_VALUE, facesApp.createValueBinding("#{" + ACTION_CONTEXT + "}"));
if (logger.isDebugEnabled())
logger.debug("-----adding PermissionEvaluator to action");
currentParent.getChildren().add(permEval);
currentParent = permEval;
}
// now prepare any code based evaluators that may be present
if (actionDef.Evaluator != null)
{
ActionInstanceEvaluator evaluator =
(ActionInstanceEvaluator)facesApp.createComponent(COMPONENT_ACTIONEVAL);
evaluator.setId(createUniqueId());
evaluator.setEvaluator(actionDef.Evaluator);
evaluator.setValueBinding(ATTR_VALUE, facesApp.createValueBinding("#{" + ACTION_CONTEXT + "}"));
// add the action evaluator component and walk down the hiearchy
if (logger.isDebugEnabled())
logger.debug("-----adding ActionEvaluator to action");
currentParent.getChildren().add(evaluator);
currentParent = evaluator;
}
// now build the UIActionLink component for this action
UIActionLink control = (UIActionLink)facesApp.createComponent(COMPONENT_ACTIONLINK);
control.setRendererType(RENDERER_ACTIONLINK);
control.setId(actionDef.getId() + createUniqueId());
if (actionDef.Action != null)
{
if (UIComponentTagUtils.isValueReference(actionDef.Action))
{
control.setAction(facesApp.createMethodBinding(actionDef.Action, null));
}
else
{
control.setAction(new ConstantMethodBinding(actionDef.Action));
}
}
if (actionDef.ActionListener != null)
{
control.setActionListener(facesApp.createMethodBinding(actionDef.ActionListener, ACTION_CLASS_ARGS));
}
if (style != null)
{
control.getAttributes().put(ATTR_STYLE, style);
}
else if (actionDef.Style != null)
{
control.getAttributes().put(ATTR_STYLE, actionDef.Style);
}
if (styleClass != null)
{
control.getAttributes().put(ATTR_STYLECLASS, styleClass);
}
else if (actionDef.StyleClass != null)
{
control.getAttributes().put(ATTR_STYLECLASS, actionDef.StyleClass);
}
if (showLink != null)
{
control.setShowLink(showLink.booleanValue());
}
else
{
control.setShowLink(actionDef.ShowLink);
}
if (actionDef.Onclick != null)
{
if (UIComponentTagUtils.isValueReference(actionDef.Onclick))
{
control.setValueBinding("onclick", facesApp.createValueBinding(actionDef.Onclick));
}
else
{
control.setOnclick(actionDef.Onclick);
}
}
if (actionDef.Href != null)
{
if (UIComponentTagUtils.isValueReference(actionDef.Href))
{
control.setValueBinding("href", facesApp.createValueBinding(actionDef.Href));
}
else
{
control.setHref(actionDef.Href);
}
}
control.setTarget(actionDef.Target);
control.setImage(actionDef.Image);
if (actionDef.TooltipMsg != null)
{
control.setTooltip(messages.getString(actionDef.TooltipMsg));
}
else if (actionDef.Tooltip != null)
{
if (UIComponentTagUtils.isValueReference(actionDef.Tooltip))
{
control.setValueBinding("tooltip", facesApp.createValueBinding(actionDef.Tooltip));
}
else
{
control.setValue(actionDef.Tooltip);
}
}
if (actionDef.LabelMsg != null)
{
control.setValue(messages.getString(actionDef.LabelMsg));
}
else if (actionDef.Label != null)
{
if (UIComponentTagUtils.isValueReference(actionDef.Label))
{
control.setValueBinding("value", facesApp.createValueBinding(actionDef.Label));
}
else
{
control.setValue(actionDef.Label);
}
}
// build any child params <f:param> components that are needed.
Map<String, String> params = actionDef.getParams();
if (params != null)
{
for (String name : params.keySet())
{
UIParameter param =
(UIParameter)facesApp.createComponent(ComponentConstants.JAVAX_FACES_PARAMETER);
param.setId(createUniqueId());
param.setName(name);
String value = params.get(name);
if (UIComponentTagUtils.isValueReference(value))
{
param.setValueBinding(ATTR_VALUE, facesApp.createValueBinding(value));
}
else
{
param.setValue(value);
}
control.getChildren().add(param);
}
}
if (logger.isDebugEnabled())
logger.debug("-----adding UIActionLink component for: " + actionDef.getId());
currentParent.getChildren().add(control);
}
}
// ------------------------------------------------------------------------------
// Strongly typed component property accessors
/**
* Get the value (for this component the value is the ID of an Action Group config block)
*
* @return the value
*/
public String getValue()
{
if (this.value == null)
{
ValueBinding vb = getValueBinding(ATTR_VALUE);
if (vb != null)
{
this.value = (String)vb.getValue(getFacesContext());
}
}
return this.value;
}
/**
* Set the value (for this component the value is the ID of an Action Group config block)
*
* @param value the value
*/
public void setValue(String value)
{
this.value = value;
}
/**
* Get the Node that forms the context object for this group of actions
*
* @return the context
*/
public Node getContext()
{
ValueBinding vb = getValueBinding("context");
if (vb != null)
{
this.context = (Node)vb.getValue(getFacesContext());
}
return this.context;
}
/**
* Set the the Node that forms the context object for this group of actions
*
* @param context the context
*/
public void setContext(Node context)
{
this.context = context;
}
/**
* Get whether to show the link as well as the image if specified
*
* @return true to show the link as well as the image if specified
*/
public boolean getShowLink()
{
ValueBinding vb = getValueBinding(ATTR_SHOWLINK);
if (vb != null)
{
this.showLink = (Boolean)vb.getValue(getFacesContext());
}
if (this.showLink != null)
{
return this.showLink.booleanValue();
}
else
{
// return default
return true;
}
}
/**
* Set whether to show the link as well as the image if specified
*
* @param showLink Whether to show the link as well as the image if specified
*/
public void setShowLink(boolean showLink)
{
this.showLink = Boolean.valueOf(showLink);
}
/**
* @return Returns the vertical spacing value in pixels or zero if not set.
*/
public int getVerticalSpacing()
{
ValueBinding vb = getValueBinding("verticalSpacing");
if (vb != null)
{
this.verticalSpacing = (Integer)vb.getValue(getFacesContext());
}
if (this.verticalSpacing != null)
{
return this.verticalSpacing;
}
else
{
return 0;
}
}
/**
* @param verticalSpacing The verticalSpacing to set.
*/
public void setVerticalSpacing(int verticalSpacing)
{
this.verticalSpacing = verticalSpacing;
}
/**
* @return a unique ID for a JSF component
*/
private static String createUniqueId()
{
return "_id_" + Short.toString(++id);
}
// ------------------------------------------------------------------------------
// Private data
/** True to show the link as well as the image if specified */
private Boolean showLink = null;
/** For this component the value is the ID of an Action Group config block */
private String value = null;
/** The context Node for the action group */
private Node context = null;
/** Vertical layout spacing */
private Integer verticalSpacing = null;
private static short id = 0;
}

View File

@@ -56,6 +56,8 @@ public class UISearchCustomProperties extends SelfRenderingComponent implements
public static final String PREFIX_DATE_TO = "to_";
public static final String PREFIX_DATE_FROM = "from_";
private static final String VALUE = "value";
private static final String MSG_TO = "to";
private static final String MSG_FROM = "from";
@@ -252,12 +254,12 @@ public class UISearchCustomProperties extends SelfRenderingComponent implements
{
control = (UISelectBoolean)facesApp.createComponent(ComponentConstants.JAVAX_FACES_SELECT_BOOLEAN);
control.setRendererType(ComponentConstants.JAVAX_FACES_CHECKBOX);
control.setValueBinding("value", vb);
control.setValueBinding(VALUE, vb);
}
else if (typeName.equals(DataTypeDefinition.CATEGORY))
{
control = (UICategorySelector)facesApp.createComponent(RepoConstants.ALFRESCO_FACES_CATEGORY_SELECTOR);
control.setValueBinding("value", vb);
control.setValueBinding(VALUE, vb);
}
else if (typeName.equals(DataTypeDefinition.DATETIME) || typeName.equals(DataTypeDefinition.DATE))
{
@@ -275,7 +277,7 @@ public class UISearchCustomProperties extends SelfRenderingComponent implements
checkbox.setId(context.getViewRoot().createUniqueId());
ValueBinding vbCheckbox = facesApp.createValueBinding(
"#{" + beanBinding + "[\"" + propDef.getName().toString() + "\"]}");
checkbox.setValueBinding("value", vbCheckbox);
checkbox.setValueBinding(VALUE, vbCheckbox);
control.getChildren().add(checkbox);
// main display label
@@ -300,7 +302,7 @@ public class UISearchCustomProperties extends SelfRenderingComponent implements
inputFromDate.getAttributes().put("showTime", showTime);
ValueBinding vbFromDate = facesApp.createValueBinding(
"#{" + beanBinding + "[\"" + PREFIX_DATE_FROM + propDef.getName().toString() + "\"]}");
inputFromDate.setValueBinding("value", vbFromDate);
inputFromDate.setValueBinding(VALUE, vbFromDate);
control.getChildren().add(inputFromDate);
// to date label
@@ -318,13 +320,13 @@ public class UISearchCustomProperties extends SelfRenderingComponent implements
inputToDate.getAttributes().put("showTime", showTime);
ValueBinding vbToDate = facesApp.createValueBinding(
"#{" + beanBinding + "[\"" + PREFIX_DATE_TO + propDef.getName().toString() + "\"]}");
inputToDate.setValueBinding("value", vbToDate);
inputToDate.setValueBinding(VALUE, vbToDate);
control.getChildren().add(inputToDate);
}
else if (typeName.equals(DataTypeDefinition.NODE_REF))
{
control = (UISpaceSelector)facesApp.createComponent(RepoConstants.ALFRESCO_FACES_SPACE_SELECTOR);
control.setValueBinding("value", vb);
control.setValueBinding(VALUE, vb);
}
else
{
@@ -333,7 +335,7 @@ public class UISearchCustomProperties extends SelfRenderingComponent implements
control.setRendererType(ComponentConstants.JAVAX_FACES_TEXT);
control.getAttributes().put("size", "28");
control.getAttributes().put("maxlength", "1024");
control.setValueBinding("value", vb);
control.setValueBinding(VALUE, vb);
}
// set up the common aspects of the control

View File

@@ -0,0 +1,99 @@
/*
* Copyright (C) 2005 Alfresco, Inc.
*
* Licensed under the Mozilla Public License version 1.1
* with a permitted attribution clause. You may obtain a
* copy of the License at
*
* http://www.alfresco.org/legal/license.txt
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
* either express or implied. See the License for the specific
* language governing permissions and limitations under the
* License.
*/
package org.alfresco.web.ui.repo.component.evaluator;
import javax.faces.context.FacesContext;
import org.alfresco.web.action.ActionEvaluator;
import org.alfresco.web.bean.repository.Node;
import org.alfresco.web.ui.common.component.evaluator.BaseEvaluator;
/**
* Evaluator for executing an ActionEvaluator instance.
*
* @author Kevin Roast
*/
public class ActionInstanceEvaluator extends BaseEvaluator
{
/**
* Evaluate by executing the specified action instance evaluator.
*
* @return true to allow rendering of child components, false otherwise
*/
public boolean evaluate()
{
boolean result = false;
try
{
Object obj = getValue();
if (obj instanceof Node)
{
result = getEvaluator().evaluate((Node)obj);
}
}
catch (Exception err)
{
// return default value on error
s_logger.debug("Error during ActionInstanceEvaluator evaluation: " + err.getMessage());
}
return result;
}
/**
* @see javax.faces.component.StateHolder#restoreState(javax.faces.context.FacesContext, java.lang.Object)
*/
public void restoreState(FacesContext context, Object state)
{
Object values[] = (Object[])state;
// standard component attributes are restored by the super class
super.restoreState(context, values[0]);
this.evaluator = (ActionEvaluator)values[1];
}
/**
* @see javax.faces.component.StateHolder#saveState(javax.faces.context.FacesContext)
*/
public Object saveState(FacesContext context)
{
Object values[] = new Object[2];
// standard component attributes are saved by the super class
values[0] = super.saveState(context);
values[1] = this.evaluator;
return (values);
}
/**
* @return the ActionEvaluator to execute
*/
public ActionEvaluator getEvaluator()
{
return this.evaluator;
}
/**
* @param evaluator The ActionEvaluator to execute
*/
public void setEvaluator(ActionEvaluator evaluator)
{
this.evaluator = evaluator;
}
private ActionEvaluator evaluator;
}

View File

@@ -0,0 +1,121 @@
/*
* Copyright (C) 2005 Alfresco, Inc.
*
* Licensed under the Mozilla Public License version 1.1
* with a permitted attribution clause. You may obtain a
* copy of the License at
*
* http://www.alfresco.org/legal/license.txt
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
* either express or implied. See the License for the specific
* language governing permissions and limitations under the
* License.
*/
package org.alfresco.web.ui.repo.tag;
import javax.faces.component.UIComponent;
import org.alfresco.web.ui.common.tag.HtmlComponentTag;
/**
* @author kevinr
*/
public class ActionsTag extends HtmlComponentTag
{
/**
* @see javax.faces.webapp.UIComponentTag#getComponentType()
*/
public String getComponentType()
{
return "org.alfresco.faces.Actions";
}
/**
* @see javax.faces.webapp.UIComponentTag#getRendererType()
*/
public String getRendererType()
{
return null;
}
/**
* @see javax.faces.webapp.UIComponentTag#setProperties(javax.faces.component.UIComponent)
*/
protected void setProperties(UIComponent component)
{
super.setProperties(component);
setBooleanProperty(component, "showLink", this.showLink);
setStringProperty(component, "value", this.value);
setStringBindingProperty(component, "context", this.context);
setIntProperty(component, "verticalSpacing", this.verticalSpacing);
}
/**
* @see org.alfresco.web.ui.common.tag.HtmlComponentTag#release()
*/
public void release()
{
super.release();
this.value = null;
this.showLink = null;
this.context = null;
this.verticalSpacing = null;
}
/**
* Set the value (id of the action group config to use)
*
* @param value the value (id of the action group config to use)
*/
public void setValue(String value)
{
this.value = value;
}
/**
* Set the showLink
*
* @param showLink the showLink
*/
public void setShowLink(String showLink)
{
this.showLink = showLink;
}
/**
* Set the context object
*
* @param context the context object
*/
public void setContext(String context)
{
this.context = context;
}
/**
* Set the verticalSpacing
*
* @param verticalSpacing the verticalSpacing
*/
public void setVerticalSpacing(String verticalSpacing)
{
this.verticalSpacing = verticalSpacing;
}
/** the verticalSpacing */
private String verticalSpacing;
/** the context object */
private String context;
/** the value (id of the action group config to use) */
private String value;
/** the showLink boolean */
private String showLink;
}

View File

@@ -44,7 +44,7 @@ public class PageTag extends TagSupport
private final static String ALF_URL = "http://www.alfresco.com";
private final static String ALF_LOGO = "/images/logo/alfresco_logo.gif";
private final static String ALF_TEXT = "Content managed by Alfresco";
private final static String ALF_COPY = "Alfresco Software Inc. <EFBFBD> 2005 All rights reserved.";
private final static String ALF_COPY = "Alfresco Software Inc. (C) 2005-2006 All rights reserved.";
private static Log logger = LogFactory.getLog(PageTag.class);
private static String alfresco = null;

View File

@@ -0,0 +1,35 @@
/*
* Copyright (C) 2005 Alfresco, Inc.
*
* Licensed under the Mozilla Public License version 1.1
* with a permitted attribution clause. You may obtain a
* copy of the License at
*
* http://www.alfresco.org/legal/license.txt
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
* either express or implied. See the License for the specific
* language governing permissions and limitations under the
* License.
*/
package org.alfresco.web.ui.repo.tag.evaluator;
import javax.faces.component.UIComponent;
import org.alfresco.web.ui.common.tag.evaluator.GenericEvaluatorTag;
/**
* @author Kevin Roast
*/
public class ActionInstanceEvaluatorTag extends GenericEvaluatorTag
{
/**
* @see javax.faces.webapp.UIComponentTag#getComponentType()
*/
public String getComponentType()
{
return "org.alfresco.faces.ActionInstanceEvaluator";
}
}

View File

@@ -109,6 +109,17 @@
<component-class>org.alfresco.web.ui.repo.component.UIMultiValueEditor</component-class>
</component>
<component>
<component-type>org.alfresco.faces.Actions</component-type>
<component-class>org.alfresco.web.ui.repo.component.UIActions</component-class>
</component>
<component>
<component-type>org.alfresco.faces.ActionInstanceEvaluator</component-type>
<component-class>org.alfresco.web.ui.repo.component.evaluator.ActionInstanceEvaluator</component-class>
</component>
<!-- ==================== CONVERTERS ==================== -->
<component>
<component-type>org.alfresco.faces.PermissionEvaluator</component-type>
@@ -120,6 +131,7 @@
<converter-class>org.alfresco.web.ui.repo.converter.MimeTypeConverter</converter-class>
</converter>
<!-- ==================== RENDERERS ==================== -->
<render-kit>
<renderer>

View File

@@ -1321,4 +1321,71 @@
</attribute>
</tag>
<tag>
<name>actions</name>
<tag-class>org.alfresco.web.ui.repo.tag.ActionsTag</tag-class>
<body-content>JSP</body-content>
<description>
The actions component renders a group of actionLink components as defined by an Action Group
in the web-client-config-actions.xml config file. Each action groups can contain many actions
which are individually rendered as ActionLink components. The action group uses a Node object
as the context for the various actions defined in config.
</description>
<attribute>
<name>id</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
<attribute>
<name>value</name>
<required>true</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
<attribute>
<name>context</name>
<required>true</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
<attribute>
<name>binding</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
<attribute>
<name>rendered</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
<attribute>
<name>style</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
<attribute>
<name>styleClass</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
<attribute>
<name>verticalSpacing</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
<attribute>
<name>showLink</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
</tag>
</taglib>

View File

@@ -104,47 +104,14 @@
<td style="padding-left:4px" width=52>
<%-- Create actions menu --%>
<a:menu id="createMenu" itemSpacing="4" label="#{msg.create_options}" image="/images/icons/menu.gif" menuStyleClass="moreActionsMenu" style="white-space:nowrap">
<r:permissionEvaluator value="#{NavigationBean.currentNode}" allow="CreateChildren" id="eval3">
<a:actionLink value="#{msg.create_content}" image="/images/icons/new_content.gif" id="link3_1" action="createContent" actionListener="#{CreateContentWizard.startWizard}" />
</r:permissionEvaluator>
<r:permissionEvaluator value="#{NavigationBean.currentNode}" allow="CreateChildren" id="eval1">
<a:actionLink value="#{msg.new_space}" image="/images/icons/create_space.gif" action="createSpace" actionListener="#{NewSpaceDialog.startWizard}" id="link1" />
</r:permissionEvaluator>
<r:permissionEvaluator value="#{NavigationBean.currentNode}" allow="CreateChildren" id="eval6">
<a:actionLink value="#{msg.advanced_space_wizard}" image="/images/icons/create_space.gif" action="createAdvancedSpace" actionListener="#{NewSpaceWizard.startWizard}" id="link9" />
</r:permissionEvaluator>
<r:actions id="acts_create" value="browse_create_menu" context="#{NavigationBean.currentNode}" />
</a:menu>
</td>
<td style="padding-left:4px" width=80>
<%-- More actions menu --%>
<a:menu id="actionsMenu" itemSpacing="4" label="#{msg.more_actions}" image="/images/icons/menu.gif" menuStyleClass="moreActionsMenu" style="white-space:nowrap">
<a:actionLink value="#{msg.view_details}" image="/images/icons/View_details.gif" action="dialog:showSpaceDetails" actionListener="#{BrowseBean.setupSpaceAction}" id="link5">
<f:param name="id" value="#{NavigationBean.currentNodeId}" id="param6" />
</a:actionLink>
<r:permissionEvaluator value="#{NavigationBean.currentNode}" allow="Delete" id="eval4">
<a:actionLink value="#{msg.delete_space}" image="/images/icons/delete.gif" action="dialog:deleteSpace" actionListener="#{BrowseBean.setupDeleteAction}" id="link2">
<f:param name="id" value="#{NavigationBean.currentNodeId}" id="param1" />
</a:actionLink>
<a:actionLink value="#{msg.cut}" image="/images/icons/cut.gif" id="link6" actionListener="#{ClipboardBean.cutNode}">
<f:param name="id" value="#{NavigationBean.currentNodeId}" id="param3" />
</a:actionLink>
</r:permissionEvaluator>
<a:actionLink value="#{msg.copy}" image="/images/icons/copy.gif" id="link7" actionListener="#{ClipboardBean.copyNode}">
<f:param name="id" value="#{NavigationBean.currentNodeId}" id="param4" />
</a:actionLink>
<r:permissionEvaluator value="#{NavigationBean.currentNode}" allow="Write" id="eval5">
<a:actionLink value="#{msg.paste_all}" image="/images/icons/paste.gif" actionListener="#{ClipboardBean.pasteAll}" id="link8" />
</r:permissionEvaluator>
<r:permissionEvaluator value="#{NavigationBean.currentNode}" allow="ChangePermissions" id="eval3_1">
<a:actionLink value="#{msg.manage_invited_users}" image="/images/icons/invite.gif" id="link4" action="dialog:manageInvitedUsers" actionListener="#{BrowseBean.setupSpaceAction}">
<f:param name="id" value="#{NavigationBean.currentNodeId}" id="param6_1" />
</a:actionLink>
</r:permissionEvaluator>
<r:permissionEvaluator value="#{NavigationBean.currentNode}" allow="Write" id="eval7">
<a:actionLink value="#{msg.manage_rules}" image="/images/icons/rule.gif" action="dialog:manageRules" actionListener="#{BrowseBean.setupSpaceAction}" id="link10">
<f:param name="id" value="#{NavigationBean.currentNodeId}" id="param5" />
</a:actionLink>
</r:permissionEvaluator>
<r:actions id="acts_browse" value="browse_actions_menu" context="#{NavigationBean.currentNode}" />
<%-- admin user only actions --%>
<a:booleanEvaluator value="#{NavigationBean.currentUser.admin == true}" id="eval8">
<a:actionLink value="#{msg.admin_console}" image="/images/icons/admin_console.gif" action="adminConsole" id="link11" />
@@ -315,39 +282,13 @@
<f:facet name="header">
<h:outputText value="#{msg.actions}"/>
</f:facet>
<a:actionLink value="#{msg.preview}" image="/images/icons/preview.gif" showLink="false" styleClass="inlineAction" actionListener="#{BrowseBean.setupSpaceAction}" action="previewSpace">
<f:param name="id" value="#{r.id}" />
</a:actionLink>
<a:booleanEvaluator value="#{r.beingDiscussed == true}">
<a:actionLink value="#{msg.discuss}" image="/images/icons/forum.gif" showLink="false" styleClass="inlineAction" actionListener="#{ForumsBean.discuss}">
<f:param name="id" value="#{r.id}" />
</a:actionLink>
</a:booleanEvaluator>
<r:permissionEvaluator value="#{r}" allow="Delete">
<a:actionLink value="#{msg.cut}" image="/images/icons/cut.gif" showLink="false" styleClass="inlineAction" actionListener="#{ClipboardBean.cutNode}">
<f:param name="id" value="#{r.id}" />
</a:actionLink>
</r:permissionEvaluator>
<a:actionLink value="#{msg.copy}" image="/images/icons/copy.gif" showLink="false" styleClass="inlineAction" actionListener="#{ClipboardBean.copyNode}">
<f:param name="id" value="#{r.id}" />
</a:actionLink>
<a:actionLink value="#{msg.view_details}" image="/images/icons/View_details.gif" showLink="false" styleClass="inlineAction" action="dialog:showSpaceDetails" actionListener="#{BrowseBean.setupSpaceAction}">
<f:param name="id" value="#{r.id}" />
</a:actionLink>
<%-- actions are configured in web-client-config-actions.xml --%>
<r:actions id="acts1" value="space_browse" context="#{r}" showLink="false" styleClass="inlineAction" />
<%-- More actions menu --%>
<a:menu itemSpacing="4" image="/images/icons/more.gif" tooltip="#{msg.more_actions}" menuStyleClass="moreActionsMenu">
<r:permissionEvaluator value="#{r}" allow="Delete">
<a:actionLink value="#{msg.delete}" image="/images/icons/delete.gif" action="dialog:deleteSpace" actionListener="#{BrowseBean.setupDeleteAction}">
<f:param name="id" value="#{r.id}" />
</a:actionLink>
</r:permissionEvaluator>
<r:permissionEvaluator value="#{r}" allow="CreateChildren">
<a:booleanEvaluator value="#{r.beingDiscussed == false}">
<a:actionLink value="#{msg.start_discussion}" image="/images/icons/create_forum.gif" actionListener="#{CreateDiscussionDialog.startWizard}">
<f:param name="id" value="#{r.id}" />
</a:actionLink>
</a:booleanEvaluator>
</r:permissionEvaluator>
<r:actions id="acts2" value="space_browse_menu" context="#{r}" />
</a:menu>
</a:column>
@@ -462,90 +403,13 @@
<f:facet name="header">
<h:outputText value="#{msg.actions}"/>
</f:facet>
<r:permissionEvaluator value="#{r}" allow="Write">
<a:booleanEvaluator value="#{(r.locked == false && r.workingCopy == false) || r.owner == true}">
<a:booleanEvaluator value="#{r.editLinkType == 'http'}">
<a:actionLink value="#{msg.edit}" image="/images/icons/edit_icon.gif" showLink="false" styleClass="inlineAction" actionListener="#{CheckinCheckoutBean.editFile}">
<f:param name="id" value="#{r.id}" />
</a:actionLink>
</a:booleanEvaluator>
<a:booleanEvaluator value="#{r.editLinkType == 'webdav'}">
<a:actionLink value="#{msg.edit}" image="/images/icons/edit_icon.gif" showLink="false" styleClass="inlineAction" onclick="javascript:openDoc('#{r.webdavUrl}');" />
</a:booleanEvaluator>
<a:booleanEvaluator value="#{r.editLinkType == 'cifs'}">
<a:actionLink value="#{msg.edit}" image="/images/icons/edit_icon.gif" showLink="false" styleClass="inlineAction" href="#{r.cifsPath}" target="new" />
</a:booleanEvaluator>
</a:booleanEvaluator>
</r:permissionEvaluator>
<r:permissionEvaluator value="#{r}" allow="CheckOut">
<a:booleanEvaluator value="#{r.locked == false && r.workingCopy == false}">
<a:actionLink value="#{msg.checkout}" image="/images/icons/CheckOut_icon.gif" showLink="false" styleClass="inlineAction" actionListener="#{CheckinCheckoutBean.setupContentAction}" action="checkoutFile">
<f:param name="id" value="#{r.id}" />
</a:actionLink>
</a:booleanEvaluator>
</r:permissionEvaluator>
<a:booleanEvaluator value="#{r.checkIn == true}">
<a:actionLink value="#{msg.checkin}" image="/images/icons/CheckIn_icon.gif" showLink="false" styleClass="inlineAction" actionListener="#{CheckinCheckoutBean.setupContentAction}" action="checkinFile">
<f:param name="id" value="#{r.id}" />
</a:actionLink>
</a:booleanEvaluator>
<a:booleanEvaluator value="#{r.beingDiscussed == true}">
<a:actionLink value="#{msg.discuss}" image="/images/icons/forum.gif" showLink="false" styleClass="inlineAction" actionListener="#{ForumsBean.discuss}">
<f:param name="id" value="#{r.id}" />
</a:actionLink>
</a:booleanEvaluator>
<a:actionLink value="#{msg.view_details}" image="/images/icons/View_details.gif" showLink="false" styleClass="inlineAction" actionListener="#{BrowseBean.setupContentAction}" action="dialog:showDocDetails">
<f:param name="id" value="#{r.id}" />
</a:actionLink>
<a:actionLink value="#{msg.preview}" image="/images/icons/preview.gif" showLink="false" styleClass="inlineAction" actionListener="#{BrowseBean.setupContentAction}" action="previewContent">
<f:param name="id" value="#{r.id}" />
</a:actionLink>
<%-- actions are configured in web-client-config-actions.xml --%>
<r:actions id="acts3" value="document_browse" context="#{r}" showLink="false" styleClass="inlineAction" />
<%-- More actions menu --%>
<a:menu itemSpacing="4" image="/images/icons/more.gif" tooltip="#{msg.more_actions}" menuStyleClass="moreActionsMenu">
<r:permissionEvaluator value="#{r}" allow="Delete">
<a:booleanEvaluator value="#{r.locked == false && r.workingCopy == false}">
<a:actionLink value="#{msg.delete}" image="/images/icons/delete.gif" actionListener="#{BrowseBean.setupContentAction}" action="dialog:deleteFile">
<f:param name="id" value="#{r.id}" />
</a:actionLink>
</a:booleanEvaluator>
</r:permissionEvaluator>
<r:permissionEvaluator value="#{r}" allow="Write">
<a:booleanEvaluator value="#{(r.locked == false && r.workingCopy == false) || r.owner == true}">
<a:actionLink value="#{msg.update}" image="/images/icons/update.gif" actionListener="#{CheckinCheckoutBean.setupContentAction}" action="updateFile">
<f:param name="id" value="#{r.id}" />
</a:actionLink>
</a:booleanEvaluator>
</r:permissionEvaluator>
<a:booleanEvaluator value="#{r.cancelCheckOut == true}">
<a:actionLink value="#{msg.undocheckout}" image="/images/icons/undo_checkout.gif" actionListener="#{CheckinCheckoutBean.setupContentAction}" action="undoCheckoutFile">
<f:param name="id" value="#{r.id}" />
</a:actionLink>
</a:booleanEvaluator>
<a:booleanEvaluator value='#{r["app:approveStep"] != null && r.workingCopy == false && r.locked == false}'>
<a:actionLink value='#{r["app:approveStep"]}' image="/images/icons/approve.gif" actionListener="#{DocumentDetailsBean.approve}">
<f:param name="id" value="#{r.id}" />
</a:actionLink>
</a:booleanEvaluator>
<a:booleanEvaluator value='#{r["app:rejectStep"] != null && r.workingCopy == false && r.locked == false}'>
<a:actionLink value='#{r["app:rejectStep"]}' image="/images/icons/reject.gif" actionListener="#{DocumentDetailsBean.reject}">
<f:param name="id" value="#{r.id}" />
</a:actionLink>
</a:booleanEvaluator>
<r:permissionEvaluator value="#{r}" allow="Delete">
<a:actionLink value="#{msg.cut}" image="/images/icons/cut.gif" actionListener="#{ClipboardBean.cutNode}">
<f:param name="id" value="#{r.id}" />
</a:actionLink>
</r:permissionEvaluator>
<a:actionLink value="#{msg.copy}" image="/images/icons/copy.gif" actionListener="#{ClipboardBean.copyNode}">
<f:param name="id" value="#{r.id}" />
</a:actionLink>
<r:permissionEvaluator value="#{r}" allow="CreateChildren">
<a:booleanEvaluator value="#{r.beingDiscussed == false && r.locked == false}">
<a:actionLink value="#{msg.start_discussion}" image="/images/icons/create_forum.gif" actionListener="#{CreateDiscussionDialog.startWizard}">
<f:param name="id" value="#{r.id}" />
</a:actionLink>
</a:booleanEvaluator>
</r:permissionEvaluator>
<r:actions id="acts4" value="document_browse_menu" context="#{r}" />
</a:menu>
</a:column>

View File

@@ -86,133 +86,8 @@
<div class="mainSubText"><h:outputText value="#{msg.documentdetails_description}" /></div>
</td>
<td align=right>
<%-- Checkin/Checkout action --%>
<nobr>
<r:permissionEvaluator value="#{DocumentDetailsBean.document}" allow="CheckOut">
<a:booleanEvaluator value="#{DocumentDetailsBean.locked == false && DocumentDetailsBean.workingCopy == false}">
<a:actionLink value="#{msg.checkout}" image="/images/icons/CheckOut_icon.gif" padding="2" style="white-space:nowrap"
actionListener="#{CheckinCheckoutBean.setupContentAction}" action="checkoutFile">
<f:param name="id" value="#{DocumentDetailsBean.id}" />
</a:actionLink>
</a:booleanEvaluator>
</r:permissionEvaluator>
<a:booleanEvaluator value="#{DocumentDetailsBean.document.properties.checkIn == true}">
<a:actionLink value="#{msg.checkin}" image="/images/icons/CheckIn_icon.gif" padding="2" style="white-space:nowrap"
actionListener="#{CheckinCheckoutBean.setupContentAction}" action="checkinFile">
<f:param name="id" value="#{DocumentDetailsBean.id}" />
</a:actionLink>
</a:booleanEvaluator>
</nobr>
</td>
<td style="padding-left:4px" width=64>
<%-- Actions menu --%>
<a:menu id="actionsMenu" itemSpacing="4" label="#{msg.actions}" image="/images/icons/menu.gif"
menuStyleClass="moreActionsMenu" style="white-space:nowrap" tooltip="#{msg.more_options_file}">
<a:booleanEvaluator value="#{DocumentDetailsBean.document.properties.cancelCheckOut == true}">
<a:actionLink value="#{msg.undocheckout}" image="/images/icons/undo_checkout.gif"
actionListener="#{CheckinCheckoutBean.setupContentAction}" action="undoCheckoutFile">
<f:param name="id" value="#{DocumentDetailsBean.id}" />
</a:actionLink>
</a:booleanEvaluator>
<%-- approve and reject --%>
<a:booleanEvaluator value="#{DocumentDetailsBean.approveStepName != null && DocumentDetailsBean.workingCopy == false && DocumentDetailsBean.locked == false}">
<a:actionLink value="#{DocumentDetailsBean.approveStepName}" image="/images/icons/approve.gif"
actionListener="#{DocumentDetailsBean.approve}" action="browse">
<f:param name="id" value="#{DocumentDetailsBean.id}" />
</a:actionLink>
</a:booleanEvaluator>
<a:booleanEvaluator value="#{DocumentDetailsBean.rejectStepName != null && DocumentDetailsBean.workingCopy == false && DocumentDetailsBean.locked == false}">
<a:actionLink value="#{DocumentDetailsBean.rejectStepName}" image="/images/icons/reject.gif"
actionListener="#{DocumentDetailsBean.reject}" action="browse">
<f:param name="id" value="#{DocumentDetailsBean.id}" />
</a:actionLink>
</a:booleanEvaluator>
<%-- edit and update --%>
<r:permissionEvaluator value="#{DocumentDetailsBean.document}" allow="Write">
<a:booleanEvaluator value="#{(DocumentDetailsBean.locked == false && DocumentDetailsBean.workingCopy == false) || DocumentDetailsBean.owner == true}">
<a:actionLink value="#{msg.edit}" image="/images/icons/edit_icon.gif"
actionListener="#{CheckinCheckoutBean.editFile}">
<f:param name="id" value="#{DocumentDetailsBean.id}" />
</a:actionLink>
<a:actionLink value="#{msg.update}" image="/images/icons/update.gif"
actionListener="#{CheckinCheckoutBean.setupContentAction}" action="updateFile">
<f:param name="id" value="#{DocumentDetailsBean.id}" />
</a:actionLink>
</a:booleanEvaluator>
</r:permissionEvaluator>
<%-- cut --%>
<r:permissionEvaluator value="#{DocumentDetailsBean.document}" allow="Delete">
<a:actionLink value="#{msg.cut}" image="/images/icons/cut.gif"
actionListener="#{ClipboardBean.cutNode}">
<f:param name="id" value="#{DocumentDetailsBean.id}" />
</a:actionLink>
</r:permissionEvaluator>
<%-- copy --%>
<a:actionLink value="#{msg.copy}" image="/images/icons/copy.gif"
actionListener="#{ClipboardBean.copyNode}">
<f:param name="id" value="#{DocumentDetailsBean.id}" />
</a:actionLink>
<%-- delete --%>
<r:permissionEvaluator value="#{DocumentDetailsBean.document}" allow="Delete">
<a:booleanEvaluator value="#{DocumentDetailsBean.locked == false && DocumentDetailsBean.workingCopy == false}">
<a:actionLink value="#{msg.delete}" image="/images/icons/delete.gif"
actionListener="#{BrowseBean.setupContentAction}" action="dialog:deleteFile">
<f:param name="id" value="#{DocumentDetailsBean.id}" />
</a:actionLink>
</a:booleanEvaluator>
</r:permissionEvaluator>
<%-- Take Ownership --%>
<r:permissionEvaluator value="#{DocumentDetailsBean.document}" allow="TakeOwnership">
<a:actionLink value="#{msg.take_ownership}" image="/images/icons/take_ownership.gif" actionListener="#{DocumentDetailsBean.takeOwnership}" id="takeOwnership" />
</r:permissionEvaluator>
<r:permissionEvaluator value="#{DocumentDetailsBean.document}" allow="ChangePermissions">
<a:actionLink value="#{msg.manage_content_users}" image="/images/icons/invite.gif" action="dialog:manageContentUsers" actionListener="#{BrowseBean.setupContentAction}">
<f:param name="id" value="#{DocumentDetailsBean.id}" />
</a:actionLink>
</r:permissionEvaluator>
<%-- create shortcut --%>
<a:actionLink value="#{msg.create_shortcut}" image="/images/icons/shortcut.gif" actionListener="#{UserShortcutsBean.createShortcut}" rendered="#{NavigationBean.isGuest == false}">
<f:param name="id" value="#{DocumentDetailsBean.id}" />
</a:actionLink>
<%-- discussion --%>
<a:booleanEvaluator value='#{DocumentDetailsBean.document.properties["beingDiscussed"] == true}'>
<a:actionLink value="#{msg.discuss}" image="/images/icons/forum.gif" actionListener="#{ForumsBean.discuss}">
<f:param name="id" value="#{DocumentDetailsBean.id}" />
</a:actionLink>
</a:booleanEvaluator>
<a:booleanEvaluator value='#{DocumentDetailsBean.document.properties["beingDiscussed"] == false}'>
<r:permissionEvaluator value="#{DocumentDetailsBean.document}" allow="CreateChildren">
<a:actionLink value="#{msg.start_discussion}" image="/images/icons/create_forum.gif" actionListener="#{CreateDiscussionDialog.startWizard}">
<f:param name="id" value="#{DocumentDetailsBean.id}" />
</a:actionLink>
</r:permissionEvaluator>
</a:booleanEvaluator>
<%-- preview in template --%>
<a:actionLink value="#{msg.preview}" image="/images/icons/preview.gif" actionListener="#{BrowseBean.setupContentAction}" action="previewContent">
<f:param name="id" value="#{DocumentDetailsBean.id}" />
</a:actionLink>
<%-- custom action --%>
<a:actionLink value="#{msg.other_action}" image="/images/icons/action.gif" action="createAction" actionListener="#{NewActionWizard.startWizard}" />
</a:menu>
</td>
<%-- Navigation --%>
<td class="separator" width=1></td>
<td style="padding-left:4px" width=80>
<td align=right>
<a:actionLink value="#{msg.previous_item}" image="/images/icons/nav_prev.gif" showLink="false" actionListener="#{DocumentDetailsBean.previousItem}" action="previousItem">
<f:param name="id" value="#{DocumentDetailsBean.id}" />
</a:actionLink>
@@ -315,7 +190,7 @@
rendered="#{DocumentDetailsBean.inlineEditable == false}" />
</r:permissionEvaluator>
<h:messages globalOnly="true" id="props-msgs" styleClass="errorMessage" layout="table" />
<h:message for="takeOwnership" styleClass="statusMessage" />
<h:message for="document-props" styleClass="statusMessage" />
</td>
</tr>
</table>
@@ -475,8 +350,9 @@
</td>
<td valign="top">
<% PanelGenerator.generatePanelStart(out, request.getContextPath(), "blue", "#D3E6FE"); %>
<table cellpadding="1" cellspacing="1" border="0">
<table cellpadding="1" cellspacing="1" border="0" width="100%">
<tr>
<td align="center">
<h:commandButton value="#{msg.close}" action="dialog:close" styleClass="wizardButton" />
@@ -484,6 +360,14 @@
</tr>
</table>
<% PanelGenerator.generatePanelEnd(out, request.getContextPath(), "blue"); %>
<div style="padding:4px"></div>
<%-- Document Actions --%>
<a:panel label="#{msg.actions}" id="actions-panel" border="white" bgcolor="white" titleBorder="blue" titleBgcolor="#D3E6FE" style="text-align:center"
progressive="true" expanded='#{DocumentDetailsBean.panels["actions-panel"]}' expandedActionListener="#{DocumentDetailsBean.expandPanel}">
<r:actions id="actions_doc" value="doc_details_actions" context="#{DocumentDetailsBean.document}" verticalSpacing="3" style="white-space:nowrap" />
</a:panel>
</td>
</tr>
</table>

View File

@@ -31,7 +31,7 @@
<%-- load a bundle of properties with I18N strings --%>
<f:loadBundle basename="alfresco.messages.webclient" var="msg"/>
<h:form acceptCharset="UTF-8" id="document-details">
<h:form acceptCharset="UTF-8" id="space-details">
<%-- Main outer table --%>
<table cellspacing="0" cellpadding="2">
@@ -74,79 +74,8 @@
<div class="mainSubText"><h:outputText value="#{msg.spacedetails_description}" /></div>
</td>
<td align=right>
<%-- Actions menu --%>
<a:menu id="actionsMenu" itemSpacing="4" label="#{msg.actions}" image="/images/icons/menu.gif"
menuStyleClass="moreActionsMenu" style="white-space:nowrap" tooltip="#{msg.more_options_space}">
<r:permissionEvaluator value="#{SpaceDetailsBean.space}" allow="Delete">
<a:actionLink value="#{msg.cut}" image="/images/icons/cut.gif" actionListener="#{ClipboardBean.cutNode}">
<f:param name="id" value="#{SpaceDetailsBean.id}" />
</a:actionLink>
</r:permissionEvaluator>
<a:actionLink value="#{msg.copy}" image="/images/icons/copy.gif" actionListener="#{ClipboardBean.copyNode}">
<f:param name="id" value="#{SpaceDetailsBean.id}" />
</a:actionLink>
<r:permissionEvaluator value="#{SpaceDetailsBean.space}" allow="Delete">
<a:actionLink value="#{msg.delete}" image="/images/icons/delete.gif" action="dialog:deleteSpace" actionListener="#{BrowseBean.setupSpaceAction}">
<f:param name="id" value="#{SpaceDetailsBean.id}" />
</a:actionLink>
</r:permissionEvaluator>
<r:permissionEvaluator value="#{SpaceDetailsBean.space}" allow="Write">
<a:actionLink value="#{msg.import}" image="/images/icons/import.gif" action="dialog:import" actionListener="#{BrowseBean.setupSpaceAction}">
<f:param name="id" value="#{SpaceDetailsBean.id}" />
</a:actionLink>
</r:permissionEvaluator>
<a:actionLink value="#{msg.export}" image="/images/icons/export.gif" action="dialog:export" actionListener="#{BrowseBean.setupSpaceAction}">
<f:param name="id" value="#{SpaceDetailsBean.id}" />
</a:actionLink>
<a:actionLink value="#{msg.create_shortcut}" image="/images/icons/shortcut.gif" actionListener="#{UserShortcutsBean.createShortcut}" rendered="#{NavigationBean.isGuest == false}">
<f:param name="id" value="#{SpaceDetailsBean.id}" />
</a:actionLink>
<r:permissionEvaluator value="#{SpaceDetailsBean.space}" allow="TakeOwnership">
<a:actionLink value="#{msg.take_ownership}" image="/images/icons/take_ownership.gif" actionListener="#{SpaceDetailsBean.takeOwnership}" id="takeOwnership" />
</r:permissionEvaluator>
<r:permissionEvaluator value="#{SpaceDetailsBean.space}" allow="ChangePermissions">
<a:actionLink value="#{msg.manage_invited_users}" image="/images/icons/invite.gif" action="dialog:manageInvitedUsers" actionListener="#{BrowseBean.setupSpaceAction}">
<f:param name="id" value="#{SpaceDetailsBean.id}" />
</a:actionLink>
</r:permissionEvaluator>
<r:permissionEvaluator value="#{SpaceDetailsBean.space}" allow="Write">
<a:actionLink value="#{msg.manage_rules}" image="/images/icons/rule.gif" action="dialog:manageRules" actionListener="#{BrowseBean.setupSpaceAction}">
<f:param name="id" value="#{SpaceDetailsBean.id}" />
</a:actionLink>
</r:permissionEvaluator>
<a:booleanEvaluator value='#{SpaceDetailsBean.space.properties["beingDiscussed"] == true}'>
<a:actionLink value="#{msg.discuss}" image="/images/icons/forum.gif" actionListener="#{ForumsBean.discuss}">
<f:param name="id" value="#{SpaceDetailsBean.id}" />
</a:actionLink>
</a:booleanEvaluator>
<a:booleanEvaluator value='#{SpaceDetailsBean.space.properties["beingDiscussed"] == false}'>
<r:permissionEvaluator value="#{SpaceDetailsBean.space}" allow="CreateChildren">
<a:actionLink value="#{msg.start_discussion}" image="/images/icons/create_forum.gif" actionListener="#{CreateDiscussionDialog.startWizard}">
<f:param name="id" value="#{SpaceDetailsBean.id}" />
</a:actionLink>
</r:permissionEvaluator>
</a:booleanEvaluator>
<a:actionLink value="#{msg.preview}" image="/images/icons/preview.gif" actionListener="#{BrowseBean.setupSpaceAction}" action="previewSpace">
<f:param name="id" value="#{SpaceDetailsBean.id}" />
</a:actionLink>
</a:menu>
</td>
<%-- Navigation --%>
<td class="separator" width=1></td>
<td style="padding-left:4px" width=80>
<td align="right">
<a:actionLink value="#{msg.previous_item}" image="/images/icons/nav_prev.gif" showLink="false" actionListener="#{SpaceDetailsBean.previousItem}" action="previousItem">
<f:param name="id" value="#{SpaceDetailsBean.id}" />
</a:actionLink>
@@ -240,7 +169,7 @@
columns="1" mode="view" labelStyleClass="propertiesLabel"
externalConfig="true" />
<h:messages globalOnly="true" styleClass="errorMessage" layout="table" />
<h:message for="takeOwnership" styleClass="statusMessage" />
<h:message for="space-props" styleClass="statusMessage" />
</td>
</tr>
</table>
@@ -271,7 +200,7 @@
<h:column id="rules-panel-facets">
<f:facet name="title">
<r:permissionEvaluator value="#{SpaceDetailsBean.space}" allow="Write">
<a:actionLink id="titleLink2" value="#{msg.modify}" showLink="false" image="/images/icons/rule.gif" action="manageRules" />
<a:actionLink id="titleLink2" value="#{msg.modify}" showLink="false" image="/images/icons/rule.gif" action="dialog:manageRules" />
</r:permissionEvaluator>
</f:facet>
</h:column>
@@ -357,7 +286,7 @@
<td valign="top">
<% PanelGenerator.generatePanelStart(out, request.getContextPath(), "blue", "#D3E6FE"); %>
<table cellpadding="1" cellspacing="1" border="0">
<table cellpadding="1" cellspacing="1" border="0" width="100%">
<tr>
<td align="center">
<h:commandButton value="#{msg.close}" action="#{SpaceDetailsBean.closeDialog}" styleClass="wizardButton" />
@@ -365,6 +294,13 @@
</tr>
</table>
<% PanelGenerator.generatePanelEnd(out, request.getContextPath(), "blue"); %>
<div style="padding:4px"></div>
<%-- Space Actions --%>
<a:panel label="#{msg.actions}" id="actions-panel" border="white" bgcolor="white" titleBorder="blue" titleBgcolor="#D3E6FE" style="text-align:center" progressive="true">
<r:actions id="actions_space" value="space_details_actions" context="#{SpaceDetailsBean.space}" verticalSpacing="3" style="white-space:nowrap" />
</a:panel>
</td>
</tr>
</table>