- Created skeleton for Foundry base theme
- A bit of formatting for several classes git-svn-id: https://svn.libreccm.org/ccm/trunk@2976 8810af33-2d31-482b-a856-94f89814c4dfmaster
parent
dfbf54d11e
commit
a84f49eed7
|
|
@ -32,16 +32,17 @@ import javax.security.auth.callback.UnsupportedCallbackException;
|
|||
import org.apache.log4j.Logger;
|
||||
|
||||
/**
|
||||
* An in-house implementation of JAAS's <code>LoginContext</code> class.
|
||||
* Needed to workaround a bug in JAAS 1.0 that requires LoginModules to be
|
||||
* loaded by the system classloader. This class loads LoginModules using
|
||||
* <code>Class.forName()</code>. The JAAS bug will be fixed in JDK 1.4.
|
||||
* An in-house implementation of JAAS's <code>LoginContext</code> class. Needed to workaround a bug
|
||||
* in JAAS 1.0 that requires LoginModules to be loaded by the system classloader. This class loads
|
||||
* LoginModules using <code>Class.forName()</code>. The JAAS bug will be fixed in JDK 1.4.
|
||||
*
|
||||
* @author Sameer Ajmani
|
||||
* @version $Id: LoginContext.java 287 2005-02-22 00:29:02Z sskracic $
|
||||
**/
|
||||
*
|
||||
*/
|
||||
public class LoginContext {
|
||||
private final static Logger s_log = Logger.getLogger( LoginContext.class );
|
||||
|
||||
private final static Logger s_log = Logger.getLogger(LoginContext.class);
|
||||
|
||||
private Subject m_subject;
|
||||
private CallbackHandler m_handler;
|
||||
|
|
@ -64,14 +65,15 @@ public class LoginContext {
|
|||
Subject subject)
|
||||
throws LoginException {
|
||||
this(name, subject, new CallbackHandler() {
|
||||
public void handle(Callback[] cbs)
|
||||
throws UnsupportedCallbackException {
|
||||
if (cbs.length > 0) {
|
||||
throw new UnsupportedCallbackException
|
||||
(cbs[0], "CallbackHandler not defined");
|
||||
}
|
||||
|
||||
public void handle(Callback[] cbs)
|
||||
throws UnsupportedCallbackException {
|
||||
if (cbs.length > 0) {
|
||||
throw new UnsupportedCallbackException(cbs[0], "CallbackHandler not defined");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -98,44 +100,37 @@ public class LoginContext {
|
|||
throw new LoginException("Login config not defined");
|
||||
}
|
||||
|
||||
AppConfigurationEntry[] entries =
|
||||
config.getAppConfigurationEntry(name);
|
||||
AppConfigurationEntry[] entries = config.getAppConfigurationEntry(name);
|
||||
if (entries == null) {
|
||||
throw new LoginException
|
||||
("Login config for '"+name+"' not defined");
|
||||
throw new LoginException("Login config for '" + name + "' not defined");
|
||||
}
|
||||
|
||||
m_modules = new LoginModule[entries.length];
|
||||
m_flags = new AppConfigurationEntry.LoginModuleControlFlag
|
||||
[entries.length];
|
||||
m_flags = new AppConfigurationEntry.LoginModuleControlFlag[entries.length];
|
||||
|
||||
for (int i = 0; i < m_modules.length; i++) {
|
||||
String module = entries[i].getLoginModuleName();
|
||||
try {
|
||||
m_modules[i] = (LoginModule)
|
||||
Class.forName(module).newInstance();
|
||||
m_modules[i] = (LoginModule) Class.forName(module).newInstance();
|
||||
m_modules[i].initialize(m_subject, m_handler, m_shared,
|
||||
entries[i].getOptions());
|
||||
m_flags[i] = entries[i].getControlFlag();
|
||||
} catch (ClassNotFoundException e) {
|
||||
throw new KernelLoginException(module+" not found", e);
|
||||
throw new KernelLoginException(module + " not found", e);
|
||||
} catch (ExceptionInInitializerError e) {
|
||||
throw new KernelLoginException(module+" initializer error", e);
|
||||
throw new KernelLoginException(module + " initializer error", e);
|
||||
} catch (LinkageError e) {
|
||||
throw new KernelLoginException(module+" linkage error", e);
|
||||
throw new KernelLoginException(module + " linkage error", e);
|
||||
} catch (IllegalAccessException e) {
|
||||
throw new KernelLoginException
|
||||
(module+" illegal access: "
|
||||
+"requires public no-argument constructor", e);
|
||||
throw new KernelLoginException(module + " illegal access: "
|
||||
+ "requires public no-argument constructor", e);
|
||||
} catch (InstantiationException e) {
|
||||
throw new KernelLoginException
|
||||
(module+" instantiation exception: "
|
||||
+"requires public no-argument constructor", e);
|
||||
throw new KernelLoginException(module + " instantiation exception: "
|
||||
+ "requires public no-argument constructor", e);
|
||||
} catch (SecurityException e) {
|
||||
throw new KernelLoginException
|
||||
(module+" security exception: check permissions", e);
|
||||
throw new KernelLoginException(module + " security exception: check permissions", e);
|
||||
} catch (ClassCastException e) {
|
||||
throw new KernelLoginException(module+" not a LoginModule", e);
|
||||
throw new KernelLoginException(module + " not a LoginModule", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -156,16 +151,15 @@ public class LoginContext {
|
|||
// login
|
||||
for (int i = 0; i < m_modules.length; i++) {
|
||||
try {
|
||||
if( s_log.isDebugEnabled() ) {
|
||||
s_log.debug( "Login on " + m_modules[i].getClass().getName() );
|
||||
}
|
||||
if (s_log.isDebugEnabled()) {
|
||||
s_log.debug("Login on " + m_modules[i].getClass().getName());
|
||||
}
|
||||
|
||||
m_modules[i].login();
|
||||
|
||||
s_log.debug( "Login succeeded" );
|
||||
s_log.debug("Login succeeded");
|
||||
|
||||
if (m_flags[i] == AppConfigurationEntry
|
||||
.LoginModuleControlFlag.SUFFICIENT) {
|
||||
if (m_flags[i] == AppConfigurationEntry.LoginModuleControlFlag.SUFFICIENT) {
|
||||
// sufficient module succeeded
|
||||
break; // end login
|
||||
}
|
||||
|
|
@ -174,16 +168,14 @@ public class LoginContext {
|
|||
first = e;
|
||||
}
|
||||
|
||||
if( s_log.isDebugEnabled() ) {
|
||||
s_log.debug( "Login failed: " + m_flags[i], e );
|
||||
}
|
||||
if (s_log.isDebugEnabled()) {
|
||||
s_log.debug("Login failed: " + m_flags[i], e);
|
||||
}
|
||||
|
||||
if (m_flags[i] == AppConfigurationEntry
|
||||
.LoginModuleControlFlag.REQUIRED) {
|
||||
if (m_flags[i] == AppConfigurationEntry.LoginModuleControlFlag.REQUIRED) {
|
||||
// required module failed
|
||||
gotFailure = true;
|
||||
} else if (m_flags[i] == AppConfigurationEntry
|
||||
.LoginModuleControlFlag.REQUISITE) {
|
||||
} else if (m_flags[i] == AppConfigurationEntry.LoginModuleControlFlag.REQUISITE) {
|
||||
// requisite module failed
|
||||
gotFailure = true;
|
||||
break; // end login
|
||||
|
|
@ -191,29 +183,29 @@ public class LoginContext {
|
|||
}
|
||||
}
|
||||
|
||||
if( s_log.isDebugEnabled() ) {
|
||||
s_log.debug( "gotFailure: " + gotFailure );
|
||||
}
|
||||
if (s_log.isDebugEnabled()) {
|
||||
s_log.debug("gotFailure: " + gotFailure);
|
||||
}
|
||||
|
||||
// commit
|
||||
if (!gotFailure) {
|
||||
// We want to report the first interesting exception. If we got here
|
||||
// then login succeeded, so that's no longer interesting.
|
||||
first = null;
|
||||
// then login succeeded, so that's no longer interesting.
|
||||
first = null;
|
||||
|
||||
s_log.debug( "Doing commit" );
|
||||
s_log.debug("Doing commit");
|
||||
|
||||
for (int i = 0; i < m_modules.length; i++) {
|
||||
try {
|
||||
if( s_log.isDebugEnabled() ) {
|
||||
s_log.debug( "Commit on " + m_modules[i].getClass().getName() );
|
||||
}
|
||||
if (s_log.isDebugEnabled()) {
|
||||
s_log.debug("Commit on " + m_modules[i].getClass().getName());
|
||||
}
|
||||
|
||||
m_modules[i].commit();
|
||||
|
||||
s_log.debug( "Commit succeeded" );
|
||||
s_log.debug("Commit succeeded");
|
||||
} catch (LoginException e) {
|
||||
s_log.debug( "Commit failed", e );
|
||||
s_log.debug("Commit failed", e);
|
||||
|
||||
gotFailure = true;
|
||||
if (first == null) {
|
||||
|
|
@ -227,20 +219,20 @@ public class LoginContext {
|
|||
// commit failed, fall through to abort
|
||||
}
|
||||
|
||||
s_log.debug( "Doing abort" );
|
||||
s_log.debug("Doing abort");
|
||||
|
||||
// abort
|
||||
for (int i = 0; i < m_modules.length; i++) {
|
||||
try {
|
||||
if( s_log.isDebugEnabled() ) {
|
||||
s_log.debug( "Abort on " + m_modules[i].getClass().getName() );
|
||||
}
|
||||
if (s_log.isDebugEnabled()) {
|
||||
s_log.debug("Abort on " + m_modules[i].getClass().getName());
|
||||
}
|
||||
|
||||
m_modules[i].abort();
|
||||
|
||||
s_log.debug( "Abort succeeded" );
|
||||
s_log.debug("Abort succeeded");
|
||||
} catch (LoginException e) {
|
||||
s_log.debug( "Abort failed", e );
|
||||
s_log.debug("Abort failed", e);
|
||||
|
||||
gotFailure = true;
|
||||
if (first == null) {
|
||||
|
|
@ -274,4 +266,5 @@ public class LoginContext {
|
|||
throw first;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -57,8 +57,7 @@ import org.apache.commons.codec.binary.Base64;
|
|||
import org.apache.log4j.Logger;
|
||||
|
||||
/**
|
||||
* Provides methods for logging in and logging out the current user and
|
||||
* accessing the user ID.
|
||||
* Provides methods for logging in and logging out the current user and accessing the user ID.
|
||||
*
|
||||
* @author Sameer Ajmani
|
||||
* @version $Id: UserContext.java 1498 2007-03-19 16:22:15Z apevec $
|
||||
|
|
@ -102,31 +101,28 @@ public class UserContext {
|
|||
}
|
||||
|
||||
/**
|
||||
* Loads the values for this <code>UserContext</code> from the given
|
||||
* Subject.
|
||||
* Loads the values for this <code>UserContext</code> from the given Subject.
|
||||
*/
|
||||
private void loadValues(Subject subject)
|
||||
throws LoginException {
|
||||
// read the user ID (m_user loaded in getUser)
|
||||
m_userID = getUserID(subject);
|
||||
s_log.debug("userID == "+m_userID);
|
||||
s_log.debug("userID == " + m_userID);
|
||||
// check whether recovering from forgotten password
|
||||
m_recovering = RecoveryLoginModule
|
||||
.isRecovering(subject);
|
||||
s_log.debug("recovering == "+m_recovering);
|
||||
s_log.debug("recovering == " + m_recovering);
|
||||
// read set of URL params provided by login modules
|
||||
m_params = subject.getPublicCredentials(ParameterData.class);
|
||||
s_log.debug("params.size == "+m_params.size());
|
||||
s_log.debug("params.size == " + m_params.size());
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a user context from an HTTP request. Attempts to log in the
|
||||
* user automatically to load the user ID. Code should access this
|
||||
* class using
|
||||
* Creates a user context from an HTTP request. Attempts to log in the user automatically to
|
||||
* load the user ID. Code should access this class using
|
||||
* <code>KernelHelper.getKernelRequestContext(req).getUserContext()</code>.
|
||||
*
|
||||
* @throws RedirectException if the user should be redirected to the
|
||||
* login page.
|
||||
* @throws RedirectException if the user should be redirected to the login page.
|
||||
*/
|
||||
public UserContext(HttpServletRequest req,
|
||||
HttpServletResponse res)
|
||||
|
|
@ -144,7 +140,7 @@ public class UserContext {
|
|||
*
|
||||
* @throws AccountNotFoundException if the target user does not exist.
|
||||
*
|
||||
* @throws LoginException if login(User) fails.
|
||||
* @throws LoginException if login(User) fails.
|
||||
*/
|
||||
public void login(String username)
|
||||
throws LoginException {
|
||||
|
|
@ -153,8 +149,7 @@ public class UserContext {
|
|||
login(UserAuthentication.retrieveForLoginName(username).getUser());
|
||||
s_log.debug("SUCCESS login(username)");
|
||||
} catch (DataObjectNotFoundException e) {
|
||||
throw new AccountNotFoundException
|
||||
("user "+username+" does not exist", e);
|
||||
throw new AccountNotFoundException("user " + username + " does not exist", e);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -165,7 +160,7 @@ public class UserContext {
|
|||
*
|
||||
* @throws AccountNotFoundException if the target user does not exist.
|
||||
*
|
||||
* @throws LoginException if login(User) fails.
|
||||
* @throws LoginException if login(User) fails.
|
||||
*/
|
||||
public void login(BigDecimal userID)
|
||||
throws LoginException {
|
||||
|
|
@ -174,8 +169,7 @@ public class UserContext {
|
|||
login(User.retrieve(userID));
|
||||
s_log.debug("SUCCESS login(userID)");
|
||||
} catch (DataObjectNotFoundException e) {
|
||||
throw new AccountNotFoundException
|
||||
("user "+userID+" does not exist", e);
|
||||
throw new AccountNotFoundException("user " + userID + " does not exist", e);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -184,10 +178,10 @@ public class UserContext {
|
|||
*
|
||||
* @param target the User to become
|
||||
*
|
||||
* @throws FailedLoginException if the current user is not logged in,
|
||||
* doesn't exist, or doesn't have admin privileges on the target user.
|
||||
* @throws FailedLoginException if the current user is not logged in, doesn't exist, or doesn't
|
||||
* have admin privileges on the target user.
|
||||
*
|
||||
* @throws LoginException if an error occurs.
|
||||
* @throws LoginException if an error occurs.
|
||||
*/
|
||||
public void login(User target)
|
||||
throws LoginException {
|
||||
|
|
@ -207,29 +201,27 @@ public class UserContext {
|
|||
// Now we check whether the target user is banned. If they are then
|
||||
// it is not possible to become this user. This situation will be
|
||||
// generally avoided by hiding the 'become user' link for banned users
|
||||
if(Kernel.getSecurityConfig().isUserBanOn() && target.isBanned()) {
|
||||
if (Kernel.getSecurityConfig().isUserBanOn() && target.isBanned()) {
|
||||
throw new LoginException("This user is currently banned");
|
||||
}
|
||||
|
||||
PermissionDescriptor superuser = new PermissionDescriptor
|
||||
(PrivilegeDescriptor.ADMIN, target, user);
|
||||
PermissionDescriptor superuser = new PermissionDescriptor(PrivilegeDescriptor.ADMIN, target,
|
||||
user);
|
||||
|
||||
if (!PermissionService.checkPermission(superuser)) {
|
||||
s_log.debug("FAILURE login(User): insufficient privileges");
|
||||
SecurityLogger.warn("user " + user.getID()
|
||||
+ " failed to log in as user "
|
||||
+ target.getID()
|
||||
+ " due to insufficient privileges");
|
||||
throw new FailedLoginException
|
||||
("insufficient privileges to become target user");
|
||||
+ " failed to log in as user "
|
||||
+ target.getID()
|
||||
+ " due to insufficient privileges");
|
||||
throw new FailedLoginException("insufficient privileges to become target user");
|
||||
}
|
||||
|
||||
// set the target user ID in the Subject and login
|
||||
Subject subject = new Subject();
|
||||
subject.getPrincipals().add(new PartyPrincipal(target.getID()));
|
||||
CallbackHandler handler = new RequestCallbackHandler();
|
||||
LoginContext context = new LoginContext
|
||||
(REQUEST_LOGIN_CONTEXT, subject, handler);
|
||||
LoginContext context = new LoginContext(REQUEST_LOGIN_CONTEXT, subject, handler);
|
||||
clearValues();
|
||||
context.login();
|
||||
loadValues(context.getSubject());
|
||||
|
|
@ -249,8 +241,7 @@ public class UserContext {
|
|||
/**
|
||||
* Determines whether the user is logged in.
|
||||
*
|
||||
* @return <code>true</code> if the user is logged in,
|
||||
* <code>false</code> otherwise.
|
||||
* @return <code>true</code> if the user is logged in, <code>false</code> otherwise.
|
||||
*/
|
||||
public boolean isLoggedIn() {
|
||||
return (m_userID != null);
|
||||
|
|
@ -259,15 +250,14 @@ public class UserContext {
|
|||
/**
|
||||
* Determines whether the user is recovering a forgotten password.
|
||||
*
|
||||
* @return <code>true</code> if the user is recovering,
|
||||
* <code>false</code> otherwise.
|
||||
* @return <code>true</code> if the user is recovering, <code>false</code> otherwise.
|
||||
*/
|
||||
public boolean isRecovering() {
|
||||
return m_recovering;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns URL parameters that authenticate this user. Package-private.
|
||||
* Returns URL parameters that authenticate this user. Package-private.
|
||||
*
|
||||
* @return an unmodifiable set of bebop ParameterData.
|
||||
*/
|
||||
|
|
@ -276,22 +266,18 @@ public class UserContext {
|
|||
}
|
||||
|
||||
/**
|
||||
* Returns the set of all possible URL params used by UserContext.
|
||||
* Package-private.
|
||||
* Returns the set of all possible URL params used by UserContext. Package-private.
|
||||
*
|
||||
* @return an unmodifiable set of bebop ParameterModels.
|
||||
*/
|
||||
static Set getModels() {
|
||||
try {
|
||||
// LoginModules add ParameterModels to Subject in initialize()
|
||||
LoginContext context =
|
||||
new LoginContext(REQUEST_LOGIN_CONTEXT);
|
||||
return Collections.unmodifiableSet
|
||||
(context.getSubject().getPublicCredentials
|
||||
(ParameterModel.class));
|
||||
LoginContext context = new LoginContext(REQUEST_LOGIN_CONTEXT);
|
||||
return Collections.unmodifiableSet(context.getSubject().getPublicCredentials(
|
||||
ParameterModel.class));
|
||||
} catch (LoginException e) {
|
||||
throw new UncheckedWrapperException
|
||||
("Could not load context", e);
|
||||
throw new UncheckedWrapperException("Could not load context", e);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -310,12 +296,10 @@ public class UserContext {
|
|||
}
|
||||
|
||||
/**
|
||||
* Returns a User object for the current user. Subsequent calls to this
|
||||
* method return references to the same User object until the
|
||||
* <code>logout</code> method is called.
|
||||
* Returns a User object for the current user. Subsequent calls to this method return references
|
||||
* to the same User object until the <code>logout</code> method is called.
|
||||
*
|
||||
* @return the User object for the logged in user or null if the
|
||||
* user is not found.
|
||||
* @return the User object for the logged in user or null if the user is not found.
|
||||
*
|
||||
* @throws IllegalStateException if the user is not logged in.
|
||||
*/
|
||||
|
|
@ -330,18 +314,17 @@ public class UserContext {
|
|||
if (m_user != null) {
|
||||
m_user.disconnect();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return m_user;
|
||||
}
|
||||
|
||||
/**
|
||||
* Logs in the user from data in the current request. Checks the
|
||||
* session ID using <code>SessionContext</code>.
|
||||
* Logs in the user from data in the current request. Checks the session ID using
|
||||
* <code>SessionContext</code>.
|
||||
*
|
||||
* @throws RedirectException if the user should be redirected to the
|
||||
* login page.
|
||||
* @throws RedirectException if the user should be redirected to the login page.
|
||||
*/
|
||||
private void login()
|
||||
throws RedirectException {
|
||||
|
|
@ -357,8 +340,8 @@ public class UserContext {
|
|||
|
||||
// Check that the user making this request is not banned. If they
|
||||
// are we logout the context and throw an exception.
|
||||
if(Kernel.getSecurityConfig().isUserBanOn()
|
||||
&& User.retrieve(m_userID).isBanned()) {
|
||||
if (Kernel.getSecurityConfig().isUserBanOn()
|
||||
&& User.retrieve(m_userID).isBanned()) {
|
||||
context.logout();
|
||||
throw new LoginException("This user is banned");
|
||||
}
|
||||
|
|
@ -378,8 +361,8 @@ public class UserContext {
|
|||
if (!success) {
|
||||
// common code for all exception cases
|
||||
if (Util.getSecurityHelper().requiresLogin(m_req)) {
|
||||
s_log.debug("This request requires logging in; " +
|
||||
"requesting redirect to login UI");
|
||||
s_log.debug("This request requires logging in; "
|
||||
+ "requesting redirect to login UI");
|
||||
redirectToLoginPage(m_req);
|
||||
} else {
|
||||
s_log.debug("This request does not require logging in");
|
||||
|
|
@ -400,6 +383,7 @@ public class UserContext {
|
|||
*/
|
||||
private class RequestCallbackHandler
|
||||
implements CallbackHandler {
|
||||
|
||||
String m_username = null;
|
||||
char[] m_password = null;
|
||||
|
||||
|
|
@ -408,20 +392,19 @@ public class UserContext {
|
|||
// HTTP Basic Authentication
|
||||
String auth = m_req.getHeader("Authorization");
|
||||
if ((auth == null)
|
||||
|| !auth.toUpperCase().startsWith("BASIC")) {
|
||||
|| !auth.toUpperCase().startsWith("BASIC")) {
|
||||
return;
|
||||
}
|
||||
String encoded = auth.substring(6).trim(); // remove "Basic "
|
||||
byte[] decoded = new Base64().decode(
|
||||
encoded.getBytes(Crypto.CHARACTER_ENCODING));
|
||||
encoded.getBytes(Crypto.CHARACTER_ENCODING));
|
||||
String userpass = new String(decoded, Crypto.CHARACTER_ENCODING);
|
||||
int colon = userpass.indexOf(':');
|
||||
if (colon < 0) {
|
||||
return;
|
||||
}
|
||||
m_username = userpass.substring(0, colon);
|
||||
m_password = userpass.substring
|
||||
(colon+1, userpass.length()).toCharArray();
|
||||
m_password = userpass.substring(colon + 1, userpass.length()).toCharArray();
|
||||
} catch (IOException e) {
|
||||
throw new UncheckedWrapperException(e);
|
||||
}
|
||||
|
|
@ -433,32 +416,30 @@ public class UserContext {
|
|||
for (int i = 0; i < callbacks.length; i++) {
|
||||
Callback cb = callbacks[i];
|
||||
if (cb instanceof HTTPRequestCallback) {
|
||||
((HTTPRequestCallback)cb).setRequest
|
||||
(UserContext.this.m_req);
|
||||
((HTTPRequestCallback) cb).setRequest(UserContext.this.m_req);
|
||||
|
||||
} else if (cb instanceof HTTPResponseCallback) {
|
||||
((HTTPResponseCallback)cb).setResponse
|
||||
(UserContext.this.m_res);
|
||||
((HTTPResponseCallback) cb).setResponse(UserContext.this.m_res);
|
||||
|
||||
} else if (cb instanceof LifetimeCallback) {
|
||||
((LifetimeCallback)cb).setForever(false);
|
||||
((LifetimeCallback) cb).setForever(false);
|
||||
|
||||
} else if (cb instanceof NameCallback) {
|
||||
((NameCallback)cb).setName(m_username);
|
||||
((NameCallback) cb).setName(m_username);
|
||||
|
||||
} else if (cb instanceof PasswordCallback) {
|
||||
((PasswordCallback)cb).setPassword(m_password);
|
||||
((PasswordCallback) cb).setPassword(m_password);
|
||||
|
||||
} else {
|
||||
UserContext.reportUnsupportedCallback(cb);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a URL to send the user to the login page and then return to
|
||||
* the current page.
|
||||
* Creates a URL to send the user to the login page and then return to the current page.
|
||||
*
|
||||
* @throws com.arsdigita.web.LoginSignal
|
||||
*/
|
||||
|
|
@ -467,25 +448,24 @@ public class UserContext {
|
|||
}
|
||||
|
||||
/**
|
||||
* Name of the request parameter that stores the URL to return to after
|
||||
* redirecting to the login page.
|
||||
* Name of the request parameter that stores the URL to return to after redirecting to the login
|
||||
* page.
|
||||
*
|
||||
* @deprecated Use com.arsdigita.ui.login.LoginHelper.RETURN_URL_PARAM_NAME
|
||||
* instead
|
||||
* @deprecated Use com.arsdigita.ui.login.LoginHelper.RETURN_URL_PARAM_NAME instead
|
||||
*/
|
||||
public final static String RETURN_URL_PARAM_NAME = "return_url";
|
||||
|
||||
/**
|
||||
* Encodes the given request into a return URL parameter. Returns
|
||||
* Encodes the given request into a return URL parameter. Returns
|
||||
* <code>URLencode(returnURL)</code> where returnURL is
|
||||
* <code>returnURI?key=URLencode(val)&...</code>. The original
|
||||
* parameter values are doubly-encoded so that they are decoded
|
||||
* appropriately.
|
||||
* <code>returnURI?key=URLencode(val)&...</code>. The original parameter values are
|
||||
* doubly-encoded so that they are decoded appropriately.
|
||||
*
|
||||
*
|
||||
* @param req the request to encode
|
||||
*
|
||||
* @return the URL-encoded parameter
|
||||
*
|
||||
* @deprecated This should be moved to a more appropriate class.
|
||||
*/
|
||||
public static String encodeReturnURL(HttpServletRequest req) {
|
||||
|
|
@ -515,33 +495,30 @@ public class UserContext {
|
|||
}
|
||||
|
||||
/**
|
||||
* Logs in the user. Checks the session ID using
|
||||
* <code>SessionContext</code>.
|
||||
* Logs in the user. Checks the session ID using <code>SessionContext</code>.
|
||||
*
|
||||
* @param username the user's username
|
||||
* @param password the user's password
|
||||
* @param forever true if the user requests permanent login
|
||||
* @param forever true if the user requests permanent login
|
||||
*
|
||||
* @throws LoginException if login fails.
|
||||
*/
|
||||
public void login(String username,
|
||||
char[] password,
|
||||
boolean forever)
|
||||
throws LoginException {
|
||||
throws LoginException {
|
||||
s_log.debug("START login(username, password, forever)");
|
||||
try {
|
||||
CallbackHandler handler = new LoginCallbackHandler
|
||||
(username, password, forever);
|
||||
LoginContext context = new LoginContext
|
||||
(REGISTER_LOGIN_CONTEXT, handler);
|
||||
CallbackHandler handler = new LoginCallbackHandler(username, password, forever);
|
||||
LoginContext context = new LoginContext(REGISTER_LOGIN_CONTEXT, handler);
|
||||
clearValues();
|
||||
context.login();
|
||||
|
||||
// We now check if the user is banned and, if so, we don't allow
|
||||
// the user to login.
|
||||
if(Kernel.getSecurityConfig().isUserBanOn()
|
||||
&& UserAuthentication.retrieveForLoginName(username).getUser()
|
||||
.isBanned()) {
|
||||
if (Kernel.getSecurityConfig().isUserBanOn()
|
||||
&& UserAuthentication.retrieveForLoginName(username).getUser()
|
||||
.isBanned()) {
|
||||
throw new LoginException("This user is currently banned");
|
||||
}
|
||||
|
||||
|
|
@ -555,9 +532,10 @@ public class UserContext {
|
|||
}
|
||||
|
||||
/**
|
||||
* Logs in the user using alternative "RegisterSSO" login context.
|
||||
* It is expected that SSO token is present in the request
|
||||
* @see SimpleSSOLoginModule
|
||||
* Logs in the user using alternative "RegisterSSO" login context. It is expected that SSO token
|
||||
* is present in the request
|
||||
*
|
||||
* @see SimpleSSOLoginModule
|
||||
* @throws LoginException
|
||||
*/
|
||||
public void loginSSO() throws LoginException {
|
||||
|
|
@ -568,7 +546,7 @@ public class UserContext {
|
|||
|
||||
CallbackHandler handler = new RequestCallbackHandler();
|
||||
LoginContext context = new LoginContext(REGISTER_SSO_LOGIN_CONTEXT,
|
||||
handler);
|
||||
handler);
|
||||
clearValues();
|
||||
context.login();
|
||||
|
||||
|
|
@ -592,24 +570,25 @@ public class UserContext {
|
|||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
*
|
||||
* @param username
|
||||
* @param password
|
||||
* @param forever
|
||||
* @param forever
|
||||
*/
|
||||
public LoginCallbackHandler(String username,
|
||||
char[] password,
|
||||
boolean forever) {
|
||||
m_username = username;
|
||||
m_password = password;
|
||||
m_forever = forever;
|
||||
m_forever = forever;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @param callbacks
|
||||
*
|
||||
* @throws IOException
|
||||
* @throws UnsupportedCallbackException
|
||||
* @throws UnsupportedCallbackException
|
||||
*/
|
||||
public void handle(Callback[] callbacks)
|
||||
throws IOException, UnsupportedCallbackException {
|
||||
|
|
@ -617,27 +596,26 @@ public class UserContext {
|
|||
for (int i = 0; i < callbacks.length; i++) {
|
||||
Callback cb = callbacks[i];
|
||||
if (cb instanceof HTTPRequestCallback) {
|
||||
((HTTPRequestCallback)cb).setRequest
|
||||
(UserContext.this.m_req);
|
||||
((HTTPRequestCallback) cb).setRequest(UserContext.this.m_req);
|
||||
|
||||
} else if (cb instanceof HTTPResponseCallback) {
|
||||
((HTTPResponseCallback)cb).setResponse
|
||||
(UserContext.this.m_res);
|
||||
((HTTPResponseCallback) cb).setResponse(UserContext.this.m_res);
|
||||
|
||||
} else if (cb instanceof LifetimeCallback) {
|
||||
((LifetimeCallback)cb).setForever(m_forever);
|
||||
((LifetimeCallback) cb).setForever(m_forever);
|
||||
|
||||
} else if (cb instanceof NameCallback) {
|
||||
((NameCallback)cb).setName(m_username);
|
||||
((NameCallback) cb).setName(m_username);
|
||||
|
||||
} else if (cb instanceof PasswordCallback) {
|
||||
((PasswordCallback)cb).setPassword(m_password);
|
||||
((PasswordCallback) cb).setPassword(m_password);
|
||||
|
||||
} else {
|
||||
UserContext.reportUnsupportedCallback(cb);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -650,23 +628,22 @@ public class UserContext {
|
|||
private BigDecimal getUserID(Subject subject) throws LoginException {
|
||||
|
||||
Iterator principals = subject.getPrincipals(PartyPrincipal.class)
|
||||
.iterator();
|
||||
.iterator();
|
||||
|
||||
if (!principals.hasNext()) {
|
||||
throw new FailedLoginException
|
||||
("no principal available after login");
|
||||
throw new FailedLoginException("no principal available after login");
|
||||
}
|
||||
|
||||
return ((PartyPrincipal) principals.next()).getID();
|
||||
}
|
||||
|
||||
/**
|
||||
* Logs out the user. Clears the cached User object. Loads a new
|
||||
* session ID using <code>SessionContext</code>.
|
||||
* Logs out the user. Clears the cached User object. Loads a new session ID using
|
||||
* <code>SessionContext</code>.
|
||||
*
|
||||
* @throws LoginException if logout fails.
|
||||
*/
|
||||
public void logout() throws LoginException {
|
||||
public void logout() throws LoginException {
|
||||
s_log.debug("START logout");
|
||||
|
||||
CallbackHandler handler = new RequestCallbackHandler();
|
||||
|
|
@ -679,15 +656,15 @@ public class UserContext {
|
|||
}
|
||||
|
||||
/**
|
||||
* Reports an unsupported callback to the debug log and throws an
|
||||
* exception. Package-private.
|
||||
* Reports an unsupported callback to the debug log and throws an exception. Package-private.
|
||||
*
|
||||
* @throws UnsupportedCallbackException with appropriate error message
|
||||
*/
|
||||
static void reportUnsupportedCallback(Callback cb)
|
||||
throws UnsupportedCallbackException {
|
||||
s_log.error ("Unsupported callback: "
|
||||
+(cb == null ? null : cb.getClass().getName()));
|
||||
throws UnsupportedCallbackException {
|
||||
s_log.error("Unsupported callback: "
|
||||
+ (cb == null ? null : cb.getClass().getName()));
|
||||
throw new UnsupportedCallbackException(cb);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -18,8 +18,6 @@
|
|||
*/
|
||||
package com.arsdigita.ui.admin;
|
||||
|
||||
|
||||
|
||||
import com.arsdigita.ui.admin.ApplicationsAdministrationTab;
|
||||
import com.arsdigita.bebop.ActionLink;
|
||||
import com.arsdigita.bebop.BoxPanel;
|
||||
|
|
@ -53,7 +51,7 @@ import com.arsdigita.bebop.table.TableModel;
|
|||
import com.arsdigita.bebop.table.TableModelBuilder;
|
||||
import com.arsdigita.domain.DataObjectNotFoundException;
|
||||
import com.arsdigita.globalization.GlobalizedMessage;
|
||||
import com.arsdigita.ui.UI ;
|
||||
import com.arsdigita.ui.UI;
|
||||
import com.arsdigita.web.URL;
|
||||
import com.arsdigita.web.Web;
|
||||
import com.arsdigita.web.RedirectSignal;
|
||||
|
|
@ -78,23 +76,21 @@ import java.util.ArrayList;
|
|||
import org.apache.log4j.Logger;
|
||||
|
||||
/**
|
||||
* This pane contains three main segmented panel which only one is visible at
|
||||
* any given time. The first panel is a table listing all available users in
|
||||
* the system. The second panel displays read only user information. And the
|
||||
* third panel is edit form.
|
||||
* This pane contains three main segmented panel which only one is visible at any given time. The
|
||||
* first panel is a table listing all available users in the system. The second panel displays read
|
||||
* only user information. And the third panel is edit form.
|
||||
*
|
||||
* @author David Dao
|
||||
* @author Ron Henderson
|
||||
* @version $Id: UserBrowsePane.java 1372 2006-11-13 09:22:54Z chrisgilbert23 $
|
||||
*/
|
||||
|
||||
class UserBrowsePane extends SegmentedPanel
|
||||
implements TableCellRenderer,
|
||||
TableActionListener,
|
||||
Resettable,
|
||||
ActionListener,
|
||||
AdminConstants,
|
||||
ChangeListener {
|
||||
implements TableCellRenderer,
|
||||
TableActionListener,
|
||||
Resettable,
|
||||
ActionListener,
|
||||
AdminConstants,
|
||||
ChangeListener {
|
||||
|
||||
private static final Logger s_log = Logger.getLogger(UserBrowsePane.class);
|
||||
|
||||
|
|
@ -141,26 +137,27 @@ class UserBrowsePane extends SegmentedPanel
|
|||
}
|
||||
|
||||
/**
|
||||
* Creates a new UserBrowsePane with multiple panels to help
|
||||
* manage various aspects of a user's account.
|
||||
* Creates a new UserBrowsePane with multiple panels to help manage various aspects of a user's
|
||||
* account.
|
||||
*/
|
||||
public UserBrowsePane () {
|
||||
public UserBrowsePane() {
|
||||
m_user = new RequestLocal() {
|
||||
protected Object initialValue(PageState ps) {
|
||||
BigDecimal id = (BigDecimal) ps.getValue(USER_ID_PARAM);
|
||||
|
||||
User user;
|
||||
protected Object initialValue(PageState ps) {
|
||||
BigDecimal id = (BigDecimal) ps.getValue(USER_ID_PARAM);
|
||||
|
||||
try {
|
||||
user = User.retrieve(id);
|
||||
} catch (DataObjectNotFoundException ex) {
|
||||
throw new UncheckedWrapperException
|
||||
("Failed to retrieve user: " + id);
|
||||
}
|
||||
User user;
|
||||
|
||||
return user;
|
||||
try {
|
||||
user = User.retrieve(id);
|
||||
} catch (DataObjectNotFoundException ex) {
|
||||
throw new UncheckedWrapperException("Failed to retrieve user: " + id);
|
||||
}
|
||||
};
|
||||
|
||||
return user;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
m_userBrowsePanel = buildUserBrowsePanel();
|
||||
m_panelList.add(m_userBrowsePanel);
|
||||
|
|
@ -197,26 +194,27 @@ class UserBrowsePane extends SegmentedPanel
|
|||
/**
|
||||
* Build the User Information panel
|
||||
*/
|
||||
private Component buildUserInfoPanel () {
|
||||
private Component buildUserInfoPanel() {
|
||||
// Edit user link
|
||||
|
||||
ActionLink link = new ActionLink
|
||||
(new Label(new GlobalizedMessage("ui.admin.user.editlink",
|
||||
BUNDLE_NAME)));
|
||||
ActionLink link = new ActionLink(new Label(new GlobalizedMessage("ui.admin.user.editlink",
|
||||
BUNDLE_NAME)));
|
||||
link.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
PageState ps = e.getPageState();
|
||||
displayEditPanel(ps);
|
||||
}
|
||||
});
|
||||
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
PageState ps = e.getPageState();
|
||||
displayEditPanel(ps);
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
link.setClassAttr("actionLink");
|
||||
|
||||
BoxPanel panel = new BoxPanel();
|
||||
|
||||
|
||||
// panel.add(new UserInfo(this));
|
||||
final ColumnPanel colPanel = new ColumnPanel(2);
|
||||
|
||||
|
||||
colPanel.add(new Label(new GlobalizedMessage("ui.admin.user.userinfo.name", BUNDLE_NAME)));
|
||||
final Label userName = new Label();
|
||||
userName.addPrintListener(new PrintListener() {
|
||||
|
|
@ -224,15 +222,17 @@ class UserBrowsePane extends SegmentedPanel
|
|||
@Override
|
||||
public void prepare(final PrintEvent event) {
|
||||
final Label target = (Label) event.getTarget();
|
||||
final PageState state = event.getPageState();
|
||||
final PageState state = event.getPageState();
|
||||
final User user = getUser(state);
|
||||
|
||||
|
||||
target.setLabel(user.getName());
|
||||
}
|
||||
|
||||
});
|
||||
colPanel.add(userName);
|
||||
|
||||
colPanel.add(new Label(new GlobalizedMessage("ui.admin.user.userinfo.screenname", BUNDLE_NAME)));
|
||||
|
||||
colPanel.add(new Label(new GlobalizedMessage("ui.admin.user.userinfo.screenname",
|
||||
BUNDLE_NAME)));
|
||||
final Label userScreenname = new Label();
|
||||
userScreenname.addPrintListener(new PrintListener() {
|
||||
|
||||
|
|
@ -241,34 +241,32 @@ class UserBrowsePane extends SegmentedPanel
|
|||
final Label target = (Label) event.getTarget();
|
||||
final PageState state = event.getPageState();
|
||||
final User user = getUser(state);
|
||||
|
||||
|
||||
target.setLabel(user.getScreenName());
|
||||
}
|
||||
|
||||
});
|
||||
colPanel.add(userScreenname);
|
||||
|
||||
colPanel.add(new Label(new GlobalizedMessage("ui.admin.user.userinfo.primaryemail", BUNDLE_NAME)));
|
||||
|
||||
colPanel.add(new Label(new GlobalizedMessage("ui.admin.user.userinfo.primaryemail",
|
||||
BUNDLE_NAME)));
|
||||
final Label userEmail = new Label();
|
||||
userEmail.addPrintListener(new PrintListener() {
|
||||
|
||||
@Override
|
||||
public void prepare(final PrintEvent event) {
|
||||
final Label target = (Label) event.getTarget();
|
||||
final PageState state = event.getPageState();
|
||||
final PageState state = event.getPageState();
|
||||
final User user = getUser(state);
|
||||
|
||||
|
||||
target.setLabel(user.getPrimaryEmail().getEmailAddress());
|
||||
}
|
||||
|
||||
});
|
||||
colPanel.add(userEmail);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
panel.add(colPanel);
|
||||
panel.add(link);
|
||||
|
||||
|
||||
|
||||
return addSegment(USER_INFO_LABEL, panel);
|
||||
}
|
||||
|
|
@ -276,9 +274,8 @@ class UserBrowsePane extends SegmentedPanel
|
|||
/**
|
||||
* Build the User Edit panel
|
||||
*/
|
||||
private Component buildUserEditPanel () {
|
||||
return addSegment
|
||||
(USER_EDIT_PANEL_HEADER, new UserEditForm(this));
|
||||
private Component buildUserEditPanel() {
|
||||
return addSegment(USER_EDIT_PANEL_HEADER, new UserEditForm(this));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -311,65 +308,69 @@ class UserBrowsePane extends SegmentedPanel
|
|||
BoxPanel p = new BoxPanel();
|
||||
|
||||
// Update password link
|
||||
|
||||
ActionLink link = new ActionLink(UPDATE_USER_PASSWORD_LABEL);
|
||||
link.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
PageState ps = e.getPageState();
|
||||
displayUserPasswordPanel(ps);
|
||||
}
|
||||
});
|
||||
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
PageState ps = e.getPageState();
|
||||
displayUserPasswordPanel(ps);
|
||||
}
|
||||
|
||||
});
|
||||
link.setClassAttr("actionLink");
|
||||
p.add(link);
|
||||
|
||||
// Become user link
|
||||
// This will not be shown when the user is banned to prevent security issues
|
||||
link = new ActionLink(BECOME_USER_LABEL){
|
||||
public boolean isVisible(PageState s) {
|
||||
if(!super.isVisible(s)) {
|
||||
return false;
|
||||
}
|
||||
User u = getUser(s);
|
||||
return (!u.isBanned());
|
||||
}
|
||||
};
|
||||
link = new ActionLink(BECOME_USER_LABEL) {
|
||||
|
||||
public boolean isVisible(PageState s) {
|
||||
if (!super.isVisible(s)) {
|
||||
return false;
|
||||
}
|
||||
User u = getUser(s);
|
||||
return (!u.isBanned());
|
||||
}
|
||||
|
||||
};
|
||||
link.setClassAttr("actionLink");
|
||||
link.addActionListener(new ActionListener() {
|
||||
public void actionPerformed (ActionEvent e) {
|
||||
PageState state = e.getPageState();
|
||||
BigDecimal id = (BigDecimal) state.getValue(USER_ID_PARAM);
|
||||
|
||||
try {
|
||||
UserContext uc = Web.getUserContext();
|
||||
uc.login(id);
|
||||
} catch (javax.security.auth.login.LoginException ex) {
|
||||
throw new UncheckedWrapperException("access denied", ex);
|
||||
}
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
PageState state = e.getPageState();
|
||||
BigDecimal id = (BigDecimal) state.getValue(USER_ID_PARAM);
|
||||
|
||||
// Redirect to workspace URL
|
||||
final String path = UI.getUserRedirectURL(state.getRequest());
|
||||
|
||||
final URL url = URL.there(state.getRequest(), path);
|
||||
|
||||
throw new RedirectSignal(url, true);
|
||||
try {
|
||||
UserContext uc = Web.getUserContext();
|
||||
uc.login(id);
|
||||
} catch (javax.security.auth.login.LoginException ex) {
|
||||
throw new UncheckedWrapperException("access denied", ex);
|
||||
}
|
||||
});
|
||||
|
||||
// Redirect to workspace URL
|
||||
final String path = UI.getUserRedirectURL(state.getRequest());
|
||||
|
||||
final URL url = URL.there(state.getRequest(), path);
|
||||
|
||||
throw new RedirectSignal(url, true);
|
||||
}
|
||||
|
||||
});
|
||||
p.add(link);
|
||||
|
||||
// Show all users
|
||||
|
||||
link = new ActionLink(new Label
|
||||
(new GlobalizedMessage("ui.admin.user.browselink",
|
||||
BUNDLE_NAME)));
|
||||
link = new ActionLink(new Label(new GlobalizedMessage("ui.admin.user.browselink",
|
||||
BUNDLE_NAME)));
|
||||
link.setClassAttr("actionLink");
|
||||
link.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
PageState ps = e.getPageState();
|
||||
displayUserBrowsePanel(ps);
|
||||
}
|
||||
});
|
||||
p.add(link);
|
||||
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
PageState ps = e.getPageState();
|
||||
displayUserBrowsePanel(ps);
|
||||
}
|
||||
|
||||
});
|
||||
p.add(link);
|
||||
|
||||
return addSegment(USER_ACTION_PANEL_HEADER, p);
|
||||
}
|
||||
|
|
@ -379,123 +380,131 @@ class UserBrowsePane extends SegmentedPanel
|
|||
*/
|
||||
private Component buildExtremeActionPanel() {
|
||||
|
||||
ActionLink deleteLink = new ActionLink(USER_DELETE_LABEL){
|
||||
public boolean isVisible(PageState s) {
|
||||
if(!super.isVisible(s)) {
|
||||
return false;
|
||||
}
|
||||
ActionLink deleteLink = new ActionLink(USER_DELETE_LABEL) {
|
||||
|
||||
public boolean isVisible(PageState s) {
|
||||
if (!super.isVisible(s)) {
|
||||
return false;
|
||||
}
|
||||
// We show the delete link if the user has never published an item
|
||||
// This implicitly checks whether the user is banned - if they
|
||||
// This implicitly checks whether the user is banned - if they
|
||||
// are deletable they cannot ever have been banned
|
||||
User u = getUser(s);
|
||||
return (!hasUserPublishedItems(u));
|
||||
}
|
||||
User u = getUser(s);
|
||||
return (!hasUserPublishedItems(u));
|
||||
}
|
||||
|
||||
};
|
||||
deleteLink.setClassAttr("actionLink");
|
||||
deleteLink.setConfirmation(USER_DELETE_CONFIRMATION.localize().toString());
|
||||
deleteLink.addActionListener(new ActionListener() {
|
||||
public void actionPerformed (ActionEvent e) {
|
||||
PageState state = e.getPageState();
|
||||
User user = getUser(state);
|
||||
|
||||
// Delete the user's authentication record
|
||||
try {
|
||||
UserAuthentication.retrieveForUser(user).delete();
|
||||
} catch (DataObjectNotFoundException ex) {
|
||||
// ignore this
|
||||
}
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
PageState state = e.getPageState();
|
||||
User user = getUser(state);
|
||||
|
||||
// Delete the user's authentication record
|
||||
try {
|
||||
UserAuthentication.retrieveForUser(user).delete();
|
||||
} catch (DataObjectNotFoundException ex) {
|
||||
// ignore this
|
||||
}
|
||||
|
||||
// Delete the user. This might throw an exception
|
||||
// because of integrity constraints, which will be
|
||||
// fixed when we can mark accounts deleted rather
|
||||
// than try to do a "hard delete". For now we'll
|
||||
// just catch the exception and display an error
|
||||
// message, but note that the account is no longer
|
||||
// available for login.
|
||||
|
||||
try {
|
||||
user.delete();
|
||||
displayUserBrowsePanel(state);
|
||||
} catch (PersistenceException ex) {
|
||||
s_log.error("Unable to delete user: " +
|
||||
ex.getMessage());
|
||||
displayUserDeleteFailedPanel(state);
|
||||
}
|
||||
// because of integrity constraints, which will be
|
||||
// fixed when we can mark accounts deleted rather
|
||||
// than try to do a "hard delete". For now we'll
|
||||
// just catch the exception and display an error
|
||||
// message, but note that the account is no longer
|
||||
// available for login.
|
||||
try {
|
||||
user.delete();
|
||||
displayUserBrowsePanel(state);
|
||||
} catch (PersistenceException ex) {
|
||||
s_log.error("Unable to delete user: " + ex.getMessage());
|
||||
displayUserDeleteFailedPanel(state);
|
||||
}
|
||||
} // End ActionPerformed method
|
||||
|
||||
} // End of new ActionListener definition
|
||||
);
|
||||
);
|
||||
|
||||
// Add link inside a BoxPanel for correct alignment with other
|
||||
// page elements.
|
||||
ActionLink banLink = new ActionLink(USER_BAN_LABEL){
|
||||
public boolean isVisible(PageState s) {
|
||||
if(!super.isVisible(s)) {
|
||||
return false;
|
||||
}
|
||||
ActionLink banLink = new ActionLink(USER_BAN_LABEL) {
|
||||
|
||||
public boolean isVisible(PageState s) {
|
||||
if (!super.isVisible(s)) {
|
||||
return false;
|
||||
}
|
||||
// We show the ban link if the user is not already banned and has never published
|
||||
// an item
|
||||
User u = getUser(s);
|
||||
return ((!u.isBanned()) && (hasUserPublishedItems(u)));
|
||||
}
|
||||
};
|
||||
banLink.setClassAttr("actionLink");
|
||||
banLink.setConfirmation(USER_BAN_CONFIRMATION.localize().toString());
|
||||
banLink.addActionListener(new ActionListener() {
|
||||
public void actionPerformed (ActionEvent e) {
|
||||
PageState state = e.getPageState();
|
||||
User user = getUser(state);
|
||||
user.setBanned(true);
|
||||
user.save();
|
||||
} // End ActionPerformed method
|
||||
} // End of new ActionListener definition
|
||||
);
|
||||
// an item
|
||||
User u = getUser(s);
|
||||
return ((!u.isBanned()) && (hasUserPublishedItems(u)));
|
||||
}
|
||||
|
||||
};
|
||||
banLink.setClassAttr("actionLink");
|
||||
banLink.setConfirmation(USER_BAN_CONFIRMATION.localize().toString());
|
||||
banLink.addActionListener(new ActionListener() {
|
||||
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
PageState state = e.getPageState();
|
||||
User user = getUser(state);
|
||||
user.setBanned(true);
|
||||
user.save();
|
||||
} // End ActionPerformed method
|
||||
|
||||
ActionLink unbanLink = new ActionLink(USER_UNBAN_LABEL){
|
||||
public boolean isVisible(PageState s) {
|
||||
if(!super.isVisible(s)) {
|
||||
return false;
|
||||
}
|
||||
PageState state = s.getPageState();
|
||||
User user = getUser(state);
|
||||
return user.isBanned();
|
||||
}
|
||||
};
|
||||
unbanLink.setClassAttr("actionLink");
|
||||
unbanLink.setConfirmation(USER_UNBAN_CONFIRMATION.localize().toString());
|
||||
unbanLink.addActionListener(new ActionListener() {
|
||||
public void actionPerformed (ActionEvent e) {
|
||||
PageState state = e.getPageState();
|
||||
User user = getUser(state);
|
||||
user.setBanned(false);
|
||||
user.save();
|
||||
} // End ActionPerformed method
|
||||
} // End of new ActionListener definition
|
||||
);
|
||||
);
|
||||
|
||||
ActionLink unbanLink = new ActionLink(USER_UNBAN_LABEL) {
|
||||
|
||||
public boolean isVisible(PageState s) {
|
||||
if (!super.isVisible(s)) {
|
||||
return false;
|
||||
}
|
||||
PageState state = s.getPageState();
|
||||
User user = getUser(state);
|
||||
return user.isBanned();
|
||||
}
|
||||
|
||||
};
|
||||
unbanLink.setClassAttr("actionLink");
|
||||
unbanLink.setConfirmation(USER_UNBAN_CONFIRMATION.localize().toString());
|
||||
unbanLink.addActionListener(new ActionListener() {
|
||||
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
PageState state = e.getPageState();
|
||||
User user = getUser(state);
|
||||
user.setBanned(false);
|
||||
user.save();
|
||||
} // End ActionPerformed method
|
||||
|
||||
} // End of new ActionListener definition
|
||||
);
|
||||
|
||||
// Add link inside a BoxPanel for correct alignment with other
|
||||
// page elements.
|
||||
|
||||
|
||||
BoxPanel p = new BoxPanel();
|
||||
p.add(deleteLink);
|
||||
p.add(banLink);
|
||||
p.add(unbanLink);
|
||||
p.add(banLink);
|
||||
p.add(unbanLink);
|
||||
return addSegment(USER_TAB_EXTREME_ACTION_LABEL, p);
|
||||
}
|
||||
|
||||
/**
|
||||
* Build a panel to display an error message when unable to delete
|
||||
* a user.
|
||||
* Build a panel to display an error message when unable to delete a user.
|
||||
*/
|
||||
private Component buildUserDeleteFailedPanel() {
|
||||
ActionLink link = new ActionLink(USER_ACTION_CONTINUE);
|
||||
link.addActionListener(new ActionListener() {
|
||||
public void actionPerformed (ActionEvent e) {
|
||||
PageState state = e.getPageState();
|
||||
displayUserInfoPanel(state);
|
||||
}
|
||||
});
|
||||
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
PageState state = e.getPageState();
|
||||
displayUserInfoPanel(state);
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
Label label = new Label(USER_DELETE_FAILED_MSG);
|
||||
label.setClassAttr("deleteFailedMessage");
|
||||
|
|
@ -508,11 +517,10 @@ class UserBrowsePane extends SegmentedPanel
|
|||
}
|
||||
|
||||
/**
|
||||
* Build the Browse User panel. Displays a list of all registered
|
||||
* users.
|
||||
* Build the Browse User panel. Displays a list of all registered users.
|
||||
*/
|
||||
private Component buildUserBrowsePanel() {
|
||||
String headers[] = new String[] {
|
||||
String headers[] = new String[]{
|
||||
"ID", "Name", "Screen Name", "Email", "SSO login"
|
||||
};
|
||||
|
||||
|
|
@ -525,15 +533,16 @@ class UserBrowsePane extends SegmentedPanel
|
|||
}
|
||||
|
||||
private class GroupsModelBuilder extends LockableImpl
|
||||
implements ListModelBuilder, AdminConstants {
|
||||
implements ListModelBuilder, AdminConstants {
|
||||
|
||||
public ListModel makeModel(List list, PageState state) {
|
||||
User user = getUser(state);
|
||||
GroupCollection groups = user.getGroups();
|
||||
GroupCollection groups = user.getGroups();
|
||||
groups.addOrder("lower(name)");
|
||||
return new PartyListModel(groups);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void displayUserInfoPanel(PageState ps) {
|
||||
hideAll(ps);
|
||||
|
|
@ -564,13 +573,12 @@ class UserBrowsePane extends SegmentedPanel
|
|||
}
|
||||
|
||||
/**
|
||||
* Hides all components of the UserBrowsePane in preparation for
|
||||
* turning selected components back on.
|
||||
* Hides all components of the UserBrowsePane in preparation for turning selected components
|
||||
* back on.
|
||||
*/
|
||||
private void hideAll(PageState ps) {
|
||||
for (int i = 0; i < m_panelList.size(); i++) {
|
||||
((Component) m_panelList.get(i)).setVisible
|
||||
(ps, false);
|
||||
((Component) m_panelList.get(i)).setVisible(ps, false);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -605,76 +613,76 @@ class UserBrowsePane extends SegmentedPanel
|
|||
displayUserBrowsePanel(ps);
|
||||
}
|
||||
|
||||
|
||||
public void setTabbedPane (TabbedPane tabbedPane) {
|
||||
public void setTabbedPane(TabbedPane tabbedPane) {
|
||||
m_tabbedPane = tabbedPane;
|
||||
}
|
||||
|
||||
public void setGroupAdministrationTab(GroupAdministrationTab
|
||||
groupAdministrationTab) {
|
||||
public void setGroupAdministrationTab(GroupAdministrationTab groupAdministrationTab) {
|
||||
m_groupAdministrationTab = groupAdministrationTab;
|
||||
}
|
||||
|
||||
public void setSitemapAdministrationTab(ApplicationsAdministrationTab
|
||||
sitemapAdministrationTab) {
|
||||
public void setSitemapAdministrationTab(ApplicationsAdministrationTab sitemapAdministrationTab) {
|
||||
m_sitemapAdministrationTab = sitemapAdministrationTab;
|
||||
}
|
||||
|
||||
// This is how we check if a user is banned or not
|
||||
private boolean hasUserPublishedItems(User user) {
|
||||
DataQuery query = user.getSession().retrieveQuery("com.arsdigita.versioning.UserPublications");
|
||||
query.setParameter("value", new Integer(user.getID().intValue()) );
|
||||
query.next();
|
||||
Integer count = (Integer) query.get("theCount");
|
||||
query.close();
|
||||
return count.intValue()!=0;
|
||||
}
|
||||
// This is how we check if a user is banned or not
|
||||
private boolean hasUserPublishedItems(User user) {
|
||||
DataQuery query = user.getSession().retrieveQuery(
|
||||
"com.arsdigita.versioning.UserPublications");
|
||||
query.setParameter("value", new Integer(user.getID().intValue()));
|
||||
query.next();
|
||||
Integer count = (Integer) query.get("theCount");
|
||||
query.close();
|
||||
return count.intValue() != 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Display group information panel when a group name is clicked.
|
||||
*/
|
||||
public void stateChanged (ChangeEvent e) {
|
||||
if ( e.getSource() == m_groupList ) {
|
||||
if ( m_tabbedPane != null &&
|
||||
m_groupAdministrationTab != null ) {
|
||||
public void stateChanged(ChangeEvent e) {
|
||||
if (e.getSource() == m_groupList) {
|
||||
if (m_tabbedPane != null && m_groupAdministrationTab != null) {
|
||||
PageState ps = e.getPageState();
|
||||
String id = (String) m_groupList.getSelectedKey(ps);
|
||||
if (id != null) {
|
||||
Group group = null;
|
||||
try {
|
||||
group = new Group(new BigDecimal(id));
|
||||
} catch(DataObjectNotFoundException exc) {
|
||||
} catch (DataObjectNotFoundException exc) {
|
||||
// Silently ignore if group does not exist.
|
||||
}
|
||||
m_groupAdministrationTab.setGroup (ps, group);
|
||||
m_groupAdministrationTab.setGroup(ps, group);
|
||||
m_groupAdministrationTab.displayGroupInfoPanel(ps);
|
||||
m_tabbedPane.setSelectedIndex (ps, GROUP_TAB_INDEX);
|
||||
m_tabbedPane.setSelectedIndex(ps, GROUP_TAB_INDEX);
|
||||
} else {
|
||||
reset(ps);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
class UserTableModelBuilder extends LockableImpl implements TableModelBuilder {
|
||||
|
||||
public TableModel makeModel(Table t, PageState s) {
|
||||
return new UserTableModel();
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
class UserTableModel implements TableModel {
|
||||
|
||||
|
||||
class UserTableModel implements TableModel{
|
||||
private DataQuery m_coll;
|
||||
|
||||
public UserTableModel() {
|
||||
m_coll = SessionManager.getSession().retrieveQuery("com.arsdigita.ui.admin.RetrieveAllUsersInfo");
|
||||
m_coll = SessionManager.getSession().retrieveQuery(
|
||||
"com.arsdigita.ui.admin.RetrieveAllUsersInfo");
|
||||
// some kind of order added - ideally ordering should be by
|
||||
// last name then first name, but query returns both as a single
|
||||
// item chris.gilbert@westsussex.gov.uk
|
||||
m_coll.addOrder("lower(userDisplayName)");
|
||||
// last name then first name, but query returns both as a single
|
||||
// item chris.gilbert@westsussex.gov.uk
|
||||
m_coll.addOrder("lower(userDisplayName)");
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -51,7 +51,7 @@ public class AtoZObjectList extends AbstractObjectList {
|
|||
private String m_titleProperty = ACSObject.DISPLAY_NAME;
|
||||
|
||||
public void setTitleProperty(String property) {
|
||||
Assert.isLocked(this);
|
||||
//Assert.isLocked(this);
|
||||
m_titleProperty = property;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,4 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<foundry:configuration xmlns:foundry="http://foundry.libreccm.org">
|
||||
<setting id="separator"> -> </setting>
|
||||
</foundry:configuration>
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<foundry:configuration xmlns:foundry="http://foundry.libreccm.org">
|
||||
<setting id="hint-symbol">ⓘ</setting>
|
||||
</foundry:configuration>
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<foundry:configuration xmlns:foundry="http://foundry.libreccm.org">
|
||||
<setting id="content-view-menu/layout">horizontal</setting>
|
||||
<setting id="category-step-summary/show-delete-link">false</setting>
|
||||
|
||||
|
||||
</foundry:configuration>
|
||||
|
|
@ -0,0 +1,15 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<css-files>
|
||||
<application name="admin">
|
||||
<css-file origin="internal">admin.css</css-file>
|
||||
</application>
|
||||
<application name="cms-admin">
|
||||
<css-file origin="internal">admin.css</css-file>
|
||||
</application>
|
||||
<application name="navigation">
|
||||
<css-file>public.css</css-file>
|
||||
</application>
|
||||
<default>
|
||||
<css-file>public.css</css-file>
|
||||
</default>
|
||||
</css-files>
|
||||
|
|
@ -0,0 +1,18 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<foundry:configuration xmlns:foundry="http://foundry.libreccm.org">
|
||||
|
||||
<supported-languages default="de">
|
||||
<language locale="de"/>
|
||||
<language locale="en"/>
|
||||
</supported-languages>
|
||||
|
||||
<setting id="theme-mode">master</setting>
|
||||
<!--
|
||||
Uncomment the following line if you want to use another theme than the Foundry base theme
|
||||
as parent theme.
|
||||
-->
|
||||
<!--<setting id="parent-theme">foundry</setting>-->
|
||||
|
||||
<setting id="site-logo">foundry/images/scientificcms_logo.png</setting>
|
||||
|
||||
</foundry:configuration>
|
||||
|
|
@ -0,0 +1,48 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<templates>
|
||||
<applications>
|
||||
<!--
|
||||
<application name = "" page-class=""></application>
|
||||
-->
|
||||
<application name="admin" internal="true">admin-layout.xml</application>
|
||||
<application name="login" internal="true">admin-layout.xml</application>
|
||||
<application name="navigation" class="portalPage">portal-workspace.xml</application>
|
||||
<application name="navigation" class="portalGridPage">portal-workspace-grid.xml</application>
|
||||
<application name="none" class="cms-admin" internal="true">admin-layout.xml</application>
|
||||
<application name="portal">portal-workspace.xml</application>
|
||||
<default>default-layout.xml</default>
|
||||
</applications>
|
||||
|
||||
<content-items>
|
||||
<detail>
|
||||
<content-item content-type="com.arsdigita.cms.contenttypes.Article">
|
||||
content-items/article-detail.xml
|
||||
</content-item>
|
||||
<content-item content-type="com.arsdigita.cms.contenttypes.Bookmark">
|
||||
content-items/bookmark-detail.xml
|
||||
</content-item>
|
||||
<content-item content-type="com.arsdigita.cms.contenttypes.Event">
|
||||
content-items/event-detail.xml
|
||||
</content-item>
|
||||
<content-item content-type="com.arsdigita.cms.contenttypes.MultiPartArticle">
|
||||
content-items/mpa-detail.xml
|
||||
</content-item>
|
||||
<content-item content-type="com.arsdigita.cms.contenttypes.NewsItem">
|
||||
content-items/news-detail.xml
|
||||
</content-item>
|
||||
<default>content-items/detail-default.xml</default>
|
||||
</detail>
|
||||
<link>
|
||||
<default>content-items/link-default.xml</default>
|
||||
</link>
|
||||
<list>
|
||||
<content-item content-type="com.arsdigita.cms.contenttypes.Article">
|
||||
content-items/article-list.xml
|
||||
</content-item>
|
||||
<content-item content-type="com.arsdigita.cms.contenttypes.MultiPartArticle">
|
||||
content-items/mpa-list.xml
|
||||
</content-item>
|
||||
<default>content-items/list-default.xml</default>
|
||||
</list>
|
||||
</content-items>
|
||||
</templates>
|
||||
|
|
@ -0,0 +1 @@
|
|||
This directory contains fonts used by the theme
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
Decorating images for the theme. All other images should be managed using
|
||||
the CMS
|
||||
|
|
@ -0,0 +1 @@
|
|||
This directory contains the CSS files for the theme.
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
/*
|
||||
|
||||
Public CSS file
|
||||
|
||||
*/
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<content-item-layout>
|
||||
|
||||
<h2>
|
||||
<content-item-title/>
|
||||
</h2>
|
||||
|
||||
<div class="lead">
|
||||
<lead-text/>
|
||||
</div>
|
||||
|
||||
<div class="main">
|
||||
<main-text/>
|
||||
</div>
|
||||
|
||||
</content-item-layout>
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<content-item-layout>
|
||||
<h2>
|
||||
<content-item-title/>
|
||||
</h2>
|
||||
<div class="lead">
|
||||
<lead-text/>
|
||||
</div>
|
||||
</content-item-layout>
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<content-item-layout>
|
||||
<h2>
|
||||
<bookmark-link>
|
||||
<a>
|
||||
<content-item-title/>
|
||||
</a>
|
||||
</bookmark-link>
|
||||
</h2>
|
||||
<div>
|
||||
<bookmark-description/>
|
||||
</div>
|
||||
</content-item-layout>
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<content-item-layout>
|
||||
<h2>
|
||||
<content-item-title/>
|
||||
</h2>
|
||||
<div>
|
||||
<show-property name="pageDescription"/>
|
||||
</div>
|
||||
</content-item-layout>
|
||||
|
|
@ -0,0 +1,72 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<content-item-layout>
|
||||
|
||||
<h2>
|
||||
<content-item-title/>
|
||||
</h2>
|
||||
|
||||
<div class="lead">
|
||||
<lead-text/>
|
||||
</div>
|
||||
|
||||
<dl>
|
||||
<dt>
|
||||
<show-text module="event">start-date</show-text>
|
||||
</dt>
|
||||
<dd>
|
||||
<start-date>
|
||||
<date-format default="true">
|
||||
<iso-date/>
|
||||
</date-format>
|
||||
</start-date>
|
||||
T
|
||||
<start-time>
|
||||
<style lang="en" style="12h"/>
|
||||
<style default="true" style="24h"/>
|
||||
</start-time>
|
||||
</dd>
|
||||
|
||||
<dt>
|
||||
<show-text module="event">end-date</show-text>
|
||||
</dt>
|
||||
<dd>
|
||||
<end-date>
|
||||
<date-format default="true">
|
||||
<iso-date/>
|
||||
</date-format>
|
||||
</end-date>
|
||||
T
|
||||
<end-time>
|
||||
<style lang="en" style="12h"/>
|
||||
<style default="true" style="24h"/>
|
||||
</end-time>
|
||||
</dd>
|
||||
|
||||
<dt>
|
||||
<show-text module="event">location</show-text>
|
||||
</dt>
|
||||
<dd>
|
||||
<location/>
|
||||
</dd>
|
||||
|
||||
<dt>
|
||||
<show-text module="event">event-type</show-text>
|
||||
</dt>
|
||||
<dd>
|
||||
<event-type/>
|
||||
</dd>
|
||||
|
||||
<dt>
|
||||
<show-text module="event">main-contributor</show-text>
|
||||
</dt>
|
||||
<dd>
|
||||
<main-contributor/>
|
||||
</dd>
|
||||
|
||||
</dl>
|
||||
|
||||
<div class="main">
|
||||
<main-text/>
|
||||
</div>
|
||||
|
||||
</content-item-layout>
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<content-item-layout>
|
||||
<a>
|
||||
<content-item-title/>
|
||||
</a>
|
||||
</content-item-layout>
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<content-item-layout>
|
||||
<h2>
|
||||
<content-item-title/>
|
||||
</h2>
|
||||
</content-item-layout>
|
||||
|
|
@ -0,0 +1,53 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<content-item-layout>
|
||||
|
||||
<h2>
|
||||
<content-item-title/>
|
||||
</h2>
|
||||
|
||||
<div class="lead">
|
||||
<mpa-summary/>
|
||||
</div>
|
||||
|
||||
<mpa-sections>
|
||||
<ul>
|
||||
<mpa-section>
|
||||
<li>
|
||||
<a>
|
||||
<mpa-section-title/>
|
||||
</a>
|
||||
</li>
|
||||
</mpa-section>
|
||||
</ul>
|
||||
</mpa-sections>
|
||||
|
||||
<mpa-current-sections>
|
||||
<mpa-current-section>
|
||||
<h3>
|
||||
<mpa-current-section-title/>
|
||||
</h3>
|
||||
<div class="main">
|
||||
<mpa-current-section-content/>
|
||||
</div>
|
||||
</mpa-current-section>
|
||||
</mpa-current-sections>
|
||||
|
||||
<div class="mpa-paginator">
|
||||
<mpa-prev-page-link>
|
||||
<a>
|
||||
<show-text module="mpa">mpa/prev-page-link</show-text>
|
||||
</a>
|
||||
</mpa-prev-page-link>
|
||||
<mpa-all-sections-link>
|
||||
<a>
|
||||
<show-text module="mpa">mpa/all-sections</show-text>
|
||||
</a>
|
||||
</mpa-all-sections-link>
|
||||
<mpa-next-page-link>
|
||||
<a>
|
||||
<show-text module="mpa">mpa/next-page-link</show-text>
|
||||
</a>
|
||||
</mpa-next-page-link>
|
||||
</div>
|
||||
|
||||
</content-item-layout>
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<content-item-layout>
|
||||
<h2>
|
||||
<content-item-title/>
|
||||
</h2>
|
||||
<div class="lead">
|
||||
<mpa-summary/>
|
||||
</div>
|
||||
</content-item-layout>
|
||||
|
|
@ -0,0 +1,27 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<content-item-layout>
|
||||
|
||||
<h2>
|
||||
<content-item-title/>
|
||||
</h2>
|
||||
|
||||
<div class="lead">
|
||||
<lead-text/>
|
||||
</div>
|
||||
|
||||
<div class="news-date">
|
||||
<news-date>
|
||||
<date-format default="true">
|
||||
<iso-date/>
|
||||
</date-format>
|
||||
<date-format lang="de">
|
||||
<day zero="true"/>.<month zero="true"/>.<year/>
|
||||
</date-format>
|
||||
</news-date>
|
||||
</div>
|
||||
|
||||
<div class="main">
|
||||
<main-text/>
|
||||
</div>
|
||||
|
||||
</content-item-layout>
|
||||
|
|
@ -0,0 +1,119 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<page-layout>
|
||||
<head>
|
||||
<title>
|
||||
<separator>: </separator>
|
||||
<show-text>layout/page/head/title</show-text>
|
||||
<show-page-title/>
|
||||
</title>
|
||||
<load-css-files/>
|
||||
</head>
|
||||
<body>
|
||||
<nav>
|
||||
<navigation-home-link>
|
||||
<a>
|
||||
<navigation-title/>
|
||||
</a>
|
||||
</navigation-home-link>
|
||||
<h1>
|
||||
<show-text>layout/page/head/title</show-text>: <show-page-title/>
|
||||
</h1>
|
||||
<navigation>
|
||||
<div class="nav-wrapper">
|
||||
<navigation-links>
|
||||
<ul>
|
||||
<navigation-link>
|
||||
<li>
|
||||
<a>
|
||||
<navigation-link-label/>
|
||||
</a>
|
||||
<navigation-sublinks/>
|
||||
</li>
|
||||
</navigation-link>
|
||||
</ul>
|
||||
</navigation-links>
|
||||
</div>
|
||||
</navigation>
|
||||
<breadcrumbs>
|
||||
<div id="breadcrumbs">
|
||||
<breadcrumb-link>
|
||||
<a>
|
||||
<breadcrumb-label mode="mark"/>
|
||||
</a>
|
||||
</breadcrumb-link>
|
||||
</div>
|
||||
<breadcrumb-separator>
|
||||
<span class="breadcrumb-separator">/</span>
|
||||
</breadcrumb-separator>
|
||||
</breadcrumbs>
|
||||
</nav>
|
||||
<main>
|
||||
<div>
|
||||
<content-item/>
|
||||
</div>
|
||||
<div>
|
||||
<image-attachments>
|
||||
<image-attachment from="2" to="3">
|
||||
<img width="320" height="240"/>
|
||||
</image-attachment>
|
||||
</image-attachments>
|
||||
</div>
|
||||
<div id="item-list-wrapper">
|
||||
<object-list id="itemList">
|
||||
<ul>
|
||||
<object-list-item>
|
||||
<li>
|
||||
<content-item mode="list"/>
|
||||
</li>
|
||||
</object-list-item>
|
||||
</ul>
|
||||
</object-list>
|
||||
</div>
|
||||
<div id="news-list-wrapper">
|
||||
<object-list id="newsList">
|
||||
<ul>
|
||||
<object-list-item>
|
||||
<li>
|
||||
<pre>news-item</pre>
|
||||
</li>
|
||||
</object-list-item>
|
||||
</ul>
|
||||
</object-list>
|
||||
</div>
|
||||
</main>
|
||||
<aside>
|
||||
<related-links>
|
||||
<ul>
|
||||
<related-link>
|
||||
<internal>
|
||||
<li>
|
||||
<content-item mode="link"/>
|
||||
</li>
|
||||
</internal>
|
||||
<external>
|
||||
<li>
|
||||
<a>
|
||||
<related-link-title/>
|
||||
</a>
|
||||
</li>
|
||||
</external>
|
||||
</related-link>
|
||||
</ul>
|
||||
</related-links>
|
||||
<notes>
|
||||
<div id="notes">
|
||||
<note>
|
||||
<div class="note">
|
||||
<note-content/>
|
||||
</div>
|
||||
</note>
|
||||
</div>
|
||||
</notes>
|
||||
</aside>
|
||||
<footer>
|
||||
<include file="fragments/footer.xml"/>
|
||||
|
||||
<include file="fragments/libreccm.xml" internal="yes"/>
|
||||
</footer>
|
||||
</body>
|
||||
</page-layout>
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<fragment-layout>
|
||||
<div>
|
||||
<strong>included from <code>fragments/footer.xml</code></strong>
|
||||
</div>
|
||||
</fragment-layout>
|
||||
|
|
@ -0,0 +1,64 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<page-layout>
|
||||
<head>
|
||||
<title>
|
||||
<separator>: </separator>
|
||||
<show-text>layout/page/head/title</show-text>
|
||||
<show-page-title/>
|
||||
</title>
|
||||
<load-css-files/>
|
||||
</head>
|
||||
<body>
|
||||
<nav>
|
||||
<navigation-home-link>
|
||||
<a>
|
||||
<navigation-title/>
|
||||
</a>
|
||||
</navigation-home-link>
|
||||
<h1>
|
||||
<show-text>layout/page/head/title</show-text>: <show-page-title/>
|
||||
</h1>
|
||||
<navigation>
|
||||
<div class="nav-wrapper">
|
||||
<navigation-links>
|
||||
<ul>
|
||||
<navigation-link>
|
||||
<li>
|
||||
<a>
|
||||
<navigation-link-label/>
|
||||
</a>
|
||||
<navigation-sublinks/>
|
||||
</li>
|
||||
</navigation-link>
|
||||
</ul>
|
||||
</navigation-links>
|
||||
</div>
|
||||
</navigation>
|
||||
<breadcrumbs>
|
||||
<div id="breadcrumbs">
|
||||
<breadcrumb-link>
|
||||
<a>
|
||||
<breadcrumb-label mode="mark"/>
|
||||
</a>
|
||||
</breadcrumb-link>
|
||||
</div>
|
||||
<breadcrumb-separator>
|
||||
<span class="breadcrumb-separator">/</span>
|
||||
</breadcrumb-separator>
|
||||
</breadcrumbs>
|
||||
</nav>
|
||||
<main>
|
||||
<portal-grid-workspace use-default-styles="true">
|
||||
<portal-grid-workspace-rows>
|
||||
<portal-grid-workspace-row>
|
||||
<portal-grid-workspace-columns>
|
||||
<portal-grid-workspace-column>
|
||||
<portal-grid-workspace-column-portlets/>
|
||||
</portal-grid-workspace-column>
|
||||
</portal-grid-workspace-columns>
|
||||
</portal-grid-workspace-row>
|
||||
</portal-grid-workspace-rows>
|
||||
</portal-grid-workspace>
|
||||
</main>
|
||||
</body>
|
||||
</page-layout>
|
||||
|
|
@ -0,0 +1,90 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<page-layout>
|
||||
<head>
|
||||
<title>
|
||||
<separator>: </separator>
|
||||
<show-text>layout/page/head/title</show-text>
|
||||
<show-page-title/>
|
||||
</title>
|
||||
<load-css-files/>
|
||||
</head>
|
||||
<body>
|
||||
<nav>
|
||||
<navigation-home-link>
|
||||
<a>
|
||||
<navigation-title/>
|
||||
</a>
|
||||
</navigation-home-link>
|
||||
<h1>
|
||||
<show-text>layout/page/head/title</show-text>: <show-page-title/>
|
||||
</h1>
|
||||
<navigation>
|
||||
<div class="nav-wrapper">
|
||||
<navigation-links>
|
||||
<ul>
|
||||
<navigation-link>
|
||||
<li>
|
||||
<a>
|
||||
<navigation-link-label/>
|
||||
</a>
|
||||
<navigation-sublinks/>
|
||||
</li>
|
||||
</navigation-link>
|
||||
</ul>
|
||||
</navigation-links>
|
||||
</div>
|
||||
</navigation>
|
||||
<breadcrumbs>
|
||||
<div id="breadcrumbs">
|
||||
<breadcrumb-link>
|
||||
<a>
|
||||
<breadcrumb-label mode="mark"/>
|
||||
</a>
|
||||
</breadcrumb-link>
|
||||
</div>
|
||||
<breadcrumb-separator>
|
||||
<span class="breadcrumb-separator">/</span>
|
||||
</breadcrumb-separator>
|
||||
</breadcrumbs>
|
||||
</nav>
|
||||
<main>
|
||||
<portal-workspace>
|
||||
<portal-admin/>
|
||||
<portal-list>
|
||||
<div>
|
||||
<portal-page-link selected="false">
|
||||
<not-selected>
|
||||
<a>
|
||||
<portal-page-title/>
|
||||
</a>
|
||||
</not-selected>
|
||||
<selected>
|
||||
<span>
|
||||
<portal-page-title/>
|
||||
</span>
|
||||
</selected>
|
||||
</portal-page-link>
|
||||
</div>
|
||||
<div>
|
||||
<portal-add-page-link/>
|
||||
<portal-edit-basic-properties-link/>
|
||||
</div>
|
||||
<div>
|
||||
<portal-edit-form/>
|
||||
<portal-layout-form/>
|
||||
</div>
|
||||
</portal-list>
|
||||
<divIfNotEmpty id="portal-workspace-edit-links" class="workspace-details">
|
||||
<portal-workspace-edit-links/>
|
||||
</divIfNotEmpty>
|
||||
<portal-workspace-columns use-default-styles="true">
|
||||
<portal-workspace-column>
|
||||
<div>
|
||||
<portal-workspace-portlets/>
|
||||
</div>
|
||||
</portal-workspace-column>
|
||||
</portal-workspace-columns>
|
||||
</portal-workspace>
|
||||
</main>
|
||||
</body>
|
||||
</page-layout>
|
||||
|
|
@ -0,0 +1 @@
|
|||
This directory contains static texts in the theme
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<foundry:static-texts xmlns:foundry="http://foundry.libreccm.org">
|
||||
<text id="root">
|
||||
<translation lang="de">Start</translation>
|
||||
<translation lang="en">Start</translation>
|
||||
</text>
|
||||
</foundry:static-texts>
|
||||
|
|
@ -0,0 +1,30 @@
|
|||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<foundry:static-texts xmlns:foundry="http://foundry.libreccm.org">
|
||||
<text id="start-date">
|
||||
<translation lang="de">Beginn</translation>
|
||||
<translation lang="en">Begin</translation>
|
||||
</text>
|
||||
|
||||
<text id="end-date">
|
||||
<translation lang="de">Ende</translation>
|
||||
<translation lang="en">End</translation>
|
||||
</text>
|
||||
|
||||
<text id="location">
|
||||
<translation lang="de">Veranstaltungsort</translation>
|
||||
<translation lang="en">Location</translation>
|
||||
</text>
|
||||
|
||||
<text id="main-contributor">
|
||||
<translation lang="de">Veranstalter</translation>
|
||||
<translation lang="en">Hosted by</translation>
|
||||
</text>
|
||||
|
||||
<text id="event-type">
|
||||
<translation lang="de">Art der Veranstaltung</translation>
|
||||
<translation lang="en">Type of event</translation>
|
||||
</text>
|
||||
|
||||
|
||||
|
||||
</foundry:static-texts>
|
||||
|
|
@ -0,0 +1,23 @@
|
|||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<foundry:static-texts xmlns:foundry="http://foundry.libreccm.org">
|
||||
<text id="layout/page/head/title">
|
||||
<translation lang="de">Foundry</translation>
|
||||
<translation lang="en">Foundry</translation>
|
||||
</text>
|
||||
|
||||
<text id="layout/page/skipnav/link">
|
||||
<translation lang="de">Navigation überspringen</translation>
|
||||
<translation lang="en">Skip navigation</translation>
|
||||
</text>
|
||||
|
||||
<text id="time/am">
|
||||
<translation lang="de">a.m.</translation>
|
||||
<translation lang="en">a.m.</translation>
|
||||
</text>
|
||||
|
||||
<text id="time/pm">
|
||||
<translation lang="de">p.m.</translation>
|
||||
<translation lang="en">p.m.</translation>
|
||||
</text>
|
||||
|
||||
</foundry:static-texts>
|
||||
|
|
@ -0,0 +1,15 @@
|
|||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<foundry:static-texts xmlns:foundry="http://foundry.libreccm.org">
|
||||
<text id="mpa/next-page-link">
|
||||
<translation lang="de">Nächste Seite</translation>
|
||||
<translation lang="en">Next page</translation>
|
||||
</text>
|
||||
<text id="mpa/prev-page-link">
|
||||
<translation lang="de">Vorherige Seite</translation>
|
||||
<translation lang="en">Previous page</translation>
|
||||
</text>
|
||||
<text id="mpa/all-sections">
|
||||
<translation lang="de">Artikel auf einer Seite</translation>
|
||||
<translation lang="en">Article on one page</translation>
|
||||
</text>
|
||||
</foundry:static-texts>
|
||||
|
|
@ -0,0 +1,33 @@
|
|||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<foundry:static-texts xmlns:foundry="http://foundry.libreccm.org">
|
||||
|
||||
<text id="admin/link">
|
||||
<translation lang="de">Administrieren</translation>
|
||||
<translation lang="en">Admin</translation>
|
||||
</text>
|
||||
<text id="admin/title">
|
||||
<translation lang="de">Administrieren</translation>
|
||||
<translation lang="en">Admin</translation>
|
||||
</text>
|
||||
|
||||
<text id="edit/link">
|
||||
<translation lang="de">Bearbeiten</translation>
|
||||
<translation lang="en">Edit</translation>
|
||||
</text>
|
||||
<text id="edit/title">
|
||||
<translation lang="de">Bearbeiten</translation>
|
||||
<translation lang="en">Edit</translation>
|
||||
</text>
|
||||
|
||||
<text id="view/link">
|
||||
<translation lang="de">Ansehen</translation>
|
||||
<translation lang="en">View</translation>
|
||||
</text>
|
||||
<text id="view/title">
|
||||
<translation lang="de">Ansehen</translation>
|
||||
<translation lang="en">View</translation>
|
||||
</text>
|
||||
|
||||
|
||||
|
||||
</foundry:static-texts>
|
||||
|
|
@ -81,8 +81,16 @@
|
|||
</a>
|
||||
<script type="text/javascript">
|
||||
<xsl:value-of select="'$(document).ready(function() {'"/>
|
||||
<xsl:value-of select="concat('minimizeImage.restore("', $imageClass, '", "', $linkClass ,'", "', $minimizeLabel, '", "', $maximizeLabel, '")')"/>
|
||||
<xsl:value-of select="concat('minimizeImage.restore("', $imageClass, '", "', $linkClass ,'", "', $minimizeLabel, '", "', $maximizeLabel, '");')"/>
|
||||
|
||||
//alert("window.height(jQuery) = " + $(window).height() + "\nwindow.height = " + window.innerHeight + "\n image.height = " + $(".headerImage").height());
|
||||
|
||||
<xsl:value-of select="concat('if($(window).height() < $(".', $imageClass, '").height() * 2.1) {')"/>
|
||||
<xsl:value-of select="concat('minimizeImage.minimize("', $imageClass, '", "', $linkClass ,'", "', $minimizeLabel, '", "', $maximizeLabel, '");')"/>
|
||||
<xsl:value-of select="'}'"/>
|
||||
|
||||
<xsl:value-of select="'});'"/>
|
||||
|
||||
</script>
|
||||
</xsl:template>
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue