Files
alfresco-community-repo/source/web/index.jsp
Kevin Roast 1aa1ef1f13 Merged V3.1 to HEAD
13173: Merged V2.1-A to V3.1
      10964: Fix for ADB-81: String 'Template' in Japanese is not good format
      10971: Fix for ADB-85: Configure dashboard wizard: long items description get truncated
      10972: Fix for ADB-95: All templates should be parameterized using a  such that they pickup the server name and port number of the current installation
      10973: Fix for ADB-117: Configure Dashboard Wizard. Layout word (Step 3) not localized for japanese and french
   13174: Merged V2.1-A to V3.1
      10975: Fix for ADB-118: Content attributes not localized [client templates]
   13182: Merged V2.1-A to V3.1
      11058: Fix for ADB-121: Next & Finish button remain disabled in 'Create Content in your home space' wizard even after entering name when locale is set to French
      11059: Fix for ADB-128: Date format is different for 'Manage Content Rules' in Japanese Locale
   13190: Merged V2.1-A to V3.1
      11070: Fix for ADB-120 ACT 4773
   13192: Merged V2.1-A to V3.1
      11195: Fix for ADB-130: The 'Finish' button doesn't work after editing the content
   13193: Merged V2.1-A to V3.1
      8395: Remove user and group admin actions from Admin console [added config switch - off by default]
      8584: Removed option for user to change password [added config switch - off by default]
      10203: Fix for ADB-96: Remove modify button on the User Options Page in the Web UI [added config switch - off by default]
      10374: Further fix for ADB-96: Remove modify button on the User Options Page in the Web UI [added config switch - off by default]
   13194: Merged V2.1-A to V3.1
      12095: Fix for ADB-131
   13195: Merged V2.1-A to V3.1
      12097: Fix for ADB-133, ADB-134
      12102: Fix for ADB-139
   13196: Merged V2.1-A to V3.1
      12350: Fix for ADB-142
   13197: Merged V2.1-A to V3.1
      12877: Fix for ADB-147: Prevent users from selecting the same action twice in the action wizards
      12878: Merged record-only for V2.1-A to HEAD 
         12877: Fix for ADB-147: Prevent users from selecting the same action twice in the action wizards
   13198: Merged V2.1-A to V3.1
      12977: Fix for ADB-158: Intermittent error while accessing the login page
      13142: Another fix for ADB-158: Intermittent error while accessing the login page
   13199: Merged V2.1-A to V3.1
      11589: Fix for ADB-95: All templates should be parameterized

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@13570 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
2009-03-11 14:45:20 +00:00

147 lines
6.2 KiB
Plaintext

