cmsusersettings.java

来自「找了很久才找到到源代码」· Java 代码 · 共 1,626 行 · 第 1/5 页

JAVA
1,626
字号
/*
 * File   : $Source: /usr/local/cvs/opencms/src/org/opencms/db/CmsUserSettings.java,v $
 * Date   : $Date: 2007-09-10 12:50:08 $
 * Version: $Revision: 1.44 $
 *
 * 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.db;

import org.opencms.configuration.CmsDefaultUserSettings;
import org.opencms.configuration.CmsWorkplaceConfiguration;
import org.opencms.configuration.I_CmsXmlConfiguration;
import org.opencms.file.CmsObject;
import org.opencms.file.CmsUser;
import org.opencms.file.CmsResource.CmsResourceCopyMode;
import org.opencms.file.CmsResource.CmsResourceDeleteMode;
import org.opencms.i18n.CmsLocaleManager;
import org.opencms.main.CmsContextInfo;
import org.opencms.main.CmsException;
import org.opencms.main.CmsLog;
import org.opencms.main.OpenCms;
import org.opencms.report.I_CmsReport;
import org.opencms.synchronize.CmsSynchronizeSettings;
import org.opencms.util.A_CmsModeStringEnumeration;
import org.opencms.util.CmsStringUtil;

import java.util.Iterator;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.TreeMap;

import org.apache.commons.logging.Log;

/**
 * Object to conveniently access and modify the users workplace settings.<p>
 *
 * @author  Andreas Zahner 
 * @author  Michael Emmerich 
 * 
 * @version $Revision: 1.44 $
 * 
 * @since 6.0.0
 */
public class CmsUserSettings {

    /**
     *  Enumeration class for workplace search result styles.<p>
     */
    public static final class CmsSearchResultStyle extends A_CmsModeStringEnumeration {

        /** Workplace search result style explorer view. */
        public static final CmsSearchResultStyle STYLE_EXPLORER = new CmsSearchResultStyle(
            "explorer",
            Messages.GUI_WORKPLACE_SEARCH_STYLE_EXPLORER_0);

        /** Workplace search result style list view with excerpts. */
        public static final CmsSearchResultStyle STYLE_LIST_WITH_EXCERPTS = new CmsSearchResultStyle(
            "list-with-excerpts",
            Messages.GUI_WORKPLACE_SEARCH_STYLE_LIST_WITH_EXCERPTS_0);

        /** Workplace search result style list view without excerpts. */
        public static final CmsSearchResultStyle STYLE_LIST_WITHOUT_EXCERPTS = new CmsSearchResultStyle(
            "list-without-excerpts",
            Messages.GUI_WORKPLACE_SEARCH_STYLE_LIST_WITHOUT_EXCERPTS_0);

        /** Serializable version id. */
        private static final long serialVersionUID = 6611568161885127011L;

        /** The localization key for this style. */
        private final String m_key;

        /**
         * Private constructor.<p>
         * 
         * @param style the workplace search result style string representation
         * @param key the localization key for this style
         */
        private CmsSearchResultStyle(String style, String key) {

            super(style);
            m_key = key;
        }

        /**
         * Returns the copy mode object from the old copy mode integer.<p>
         * 
         * @param mode the old copy mode integer
         * 
         * @return the copy mode object
         */
        public static CmsSearchResultStyle valueOf(String mode) {

            if (STYLE_LIST_WITHOUT_EXCERPTS.getMode().equals(mode)) {
                return STYLE_LIST_WITHOUT_EXCERPTS;
            } else if (STYLE_LIST_WITH_EXCERPTS.getMode().equals(mode)) {
                return STYLE_LIST_WITH_EXCERPTS;
            } else {
                return STYLE_EXPLORER;
            }
        }

        /**
         * Returns the localization key for this style.<p>
         * 
         * @return the localization key for this style
         */
        public String getKey() {

            return m_key;
        }
    }

    /** Key for additional info address. */
    public static final String ADDITIONAL_INFO_ADDRESS = "USER_ADDRESS";

    /** Key for additional info city. */
    public static final String ADDITIONAL_INFO_CITY = "USER_TOWN"; // Value must unfortunately still be "USER_TOWN" or existing serialized user information will be lost

    /** Key for additional info of resources that were confirmed by the user. */
    public static final String ADDITIONAL_INFO_CONFIRMED_RESOURCES = "ADDITIONAL_INFO_CONFIRMED_RESOURCES";

    /** Key for additional info address. */
    public static final String ADDITIONAL_INFO_COUNTRY = "USER_COUNTRY";

    /** Key for additional info default group. */
    public static final String ADDITIONAL_INFO_DEFAULTGROUP = "USER_DEFAULTGROUP";

    /** Key for additional info address. */
    public static final String ADDITIONAL_INFO_DESCRIPTION = "USER_DESCRIPTION";

    /** Key for additional info explorer settings. */
    public static final String ADDITIONAL_INFO_EXPLORERSETTINGS = "USER_EXPLORERSETTINGS";

    /** Key for additional info flags. */
    public static final String ADDITIONAL_INFO_PREFERENCES = "USER_PREFERENCES";

    /** Key for additional info start settings. */
    public static final String ADDITIONAL_INFO_STARTSETTINGS = "USER_STARTSETTINGS";

