/** * Stores the given app setting within the users additional info.<p> * * @param cms the cms context * @param type the app setting type, used as the settings key * @param appSettings the settings to store */ public void storeAppSettings(CmsObject cms, Class<? extends I_CmsAppSettings> type, I_CmsAppSettings appSettings) { CmsUser user = cms.getRequestContext().getCurrentUser(); CmsUserSettings settings = new CmsUserSettings(user); String currentSetting = settings.getAdditionalPreference(type.getName(), true); String state = appSettings.getSettingsString(); if (((state == null) && (currentSetting == null)) || ((state != null) && state.equals(currentSetting))) { // nothing changed return; } settings.setAdditionalPreference(type.getName(), state); try { settings.save(cms); } catch (CmsException e) { LOG.error("Failed to store workplace app settings for type " + type.getName(), e); } }
/** * Sets a configured preference.<p> * * @param cms the Cms context * @param key the setting name * @param value the value */ public static void setAdditionalPreference(CmsObject cms, String key, String value) { CmsUser user = cms.getRequestContext().getCurrentUser(); CmsUserSettings settings = new CmsUserSettings(user); settings.setAdditionalPreference(key, value); try { settings.save(cms); } catch (CmsException e) { LOG.error("Could not store preference " + key + ": " + e.getLocalizedMessage(), e); } }
/** * Sets the locale of the current user.<p> * * @param locale the locale to set * * @throws CmsException in case the locale of the current user can not be stored */ public void setLocale(Locale locale) throws CmsException { CmsUserSettings settings = getSettings(); if (settings != null) { settings.setLocale(locale); settings.save(m_cms); m_messages = Messages.get().getBundle(locale); } }
/** * Sets the locale of the current user.<p> * * @param locale the locale to set * * @throws CmsException in case the locale of the current user can not be stored */ public void setLocale(Locale locale) throws CmsException { CmsUserSettings settings = getSettings(); if (settings != null) { settings.setLocale(locale); settings.save(m_cms); m_messages = Messages.get().getBundle(locale); } }
/** * Commits the edited synchronize settings to the user settings.<p> */ @Override public void actionCommit() { List<Throwable> errors = new ArrayList<Throwable>(); try { // set the synchronize settings CmsUserSettings userSettings = new CmsUserSettings(getCms()); m_synchronizeSettings.checkValues(getCms()); userSettings.setSynchronizeSettings(m_synchronizeSettings); userSettings.save(getCms()); setDialogObject(null); } catch (Throwable t) { errors.add(t); } // set the list of errors to display when saving failed setCommitErrors(errors); }
try { m_userSettings.save(getCms()); } catch (CmsException e) {
m_userSettings.save(getCms()); } catch (CmsException e) {
/** * Change the user settings concerned with the place where a user is taken on login * @param username the name of the user for which the data should be changed * @param startProject the start project * @param startSite the start site * @param startFolder the start folder (relative to the site root) * @param startView the start view * - Direct edit (/system/workplace/views/explorer/directEdit.jsp) * - Explorer (/system/workplace/views/explorer/explorer_fs.jsp) * - Administration (/system/workplace/views/admin/admin-fs.jsp) * @throws CmsException thrown if user can't be read or settings can't be saved. */ public void changeUserSettingsStartParameters( String username, String startProject, String startSite, String startFolder, String startView) throws CmsException { CmsUser user = m_cms.readUser(username); CmsUserSettings settings = new CmsUserSettings(user); settings.setStartProject(startProject); settings.setStartSite(startSite); settings.setStartFolder(startFolder); settings.setStartView(startView); settings.save(m_cms); }
save(null); } catch (CmsException e) {
save(null); } catch (CmsException e) {
userSettings.setUploadAppletClientFolder(getParamClientFolder()); try { userSettings.save(getCms()); } catch (CmsException e) {
userSettings.setUploadAppletClientFolder(getParamClientFolder()); try { userSettings.save(getCms()); } catch (CmsException e) {
settings.save(getCms());