userProfileList = systemProfileList = null;
epstate.setRuntimeData(rd);
internalState = epstate;
} else if (action.equals("copy")) {
// retrieve a profile from the database
UserProfile p=null;
if(systemProfile) {
p=(UserProfile)systemProfileList.get(new Integer(profileId));
} else {
p=(UserProfile)userProfileList.get(new Integer(profileId));
}
if(p!=null) {
// create a new layout
try {
p=this.getUserLayoutStore().addUserProfile(context.getUserPreferencesManager().getPerson(),p);
} catch (Exception e) {
throw new PortalException(e);
}
// reset user profile listing
userProfileList=null;
}
} else if (action.equals("delete")) {
// delete a profile
if (systemProfile) {
// need to check permissions here
// context.getUserPreferencesStore().deleteSystemProfile(Integer.parseInt(profileId));
// systemProfileList=null;
} else {
try {
this.getUserLayoutStore().deleteUserProfile(context.getUserPreferencesManager().getPerson(), Integer.parseInt(profileId));
} catch (Exception e) {
throw new PortalException(e);
}
userProfileList = null;
}
} else if (action.equals("map")) {
try {
this.getUserLayoutStore().setUserBrowserMapping(context.getUserPreferencesManager().getPerson(), this.runtimeData.getBrowserInfo().getUserAgent(), Integer.parseInt(profileId));
} catch (Exception e) {
throw new PortalException(e);
}
// let userPreferencesManager know that the current profile has changed : everything must be reloaded
} else if (action.equals("changeView")) {
String view=runtimeData.getParameter("view");
boolean expand=false;
if(view.equals("expanded")) expand=true;
if(systemProfile) {
systemExpandStates.put(profileId,new Boolean(expand));
} else {
userExpandStates.put(profileId,new Boolean(expand));
}
}
}
if(action.equals("newProfile")) {
// get a copy of a current layout to copy the values from
UserProfile cp=context.getCurrentUserPreferences().getProfile();
if(cp!=null) {
// create a new profile
UserProfile p=new UserProfile(0,"new profile","please edit the profile",cp.getLayoutId(),cp.getStructureStylesheetId(),cp.getThemeStylesheetId());
try {
p=this.getUserLayoutStore().addUserProfile(context.getUserPreferencesManager().getPerson(),p);
} catch (Exception e) {
throw new PortalException(e);
}
// reset user profile listing
userProfileList=null;
}
} else if(action.equals("condenseAll")) {
String profileType = runtimeData.getParameter("profileType");
if (profileType != null && profileType.equals("system")) {
// system profiles
systemExpandStates.clear();
} else {
// user profiles
userExpandStates.clear();
}
} else if(action.equals("expandAll")) {
String profileType = runtimeData.getParameter("profileType");
if (profileType != null && profileType.equals("system")) {
// system profiles
systemExpandStates.clear();
Boolean expState=new Boolean(true);
for (Enumeration upe = this.getSystemProfileList().elements(); upe.hasMoreElements();) {
UserProfile p = (UserProfile)upe.nextElement();
systemExpandStates.put(Integer.toString(p.getProfileId()),expState);
}
} else {
// user profiles
userExpandStates.clear();
Boolean expState=new Boolean(true);
for (Enumeration upe = this.getUserProfileList().elements(); upe.hasMoreElements();) {
UserProfile p = (UserProfile)upe.nextElement();
userExpandStates.put(Integer.toString(p.getProfileId()),expState);
}
}
}
}
if (internalState != null)