<%--
* Copyright (C) 2005-2007 Alfresco Software Limited.
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
* As a special exception to the terms and conditions of version 2.0 of
* the GPL, you may redistribute this Program in connection with Free/Libre
* and Open Source Software ("FLOSS") applications as described in Alfresco's
* FLOSS exception. You should have recieved a copy of the text describing
* the FLOSS exception, and it is also available here:
* http://www.alfresco.com/legal/licensing"
--%>
<%@ page import="javax.faces.context.FacesContext" %>
<%@ page import="javax.transaction.UserTransaction" %>
<%@ page import="org.springframework.web.context.WebApplicationContext" %>
<%@ page import="org.springframework.web.context.support.WebApplicationContextUtils" %>
<%@ page import="org.alfresco.service.transaction.TransactionService" %>
<%@ page import="org.alfresco.service.cmr.security.PermissionService" %>
<%@ page import="org.alfresco.service.cmr.security.AuthenticationService" %>
<%@ page import="org.alfresco.service.cmr.security.PersonService" %>
<%@ page import="org.alfresco.service.cmr.security.PermissionService" %>
<%@ page import="org.alfresco.service.cmr.repository.NodeRef" %>
<%@ page import="org.alfresco.repo.security.authentication.AuthenticationException" %>
<%@ page import="org.alfresco.config.ConfigService" %>
<%@ page import="org.alfresco.web.app.servlet.AuthenticationHelper" %>
<%@ page import="org.alfresco.web.app.servlet.FacesHelper" %>
<%@ page import="org.alfresco.web.bean.NavigationBean" %>
<%@ page import="org.alfresco.web.bean.repository.User" %>
<%@ page import="org.alfresco.web.bean.repository.PreferencesService" %>
<%@ page import="org.alfresco.web.config.ClientConfigElement" %>
<%-- redirect to the web application's appropriate start page --%>
<%
// get the start location as configured by the web-client config
WebApplicationContext context = WebApplicationContextUtils.getRequiredWebApplicationContext(session.getServletContext());
ConfigService configService = (ConfigService)context.getBean("webClientConfigService");
ClientConfigElement configElement = (ClientConfigElement)configService.getGlobalConfig().getConfigElement("client");
String location = configElement.getInitialLocation();
AuthenticationService authService = (AuthenticationService)context.getBean("AuthenticationService");
// override with the users preference if they have one
User user = (User)session.getAttribute(AuthenticationHelper.AUTHENTICATION_USER);
if (user != null)
{
UserTransaction tx = ((TransactionService)context.getBean("TransactionService")).getUserTransaction();;
tx.begin();
try
{
authService.validate(user.getTicket());
// ensure construction of the FacesContext before attemping a service call
FacesContext fc = FacesHelper.getFacesContext(request, response, application);
String preference = (String)PreferencesService.getPreferences(fc).getValue("start-location");
if (preference != null)
{
location = preference;
}
tx.commit();
}
catch (AuthenticationException authErr)
{
try { tx.rollback(); } catch (Throwable tex) {}
// expired ticket
AuthenticationService unpAuth = (AuthenticationService)context.getBean("authenticationService");
unpAuth.invalidateTicket(unpAuth.getCurrentTicket());
unpAuth.clearCurrentSecurityContext();
}
catch (Throwable e)
{
try { tx.rollback(); } catch (Throwable tex) {}
}
}
else
{
UserTransaction tx = ((TransactionService)context.getBean("TransactionService")).getUserTransaction();;
tx.begin();
try
{
authService.authenticateAsGuest();
PersonService personService = (PersonService)context.getBean("personService");
NodeRef guestRef = personService.getPerson(PermissionService.GUEST_AUTHORITY);
user = new User(authService.getCurrentUserName(), authService.getCurrentTicket(), guestRef);
session.setAttribute(AuthenticationHelper.AUTHENTICATION_USER, user);
// ensure construction of the FacesContext before attemping a service call
FacesContext fc = FacesHelper.getFacesContext(request, response, application);
String preference = (String)PreferencesService.getPreferences(session).getValue("start-location");
if (preference != null)
{
location = preference;
}
session.removeAttribute(AuthenticationHelper.AUTHENTICATION_USER);
tx.commit();
}
catch (Throwable e)
{
try { tx.rollback(); } catch (Throwable tex) {}
}
}
if (request.getMethod().equalsIgnoreCase("GET"))
{
if (NavigationBean.LOCATION_MYALFRESCO.equals(location))
{
// Clear previous location - Fixes the issue ADB-61
FacesContext fc = FacesHelper.getFacesContext(request, response, application);
if (fc != null)
{
NavigationBean navigationBean = (NavigationBean)FacesHelper.getManagedBean(fc, "NavigationBean");
if (navigationBean != null)
{
navigationBean.setLocation(null);
navigationBean.setToolbarLocation(null);
}
}
// Send redirect
response.sendRedirect(request.getContextPath() + "/faces/jsp/dashboards/container.jsp");
}
else
{
response.sendRedirect(request.getContextPath() + "/faces/jsp/browse/browse.jsp");
}
}
// route WebDAV requests
else if (request.getMethod().equalsIgnoreCase("PROPFIND") ||
request.getMethod().equalsIgnoreCase("OPTIONS"))
{
response.sendRedirect(request.getContextPath() + "/webdav/");
}
%>