/** * Initializes the internal <code>CmsWorkplaceSettings</code> that contain (amongst other * information) important information additional information about the current user * (an instance of {@link CmsUserSettings}).<p> * * This step is performed within the <code>CmsShell</code> constructor directly after * switching to run-level 2 and obtaining the <code>CmsObject</code> for the guest user as * well as when invoking the CmsShell command <code>login</code>.<p> * * @return the user settings for the current user. */ protected CmsUserSettings initSettings() { m_settings = new CmsUserSettings(m_cms); return m_settings; }
/** * Initializes the internal <code>CmsWorkplaceSettings</code> that contain (amongst other * information) important information additional information about the current user * (an instance of {@link CmsUserSettings}).<p> * * This step is performed within the <code>CmsShell</code> constructor directly after * switching to run-level 2 and obtaining the <code>CmsObject</code> for the guest user as * well as when invoking the CmsShell command <code>login</code>.<p> * * @return the user settings for the current user. */ protected CmsUserSettings initSettings() { m_settings = new CmsUserSettings(m_cms); return m_settings; }
/** * Sets the default preferences for the current user if those values are not available.<p> * * @return the integer value of the default preferences */ private int getUserPreferences() { CmsUserSettings settings = new CmsUserSettings(getCms()); return settings.getExplorerSettings(); }
/** * Fills the parameter values according to the settings of the current user.<p> * * This method is called once when first displaying the preferences dialog.<p> */ private void fillUserSettings() { m_userSettings = new CmsUserSettings(getSettings().getUser()); }
/** * Sets the default preferences for the current user if those values are not available.<p> * * @return the integer value of the default preferences */ private int getUserPreferences() { CmsUserSettings settings = new CmsUserSettings(getCms()); return settings.getExplorerSettings(); }
/** * Returns the file settings for the Workplace explorer view.<p> * * @return the file settings for the Workplace explorer view */ public int getExplorerSettings() { CmsUserSettings settings = new CmsUserSettings(getCms()); int value = settings.getExplorerSettings(); return value; }
/** * Fills the parameter values according to the settings of the current user.<p> * * This method is called once when first displaying the preferences dialog.<p> */ private void fillUserSettings() { m_userSettings = new CmsUserSettings(getSettings().getUser()); }
/** * Returns the file settings for the Workplace explorer view.<p> * * @return the file settings for the Workplace explorer view */ public int getExplorerSettings() { CmsUserSettings settings = new CmsUserSettings(getCms()); int value = settings.getExplorerSettings(); return value; }
/** * @see org.opencms.ui.apps.A_CmsWorkplaceAppConfiguration#getVisibility(org.opencms.file.CmsObject) */ @Override public CmsAppVisibilityStatus getVisibility(CmsObject cms) { CmsUserSettings userSettings = new CmsUserSettings(cms); boolean usesNewWorkplace = userSettings.usesNewWorkplace(); if (!usesNewWorkplace) { return super.getVisibility(cms); } else { return CmsAppVisibilityStatus.INVISIBLE; } } }
/** * Gets a configured preference.<p> * * @param cms the cms context * @param key the settings key * @param useDefault true if we want the default value if no value is configured * * @return the preference value */ public static String getAdditionalPreference(CmsObject cms, String key, boolean useDefault) { CmsUser user = cms.getRequestContext().getCurrentUser(); CmsUserSettings settings = new CmsUserSettings(user); return settings.getAdditionalPreference(key, useDefault); }
/** * 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); } }
/** * Initializes the synchronize settings object for this dialog.<p> */ protected void initSynchronizeSettingsObject() { Object o = getDialogObject(); if ((o == null) || !(o instanceof CmsSynchronizeSettings)) { CmsUserSettings userSettings = new CmsUserSettings(getCms()); o = userSettings.getSynchronizeSettings(); } if (o != null) { m_synchronizeSettings = (CmsSynchronizeSettings)o; } else { m_synchronizeSettings = new CmsSynchronizeSettings(); } }
/** * @see org.opencms.workplace.tools.I_CmsToolHandler#isEnabled(org.opencms.file.CmsObject) */ public boolean isEnabled(CmsObject cms) { if (getPath().startsWith("/workplace/broadcast") || getPath().equals("/workplace")) { if (OpenCms.getRoleManager().hasRole(cms, CmsRole.ACCOUNT_MANAGER)) { return true; } } if (getPath().startsWith("/workplace/synchronize_action")) { CmsUserSettings settings = new CmsUserSettings(cms); CmsSynchronizeSettings syncSettings = settings.getSynchronizeSettings(); return (syncSettings != null) && syncSettings.isSyncEnabled(); } return OpenCms.getRoleManager().hasRole(cms, CmsRole.WORKPLACE_MANAGER); }
/** * @see org.opencms.workplace.editors.directedit.I_CmsDirectEditProvider#init(org.opencms.file.CmsObject, org.opencms.workplace.editors.directedit.CmsDirectEditMode, java.lang.String) */ public void init(CmsObject cms, CmsDirectEditMode mode, String fileName) { m_cms = cms; m_fileName = fileName; if (CmsStringUtil.isEmpty(m_fileName)) { m_fileName = INCLUDE_FILE_DEFAULT; } m_mode = mode != null ? mode : CmsDirectEditMode.AUTO; m_rnd = new Random(); CmsUserSettings settings = new CmsUserSettings(cms); m_messages = new CmsMessages(Messages.get().getBundleName(), settings.getLocale()); m_editButtonStyle = settings.getEditorButtonStyle(); }
/** * Constructs a new error bean.<p> * * @param cms the current CmsObject * @param throwable the exception that was caught */ public CmsErrorBean(CmsObject cms, Throwable throwable) { m_cms = cms; // get the settings for system users to display errors in correct language CmsUser user = cms.getRequestContext().getCurrentUser(); CmsUserSettings settings = new CmsUserSettings(user); m_locale = settings.getLocale(); m_throwable = throwable; m_messages = Messages.get().getBundle(m_locale); }
/** * Constructs a new error bean.<p> * * @param cms the current CmsObject * @param throwable the exception that was caught */ public CmsErrorBean(CmsObject cms, Throwable throwable) { m_cms = cms; // get the settings for system users to display errors in correct language CmsUser user = cms.getRequestContext().currentUser(); CmsUserSettings settings = new CmsUserSettings(user); m_locale = settings.getLocale(); m_throwable = throwable; m_messages = Messages.get().getBundle(m_locale); }
/** * Creates the synchronize Thread.<p> * * @param cms the current OpenCms context object */ public CmsSynchronizeThread(CmsObject cms) { super(cms, Messages.get().getBundle().key( Messages.GUI_SYNCHRONIZE_THREAD_NAME_1, cms.getRequestContext().currentProject().getName())); initHtmlReport(cms.getRequestContext().getLocale()); m_settings = new CmsUserSettings(cms).getSynchronizeSettings(); }
/** * Creates the synchronize Thread.<p> * * @param cms the current OpenCms context object */ public CmsSynchronizeThread(CmsObject cms) { super( cms, Messages.get().getBundle().key( Messages.GUI_SYNCHRONIZE_THREAD_NAME_1, cms.getRequestContext().getCurrentProject().getName())); initHtmlReport(cms.getRequestContext().getLocale()); m_settings = new CmsUserSettings(cms).getSynchronizeSettings(); }
/** Returns a new macro resolver that loads message keys from the workplace bundle in the user setting's language. * @param cms the CmsObject. * @return a new macro resolver with messages from the workplace bundle in the current users locale. */ public static I_CmsMacroResolver newWorkplaceLocaleResolver(final CmsObject cms) { // Resolve macros in the property configuration CmsMacroResolver resolver = new CmsMacroResolver(); resolver.setCmsObject(cms); CmsUserSettings userSettings = new CmsUserSettings(cms.getRequestContext().getCurrentUser()); CmsMultiMessages multimessages = new CmsMultiMessages(userSettings.getLocale()); multimessages.addMessages(OpenCms.getWorkplaceManager().getMessages(userSettings.getLocale())); resolver.setMessages(multimessages); resolver.setKeepEmptyMacros(true); return resolver; }
/** * @see org.opencms.repository.I_CmsRepository#login(java.lang.String, java.lang.String) */ public I_CmsRepositorySession login(String userName, String password) throws CmsException { CmsObject cms; cms = OpenCms.initCmsObject(OpenCms.getDefaultUsers().getUserGuest()); cms.loginUser(userName, password); CmsUserSettings settings = new CmsUserSettings(cms); cms.getRequestContext().setSiteRoot(settings.getStartSite()); cms.getRequestContext().setCurrentProject(cms.readProject(settings.getStartProject())); // set the object wrapper as an attribute in the request context, so that it can be // used everywhere a CmsObject is accessible. CmsObjectWrapper objWrapper = new CmsObjectWrapper(cms, m_wrappers); cms.getRequestContext().setAttribute(CmsObjectWrapper.ATTRIBUTE_NAME, objWrapper); return new CmsRepositorySession(objWrapper, getFilter()); }