    /** Key for additional info time warp. */
    public static final String ADDITIONAL_INFO_TIMEWARP = "USER_TIMEWARP";

    /**
     *  Key for additional info city.
     *  
     *  @deprecated use {@link #ADDITIONAL_INFO_CITY} instead
     */
    public static final String ADDITIONAL_INFO_TOWN = "USER_TOWN";

    /** Key for additional info upload applet client folder path. */
    public static final String ADDITIONAL_INFO_UPLOADAPPLET_CLIENTFOLDER = "USER_UPLOADAPPLET_CLIENTFOLDER";

    /** Key for additional info address. */
    public static final String ADDITIONAL_INFO_ZIPCODE = "USER_ZIPCODE";

    /** Flag for displaying the date created column. */
    public static final int FILELIST_DATE_CREATED = 1024;

    /** Flag for displaying the date expired column. */
    public static final int FILELIST_DATE_EXPIRED = 8192;

    /** Flag for displaying the changed column. */
    public static final int FILELIST_DATE_LASTMODIFIED = 4;

    /** Flag for displaying the date released column. */
    public static final int FILELIST_DATE_RELEASED = 4096;

    /** Flag for displaying the locked column. */
    public static final int FILELIST_LOCKEDBY = 256;

    /** Flag for displaying the name column. */
    public static final int FILELIST_NAME = 512;

    /** Flag for displaying the navigation text column. */
    public static final int FILELIST_NAVTEXT = 64;

    /** Flag for displaying the access column. */
    public static final int FILELIST_PERMISSIONS = 128;

    /** Flag for displaying the size column. */
    public static final int FILELIST_SIZE = 8;

    /** Flag for displaying the state column. */
    public static final int FILELIST_STATE = 16;

    /** Flag for displaying the title column. */
    public static final int FILELIST_TITLE = 1;

    /** Flag for displaying the file type column. */
    public static final int FILELIST_TYPE = 2;

    /** Flag for displaying the owner column. */
    public static final int FILELIST_USER_CREATED = 32;

    /** Flag for displaying the user who last modified column. */
    public static final int FILELIST_USER_LASTMODIFIED = 2048;

    /** Identifier prefix for all keys in the user additional info table. */
    public static final String PREFERENCES = "USERPREFERENCES_";

    /** Identifier for the synchronize setting key. */
    public static final String SYNC_DESTINATION = "DESTINATION";

    /** Identifier for the synchronize setting key. */
    public static final String SYNC_ENABLED = "ENABLED";

    /** Identifier for the synchronize setting key. */
    public static final String SYNC_SETTINGS = "SYNC_SETTINGS_";

    /** Identifier for the synchronize setting key. */
    public static final String SYNC_VFS_LIST = "VFS_LIST";

    /** The default button style. */
    private static final int BUTTONSTYLE_DEFAULT = 1;

    /** The default number of entries per page. */
    private static final int ENTRYS_PER_PAGE_DEFAULT = 50;

    /** The log object for this class. */
    private static final Log LOG = CmsLog.getLog(CmsDriverManager.class);

    /** Default workplace search index name. */
    private static final String SEARCH_INDEX_DEFAULT = "Offline project (VFS)";

    private boolean m_dialogDirectpublish;

    private boolean m_dialogExpandInheritedPermissions;

    private boolean m_dialogExpandUserPermissions;

    private CmsResourceCopyMode m_dialogFileCopy;

    private CmsResourceDeleteMode m_dialogFileDelete;

    private CmsResourceCopyMode m_dialogFolderCopy;

    private boolean m_dialogPermissionsInheritOnFolder;

    private int m_directeditButtonStyle;

    private int m_editorButtonStyle;

    private TreeMap m_editorSettings;

    private int m_explorerButtonStyle;

    private int m_explorerFileEntries;

    private int m_explorerSettings;

    private Locale m_locale;

    /** Controls if the "create index page" check box in the new folder dialog should be initially be checked or not. */
    private Boolean m_newFolderCreateIndexPage;

    /** Controls if the "edit properties" check box in the new folder dialog should be initially be checked or not. */
    private Boolean m_newFolderEditProperties;

    private String m_project;

    /** Controls appearance of the publish button. */
    private String m_publishButtonAppearance;

    private boolean m_restrictExplorerView;

    private boolean m_showExportSettings;

    /** Flag that controls display of the file upload button. */
    private boolean m_showFileUploadButton;

    private boolean m_showLock;

    /** Flag to determine if the publish notifications should be shown. */
    private boolean m_showPublishNotification;

    /** Controls if the resource type dialog for uploaded resources (not the applet) is shown or not. */
    private Boolean m_showUploadTypeDialog;

    private String m_startFolder;

    private String m_startSite;

    private CmsSynchronizeSettings m_synchronizeSettings;

    /** The custom user surf time. */
    private long m_timeWarp;

    private boolean m_uploadApplet;

    /** The path of the preselected folder for the upload applet on the client machine. */
    private String m_uploadAppletClientFolder;

    private CmsUser m_user;

    private String m_view;

    private int m_workplaceButtonStyle;

    private String m_workplaceReportType;

    /** The name of the search index to use in the workplace. */

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?