📄 cmsworkplacemanager.java
字号:
}
}
/**
* Adds a folder to the list of labeled folders.<p>
*
* @param uri the folder uri to add
*/
public void addLabeledFolder(String uri) {
m_labelSiteFolders.add(uri);
if (CmsLog.INIT.isInfoEnabled()) {
CmsLog.INIT.info(Messages.get().getBundle().key(Messages.INIT_LABEL_LINKS_IN_FOLDER_1, uri));
}
}
/**
* Adds a new folder to the list of localized workplace folders.<p>
*
* @param uri a new folder to add to the list of localized workplace folders
*/
public void addLocalizedFolder(String uri) {
m_localizedFolders.add(uri);
if (CmsLog.INIT.isInfoEnabled()) {
CmsLog.INIT.info(Messages.get().getBundle().key(Messages.INIT_WORKPLACE_LOCALIZED_1, uri));
}
}
/**
* Returns if the autolock resources feature is enabled.<p>
*
* @return true if the autolock resources feature is enabled, otherwise false
*/
public boolean autoLockResources() {
return m_autoLockResources;
}
/**
* Implements the event listener of this class.<p>
*
* @see org.opencms.main.I_CmsEventListener#cmsEvent(org.opencms.main.CmsEvent)
*/
public void cmsEvent(CmsEvent event) {
switch (event.getType()) {
case I_CmsEventListener.EVENT_CLEAR_CACHES:
// clear the cached message objects
m_messages = new HashMap();
if (LOG.isDebugEnabled()) {
LOG.debug(Messages.get().getBundle().key(Messages.LOG_EVENT_CLEAR_CACHES_0));
}
break;
default: // no operation
}
}
/**
* Gets the access object of the type settings.<p>
*
* @return access object of the type settings
*/
public CmsExplorerTypeAccess getDefaultAccess() {
return m_defaultAccess;
}
/**
* Returns the Workplace default locale.<p>
*
* @return the Workplace default locale
*/
public Locale getDefaultLocale() {
return m_defaultLocale;
}
/**
* Returns the Workplace default user settings.<p>
*
* @return the Workplace default user settings
*/
public CmsDefaultUserSettings getDefaultUserSettings() {
return m_defaultUserSettings;
}
/**
* Returns all instanciated dialog handlers for the workplace.<p>
*
* @return all instanciated dialog handlers for the workplace
*/
public Map getDialogHandler() {
return m_dialogHandler;
}
/**
* Returns the instanciated dialog handler class for the key or null, if there is no mapping for the key.<p>
*
* @param key the key whose associated value is to be returned
* @return the instanciated dialog handler class for the key
*/
public Object getDialogHandler(String key) {
return m_dialogHandler.get(key);
}
/**
* Returns a new instance of the configured direct edit provider.<p>
*
* @return a new instance of the configured direct edit provider
*/
public I_CmsDirectEditProvider getDirectEditProvider() {
return m_directEditProvider.newInstance();
}
/**
* Returns the instanciated editor action handler class.<p>
*
* @return the instanciated editor action handler class
*/
public I_CmsEditorActionHandler getEditorActionHandler() {
return m_editorAction;
}
/**
* Returns the instanciated editor display option class.<p>
*
* @return the instanciated editor display option class
*/
public CmsEditorDisplayOptions getEditorDisplayOptions() {
return m_editorDisplayOptions;
}
/**
* Returns the instanciated editor handler class.<p>
*
* @return the instanciated editor handler class
*/
public I_CmsEditorHandler getEditorHandler() {
return m_editorHandler;
}
/**
* Returns the configured workplace encoding.<p>
*
* @return the configured workplace encoding
*/
public String getEncoding() {
return m_encoding;
}
/**
* Returns the explorer type settings for the specified resource type.<p>
*
* @param type the resource type for which the settings are required
* @return the explorer type settings for the specified resource type
*/
public CmsExplorerTypeSettings getExplorerTypeSetting(String type) {
return (CmsExplorerTypeSettings)m_explorerTypeSettingsMap.get(type);
}
/**
* Returns the list of explorer type settings.<p>
*
* These settings provide information for the new resource dialog and the context menu appearance.<p>
*
* @return the list of explorer type settings
*/
public List getExplorerTypeSettings() {
if (m_explorerTypeSettings == null) {
// initialize all explorer type settings if not already done
initExplorerTypeSettings();
}
return m_explorerTypeSettings;
}
/**
* Returns the set of configured export points for the workplace.<p>
*
* @return the set of configured export points for the workplace
*/
public Set getExportPoints() {
return m_exportPoints;
}
/**
* Returns the value (in bytes) for the maximum file upload size of the current user.<p>
*
* @param cms the initialized CmsObject
* @return the value (in bytes) for the maximum file upload size
*/
public long getFileBytesMaxUploadSize(CmsObject cms) {
int maxFileSize = getFileMaxUploadSize();
long maxFileSizeBytes = maxFileSize * 1024;
// check if current user belongs to Admin group, if so no file upload limit
if ((maxFileSize <= 0) || cms.hasRole(CmsRole.VFS_MANAGER)) {
maxFileSizeBytes = -1;
}
return maxFileSizeBytes;
}
/**
* Returns the value (in kb) for the maximum file upload size.<p>
*
* @return the value (in kb) for the maximum file upload size
*/
public int getFileMaxUploadSize() {
return m_fileMaxUploadSize;
}
/**
* Returns the system-wide file view settings for the workplace.<p>
*
* Note that this instance may not modified (invocation of setters) directly or a
* <code>{@link org.opencms.main.CmsRuntimeException}</code> will be thrown.
* It has to be cloned first and then may be written back to the workplace settings using
* method {@link #setFileViewSettings(CmsObject, org.opencms.util.CmsRfsFileViewer)}.
*
* @return the system-wide file view settings for the workplace
*/
public CmsRfsFileViewer getFileViewSettings() {
return m_fileViewSettings;
}
/**
* Returns a collection of all available galleries.<p>
*
* The Map has the gallery type name as key and an instance of the gallery class (not completely initialized) as value.<p>
*
* @return a collection of all available galleries
*/
public Map getGalleries() {
return m_galleries;
}
/**
* @see org.opencms.i18n.I_CmsLocaleHandler#getI18nInfo(javax.servlet.http.HttpServletRequest, org.opencms.file.CmsUser, org.opencms.file.CmsProject, java.lang.String)
*/
public CmsI18nInfo getI18nInfo(HttpServletRequest req, CmsUser user, CmsProject project, String resource) {
Locale locale = null;
// try to read locale from session
if (req != null) {
// set the request character encoding
try {
req.setCharacterEncoding(m_encoding);
} catch (UnsupportedEncodingException e) {
// should not ever really happen
LOG.error(Messages.get().getBundle().key(Messages.LOG_UNSUPPORTED_ENCODING_SET_1, m_encoding), e);
}
// read workplace settings
HttpSession session = req.getSession(false);
if (session != null) {
CmsWorkplaceSettings settings = (CmsWorkplaceSettings)session.getAttribute(CmsWorkplaceManager.SESSION_WORKPLACE_SETTINGS);
if (settings != null) {
locale = settings.getUserSettings().getLocale();
}
}
}
if (locale == null) {
// no session available, try to read the locale form the user additional info
if (!user.isGuestUser()) {
// check user settings only for "real" users
CmsUserSettings settings = new CmsUserSettings(user);
locale = settings.getLocale();
}
if (req != null) {
List acceptedLocales = (new CmsAcceptLanguageHeaderParser(req, getDefaultLocale())).getAcceptedLocales();
if ((locale != null) && (!acceptedLocales.contains(locale))) {
acceptedLocales.add(0, locale);
}
locale = OpenCms.getLocaleManager().getFirstMatchingLocale(acceptedLocales, m_locales);
}
// if no locale was found, use the default
if (locale == null) {
locale = getDefaultLocale();
}
}
return new CmsI18nInfo(locale, m_encoding);
}
/**
* Returns a list of site folders which generate labeled links.<p>
*
* @return a list of site folders which generate labeled links
*/
public List getLabelSiteFolders() {
return m_labelSiteFolders;
}
/**
* Returns the list of available workplace locales, sorted ascending.<p>
*
* Please note: Be careful not to modify the returned Set as it is not a clone.<p>
*
* @return the set of available workplace locales
*/
public List getLocales() {
return m_locales;
}
/**
* Returns the configured list of localized workplace folders.<p>
*
* @return the configured list of localized workplace folders
*/
public List getLocalizedFolders() {
return m_localizedFolders;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -