05-27-2020 03:00 PM
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"); } %>
05-28-2020 12:30 AM
Hi,
What type of changes you have performed in these pages?
05-28-2020 12:28 PM
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"); } %>
06-01-2020 06:12 PM
Can someone provide your input on this. Thanks
06-02-2020 02:40 AM
Below Changes will redurect you to Document Library of Particular Site.
response.sendRedirect(request.getContextPath() + "/page/site/" + URLEncoder.encode(siteName)+"/documentlibrary");
06-02-2020 12:38 PM
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"); %>
Explore our Alfresco products with the links below. Use labels to filter content by product module.