- Fixed actions config overriding

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@2859 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Gavin Cornwell
2006-05-11 22:05:03 +00:00
parent 931685b753
commit 38f88da91b
17 changed files with 302 additions and 166 deletions

View File

@@ -1,6 +1,6 @@
<alfresco-config> <alfresco-config>
<config evaluator="string-compare" condition="Actions"> <config>
<actions> <actions>
<!-- each action is defined individually and then referenced in an 'action-group' block <!-- each action is defined individually and then referenced in an 'action-group' block
via an 'idref' attribute specifing the action definition to use --> via an 'idref' attribute specifing the action definition to use -->
@@ -430,9 +430,9 @@
<image>/images/icons/action.gif</image> <image>/images/icons/action.gif</image>
<action>wizard:runAction</action> <action>wizard:runAction</action>
<action-listener>#{WizardManager.setupParameters}</action-listener> <action-listener>#{WizardManager.setupParameters}</action-listener>
<params> <params>
<param name="id">#{actionContext.id}</param> <param name="id">#{actionContext.id}</param>
</params> </params>
</action> </action>
<!-- Import into Space --> <!-- Import into Space -->

View File

@@ -1,6 +1,6 @@
<alfresco-config> <alfresco-config>
<config evalutor="string-compare" condition="Dialogs"> <config evaluator="string-compare" condition="Dialogs">
<dialog-container>/jsp/dialog/container.jsp</dialog-container> <dialog-container>/jsp/dialog/container.jsp</dialog-container>
<dialogs> <dialogs>

View File

@@ -1,6 +1,6 @@
<alfresco-config> <alfresco-config>
<config evaluator="string-compare" condition="Actions"> <config>
<actions> <actions>
<!-- Forums overrides the checkin document action - as it has more complex evaluation <!-- Forums overrides the checkin document action - as it has more complex evaluation
@@ -180,90 +180,35 @@
<!-- Actions for a document in the Browse screen --> <!-- Actions for a document in the Browse screen -->
<action-group id="document_browse"> <action-group id="document_browse">
<show-link>false</show-link> <show-link>false</show-link>
<style-class>inlineAction</style-class>
<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="discuss_node" />
<action idref="details_doc" />
<action idref="preview_doc" />
</action-group> </action-group>
<!-- Actions Menu for a document in the Browse screen --> <!-- Actions Menu for a document in the Browse screen -->
<action-group id="document_browse_menu"> <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 idref="create_forum_node" />
</action-group> </action-group>
<!-- Actions for a space in the Browse screen --> <!-- Actions for a space in the Browse screen -->
<action-group id="space_browse"> <action-group id="space_browse">
<show-link>false</show-link> <show-link>false</show-link>
<style-class>inlineAction</style-class>
<action idref="preview_space" />
<action idref="discuss_node" /> <action idref="discuss_node" />
<action idref="cut_node" />
<action idref="copy_node" />
<action idref="details_space" />
</action-group> </action-group>
<!-- Actions Menu for a space in the Browse screen --> <!-- Actions Menu for a space in the Browse screen -->
<action-group id="space_browse_menu"> <action-group id="space_browse_menu">
<action idref="delete_space" />
<action idref="create_forum_node" /> <action idref="create_forum_node" />
</action-group> </action-group>
<!-- Actions Menu for Document Details screen --> <!-- Actions Menu for Document Details screen -->
<action-group id="doc_details_actions"> <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="discuss_node" />
<action idref="create_forum_node" /> <action idref="create_forum_node" />
<action idref="preview_doc" />
<action idref="run_action" />
</action-group> </action-group>
<!-- Actions Menu for Space Details screen --> <!-- Actions Menu for Space Details screen -->
<action-group id="space_details_actions"> <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_users" />
<action idref="manage_space_rules" />
<action idref="discuss_node" /> <action idref="discuss_node" />
<action idref="create_forum_node" /> <action idref="create_forum_node" />
<action idref="preview_space" />
<action idref="run_action" />
</action-group> </action-group>
<!-- Actions Menu for Forums Details page --> <!-- Actions Menu for Forums Details page -->

View File

@@ -1,6 +1,6 @@
<alfresco-config> <alfresco-config>
<config evalutor="string-compare" condition="Wizards"> <config evaluator="string-compare" condition="Wizards">
<wizard-container>/jsp/wizard/container.jsp</wizard-container> <wizard-container>/jsp/wizard/container.jsp</wizard-container>
<wizards> <wizards>

