cmsdefaultusersettings.java
来自「找了很久才找到到源代码」· Java 代码 · 共 999 行 · 第 1/3 页
JAVA
999 行
/*
* File : $Source: /usr/local/cvs/opencms/src/org/opencms/configuration/CmsDefaultUserSettings.java,v $
* Date : $Date: 2007-08-22 12:52:51 $
* Version: $Revision: 1.21 $
*
* This library is part of OpenCms -
* the Open Source Content Management System
*
* Copyright (c) 2002 - 2007 Alkacon Software GmbH (http://www.alkacon.com)
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* For further information about Alkacon Software GmbH, please see the
* company website: http://www.alkacon.com
*
* For further information about OpenCms, please see the
* project website: http://www.opencms.org
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
package org.opencms.configuration;
import org.opencms.db.CmsUserSettings;
import org.opencms.file.CmsResource;
import org.opencms.file.CmsResource.CmsResourceCopyMode;
import org.opencms.file.CmsResource.CmsResourceDeleteMode;
import org.opencms.i18n.CmsLocaleManager;
import org.opencms.main.CmsLog;
import org.opencms.util.A_CmsModeStringEnumeration;
import org.opencms.util.CmsStringUtil;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
/**
* Default user workplace settings, used as default values for worklace settings in the
* user preferences.<p>
*
* @author Michael Emmerich
* @author Andreas Zahner
*
* @version $Revision: 1.21 $
*
* @since 6.0.0
*/
public class CmsDefaultUserSettings extends CmsUserSettings {
/**
* Enumeration class for defining the publish related resources mode.<p>
*/
public static final class CmsPublishRelatedResourcesMode extends A_CmsModeStringEnumeration {
/** Constant for the publish related resources mode, checkbox disabled by default. */
protected static final CmsPublishRelatedResourcesMode MODE_FALSE = new CmsPublishRelatedResourcesMode(
CmsStringUtil.FALSE);
/**
* Constant for the publish related resources mode, only {@link org.opencms.security.CmsRole#VFS_MANAGER}s
* may publish resources without publishing the related resources.
*/
protected static final CmsPublishRelatedResourcesMode MODE_FORCE = new CmsPublishRelatedResourcesMode("FORCE");
/** Constant for the publish related resources mode, checkbox enabled by default. */
protected static final CmsPublishRelatedResourcesMode MODE_TRUE = new CmsPublishRelatedResourcesMode(
CmsStringUtil.TRUE);
/** The serial version id. */
private static final long serialVersionUID = -2665888243460791770L;
/**
* Default constructor.<p>
*
* @param mode string representation
*/
private CmsPublishRelatedResourcesMode(String mode) {
super(mode);
}
/**
* Returns the parsed mode object if the string representation matches, or <code>null</code> if not.<p>
*
* @param publishRelatedResourcesMode the string representation to parse
*
* @return the parsed mode object
*/
public static CmsPublishRelatedResourcesMode valueOf(String publishRelatedResourcesMode) {
if (publishRelatedResourcesMode == null) {
return null;
}
if (publishRelatedResourcesMode.equalsIgnoreCase(MODE_FALSE.getMode())) {
return MODE_FALSE;
}
if (publishRelatedResourcesMode.equalsIgnoreCase(MODE_TRUE.getMode())) {
return MODE_TRUE;
}
if (publishRelatedResourcesMode.equalsIgnoreCase(MODE_FORCE.getMode())) {
return MODE_FORCE;
}
return null;
}
}
/** Constant for the publish related resources mode, checkbox disabled by default. */
public static final CmsPublishRelatedResourcesMode PUBLISH_RELATED_RESOURCES_MODE_FALSE = CmsPublishRelatedResourcesMode.MODE_FALSE;
/**
* Constant for the publish related resources mode, only {@link org.opencms.security.CmsRole#VFS_MANAGER}s
* may publish resources without publishing the related resources.
*/
public static final CmsPublishRelatedResourcesMode PUBLISH_RELATED_RESOURCES_MODE_FORCE = CmsPublishRelatedResourcesMode.MODE_FORCE;
/** Constant for the publish related resources mode, checkbox enabled by default. */
public static final CmsPublishRelatedResourcesMode PUBLISH_RELATED_RESOURCES_MODE_TRUE = CmsPublishRelatedResourcesMode.MODE_TRUE;
/** Publish button appearance: show always. */
public static final String PUBLISHBUTTON_SHOW_ALWAYS = "always";
/** Publish button appearance: show auto (only if user has publish permissions). */
public static final String PUBLISHBUTTON_SHOW_AUTO = "auto";
/** Publish button appearance: show never. */
public static final String PUBLISHBUTTON_SHOW_NEVER = "never";
/**
* Array of the possible "button styles".
* Must be private because of Findbugs rule "MS".
*/
private static final String[] BUTTON_STYLES = {"image", "textimage", "text"};
/** Array list for fast lookup of "button styles". */
public static final List BUTTON_STYLES_LIST = Collections.unmodifiableList(Arrays.asList(BUTTON_STYLES));
/** Parameter for buttonstyle text & image. */
private static final int BUTTONSTYLE_TEXTIMAGE = 1;
/** Value for preserving siblings in copy dialog settings. */
private static final String COPYMODE_PRESERVE = "preservesiblings";
/** Value for creating a resource in copy dialog settings. */
private static final String COPYMODE_RESOURCE = "createresource";
/** Value for creating a sibling in copy dialog settings. */
private static final String COPYMODE_SIBLING = "createsibling";
/** Value for deleting siblings in delete dialog settings. */
private static final String DELETEMODE_DELETE = "deletesiblings";
/** Value for preserving siblings in delete dialog settings. */
private static final String DELETEMODE_PRESERVE = "preservesiblings";
/** Value for publishing only resources in publish dialog settings. */
private static final String PUBLISHMODE_ONLYRESOURCE = "onlyresource";
/** Value for publishing siblings in publish dialog settings. */
private static final String PUBLISHMODE_SIBLINGS = "allsiblings";
/** The enable relation deletion flag. */
private boolean m_allowBrokenRelations = true;
/** The publish related resources mode. */
private CmsPublishRelatedResourcesMode m_publishRelatedResourcesMode;
/**
* Gets the default copy mode when copying a file of the user.<p>
*
* @return the default copy mode when copying a file of the user
*/
public String getDialogCopyFileModeString() {
if (getDialogCopyFileMode() == CmsResource.COPY_AS_NEW) {
return COPYMODE_RESOURCE;
} else {
return COPYMODE_SIBLING;
}
}
/**
* Gets the default copy mode when copying a folder of the user.<p>
*
* @return the default copy mode when copying a folder of the user
*/
public String getDialogCopyFolderModeString() {
if (getDialogCopyFolderMode() == CmsResource.COPY_AS_NEW) {
return COPYMODE_RESOURCE;
} else if (getDialogCopyFolderMode() == CmsResource.COPY_AS_SIBLING) {
return COPYMODE_SIBLING;
} else {
return COPYMODE_PRESERVE;
}
}
/**
* Returns the default setting for file deletion.<p>
*
* @return the default setting for file deletion
*/
public String getDialogDeleteFileModeString() {
if (getDialogDeleteFileMode() == CmsResource.DELETE_REMOVE_SIBLINGS) {
return DELETEMODE_DELETE;
} else {
return DELETEMODE_PRESERVE;
}
}
/**
* Returns the default setting for expanding inherited permissions in the dialog.<p>
*
* @return true if inherited permissions should be expanded, otherwise false
*
* @see #getDialogExpandInheritedPermissions()
*/
public String getDialogExpandInheritedPermissionsString() {
return String.valueOf(getDialogExpandInheritedPermissions());
}
/**
* Returns the default setting for expanding the users permissions in the dialog.<p>
*
* @return true if the users permissions should be expanded, otherwise false
*
* @see #getDialogExpandUserPermissions()
*/
public String getDialogExpandUserPermissionsString() {
return String.valueOf(getDialogExpandUserPermissions());
}
/**
* Returns the default setting for inheriting permissions on folders.<p>
*
* @return true if permissions should be inherited on folders, otherwise false
*/
public String getDialogPermissionsInheritOnFolderString() {
return String.valueOf(getDialogPermissionsInheritOnFolder());
}
/**
* Returns the default setting for direct publishing.<p>
*
* @return the default setting for direct publishing
*/
public String getDialogPublishSiblingsString() {
if (getDialogPublishSiblings()) {
return PUBLISHMODE_SIBLINGS;
} else {
return PUBLISHMODE_ONLYRESOURCE;
}
}
/**
* Determines if the export settings part of the secure/export dialog should be shown.<p>
*
* @return true if the export dialog is shown, otherwise false
*/
public String getDialogShowExportSettingsString() {
return String.valueOf(getDialogShowExportSettings());
}
/**
* Determines if the lock dialog should be shown.<p>
*
* @return true if the lock dialog is shown, otherwise false
*/
public String getDialogShowLockString() {
return String.valueOf(getDialogShowLock());
}
/**
* Returns a string representation of the direct edit button style.<p>
*
* @return string representation of the direct edit button style
*/
public String getDirectEditButtonStyleString() {
return BUTTON_STYLES[getDirectEditButtonStyle()];
}
/**
* Returns a string representation of the editor button style.<p>
*
* @return string representation of the editor button style
*/
public String getEditorButtonStyleString() {
return BUTTON_STYLES[getEditorButtonStyle()];
}
/**
* Returns a string representation of the explorer button style.<p>
*
* @return string representation of the explorer button style
*/
public String getExplorerButtonStyleString() {
return BUTTON_STYLES[getExplorerButtonStyle()];
}
/**
* Returns the publish related resources mode.<p>
*
* @return the publish related resources mode
*/
public CmsPublishRelatedResourcesMode getPublishRelatedResources() {
return m_publishRelatedResourcesMode;
}
/**
* Returns if the explorer view is restricted to the defined site and folder.<p>
*
* @return true if the explorer view is restricted, otherwise false
*/
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?