Hi, after making below changes, I tried logging in as admin to see changes. I get the below error page rather accessing the document library page. What could be the reason
<%@ page import="org.alfresco.web.site.*" %> <%@ page import="org.springframework.extensions.surf.*" %> <%@ page import="org.springframework.extensions.surf.site.*" %> <%@ page import="org.springframework.extensions.surf.util.*" %> <%@ page import="java.util.*" %> <% <!-- // retrieve user name from the session --> String userid = (String)session.getAttribute(SlingshotUserFactory.SESSION_ATTRIBUTE_KEY_USER_ID); <!-- // test user dashboard page exists? --> RequestContext context = (RequestContext)request.getAttribute(RequestContext.ATTR_REQUEST_CONTEXT); if (!context.getObjectService().hasPage("user/" + userid + "/dashboard")) { <!-- // no user dashboard page found! create initial dashboard for this user... --> Map<String, String> tokens = new HashMap<String, String>(); tokens.put("userid", userid); FrameworkUtil.getServiceRegistry().getPresetsManager().constructPreset("user-dashboard", tokens); } <!-- // redirect to site or user dashboard as appropriate --> String siteName = request.getParameter("enterprise"); if (siteName == null || siteName.length() == 0) { <!-- // Get and forward to user's home page --> SlingshotUserFactory slingshotUserFactory = (SlingshotUserFactory) FrameworkUtil.getServiceRegistry().getUserFactory(); String userHomePage = slingshotUserFactory.getUserHomePage(context, userid); response.sendRedirect(request.getContextPath() + userHomePage); } else { <!-- // forward to site specific dashboard page --> response.sendRedirect(request.getContextPath() + "/page/site/" + URLEncoder.encode(siteName) + "/documentlibrary"); } %>
<% <!-- // retrieve user name from the session --> String userid = (String)session.getAttribute(SlingshotUserFactory.SESSION_ATTRIBUTE_KEY_USER_ID); <!-- // test user dashboard page exists? --> RequestContext context = (RequestContext)request.getAttribute(RequestContext.ATTR_REQUEST_CONTEXT); if (!context.getObjectService().hasPage("user/" + userid + "/dashboard")) { <!-- // no user dashboard page found! create initial dashboard for this user... --> Map<String, String> tokens = new HashMap<String, String>(); tokens.put("userid", userid); FrameworkUtil.getServiceRegistry().getPresetsManager().constructPreset("user-dashboard", tokens); } <!-- // redirect to site or user dashboard as appropriate --> String siteName = request.getParameter("enterprise"); if (siteName == null || siteName.length() == 0) { <!-- // Get and forward to user's home page --> SlingshotUserFactory slingshotUserFactory = (SlingshotUserFactory) FrameworkUtil.getServiceRegistry().getUserFactory(); String userHomePage = slingshotUserFactory.getUserHomePage(context, userid); response.sendRedirect(request.getContextPath() + userHomePage); } else { <!-- // forward to site specific dashboard page --> response.sendRedirect(request.getContextPath() + "/page/site/" + URLEncoder.encode(siteName) + "/documentlibrary"); } %>
Hi,
What type of changes you have performed in these pages?
Thank you! After making below changes now I can see the changes been implemented but I would like to make the page dynampic so any site user can directly visit document library page. From the below I have hard coded to siteName = "enterprise"; can we change it to dynamic.
<%@ page import="org.alfresco.web.site.*" %> <%@ page import="org.springframework.extensions.surf.*" %> <%@ page import="org.springframework.extensions.surf.site.*" %> <%@ page import="org.springframework.extensions.surf.util.*" %> <%@ page import="java.util.*" %> <% // retrieve user name from the session String userid = (String)session.getAttribute(SlingshotUserFactory.SESSION_ATTRIBUTE_KEY_USER_ID); // test user dashboard page exists? RequestContext context = (RequestContext)request.getAttribute(RequestContext.ATTR_REQUEST_CONTEXT); if (!context.getObjectService().hasPage("user/" + userid + "/dashboard")) { // no user dashboard page found! create initial dashboard for this user... Map<String, String> tokens = new HashMap<String, String>(); tokens.put("userid", userid); FrameworkUtil.getServiceRegistry().getPresetsManager().constructPreset("user-dashboard", tokens); } // redirect to site or user dashboard as appropriate String siteName = request.getParameter("site"); siteName = "enterprise"; if (siteName == null || siteName.length() == 0) { // Get and forward to user's home page SlingshotUserFactory slingshotUserFactory = (SlingshotUserFactory) FrameworkUtil.getServiceRegistry().getUserFactory(); String userHomePage = slingshotUserFactory.getUserHomePage(context, userid); response.sendRedirect(request.getContextPath() + userHomePage); } else { // forward to site specific dashboard page response.sendRedirect(request.getContextPath() + "/page/site/" + URLEncoder.encode(siteName) + "/documentlibrary"); } %>
Can someone provide your input on this. Thanks
Below Changes will redurect you to Document Library of Particular Site.
response.sendRedirect(request.getContextPath() + "/page/site/" + URLEncoder.encode(siteName)+"/documentlibrary");
I tried the below patch but I get to a screen
" Something's wrong with this page...
We may have hit an error or something might have been removed or deleted, so check that the URL is correct.
Alternatively you might not have permission to view the page (it could be on a private site) or there could have been an internal error. Try checking with your Alfresco administrator.
If you're trying to get to your home page and it's no longer available you should change it by clicking your name on the Alfresco toolbar."
<%@ page import="org.alfresco.web.site.*" %> <%@ page import="org.springframework.extensions.surf.*" %> <%@ page import="org.springframework.extensions.surf.site.*" %> <%@ page import="org.springframework.extensions.surf.util.*" %> <%@ page import="java.util.*" %> <% response.sendRedirect(request.getContextPath() + "/page/site/" + URLEncoder.encode(siteName)+"/documentlibrary"); %>
Ask for and offer help to other Alfresco Content Services Users and members of the Alfresco team.
Related links:
By using this site, you are agreeing to allow us to collect and use cookies as outlined in Alfresco’s Cookie Statement and Terms of Use (and you have a legitimate interest in Alfresco and our products, authorizing us to contact you in such methods). If you are not ok with these terms, please do not use this website.