View File

@@ -19,7 +19,6 @@ package org.alfresco.web.config;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.Iterator; import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.LinkedHashSet; import java.util.LinkedHashSet;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
@@ -71,14 +70,51 @@ public class ActionsConfigElement extends ConfigElementAdapter
*/ */
public ConfigElement combine(ConfigElement configElement) public ConfigElement combine(ConfigElement configElement)
{ {
ActionsConfigElement existingElement = (ActionsConfigElement)configElement; ActionsConfigElement newElement = (ActionsConfigElement)configElement;
ActionsConfigElement combinedElement = new ActionsConfigElement(); ActionsConfigElement combinedElement = new ActionsConfigElement();
// add the existing action definitions
combinedElement.actionDefs.putAll(this.actionDefs); combinedElement.actionDefs.putAll(this.actionDefs);
combinedElement.actionDefs.putAll(existingElement.actionDefs);
// overwrite any existing action definitions i.e. don't combine
combinedElement.actionDefs.putAll(newElement.actionDefs);
// add the existing action groups
combinedElement.actionGroups.putAll(this.actionGroups); combinedElement.actionGroups.putAll(this.actionGroups);
combinedElement.actionGroups.putAll(existingElement.actionGroups);
// any new action groups with the same name must be combined
for (ActionGroup newGroup : newElement.actionGroups.values())
{
if (combinedElement.actionGroups.containsKey(newGroup.getId()))
{
// there is already a group with this id, combine it
// with the new one
ActionGroup existingGroup = combinedElement.actionGroups.get(newGroup.getId());
if (newGroup.ShowLink != existingGroup.ShowLink)
{
existingGroup.ShowLink = newGroup.ShowLink;
}
if (newGroup.Style != null)
{
existingGroup.Style = newGroup.Style;
}
if (newGroup.StyleClass != null)
{
existingGroup.StyleClass = newGroup.StyleClass;
}
// add the new groups to the existing set
for (String actionRef : newGroup.actions)
{
existingGroup.actions.add(actionRef);
}
}
else
{
// it's a new group so just add it
combinedElement.actionGroups.put(newGroup.getId(), newGroup);
}
}
return combinedElement; return combinedElement;
} }

View File

