diff --git a/config/alfresco/web-client-config.xml b/config/alfresco/web-client-config.xml index 5c5b6cb4da..222a21777e 100644 --- a/config/alfresco/web-client-config.xml +++ b/config/alfresco/web-client-config.xml @@ -52,6 +52,10 @@ Consumer + + + userhome + http://www.alfresco.org/help/webclient diff --git a/source/java/org/alfresco/web/app/servlet/ExternalAccessServlet.java b/source/java/org/alfresco/web/app/servlet/ExternalAccessServlet.java index d58f0caf6c..e32021a615 100644 --- a/source/java/org/alfresco/web/app/servlet/ExternalAccessServlet.java +++ b/source/java/org/alfresco/web/app/servlet/ExternalAccessServlet.java @@ -34,6 +34,7 @@ import org.alfresco.service.cmr.security.AccessStatus; import org.alfresco.service.cmr.security.PermissionService; import org.alfresco.web.app.Application; import org.alfresco.web.bean.BrowseBean; +import org.alfresco.web.bean.dashboard.DashboardManager; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; @@ -64,9 +65,11 @@ public class ExternalAccessServlet extends BaseServlet private final static String OUTCOME_DOCDETAILS = "showDocDetails"; private final static String OUTCOME_SPACEDETAILS = "showSpaceDetails"; private final static String OUTCOME_BROWSE = "browse"; + private final static String OUTCOME_MYALFRESCO = "myalfresco"; private final static String OUTCOME_LOGOUT = "logout"; private static final String ARG_TEMPLATE = "template"; + private static final String ARG_PAGE = "page"; /** * @see javax.servlet.http.HttpServlet#service(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse) @@ -224,6 +227,19 @@ public class ExternalAccessServlet extends BaseServlet navigationHandler.handleNavigation(fc, null, outcome); } } + else if (OUTCOME_MYALFRESCO.equals(outcome)) + { + // setup the Dashboard Manager ready for the page we want to display + if (req.getParameter(ARG_PAGE) != null) + { + DashboardManager manager = (DashboardManager)FacesHelper.getManagedBean(fc, "DashboardManager"); + manager.getPageConfig().setCurrentPage(req.getParameter(ARG_PAGE)); + } + + // perform the appropriate JSF navigation outcome + NavigationHandler navigationHandler = fc.getApplication().getNavigationHandler(); + navigationHandler.handleNavigation(fc, null, outcome); + } else if (OUTCOME_LOGOUT.equals(outcome)) { // special case for logout diff --git a/source/java/org/alfresco/web/bean/LoginBean.java b/source/java/org/alfresco/web/bean/LoginBean.java index 896d5c117d..aad12d6d3c 100644 --- a/source/java/org/alfresco/web/bean/LoginBean.java +++ b/source/java/org/alfresco/web/bean/LoginBean.java @@ -325,7 +325,17 @@ public class LoginBean } else { - return "success"; + // special case to handle jump to My Alfresco page initially + String location = Application.getClientConfig(FacesContext.getCurrentInstance()).getInitialLocation(); + if (NavigationBean.LOCATION_MYALFRESCO.equals(location)) + { + return "myalfresco"; + } + else + { + // generally this will navigate to the generic browse screen + return "success"; + } } } catch (AuthenticationException aerr) diff --git a/source/java/org/alfresco/web/bean/NavigationBean.java b/source/java/org/alfresco/web/bean/NavigationBean.java index 57a7f07158..4fb870af90 100644 --- a/source/java/org/alfresco/web/bean/NavigationBean.java +++ b/source/java/org/alfresco/web/bean/NavigationBean.java @@ -187,11 +187,93 @@ public class NavigationBean } /** - * @param toolbarLocation The toolbar Location to set. + * @param location The toolbar Location to set. */ - public void setToolbarLocation(String toolbarLocation) + public void setToolbarLocation(String location) { - this.toolbarLocation = toolbarLocation; + processToolbarLocation(location, true); + } + + /** + * Process the selected toolbar location. Setup the breadcrumb with initial value and + * setup the current node ID. This method can also perform the navigatin setup if requested. + * + * @param location Toolbar location constant + * @param navigate True to perform navigation, false otherwise + */ + private void processToolbarLocation(String location, boolean navigate) + { + this.toolbarLocation = location; + + FacesContext context = FacesContext.getCurrentInstance(); + if (LOCATION_COMPANY.equals(location)) + { + List elements = new ArrayList(1); + Node companyHome = getCompanyHomeNode(); + elements.add(new NavigationBreadcrumbHandler(companyHome.getNodeRef(), companyHome.getName())); + setLocation(elements); + setCurrentNodeId(companyHome.getId()); + + // we need to force a navigation to refresh the browse screen breadcrumb + if (navigate) + { + context.getApplication().getNavigationHandler().handleNavigation(context, null, OUTCOME_BROWSE); + } + } + else if (LOCATION_HOME.equals(location)) + { + List elements = new ArrayList(1); + String homeSpaceId = Application.getCurrentUser(context).getHomeSpaceId(); + NodeRef homeSpaceRef = new NodeRef(Repository.getStoreRef(), homeSpaceId); + String homeSpaceName = Repository.getNameForNode(this.nodeService, homeSpaceRef); + elements.add(new NavigationBreadcrumbHandler(homeSpaceRef, homeSpaceName)); + setLocation(elements); + setCurrentNodeId(homeSpaceRef.getId()); + + // we need to force a navigation to refresh the browse screen breadcrumb + if (navigate) + { + context.getApplication().getNavigationHandler().handleNavigation(context, null, OUTCOME_BROWSE); + } + } + else if (LOCATION_GUEST.equals(location)) + { + List elements = new ArrayList(1); + Node guestHome = getGuestHomeNode(); + elements.add(new NavigationBreadcrumbHandler(guestHome.getNodeRef(), guestHome.getName())); + setLocation(elements); + setCurrentNodeId(guestHome.getId()); + + // we need to force a navigation to refresh the browse screen breadcrumb + if (navigate) + { + context.getApplication().getNavigationHandler().handleNavigation(context, null, OUTCOME_BROWSE); + } + } + else if (LOCATION_MYALFRESCO.equals(location)) + { + List elements = new ArrayList(1); + elements.add(new IBreadcrumbHandler() + { + public String navigationOutcome(UIBreadcrumb breadcrumb) + { + setLocation( (List)breadcrumb.getValue() ); + return OUTCOME_MYALFRESCO; + }; + + public String toString() + { + return Application.getMessage(FacesContext.getCurrentInstance(), MSG_MYALFRESCO); + }; + }); + setLocation(elements); + + // we need to force a navigation to refresh the browse screen breadcrumb + if (navigate) + { + context.getApplication().getNavigationHandler().handleNavigation(context, null, OUTCOME_MYALFRESCO); + } + } } /** @@ -396,20 +478,20 @@ public class NavigationBean if (diskShare != null) { - ContentContext contentCtx = (ContentContext) diskShare.getContext(); - NodeRef rootNode = contentCtx.getRootNode(); - try - { - String cifsPath = Repository.getNamePath(this.nodeService, path, rootNode, "\\", "file:///" + getCIFSServerPath(diskShare)); - - node.getProperties().put("cifsPath", cifsPath); - node.getProperties().put("cifsPathLabel", cifsPath.substring(8)); // strip file:/// part - } - catch(AccessDeniedException ade) - { - node.getProperties().put("cifsPath", ""); - node.getProperties().put("cifsPathLabel",""); // strip file:/// part - } + ContentContext contentCtx = (ContentContext) diskShare.getContext(); + NodeRef rootNode = contentCtx.getRootNode(); + try + { + String cifsPath = Repository.getNamePath(this.nodeService, path, rootNode, "\\", "file:///" + getCIFSServerPath(diskShare)); + + node.getProperties().put("cifsPath", cifsPath); + node.getProperties().put("cifsPathLabel", cifsPath.substring(8)); // strip file:/// part + } + catch(AccessDeniedException ade) + { + node.getProperties().put("cifsPath", ""); + node.getProperties().put("cifsPathLabel",""); // strip file:/// part + } } this.currentNode = node; @@ -425,26 +507,13 @@ public class NavigationBean { if (this.location == null) { - // set the current node to the users Home Space Id if one has not already been set - NodeRef homeSpaceRef; - List elements = new ArrayList(1); - if (getCurrentNodeId() == null) + // get the initial location from the client config + String initialLocation = clientConfig.getInitialLocation(); + if (initialLocation == null || initialLocation.length() == 0) { - User user = Application.getCurrentUser(FacesContext.getCurrentInstance()); - homeSpaceRef = new NodeRef(Repository.getStoreRef(), user.getHomeSpaceId()); + initialLocation = LOCATION_HOME; } - else - { - homeSpaceRef = new NodeRef(Repository.getStoreRef(), getCurrentNodeId()); - } - - // set initial node ID - setCurrentNodeId(homeSpaceRef.getId()); - - // setup the breadcrumb with the same initial location - String homeSpaceName = Repository.getNameForNode(this.nodeService, homeSpaceRef); - elements.add(new NavigationBreadcrumbHandler(homeSpaceRef, homeSpaceName)); - setLocation(elements); + processToolbarLocation(initialLocation, false); } return this.location; @@ -591,63 +660,6 @@ public class NavigationBean UIModeList locationList = (UIModeList)event.getComponent(); String location = locationList.getValue().toString(); setToolbarLocation(location); - - if (LOCATION_COMPANY.equals(location)) - { - List elements = new ArrayList(1); - Node companyHome = getCompanyHomeNode(); - elements.add(new NavigationBreadcrumbHandler(companyHome.getNodeRef(), companyHome.getName())); - setLocation(elements); - setCurrentNodeId(companyHome.getId()); - - // we need to force a navigation to refresh the browse screen breadcrumb - context.getApplication().getNavigationHandler().handleNavigation(context, null, OUTCOME_BROWSE); - } - else if (LOCATION_HOME.equals(location)) - { - List elements = new ArrayList(1); - String homeSpaceId = Application.getCurrentUser(context).getHomeSpaceId(); - NodeRef homeSpaceRef = new NodeRef(Repository.getStoreRef(), homeSpaceId); - String homeSpaceName = Repository.getNameForNode(this.nodeService, homeSpaceRef); - elements.add(new NavigationBreadcrumbHandler(homeSpaceRef, homeSpaceName)); - setLocation(elements); - setCurrentNodeId(homeSpaceRef.getId()); - - // we need to force a navigation to refresh the browse screen breadcrumb - context.getApplication().getNavigationHandler().handleNavigation(context, null, OUTCOME_BROWSE); - } - else if (LOCATION_GUEST.equals(location)) - { - List elements = new ArrayList(1); - Node guestHome = getGuestHomeNode(); - elements.add(new NavigationBreadcrumbHandler(guestHome.getNodeRef(), guestHome.getName())); - setLocation(elements); - setCurrentNodeId(guestHome.getId()); - - // we need to force a navigation to refresh the browse screen breadcrumb - context.getApplication().getNavigationHandler().handleNavigation(context, null, OUTCOME_BROWSE); - } - else if (LOCATION_DASHBOARD.equals(location)) - { - List elements = new ArrayList(1); - elements.add(new IBreadcrumbHandler() - { - public String navigationOutcome(UIBreadcrumb breadcrumb) - { - setLocation( (List)breadcrumb.getValue() ); - return OUTCOME_MYALFRESCO; - }; - - public String toString() - { - return Application.getMessage(FacesContext.getCurrentInstance(), MSG_MYALFRESCO); - }; - }); - setLocation(elements); - - // we need to force a navigation to refresh the browse screen breadcrumb - context.getApplication().getNavigationHandler().handleNavigation(context, null, OUTCOME_MYALFRESCO); - } } catch (InvalidNodeRefException refErr) { @@ -770,10 +782,10 @@ public class NavigationBean private static Logger s_logger = Logger.getLogger(NavigationBean.class); /** constant values used by the toolbar location modelist control */ - private static final String LOCATION_COMPANY = "company"; - private static final String LOCATION_HOME = "home"; - private static final String LOCATION_GUEST = "guest"; - private static final String LOCATION_DASHBOARD = "dashboard"; + static final String LOCATION_COMPANY = "companyhome"; + static final String LOCATION_HOME = "userhome"; + static final String LOCATION_GUEST = "guesthome"; + static final String LOCATION_MYALFRESCO = "myalfresco"; private static final String MSG_MYALFRESCO = "my_alfresco"; diff --git a/source/java/org/alfresco/web/bean/dashboard/PageConfig.java b/source/java/org/alfresco/web/bean/dashboard/PageConfig.java index f59b271a76..65d8dbed76 100644 --- a/source/java/org/alfresco/web/bean/dashboard/PageConfig.java +++ b/source/java/org/alfresco/web/bean/dashboard/PageConfig.java @@ -42,7 +42,7 @@ import org.dom4j.io.XMLWriter; * * @author Kevin Roast */ -final class PageConfig +public final class PageConfig { private static Log logger = LogFactory.getLog(DashboardManager.class); @@ -55,7 +55,7 @@ final class PageConfig private static final String ATTR_REFID = "idref"; private List pages = new ArrayList(4); - private int currentPageIndex = 0; + private Page currentPage = null; /** @@ -86,13 +86,30 @@ final class PageConfig */ public Page getCurrentPage() { - if (currentPageIndex < pages.size()) + if (this.currentPage == null) { - return pages.get(currentPageIndex); + if (this.pages.size() != 0) + { + this.currentPage = pages.get(0); + } } - else + return this.currentPage; + } + + /** + * Set the current Page for the cnfig + * + * @param pageId ID of the page to set as current + */ + public void setCurrentPage(String pageId) + { + for (Page page : pages) { - return null; + if (page.getId().equals(pageId)) + { + this.currentPage = page; + break; + } } } diff --git a/source/java/org/alfresco/web/config/ClientConfigElement.java b/source/java/org/alfresco/web/config/ClientConfigElement.java index 4c75bfcc8d..0f6a3e216e 100644 --- a/source/java/org/alfresco/web/config/ClientConfigElement.java +++ b/source/java/org/alfresco/web/config/ClientConfigElement.java @@ -40,6 +40,7 @@ public class ClientConfigElement extends ConfigElementAdapter private String editLinkType = "http"; private String homeSpacePermission = null; private boolean ajaxEnabled = false; + private String initialLocation = null; /** * Default Constructor @@ -145,6 +146,17 @@ public class ClientConfigElement extends ConfigElementAdapter combinedElement.setFromEmailAddress(newElement.getFromEmailAddress()); } + if (newElement.isAjaxEnabled() != combinedElement.isAjaxEnabled()) + { + combinedElement.setAjaxEnabled(newElement.isAjaxEnabled()); + } + + if (newElement.getInitialLocation() != null && + newElement.getInitialLocation().equals(combinedElement.getInitialLocation()) == false) + { + combinedElement.setInitialLocation(newElement.getInitialLocation()); + } + return combinedElement; } @@ -348,4 +360,20 @@ public class ClientConfigElement extends ConfigElementAdapter { this.ajaxEnabled = ajaxEnabled; } + + /** + * @return Returns the default initial location for the user. + */ + public String getInitialLocation() + { + return this.initialLocation; + } + + /** + * @param initialLocation The initial location to set. + */ + /*package*/ void setInitialLocation(String initialLocation) + { + this.initialLocation = initialLocation; + } } diff --git a/source/java/org/alfresco/web/config/ClientElementReader.java b/source/java/org/alfresco/web/config/ClientElementReader.java index 00feb8377f..43d25005ee 100644 --- a/source/java/org/alfresco/web/config/ClientElementReader.java +++ b/source/java/org/alfresco/web/config/ClientElementReader.java @@ -40,6 +40,7 @@ public class ClientElementReader implements ConfigElementReader public static final String ELEMENT_FROMEMAILADDRESS = "from-email-address"; public static final String ELEMENT_SHELFVISIBLE = "shelf-visible"; public static final String ELEMENT_AJAX_ENABLED = "ajax-enabled"; + public static final String ELEMENT_INITIALLOCATION = "initial-location"; /** * @see org.alfresco.config.xml.elementreader.ConfigElementReader#parse(org.dom4j.Element) @@ -144,6 +145,13 @@ public class ClientElementReader implements ConfigElementReader { configElement.setAjaxEnabled(Boolean.parseBoolean(ajaxEnabled.getTextTrim())); } + + // get the initial location + Element initialLocation = element.element(ELEMENT_INITIALLOCATION); + if (initialLocation != null) + { + configElement.setInitialLocation(initialLocation.getTextTrim()); + } } return configElement; diff --git a/source/java/org/alfresco/web/config/DashboardsConfigElement.java b/source/java/org/alfresco/web/config/DashboardsConfigElement.java index d35e0256e5..83ed1a8039 100644 --- a/source/java/org/alfresco/web/config/DashboardsConfigElement.java +++ b/source/java/org/alfresco/web/config/DashboardsConfigElement.java @@ -148,5 +148,6 @@ public class DashboardsConfigElement extends ConfigElementAdapter public String Description; public String DescriptionId; public String JSPPage; + public String ConfigJSPPage; } } diff --git a/source/java/org/alfresco/web/config/DashboardsElementReader.java b/source/java/org/alfresco/web/config/DashboardsElementReader.java index b9e3e08079..e532ec8486 100644 --- a/source/java/org/alfresco/web/config/DashboardsElementReader.java +++ b/source/java/org/alfresco/web/config/DashboardsElementReader.java @@ -46,6 +46,7 @@ public class DashboardsElementReader implements ConfigElementReader public static final String ATTR_LABELID = "label-id"; public static final String ATTR_DESCRIPTIONID = "description-id"; public static final String ATTR_JSP = "jsp"; + public static final String ATTR_CONFIGJSP = "config-jsp"; public static final String ATTR_ALLOWNARROW = "allow-narrow"; /** @@ -165,6 +166,7 @@ public class DashboardsElementReader implements ConfigElementReader def.AllowNarrow = Boolean.parseBoolean(allowNarrow); } def.JSPPage = getMandatoryDashletAttributeValue(config, ATTR_JSP); + def.ConfigJSPPage = config.attributeValue(ATTR_CONFIGJSP); String label = config.attributeValue(ATTR_LABEL); String labelId = config.attributeValue(ATTR_LABELID); if ((label == null || label.length() == 0) && (labelId == null || labelId.length() == 0)) diff --git a/source/web/jsp/parts/titlebar.jsp b/source/web/jsp/parts/titlebar.jsp index cc014227a7..4397ec40ea 100644 --- a/source/web/jsp/parts/titlebar.jsp +++ b/source/web/jsp/parts/titlebar.jsp @@ -28,10 +28,10 @@ - - - - + + + +