@@ -67,15 +67,15 @@ public class AdvancedSearchConfigElement extends ConfigElementAdapter
*/ */
public ConfigElement combine(ConfigElement configElement) public ConfigElement combine(ConfigElement configElement)
{ {
AdvancedSearchConfigElement existingElement = (AdvancedSearchConfigElement)configElement; AdvancedSearchConfigElement newElement = (AdvancedSearchConfigElement)configElement;
AdvancedSearchConfigElement newElement = new AdvancedSearchConfigElement(); AdvancedSearchConfigElement combinedElement = new AdvancedSearchConfigElement();
// just copy the list of types and properties from this instance to the new one // just copy the list of types and properties from this instance to the new one
if (this.contentTypes != null) if (this.contentTypes != null)
{ {
for (String type : this.contentTypes) for (String type : this.contentTypes)
{ {
newElement.addContentType(type); combinedElement.addContentType(type);
} }
} }
@@ -83,28 +83,28 @@ public class AdvancedSearchConfigElement extends ConfigElementAdapter
{ {
for (CustomProperty property : this.customProps) for (CustomProperty property : this.customProps)
{ {
newElement.addCustomProperty(property); combinedElement.addCustomProperty(property);
} }
} }
// now add those types and custom properties from the element to be combined // now add those types and custom properties from the element to be combined
if (existingElement.getContentTypes() != null) if (newElement.getContentTypes() != null)
{ {
for (String type : existingElement.getContentTypes()) for (String type : newElement.getContentTypes())
{ {
newElement.addContentType(type); combinedElement.addContentType(type);
} }
} }
if (existingElement.getCustomProperties() != null) if (newElement.getCustomProperties() != null)
{ {
for (CustomProperty property : existingElement.getCustomProperties()) for (CustomProperty property : newElement.getCustomProperties())
{ {
newElement.addCustomProperty(property); combinedElement.addCustomProperty(property);
} }
} }
return newElement; return combinedElement;
} }
/** /**

View File

@@ -63,88 +63,88 @@ public class ClientConfigElement extends ConfigElementAdapter
*/ */
public ConfigElement combine(ConfigElement configElement) public ConfigElement combine(ConfigElement configElement)
{ {
ClientConfigElement existingElement = (ClientConfigElement)configElement; ClientConfigElement newElement = (ClientConfigElement)configElement;
ClientConfigElement newElement = new ClientConfigElement(); ClientConfigElement combinedElement = new ClientConfigElement();
// set those values that have changed // set those values that have changed
if (existingElement.getEditLinkType() == null) if (newElement.getEditLinkType() == null)
{ {
newElement.setEditLinkType(this.editLinkType); combinedElement.setEditLinkType(this.editLinkType);
} }
else else
{ {
newElement.setEditLinkType(existingElement.getEditLinkType()); combinedElement.setEditLinkType(newElement.getEditLinkType());
} }
if (existingElement.getErrorPage() == null) if (newElement.getErrorPage() == null)
{ {
newElement.setErrorPage(this.errorPage); combinedElement.setErrorPage(this.errorPage);
} }
else else
{ {
newElement.setErrorPage(existingElement.getErrorPage()); combinedElement.setErrorPage(newElement.getErrorPage());
} }
if (existingElement.getLoginPage() == null) if (newElement.getLoginPage() == null)
{ {
newElement.setLoginPage(this.loginPage); combinedElement.setLoginPage(this.loginPage);
} }
else else
{ {
newElement.setLoginPage(existingElement.getLoginPage()); combinedElement.setLoginPage(newElement.getLoginPage());
} }
if (existingElement.getHelpUrl() == null ) if (newElement.getHelpUrl() == null )
{ {
newElement.setHelpUrl(this.helpUrl); combinedElement.setHelpUrl(this.helpUrl);
} }
else else
{ {
newElement.setHelpUrl(existingElement.getHelpUrl()); combinedElement.setHelpUrl(newElement.getHelpUrl());
} }
if (existingElement.getHomeSpacePermission() == null) if (newElement.getHomeSpacePermission() == null)
{ {
newElement.setHomeSpacePermission(this.homeSpacePermission); combinedElement.setHomeSpacePermission(this.homeSpacePermission);
} }
else else
{ {
newElement.setHomeSpacePermission(existingElement.getHomeSpacePermission()); combinedElement.setHomeSpacePermission(newElement.getHomeSpacePermission());
} }
// override default values if they have changed // override default values if they have changed
if (existingElement.getRecentSpacesItems() != newElement.getRecentSpacesItems()) if (newElement.getRecentSpacesItems() != combinedElement.getRecentSpacesItems())
{ {
newElement.setRecentSpacesItems(existingElement.getRecentSpacesItems()); combinedElement.setRecentSpacesItems(newElement.getRecentSpacesItems());
} }
if (existingElement.getSearchMinimum() != newElement.getSearchMinimum()) if (newElement.getSearchMinimum() != combinedElement.getSearchMinimum())
{ {
newElement.setSearchMinimum(existingElement.getSearchMinimum()); combinedElement.setSearchMinimum(newElement.getSearchMinimum());
} }
if (existingElement.getForceAndTerms() != newElement.getForceAndTerms()) if (newElement.getForceAndTerms() != combinedElement.getForceAndTerms())
{ {
newElement.setForceAndTerms(existingElement.getForceAndTerms()); combinedElement.setForceAndTerms(newElement.getForceAndTerms());
} }
if (existingElement.getSearchMaxResults() != newElement.getSearchMaxResults()) if (newElement.getSearchMaxResults() != combinedElement.getSearchMaxResults())
{ {
newElement.setSearchMaxResults(existingElement.getSearchMaxResults()); combinedElement.setSearchMaxResults(newElement.getSearchMaxResults());
} }
if (existingElement.isShelfVisible() != newElement.isShelfVisible()) if (newElement.isShelfVisible() != combinedElement.isShelfVisible())
{ {
newElement.setShelfVisible(existingElement.isShelfVisible()); combinedElement.setShelfVisible(newElement.isShelfVisible());
} }
if (existingElement.getFromEmailAddress() != null && if (newElement.getFromEmailAddress() != null &&
(existingElement.getFromEmailAddress().equals(newElement.getFromEmailAddress()) == false)) (newElement.getFromEmailAddress().equals(combinedElement.getFromEmailAddress()) == false))
{ {
newElement.setFromEmailAddress(existingElement.getFromEmailAddress()); combinedElement.setFromEmailAddress(newElement.getFromEmailAddress());
} }
return newElement; return combinedElement;
} }
/** /**

View File

@@ -64,19 +64,19 @@ public class CommandServletConfigElement extends ConfigElementAdapter
*/ */
public ConfigElement combine(ConfigElement configElement) public ConfigElement combine(ConfigElement configElement)
{ {
CommandServletConfigElement existingElement = (CommandServletConfigElement)configElement; CommandServletConfigElement newElement = (CommandServletConfigElement)configElement;
CommandServletConfigElement newElement = new CommandServletConfigElement(); CommandServletConfigElement combinedElement = new CommandServletConfigElement();
for (String name : commandProcessors.keySet()) for (String name : commandProcessors.keySet())
{ {
newElement.addCommandProcessor(name, commandProcessors.get(name)); combinedElement.addCommandProcessor(name, commandProcessors.get(name));
} }
for (String name : existingElement.commandProcessors.keySet()) for (String name : newElement.commandProcessors.keySet())
{ {
newElement.addCommandProcessor(name, existingElement.commandProcessors.get(name)); combinedElement.addCommandProcessor(name, newElement.commandProcessors.get(name));
} }
return newElement; return combinedElement;
} }
/*package*/ void addCommandProcessor(String name, String className) /*package*/ void addCommandProcessor(String name, String className)

View File

@@ -69,28 +69,28 @@ public class LanguagesConfigElement extends ConfigElementAdapter
*/ */
public ConfigElement combine(ConfigElement configElement) public ConfigElement combine(ConfigElement configElement)
{ {
LanguagesConfigElement existingElement = (LanguagesConfigElement)configElement; LanguagesConfigElement newElement = (LanguagesConfigElement)configElement;
LanguagesConfigElement newElement = new LanguagesConfigElement(); LanguagesConfigElement combinedElement = new LanguagesConfigElement();
// add the languages from this config element // add the languages from this config element
for (String locale : this.languages) for (String locale : this.languages)
{ {
newElement.addLanguage(locale, this.localeMap.get(locale)); combinedElement.addLanguage(locale, this.localeMap.get(locale));
} }
// now add the languages from the one to be combined (but // now add the languages from the one to be combined (but
// only if they are not already in the list) // only if they are not already in the list)
List<String> languages = existingElement.getLanguages(); List<String> languages = newElement.getLanguages();
for (String locale : languages) for (String locale : languages)
{ {
if (newElement.getLabelForLanguage(locale) == null) if (combinedElement.getLabelForLanguage(locale) == null)
{ {
String label = existingElement.getLabelForLanguage(locale); String label = newElement.getLabelForLanguage(locale);
newElement.addLanguage(locale, label); combinedElement.addLanguage(locale, label);
} }
} }
return newElement; return combinedElement;
} }
/** /**

View File

@@ -123,36 +123,36 @@ public class NavigationConfigElement extends ConfigElementAdapter
*/ */
public ConfigElement combine(ConfigElement configElement) public ConfigElement combine(ConfigElement configElement)
{ {
NavigationConfigElement combined = new NavigationConfigElement(); NavigationConfigElement newElement = (NavigationConfigElement)configElement;
NavigationConfigElement combinedElement = new NavigationConfigElement();
// add all the existing from view id overrides // add all the existing from view id overrides
for (String fromViewId : this.viewIds.keySet()) for (String fromViewId : this.viewIds.keySet())
{ {
combined.addOverride(fromViewId, null, this.viewIds.get(fromViewId)); combinedElement.addOverride(fromViewId, null, this.viewIds.get(fromViewId));
} }
// add all the existing from outcome overrides // add all the existing from outcome overrides
for (String fromOutcome : this.outcomes.keySet()) for (String fromOutcome : this.outcomes.keySet())
{ {
combined.addOverride(null, fromOutcome, this.outcomes.get(fromOutcome)); combinedElement.addOverride(null, fromOutcome, this.outcomes.get(fromOutcome));
} }
// add all the from view id overrides from the given element // add all the from view id overrides from the given element
NavigationConfigElement navCfg = (NavigationConfigElement)configElement; HashMap<String, NavigationResult> viewIds = newElement.getViewIds();
HashMap<String, NavigationResult> viewIds = navCfg.getViewIds();
for (String fromViewId : viewIds.keySet()) for (String fromViewId : viewIds.keySet())
{ {
combined.addOverride(fromViewId, null, viewIds.get(fromViewId)); combinedElement.addOverride(fromViewId, null, viewIds.get(fromViewId));
} }
// add all the from outcome overrides from the given element // add all the from outcome overrides from the given element
HashMap<String, NavigationResult> outcomes = navCfg.getOutcomes(); HashMap<String, NavigationResult> outcomes = newElement.getOutcomes();
for (String fromOutcome : outcomes.keySet()) for (String fromOutcome : outcomes.keySet())
{ {
combined.addOverride(null, fromOutcome, outcomes.get(fromOutcome)); combinedElement.addOverride(null, fromOutcome, outcomes.get(fromOutcome));
} }
return combined; return combinedElement;
} }
/** /**

View File

@@ -72,21 +72,21 @@ public class PropertySheetConfigElement extends ConfigElementAdapter
*/ */
public ConfigElement combine(ConfigElement configElement) public ConfigElement combine(ConfigElement configElement)
{ {
PropertySheetConfigElement combined = new PropertySheetConfigElement(); PropertySheetConfigElement combinedElement = new PropertySheetConfigElement();
// add all the existing properties // add all the existing properties
for (ItemConfig item : this.getItems().values()) for (ItemConfig item : this.getItems().values())
{ {
combined.addItem(item); combinedElement.addItem(item);
} }
// add all the properties from the given element // add all the properties from the given element
for (ItemConfig item : ((PropertySheetConfigElement)configElement).getItems().values()) for (ItemConfig item : ((PropertySheetConfigElement)configElement).getItems().values())
{ {
combined.addItem(item); combinedElement.addItem(item);
} }
return combined; return combinedElement;
} }
/** /**

View File

@@ -101,18 +101,18 @@ public class ViewsConfigElement extends ConfigElementAdapter
*/ */
public ConfigElement combine(ConfigElement configElement) public ConfigElement combine(ConfigElement configElement)
{ {
ViewsConfigElement existingElement = (ViewsConfigElement)configElement; ViewsConfigElement newElement = (ViewsConfigElement)configElement;
ViewsConfigElement newElement = new ViewsConfigElement(); ViewsConfigElement combinedElement = new ViewsConfigElement();
// copy all the config from this element into the new one // copy all the config from this element into the new one
for (String viewImpl : this.views) for (String viewImpl : this.views)
{ {
newElement.addView(viewImpl); combinedElement.addView(viewImpl);
} }
for (String page : this.defaultViews.keySet()) for (String page : this.defaultViews.keySet())
{ {
newElement.addDefaultView(page, this.defaultViews.get(page)); combinedElement.addDefaultView(page, this.defaultViews.get(page));
} }
for (String pageView : this.pageSizes.keySet()) for (String pageView : this.pageSizes.keySet())
@@ -121,56 +121,56 @@ public class ViewsConfigElement extends ConfigElementAdapter
{ {
String page = pageView.substring(0, pageView.indexOf(SEPARATOR)); String page = pageView.substring(0, pageView.indexOf(SEPARATOR));
String view = pageView.substring(pageView.indexOf(SEPARATOR)+1); String view = pageView.substring(pageView.indexOf(SEPARATOR)+1);
newElement.addDefaultPageSize(page, view, this.pageSizes.get(pageView).intValue()); combinedElement.addDefaultPageSize(page, view, this.pageSizes.get(pageView).intValue());
} }
} }
for (String page : this.sortColumns.keySet()) for (String page : this.sortColumns.keySet())
{ {
newElement.addDefaultSortColumn(page, this.sortColumns.get(page)); combinedElement.addDefaultSortColumn(page, this.sortColumns.get(page));
} }
for (String page : this.sortDirections.keySet()) for (String page : this.sortDirections.keySet())
{ {
newElement.addSortDirection(page, this.sortDirections.get(page)); combinedElement.addSortDirection(page, this.sortDirections.get(page));
} }
// copy all the config from the element to be combined into the new one // copy all the config from the element to be combined into the new one
for (String viewImpl : existingElement.getViews()) for (String viewImpl : newElement.getViews())
{ {
newElement.addView(viewImpl); combinedElement.addView(viewImpl);
} }
Map<String, String> existingDefaultViews = existingElement.getDefaultViews(); Map<String, String> newDefaultViews = newElement.getDefaultViews();
for (String page : existingDefaultViews.keySet()) for (String page : newDefaultViews.keySet())
{ {
newElement.addDefaultView(page, existingDefaultViews.get(page)); combinedElement.addDefaultView(page, newDefaultViews.get(page));
} }
Map<String, Integer> existingPageSizes = existingElement.getDefaultPageSizes(); Map<String, Integer> newPageSizes = newElement.getDefaultPageSizes();
for (String pageView : existingPageSizes.keySet()) for (String pageView : newPageSizes.keySet())
{ {
if (pageView.indexOf(SEPARATOR) != -1) if (pageView.indexOf(SEPARATOR) != -1)
{ {
String page = pageView.substring(0, pageView.indexOf(SEPARATOR)); String page = pageView.substring(0, pageView.indexOf(SEPARATOR));
String view = pageView.substring(pageView.indexOf(SEPARATOR)+1); String view = pageView.substring(pageView.indexOf(SEPARATOR)+1);
newElement.addDefaultPageSize(page, view, existingPageSizes.get(pageView).intValue()); combinedElement.addDefaultPageSize(page, view, newPageSizes.get(pageView).intValue());
} }
} }
Map<String, String> existingSortColumns = existingElement.getDefaultSortColumns(); Map<String, String> newSortColumns = newElement.getDefaultSortColumns();
for (String page : existingSortColumns.keySet()) for (String page : newSortColumns.keySet())
{ {
newElement.addDefaultSortColumn(page, existingSortColumns.get(page)); combinedElement.addDefaultSortColumn(page, newSortColumns.get(page));
} }
Map<String, String> existingSortDirs = existingElement.getSortDirections(); Map<String, String> existingSortDirs = newElement.getSortDirections();
for (String page : existingSortDirs.keySet()) for (String page : existingSortDirs.keySet())
{ {
newElement.addSortDirection(page, existingSortDirs.get(page)); combinedElement.addSortDirection(page, existingSortDirs.get(page));
} }
return newElement; return combinedElement;
} }
/** /**

View File

@@ -18,6 +18,7 @@ package org.alfresco.web.config;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collection; import java.util.Collection;
import java.util.Iterator;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
@@ -27,6 +28,8 @@ import org.alfresco.config.ConfigException;
import org.alfresco.config.source.FileConfigSource; import org.alfresco.config.source.FileConfigSource;
import org.alfresco.config.xml.XMLConfigService; import org.alfresco.config.xml.XMLConfigService;
import org.alfresco.util.BaseTest; import org.alfresco.util.BaseTest;
import org.alfresco.web.config.ActionsConfigElement.ActionDefinition;
import org.alfresco.web.config.ActionsConfigElement.ActionGroup;
import org.alfresco.web.config.AdvancedSearchConfigElement.CustomProperty; import org.alfresco.web.config.AdvancedSearchConfigElement.CustomProperty;
import org.alfresco.web.config.DialogsConfigElement.DialogConfig; import org.alfresco.web.config.DialogsConfigElement.DialogConfig;
import org.alfresco.web.config.PropertySheetConfigElement.ItemConfig; import org.alfresco.web.config.PropertySheetConfigElement.ItemConfig;
@@ -815,4 +818,110 @@ public class WebClientConfigTest extends BaseTest
assertNull("step 3 title should be null", step3Page.getTitle()); assertNull("step 3 title should be null", step3Page.getTitle());
assertNull("step 3 description should be null", step3Page.getDescription()); assertNull("step 3 description should be null", step3Page.getDescription());
} }
public void testActions()
{
// setup the config service
String configFile = getResourcesDir() + "test-config.xml";
XMLConfigService svc = new XMLConfigService(new FileConfigSource(configFile));
svc.init();
// get the "Actions" config
Config cfg = svc.getGlobalConfig();
assertNotNull("cfg should not be null", cfg);
// get the <actions> config element
ActionsConfigElement actionsConfig = (ActionsConfigElement)cfg.
getConfigElement(ActionsConfigElement.CONFIG_ELEMENT_ID);
assertNotNull("actions config element should not be null", actionsConfig);
// get the individual actions
ActionDefinition docDetails = actionsConfig.getActionDefinition("details_doc");
assertNotNull("details_doc action definition should not be null", docDetails);
assertEquals("details_doc action", "dialog:showDocDetails", docDetails.Action);
ActionDefinition spaceDetails = actionsConfig.getActionDefinition("details_space");
assertNotNull("details_space action definition should not be null", spaceDetails);
assertEquals("details_space action", "dialog:showSpaceDetails", spaceDetails.Action);
// get the action group
ActionGroup group = actionsConfig.getActionGroup("document_browse");
assertNotNull("group definition should not be null", group);
assertFalse("showLink for document_browse group should be false", group.ShowLink);
for (String actionId : group)
{
if (actionId.equals("details_doc") == false &&
actionId.equals("details_space") == false)
{
fail("Unrecognised action-id '" + actionId + "' in action group '" + group.getId() + "'");
}
}
}
public void testActionsOverriding()
{
// setup the config service
List<String> configFiles = new ArrayList<String>(2);
configFiles.add(getResourcesDir() + "test-config.xml");
configFiles.add(getResourcesDir() + "test-config-override.xml");
XMLConfigService svc = new XMLConfigService(new FileConfigSource(configFiles));
svc.init();
// get the "Actions" config
Config cfg = svc.getConfig("Actions Override");
assertNotNull("cfg should not be null", cfg);
// get the <actions> config element
ActionsConfigElement actionsConfig = (ActionsConfigElement)cfg.
getConfigElement(ActionsConfigElement.CONFIG_ELEMENT_ID);
assertNotNull("actions config element should not be null", actionsConfig);
// get the individual actions
ActionDefinition docDetails = actionsConfig.getActionDefinition("details_doc");
assertNotNull("details_doc action definition should not be null", docDetails);
assertEquals("details_doc action", "dialog:showCustomDocDetails", docDetails.Action);
ActionDefinition spaceDetails = actionsConfig.getActionDefinition("details_space");
assertNotNull("details_space action definition should not be null", spaceDetails);
assertEquals("details_space action", "dialog:showSpaceDetails", spaceDetails.Action);
ActionDefinition customAction = actionsConfig.getActionDefinition("custom_action");
assertNotNull("custom_action action definition should not be null", customAction);
assertEquals("custom_action action", "customAction", customAction.Action);
// get the document_browse action group
ActionGroup group = actionsConfig.getActionGroup("document_browse");
assertNotNull("group definition should not be null", group);
assertTrue("showLink for document_browse group should be true", group.ShowLink);
assertEquals("document_browse group style class", "inlineAction", group.StyleClass);
assertNull("Style for document_browse group should be null", group.Style);
// make sure there are 3 items
ArrayList<String> actions = new ArrayList<String>(3);
for (String actionId : group)
{
actions.add(actionId);
}
assertEquals("number of items in document_browse group", 3, actions.size());
// make sure they are in the correct order
assertEquals("first action", "details_doc", actions.get(0));
assertEquals("second action", "details_space", actions.get(1));
assertEquals("third action", "custom_action", actions.get(2));
// get the new_group action group
ActionGroup newGroup = actionsConfig.getActionGroup("new_group");
assertNotNull("new_group definition should not be null", newGroup);
// make sure there is only 1 item and it's id is correct
actions = new ArrayList<String>(1);
for (String actionId : newGroup)
{
actions.add(actionId);
}
assertEquals("number of items in new_group group", 1, actions.size());
assertEquals("action", "custom_action", actions.get(0));
}
} }

View File

@@ -22,7 +22,6 @@ import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.ResourceBundle; import java.util.ResourceBundle;
import javax.faces.component.NamingContainer;
import javax.faces.component.UIComponent; import javax.faces.component.UIComponent;
import javax.faces.component.UIParameter; import javax.faces.component.UIParameter;
import javax.faces.context.FacesContext; import javax.faces.context.FacesContext;
@@ -108,6 +107,7 @@ public class UIActions extends SelfRenderingComponent
/** /**
* @see javax.faces.component.UIComponentBase#encodeBegin(javax.faces.context.FacesContext) * @see javax.faces.component.UIComponentBase#encodeBegin(javax.faces.context.FacesContext)
*/ */
@SuppressWarnings("unchecked")
public void encodeBegin(FacesContext context) throws IOException public void encodeBegin(FacesContext context) throws IOException
{ {
if (isRendered() == false) if (isRendered() == false)
@@ -130,12 +130,10 @@ public class UIActions extends SelfRenderingComponent
return; return;
} }
ResponseWriter out = context.getResponseWriter();
String groupId = getValue(); String groupId = getValue();
if (groupId != null && groupId.length() != 0) if (groupId != null && groupId.length() != 0)
{ {
Config config = Application.getConfigService(context).getConfig("Actions"); Config config = Application.getConfigService(context).getGlobalConfig();
if (config != null) if (config != null)
{ {
// find the Actions specific config element // find the Actions specific config element
@@ -222,11 +220,11 @@ public class UIActions extends SelfRenderingComponent
* @param context * @param context
* @param actionGroup * @param actionGroup
*/ */
@SuppressWarnings("unchecked")
private void buildActionGroup(FacesContext context, ActionsConfigElement config, ActionGroup actionGroup) private void buildActionGroup(FacesContext context, ActionsConfigElement config, ActionGroup actionGroup)
throws IOException throws IOException
{ {
javax.faces.application.Application facesApp = context.getApplication(); javax.faces.application.Application facesApp = context.getApplication();
Node node = getContext();
ResourceBundle messages = Application.getBundle(context); ResourceBundle messages = Application.getBundle(context);
// get overriding display attributes // get overriding display attributes

View File

@@ -7,7 +7,7 @@
</element-readers> </element-readers>
</plug-ins> </plug-ins>
<config evalutor="string-compare" condition="Dialogs"> <config evaluator="string-compare" condition="Dialogs">
<dialog-container>/jsp/dialog/container.jsp</dialog-container> <dialog-container>/jsp/dialog/container.jsp</dialog-container>
<dialogs> <dialogs>
@@ -22,7 +22,7 @@
</dialogs> </dialogs>
</config> </config>
<config evalutor="string-compare" condition="Wizards"> <config evaluator="string-compare" condition="Wizards">
<wizard-container>/jsp/wizard/container.jsp</wizard-container> <wizard-container>/jsp/wizard/container.jsp</wizard-container>
<wizards> <wizards>

View File

@@ -91,7 +91,7 @@
</property-sheet> </property-sheet>
</config> </config>
<config evalutor="string-compare" condition="Dialogs"> <config evaluator="string-compare" condition="Dialogs">
<dialog-container>/custom/my-container.jsp</dialog-container> <dialog-container>/custom/my-container.jsp</dialog-container>
<dialogs> <dialogs>
@@ -100,4 +100,30 @@
</dialogs> </dialogs>
</config> </config>
<config evaluator="string-compare" condition="Actions Override">
<actions>
<action id="details_doc">
<label-id>view_details</label-id>
<image>/images/icons/View_details.gif</image>
<action>dialog:showCustomDocDetails</action>
</action>
<action id="custom_action">
<label-id>some_label_id</label-id>
<image>/images/icons/details.gif</image>
<action>customAction</action>
</action>
<!-- Add the custom action to the existing document_browse group -->
<action-group id="document_browse">
<show-link>true</show-link>
<action idref="custom_action" />
</action-group>
<action-group id="new_group">
<action idref="custom_action" />
</action-group>
</actions>
</config>
</alfresco-config> </alfresco-config>

View File

@@ -8,6 +8,7 @@
<element-reader element-name="languages" class="org.alfresco.web.config.LanguagesElementReader" /> <element-reader element-name="languages" class="org.alfresco.web.config.LanguagesElementReader" />
<element-reader element-name="advanced-search" class="org.alfresco.web.config.AdvancedSearchElementReader" /> <element-reader element-name="advanced-search" class="org.alfresco.web.config.AdvancedSearchElementReader" />
<element-reader element-name="views" class="org.alfresco.web.config.ViewsElementReader" /> <element-reader element-name="views" class="org.alfresco.web.config.ViewsElementReader" />
<element-reader element-name="actions" class="org.alfresco.web.config.ActionsElementReader" />
</element-readers> </element-readers>
</plug-ins> </plug-ins>
@@ -47,6 +48,27 @@
<!-- the from address to use when sending emails from the client --> <!-- the from address to use when sending emails from the client -->
<from-email-address>alfresco@alfresco.org</from-email-address> <from-email-address>alfresco@alfresco.org</from-email-address>
</client> </client>
<actions>
<action id="details_doc">
<label-id>view_details</label-id>
<image>/images/icons/View_details.gif</image>
<action>dialog:showDocDetails</action>
</action>
<action id="details_space">
<label-id>view_details</label-id>
<image>/images/icons/View_details.gif</image>
<action>dialog:showSpaceDetails</action>
</action>
<action-group id="document_browse">
<show-link>false</show-link>
<style-class>inlineAction</style-class>
<action idref="details_doc" />
<action idref="details_space" />
</action-group>
</actions>
</config> </config>
<config evaluator="string-compare" condition="Languages"> <config evaluator="string-compare" condition="Languages">