0001: /*
0002: * File : $Source: /usr/local/cvs/opencms/src/org/opencms/db/CmsUserSettings.java,v $
0003: * Date : $Date: 2008-02-27 12:05:42 $
0004: * Version: $Revision: 1.47 $
0005: *
0006: * This library is part of OpenCms -
0007: * the Open Source Content Management System
0008: *
0009: * Copyright (c) 2002 - 2008 Alkacon Software GmbH (http://www.alkacon.com)
0010: *
0011: * This library is free software; you can redistribute it and/or
0012: * modify it under the terms of the GNU Lesser General Public
0013: * License as published by the Free Software Foundation; either
0014: * version 2.1 of the License, or (at your option) any later version.
0015: *
0016: * This library is distributed in the hope that it will be useful,
0017: * but WITHOUT ANY WARRANTY; without even the implied warranty of
0018: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
0019: * Lesser General Public License for more details.
0020: *
0021: * For further information about Alkacon Software GmbH, please see the
0022: * company website: http://www.alkacon.com
0023: *
0024: * For further information about OpenCms, please see the
0025: * project website: http://www.opencms.org
0026: *
0027: * You should have received a copy of the GNU Lesser General Public
0028: * License along with this library; if not, write to the Free Software
0029: * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
0030: */
0031:
0032: package org.opencms.db;
0033:
0034: import org.opencms.configuration.CmsDefaultUserSettings;
0035: import org.opencms.configuration.CmsWorkplaceConfiguration;
0036: import org.opencms.configuration.I_CmsXmlConfiguration;
0037: import org.opencms.file.CmsObject;
0038: import org.opencms.file.CmsUser;
0039: import org.opencms.file.CmsResource.CmsResourceCopyMode;
0040: import org.opencms.file.CmsResource.CmsResourceDeleteMode;
0041: import org.opencms.i18n.CmsLocaleManager;
0042: import org.opencms.main.CmsContextInfo;
0043: import org.opencms.main.CmsException;
0044: import org.opencms.main.CmsLog;
0045: import org.opencms.main.OpenCms;
0046: import org.opencms.report.I_CmsReport;
0047: import org.opencms.synchronize.CmsSynchronizeSettings;
0048: import org.opencms.util.A_CmsModeStringEnumeration;
0049: import org.opencms.util.CmsStringUtil;
0050:
0051: import java.util.Iterator;
0052: import java.util.List;
0053: import java.util.Locale;
0054: import java.util.Map;
0055: import java.util.TreeMap;
0056:
0057: import org.apache.commons.logging.Log;
0058:
0059: /**
0060: * Object to conveniently access and modify the users workplace settings.<p>
0061: *
0062: * @author Andreas Zahner
0063: * @author Michael Emmerich
0064: *
0065: * @version $Revision: 1.47 $
0066: *
0067: * @since 6.0.0
0068: */
0069: public class CmsUserSettings {
0070:
0071: /**
0072: * Enumeration class for workplace search result styles.<p>
0073: */
0074: public static final class CmsSearchResultStyle extends
0075: A_CmsModeStringEnumeration {
0076:
0077: /** Workplace search result style explorer view. */
0078: public static final CmsSearchResultStyle STYLE_EXPLORER = new CmsSearchResultStyle(
0079: "explorer",
0080: Messages.GUI_WORKPLACE_SEARCH_STYLE_EXPLORER_0);
0081:
0082: /** Workplace search result style list view with excerpts. */
0083: public static final CmsSearchResultStyle STYLE_LIST_WITH_EXCERPTS = new CmsSearchResultStyle(
0084: "list-with-excerpts",
0085: Messages.GUI_WORKPLACE_SEARCH_STYLE_LIST_WITH_EXCERPTS_0);
0086:
0087: /** Workplace search result style list view without excerpts. */
0088: public static final CmsSearchResultStyle STYLE_LIST_WITHOUT_EXCERPTS = new CmsSearchResultStyle(
0089: "list-without-excerpts",
0090: Messages.GUI_WORKPLACE_SEARCH_STYLE_LIST_WITHOUT_EXCERPTS_0);
0091:
0092: /** Serializable version id. */
0093: private static final long serialVersionUID = 6611568161885127011L;
0094:
0095: /**
0096: * Returns the copy mode object from the old copy mode integer.<p>
0097: *
0098: * @param mode the old copy mode integer
0099: *
0100: * @return the copy mode object
0101: */
0102: public static CmsSearchResultStyle valueOf(String mode) {
0103:
0104: if (STYLE_LIST_WITHOUT_EXCERPTS.getMode().equals(mode)) {
0105: return STYLE_LIST_WITHOUT_EXCERPTS;
0106: } else if (STYLE_LIST_WITH_EXCERPTS.getMode().equals(mode)) {
0107: return STYLE_LIST_WITH_EXCERPTS;
0108: } else {
0109: return STYLE_EXPLORER;
0110: }
0111: }
0112:
0113: /** The localization key for this style. */
0114: private final String m_key;
0115:
0116: /**
0117: * Private constructor.<p>
0118: *
0119: * @param style the workplace search result style string representation
0120: * @param key the localization key for this style
0121: */
0122: private CmsSearchResultStyle(String style, String key) {
0123:
0124: super (style);
0125: m_key = key;
0126: }
0127:
0128: /**
0129: * Returns the localization key for this style.<p>
0130: *
0131: * @return the localization key for this style
0132: */
0133: public String getKey() {
0134:
0135: return m_key;
0136: }
0137: }
0138:
0139: /** Key for additional info address. */
0140: public static final String ADDITIONAL_INFO_ADDRESS = "USER_ADDRESS";
0141:
0142: /** Key for additional info city. */
0143: public static final String ADDITIONAL_INFO_CITY = "USER_TOWN"; // Value must unfortunately still be "USER_TOWN" or existing serialized user information will be lost
0144:
0145: /** Key for additional info of resources that were confirmed by the user. */
0146: public static final String ADDITIONAL_INFO_CONFIRMED_RESOURCES = "ADDITIONAL_INFO_CONFIRMED_RESOURCES";
0147:
0148: /** Key for additional info address. */
0149: public static final String ADDITIONAL_INFO_COUNTRY = "USER_COUNTRY";
0150:
0151: /** Key for additional info default group. */
0152: public static final String ADDITIONAL_INFO_DEFAULTGROUP = "USER_DEFAULTGROUP";
0153:
0154: /** Key for additional info address. */
0155: public static final String ADDITIONAL_INFO_DESCRIPTION = "USER_DESCRIPTION";
0156:
0157: /** Key for additional info explorer settings. */
0158: public static final String ADDITIONAL_INFO_EXPLORERSETTINGS = "USER_EXPLORERSETTINGS";
0159:
0160: /** Key for additional info flags. */
0161: public static final String ADDITIONAL_INFO_PREFERENCES = "USER_PREFERENCES";
0162:
0163: /** Key for additional info start settings. */
0164: public static final String ADDITIONAL_INFO_STARTSETTINGS = "USER_STARTSETTINGS";
0165:
0166: /** Key for additional info time warp. */
0167: public static final String ADDITIONAL_INFO_TIMEWARP = "USER_TIMEWARP";
0168:
0169: /**
0170: * Key for additional info city.
0171: *
0172: * @deprecated use {@link #ADDITIONAL_INFO_CITY} instead
0173: */
0174: public static final String ADDITIONAL_INFO_TOWN = "USER_TOWN";
0175:
0176: /** Key for additional info upload applet client folder path. */
0177: public static final String ADDITIONAL_INFO_UPLOADAPPLET_CLIENTFOLDER = "USER_UPLOADAPPLET_CLIENTFOLDER";
0178:
0179: /** Key for additional info address. */
0180: public static final String ADDITIONAL_INFO_ZIPCODE = "USER_ZIPCODE";
0181:
0182: /** Flag for displaying the date created column. */
0183: public static final int FILELIST_DATE_CREATED = 1024;
0184:
0185: /** Flag for displaying the date expired column. */
0186: public static final int FILELIST_DATE_EXPIRED = 8192;
0187:
0188: /** Flag for displaying the changed column. */
0189: public static final int FILELIST_DATE_LASTMODIFIED = 4;
0190:
0191: /** Flag for displaying the date released column. */
0192: public static final int FILELIST_DATE_RELEASED = 4096;
0193:
0194: /** Flag for displaying the locked column. */
0195: public static final int FILELIST_LOCKEDBY = 256;
0196:
0197: /** Flag for displaying the name column. */
0198: public static final int FILELIST_NAME = 512;
0199:
0200: /** Flag for displaying the navigation text column. */
0201: public static final int FILELIST_NAVTEXT = 64;
0202:
0203: /** Flag for displaying the access column. */
0204: public static final int FILELIST_PERMISSIONS = 128;
0205:
0206: /** Flag for displaying the size column. */
0207: public static final int FILELIST_SIZE = 8;
0208:
0209: /** Flag for displaying the state column. */
0210: public static final int FILELIST_STATE = 16;
0211:
0212: /** Flag for displaying the title column. */
0213: public static final int FILELIST_TITLE = 1;
0214:
0215: /** Flag for displaying the file type column. */
0216: public static final int FILELIST_TYPE = 2;
0217:
0218: /** Flag for displaying the owner column. */
0219: public static final int FILELIST_USER_CREATED = 32;
0220:
0221: /** Flag for displaying the user who last modified column. */
0222: public static final int FILELIST_USER_LASTMODIFIED = 2048;
0223:
0224: /** Identifier prefix for all keys in the user additional info table. */
0225: public static final String PREFERENCES = "USERPREFERENCES_";
0226:
0227: /** Identifier for the synchronize setting key. */
0228: public static final String SYNC_DESTINATION = "DESTINATION";
0229:
0230: /** Identifier for the synchronize setting key. */
0231: public static final String SYNC_ENABLED = "ENABLED";
0232:
0233: /** Identifier for the synchronize setting key. */
0234: public static final String SYNC_SETTINGS = "SYNC_SETTINGS_";
0235:
0236: /** Identifier for the synchronize setting key. */
0237: public static final String SYNC_VFS_LIST = "VFS_LIST";
0238:
0239: /** The default button style. */
0240: private static final int BUTTONSTYLE_DEFAULT = 1;
0241:
0242: /** The default number of entries per page. */
0243: private static final int ENTRYS_PER_PAGE_DEFAULT = 50;
0244:
0245: /** The log object for this class. */
0246: private static final Log LOG = CmsLog
0247: .getLog(CmsDriverManager.class);
0248:
0249: /** Default workplace search index name. */
0250: private static final String SEARCH_INDEX_DEFAULT = "Offline project (VFS)";
0251:
0252: private boolean m_dialogDirectpublish;
0253:
0254: private boolean m_dialogExpandInheritedPermissions;
0255:
0256: private boolean m_dialogExpandUserPermissions;
0257:
0258: private CmsResourceCopyMode m_dialogFileCopy;
0259:
0260: private CmsResourceDeleteMode m_dialogFileDelete;
0261:
0262: private CmsResourceCopyMode m_dialogFolderCopy;
0263:
0264: private boolean m_dialogPermissionsInheritOnFolder;
0265:
0266: private int m_directeditButtonStyle;
0267:
0268: private int m_editorButtonStyle;
0269:
0270: private TreeMap m_editorSettings;
0271:
0272: private int m_explorerButtonStyle;
0273:
0274: private int m_explorerFileEntries;
0275:
0276: private int m_explorerSettings;
0277:
0278: /** The list of numbers in the preferences dialog, how much entries shown on a page. */
0279: private String m_exporerFileEntryOptions;
0280:
0281: private Locale m_locale;
0282:
0283: /** Controls if the "create index page" check box in the new folder dialog should be initially be checked or not. */
0284: private Boolean m_newFolderCreateIndexPage;
0285:
0286: /** Controls if the "edit properties" check box in the new folder dialog should be initially be checked or not. */
0287: private Boolean m_newFolderEditProperties;
0288:
0289: private String m_project;
0290:
0291: /** Controls appearance of the publish button. */
0292: private String m_publishButtonAppearance;
0293:
0294: private boolean m_restrictExplorerView;
0295:
0296: private boolean m_showExportSettings;
0297:
0298: /** Flag that controls display of the file upload button. */
0299: private boolean m_showFileUploadButton;
0300:
0301: private boolean m_showLock;
0302:
0303: /** Flag to determine if the publish notifications should be shown. */
0304: private boolean m_showPublishNotification;
0305:
0306: /** Controls if the resource type dialog for uploaded resources (not the applet) is shown or not. */
0307: private Boolean m_showUploadTypeDialog;
0308:
0309: private String m_startFolder;
0310:
0311: private String m_startSite;
0312:
0313: private CmsSynchronizeSettings m_synchronizeSettings;
0314:
0315: /** The custom user surf time. */
0316: private long m_timeWarp;
0317:
0318: private boolean m_uploadApplet;
0319:
0320: /** The path of the preselected folder for the upload applet on the client machine. */
0321: private String m_uploadAppletClientFolder;
0322:
0323: private CmsUser m_user;
0324:
0325: private String m_view;
0326:
0327: private int m_workplaceButtonStyle;
0328:
0329: private String m_workplaceReportType;
0330:
0331: /** The name of the search index to use in the workplace. */
0332: private String m_workplaceSearchIndexName;
0333:
0334: /** Workplace search result list view style. */
0335: private CmsSearchResultStyle m_workplaceSearchViewStyle;
0336:
0337: /**
0338: * Creates an empty new user settings object.<p>
0339: */
0340: public CmsUserSettings() {
0341:
0342: m_workplaceButtonStyle = CmsUserSettings.BUTTONSTYLE_DEFAULT;
0343: m_workplaceReportType = I_CmsReport.REPORT_TYPE_SIMPLE;
0344: m_explorerButtonStyle = CmsUserSettings.BUTTONSTYLE_DEFAULT;
0345: m_explorerFileEntries = CmsUserSettings.ENTRYS_PER_PAGE_DEFAULT;
0346: m_explorerSettings = CmsUserSettings.FILELIST_NAME;
0347: m_editorSettings = new TreeMap();
0348: m_showFileUploadButton = true;
0349: m_showPublishNotification = false;
0350: m_uploadApplet = true;
0351: m_publishButtonAppearance = CmsDefaultUserSettings.PUBLISHBUTTON_SHOW_ALWAYS;
0352: m_newFolderCreateIndexPage = Boolean.TRUE;
0353: m_newFolderEditProperties = Boolean.TRUE;
0354: m_showUploadTypeDialog = Boolean.TRUE;
0355: m_workplaceSearchIndexName = SEARCH_INDEX_DEFAULT;
0356: m_workplaceSearchViewStyle = CmsSearchResultStyle.STYLE_EXPLORER;
0357: }
0358:
0359: /**
0360: * Creates a user settings object with initialized settings of the current user.<p>
0361: *
0362: * @param cms the OpenCms context
0363: */
0364: public CmsUserSettings(CmsObject cms) {
0365:
0366: init(cms.getRequestContext().currentUser());
0367: }
0368:
0369: /**
0370: * Creates a user settings object with initialized settings of the user.<p>
0371: *
0372: * Some default settings will not be set, if no cms object is given.<p>
0373: *
0374: * @param user the current CmsUser
0375: *
0376: * @see #CmsUserSettings(CmsObject)
0377: */
0378: public CmsUserSettings(CmsUser user) {
0379:
0380: init(user);
0381: }
0382:
0383: /**
0384: * Gets the default copy mode when copying a file of the user.<p>
0385: *
0386: * @return the default copy mode when copying a file of the user
0387: */
0388: public CmsResourceCopyMode getDialogCopyFileMode() {
0389:
0390: return m_dialogFileCopy;
0391: }
0392:
0393: /**
0394: * Gets the default copy mode when copying a folder of the user.<p>
0395: *
0396: * @return the default copy mode when copying a folder of the user
0397: */
0398: public CmsResourceCopyMode getDialogCopyFolderMode() {
0399:
0400: return m_dialogFolderCopy;
0401: }
0402:
0403: /**
0404: * Returns the default setting for file deletion.<p>
0405: *
0406: * @return the default setting for file deletion
0407: */
0408: public CmsResourceDeleteMode getDialogDeleteFileMode() {
0409:
0410: return m_dialogFileDelete;
0411: }
0412:
0413: /**
0414: * Returns the default setting for expanding inherited permissions in the dialog.<p>
0415: *
0416: * @return true if inherited permissions should be expanded, otherwise false
0417: */
0418: public boolean getDialogExpandInheritedPermissions() {
0419:
0420: return m_dialogExpandInheritedPermissions;
0421: }
0422:
0423: /**
0424: * Returns the default setting for expanding the users permissions in the dialog.<p>
0425: *
0426: * @return true if the users permissions should be expanded, otherwise false
0427: */
0428: public boolean getDialogExpandUserPermissions() {
0429:
0430: return m_dialogExpandUserPermissions;
0431: }
0432:
0433: /**
0434: * Returns the default setting for inheriting permissions on folders.<p>
0435: *
0436: * @return true if permissions should be inherited on folders, otherwise false
0437: */
0438: public boolean getDialogPermissionsInheritOnFolder() {
0439:
0440: return m_dialogPermissionsInheritOnFolder;
0441: }
0442:
0443: /**
0444: * Returns the default setting for direct publishing.<p>
0445: *
0446: * @return the default setting for direct publishing: true if siblings should be published, otherwise false
0447: */
0448: public boolean getDialogPublishSiblings() {
0449:
0450: return m_dialogDirectpublish;
0451: }
0452:
0453: /**
0454: * Determines if the export part of the secure/export dialog should be shown.<p>
0455: *
0456: * @return true if the export dialog is shown, otherwise false
0457: */
0458: public boolean getDialogShowExportSettings() {
0459:
0460: return m_showExportSettings;
0461: }
0462:
0463: /**
0464: * Determines if the lock dialog should be shown.<p>
0465: *
0466: * @return true if the lock dialog is shown, otherwise false
0467: */
0468: public boolean getDialogShowLock() {
0469:
0470: return m_showLock;
0471: }
0472:
0473: /**
0474: * Returns the style of the direct edit buttons of the user.<p>
0475: *
0476: * @return the style of the direct edit buttons of the user
0477: */
0478: public int getDirectEditButtonStyle() {
0479:
0480: return m_directeditButtonStyle;
0481: }
0482:
0483: /**
0484: * Returns the style of the editor buttons of the user.<p>
0485: *
0486: * @return the style of the editor buttons of the user
0487: */
0488: public int getEditorButtonStyle() {
0489:
0490: return m_editorButtonStyle;
0491: }
0492:
0493: /**
0494: * Returns the editor settings of the user.<p>
0495: *
0496: * @return the editor settings of the user
0497: */
0498: public Map getEditorSettings() {
0499:
0500: return m_editorSettings;
0501: }
0502:
0503: /**
0504: * Returns the style of the explorer buttons of the user.<p>
0505: *
0506: * @return the style of the explorer buttons of the user
0507: */
0508: public int getExplorerButtonStyle() {
0509:
0510: return m_explorerButtonStyle;
0511: }
0512:
0513: /**
0514: * Returns the number of displayed files per page of the user.<p>
0515: *
0516: * @return the number of displayed files per page of the user
0517: */
0518: public int getExplorerFileEntries() {
0519:
0520: return m_explorerFileEntries;
0521: }
0522:
0523: /**
0524: * Returns the explorer start settings.<p>
0525: *
0526: * @return the explorer start settings
0527: */
0528: public int getExplorerSettings() {
0529:
0530: return m_explorerSettings;
0531: }
0532:
0533: /**
0534: * Returns the exporerFileEntryOptions.<p>
0535: *
0536: * @return the exporerFileEntryOptions
0537: */
0538: public String getExporerFileEntryOptions() {
0539:
0540: return m_exporerFileEntryOptions;
0541: }
0542:
0543: /**
0544: * Returns the locale of the user.<p>
0545: *
0546: * @return the locale of the user
0547: */
0548: public Locale getLocale() {
0549:
0550: return m_locale;
0551: }
0552:
0553: /**
0554: * Returns <code>{@link Boolean#TRUE}</code> if the "create index page" check box in the new folder
0555: * dialog should be initially be checked. <p>
0556: *
0557: * @return <code>{@link Boolean#TRUE}</code> if the "create index page" check box in the new folder
0558: * dialog should be initially be checked.
0559: */
0560: public Boolean getNewFolderCreateIndexPage() {
0561:
0562: return m_newFolderCreateIndexPage;
0563: }
0564:
0565: /**
0566: * Returns <code>{@link Boolean#TRUE}</code> if the "edit properties" check box in the new folder
0567: * dialog should be initially be checked. <p>
0568: *
0569: * @return <code>{@link Boolean#TRUE}</code> if the "edit properties" check box in the new folder
0570: * dialog should be initially be checked.
0571: */
0572: public Boolean getNewFolderEditProperties() {
0573:
0574: return m_newFolderEditProperties;
0575: }
0576:
0577: /**
0578: * Returns the preferred editor for the given resource type of the user.<p>
0579: *
0580: * @param resourceType the resource type
0581: * @return the preferred editor for the resource type or null, if not specified
0582: */
0583: public String getPreferredEditor(String resourceType) {
0584:
0585: return (String) m_editorSettings.get(resourceType);
0586: }
0587:
0588: /**
0589: * Returns the appearance of the "publish project" button.<p>
0590: *
0591: * This can be either {@link CmsDefaultUserSettings#PUBLISHBUTTON_SHOW_ALWAYS},
0592: * {@link CmsDefaultUserSettings#PUBLISHBUTTON_SHOW_AUTO} or
0593: * {@link CmsDefaultUserSettings#PUBLISHBUTTON_SHOW_NEVER}.<p>
0594: *
0595: * @return the appearance of the "publish project" button
0596: */
0597: public String getPublishButtonAppearance() {
0598:
0599: return m_publishButtonAppearance;
0600: }
0601:
0602: /**
0603: * Sets if the explorer view is restricted to the defined site and folder.<p>
0604: *
0605: * @return true if the explorer view is restricted, otherwise false
0606: */
0607: public boolean getRestrictExplorerView() {
0608:
0609: return m_restrictExplorerView;
0610: }
0611:
0612: /**
0613: * Returns <code>true</code> if the file upload button should be shown or <code>false</code> otherwise.<p>
0614: *
0615: * @return the showFileUpload
0616: */
0617: public boolean getShowFileUploadButton() {
0618:
0619: return m_showFileUploadButton;
0620: }
0621:
0622: /**
0623: * Returns if the publish notifications should be shown or not.<p>
0624: *
0625: * @return true if the publish notifications should be shown, otherwise false
0626: */
0627: public boolean getShowPublishNotification() {
0628:
0629: return m_showPublishNotification;
0630: }
0631:
0632: /**
0633: * Returns <code>{@link Boolean#TRUE}</code> if the resource type selection dialog should
0634: * be shown in the file upload process (non - applet version). <p>
0635: *
0636: * @return <code>{@link Boolean#TRUE}</code> if the resource type selection dialog should
0637: * be shown in the file upload process (non - applet version).
0638: */
0639: public Boolean getShowUploadTypeDialog() {
0640:
0641: return m_showUploadTypeDialog;
0642: }
0643:
0644: /**
0645: * Returns the start folder of the user.<p>
0646: *
0647: * @return the start folder of the user
0648: */
0649: public String getStartFolder() {
0650:
0651: return m_startFolder;
0652: }
0653:
0654: /**
0655: * Returns the start project of the user.<p>
0656: *
0657: * @return the start project of the user
0658: */
0659: public String getStartProject() {
0660:
0661: return m_project;
0662: }
0663:
0664: /**
0665: * Returns the start site of the user.<p>
0666: *
0667: * @return the start site of the user
0668: */
0669: public String getStartSite() {
0670:
0671: return m_startSite;
0672: }
0673:
0674: /**
0675: * Returns the current start view of the user.<p>
0676: *
0677: * @return the current start view of the user
0678: */
0679: public String getStartView() {
0680:
0681: return m_view;
0682: }
0683:
0684: /**
0685: * Returns the (optional) workplace synchronize settings.<p>
0686: *
0687: * @return the (optional) workplace synchronize settings
0688: */
0689: public CmsSynchronizeSettings getSynchronizeSettings() {
0690:
0691: return m_synchronizeSettings;
0692: }
0693:
0694: /**
0695: * Returns the current users time warp time, or
0696: * {@link org.opencms.main.CmsContextInfo#CURRENT_TIME} if this feature is disabled and the current time
0697: * is used for each user request.<p>
0698: *
0699: * @return the current users time warp time, or
0700: * {@link org.opencms.main.CmsContextInfo#CURRENT_TIME} if this feature is disabled
0701: */
0702: public long getTimeWarp() {
0703:
0704: return m_timeWarp;
0705: }
0706:
0707: /**
0708: * Returns the folder path of the upload applet on the client machine.<p>
0709: *
0710: * @return the folder path of the upload applet on the client machine
0711: */
0712: public String getUploadAppletClientFolder() {
0713:
0714: return m_uploadAppletClientFolder;
0715: }
0716:
0717: /**
0718: * Returns the current user for the settings.<p>
0719: *
0720: * @return the CmsUser
0721: */
0722: public CmsUser getUser() {
0723:
0724: return m_user;
0725: }
0726:
0727: /**
0728: * Returns the style of the workplace buttons of the user.<p>
0729: *
0730: * @return the style of the workplace buttons of the user
0731: */
0732: public int getWorkplaceButtonStyle() {
0733:
0734: return m_workplaceButtonStyle;
0735: }
0736:
0737: /**
0738: * Returns the type of the report (simple or extended) of the user.<p>
0739: *
0740: * @return the type of the report (simple or extended) of the user
0741: */
0742: public String getWorkplaceReportType() {
0743:
0744: return m_workplaceReportType;
0745: }
0746:
0747: /**
0748: * Returns the name of the search index to use in the workplace.<p>
0749: *
0750: * @return the name of the search index to use in the workplace
0751: */
0752: public String getWorkplaceSearchIndexName() {
0753:
0754: return m_workplaceSearchIndexName;
0755: }
0756:
0757: /**
0758: * Returns the workplace search result list view style.<p>
0759: *
0760: * @return the workplace search result list view style
0761: */
0762: public CmsSearchResultStyle getWorkplaceSearchViewStyle() {
0763:
0764: return m_workplaceSearchViewStyle;
0765: }
0766:
0767: /**
0768: * Initializes the user settings with the given users setting parameters.<p>
0769: *
0770: * @param user the current CmsUser
0771: */
0772: public void init(CmsUser user) {
0773:
0774: m_user = user;
0775:
0776: // try to initialize the User Settings with the values stored in the user object.
0777: // if no values are found, the default user settings will be used.
0778:
0779: // workplace button style
0780: try {
0781: m_workplaceButtonStyle = ((Integer) m_user
0782: .getAdditionalInfo(PREFERENCES
0783: + CmsWorkplaceConfiguration.N_WORKPLACEGENERALOPTIONS
0784: + CmsWorkplaceConfiguration.N_BUTTONSTYLE))
0785: .intValue();
0786: } catch (Throwable t) {
0787: m_workplaceButtonStyle = OpenCms.getWorkplaceManager()
0788: .getDefaultUserSettings().getWorkplaceButtonStyle();
0789: }
0790: // workplace time warp setting
0791: Object timeWarpObj = m_user
0792: .getAdditionalInfo(ADDITIONAL_INFO_TIMEWARP);
0793: try {
0794: m_timeWarp = ((Long) timeWarpObj).longValue();
0795: } catch (ClassCastException e) {
0796: try {
0797: m_timeWarp = Long.parseLong((String) timeWarpObj);
0798: } catch (Throwable t) {
0799: m_timeWarp = CmsContextInfo.CURRENT_TIME;
0800: }
0801: } catch (Throwable t) {
0802: m_timeWarp = CmsContextInfo.CURRENT_TIME;
0803: }
0804: // workplace report type
0805: m_workplaceReportType = (String) m_user
0806: .getAdditionalInfo(PREFERENCES
0807: + CmsWorkplaceConfiguration.N_WORKPLACEGENERALOPTIONS
0808: + CmsWorkplaceConfiguration.N_REPORTTYPE);
0809: if (m_workplaceReportType == null) {
0810: m_workplaceReportType = OpenCms.getWorkplaceManager()
0811: .getDefaultUserSettings().getWorkplaceReportType();
0812: }
0813: // workplace upload applet mode
0814: try {
0815: m_showPublishNotification = ((Boolean) m_user
0816: .getAdditionalInfo(PREFERENCES
0817: + CmsWorkplaceConfiguration.N_WORKPLACEGENERALOPTIONS
0818: + CmsWorkplaceConfiguration.N_PUBLISHNOTIFICATION))
0819: .booleanValue();
0820: } catch (Throwable t) {
0821: m_showPublishNotification = OpenCms.getWorkplaceManager()
0822: .getDefaultUserSettings()
0823: .getShowPublishNotification();
0824: }
0825: // workplace show publish notification
0826: try {
0827: m_uploadApplet = ((Boolean) m_user
0828: .getAdditionalInfo(PREFERENCES
0829: + CmsWorkplaceConfiguration.N_WORKPLACEGENERALOPTIONS
0830: + CmsWorkplaceConfiguration.N_UPLOADAPPLET))
0831: .booleanValue();
0832: } catch (Throwable t) {
0833: m_uploadApplet = OpenCms.getWorkplaceManager()
0834: .getDefaultUserSettings().useUploadApplet();
0835: }
0836: // locale
0837: Object obj = m_user.getAdditionalInfo(PREFERENCES
0838: + CmsWorkplaceConfiguration.N_WORKPLACESTARTUPSETTINGS
0839: + CmsWorkplaceConfiguration.N_LOCALE);
0840: if (obj == null) {
0841: m_locale = null;
0842: } else {
0843: m_locale = CmsLocaleManager.getLocale(String.valueOf(obj));
0844: }
0845: if (m_locale == null) {
0846: m_locale = OpenCms.getWorkplaceManager()
0847: .getDefaultUserSettings().getLocale();
0848: }
0849: // start project
0850: try {
0851: m_project = (String) m_user
0852: .getAdditionalInfo(PREFERENCES
0853: + CmsWorkplaceConfiguration.N_WORKPLACESTARTUPSETTINGS
0854: + CmsWorkplaceConfiguration.N_PROJECT);
0855: } catch (Throwable t) {
0856: m_project = null;
0857: }
0858: if (m_project == null) {
0859: m_project = OpenCms.getWorkplaceManager()
0860: .getDefaultUserSettings().getStartProject();
0861: String ou = user.getOuFqn();
0862: if (ou == null) {
0863: ou = "";
0864: }
0865: m_project = user.getOuFqn() + m_project;
0866: }
0867: // start view
0868: m_view = (String) m_user.getAdditionalInfo(PREFERENCES
0869: + CmsWorkplaceConfiguration.N_WORKPLACESTARTUPSETTINGS
0870: + CmsWorkplaceConfiguration.N_WORKPLACEVIEW);
0871: if (m_view == null) {
0872: m_view = OpenCms.getWorkplaceManager()
0873: .getDefaultUserSettings().getStartView();
0874: }
0875: // explorer button style
0876: try {
0877: m_explorerButtonStyle = ((Integer) m_user
0878: .getAdditionalInfo(PREFERENCES
0879: + CmsWorkplaceConfiguration.N_EXPLORERGENERALOPTIONS
0880: + CmsWorkplaceConfiguration.N_BUTTONSTYLE))
0881: .intValue();
0882: } catch (Throwable t) {
0883: m_explorerButtonStyle = OpenCms.getWorkplaceManager()
0884: .getDefaultUserSettings().getExplorerButtonStyle();
0885: }
0886: // explorer file entries
0887: try {
0888: m_explorerFileEntries = ((Integer) m_user
0889: .getAdditionalInfo(PREFERENCES
0890: + CmsWorkplaceConfiguration.N_EXPLORERGENERALOPTIONS
0891: + CmsWorkplaceConfiguration.N_ENTRIES))
0892: .intValue();
0893: } catch (Throwable t) {
0894: m_explorerFileEntries = OpenCms.getWorkplaceManager()
0895: .getDefaultUserSettings().getExplorerFileEntries();
0896: }
0897: // explorer settings
0898: try {
0899: m_explorerSettings = ((Integer) m_user
0900: .getAdditionalInfo(PREFERENCES
0901: + CmsWorkplaceConfiguration.N_EXPLORERGENERALOPTIONS
0902: + CmsWorkplaceConfiguration.N_EXPLORERDISPLAYOPTIONS))
0903: .intValue();
0904: } catch (Throwable t) {
0905: m_explorerSettings = OpenCms.getWorkplaceManager()
0906: .getDefaultUserSettings().getExplorerSettings();
0907: }
0908: // dialog file copy mode
0909: try {
0910: m_dialogFileCopy = CmsResourceCopyMode
0911: .valueOf(((Integer) m_user
0912: .getAdditionalInfo(PREFERENCES
0913: + CmsWorkplaceConfiguration.N_DIALOGSDEFAULTSETTINGS
0914: + CmsWorkplaceConfiguration.N_FILECOPY))
0915: .intValue());
0916: } catch (Throwable t) {
0917: m_dialogFileCopy = OpenCms.getWorkplaceManager()
0918: .getDefaultUserSettings().getDialogCopyFileMode();
0919: }
0920: // dialog folder copy mode
0921: try {
0922: m_dialogFolderCopy = CmsResourceCopyMode
0923: .valueOf(((Integer) m_user
0924: .getAdditionalInfo(PREFERENCES
0925: + CmsWorkplaceConfiguration.N_DIALOGSDEFAULTSETTINGS
0926: + CmsWorkplaceConfiguration.N_FOLDERCOPY))
0927: .intValue());
0928: } catch (Throwable t) {
0929: m_dialogFolderCopy = OpenCms.getWorkplaceManager()
0930: .getDefaultUserSettings().getDialogCopyFolderMode();
0931: }
0932: // dialog file delete mode
0933: try {
0934: m_dialogFileDelete = CmsResourceDeleteMode
0935: .valueOf(((Integer) m_user
0936: .getAdditionalInfo(PREFERENCES
0937: + CmsWorkplaceConfiguration.N_DIALOGSDEFAULTSETTINGS
0938: + CmsWorkplaceConfiguration.N_FILEDELETION))
0939: .intValue());
0940: } catch (Throwable t) {
0941: m_dialogFileDelete = OpenCms.getWorkplaceManager()
0942: .getDefaultUserSettings().getDialogDeleteFileMode();
0943: }
0944: // dialog direct publish mode
0945: try {
0946: m_dialogDirectpublish = ((Boolean) m_user
0947: .getAdditionalInfo(PREFERENCES
0948: + CmsWorkplaceConfiguration.N_DIALOGSDEFAULTSETTINGS
0949: + CmsWorkplaceConfiguration.N_DIRECTPUBLISH))
0950: .booleanValue();
0951: } catch (Throwable t) {
0952: m_dialogDirectpublish = OpenCms.getWorkplaceManager()
0953: .getDefaultUserSettings()
0954: .getDialogPublishSiblings();
0955: }
0956: // dialog show lock mode
0957: try {
0958: m_showLock = ((Boolean) m_user
0959: .getAdditionalInfo(PREFERENCES
0960: + CmsWorkplaceConfiguration.N_DIALOGSDEFAULTSETTINGS
0961: + CmsWorkplaceConfiguration.N_SHOWLOCK))
0962: .booleanValue();
0963: } catch (Throwable t) {
0964: m_showLock = OpenCms.getWorkplaceManager()
0965: .getDefaultUserSettings().getDialogShowLock();
0966: }
0967: // dialog show export settings mode
0968: try {
0969: m_showExportSettings = ((Boolean) m_user
0970: .getAdditionalInfo(PREFERENCES
0971: + CmsWorkplaceConfiguration.N_DIALOGSDEFAULTSETTINGS
0972: + CmsWorkplaceConfiguration.N_SHOWEXPORTSETTINGS))
0973: .booleanValue();
0974: } catch (Throwable t) {
0975: m_showExportSettings = OpenCms.getWorkplaceManager()
0976: .getDefaultUserSettings()
0977: .getDialogShowExportSettings();
0978: }
0979: // dialog permissions inheriting mode
0980: try {
0981: m_dialogPermissionsInheritOnFolder = ((Boolean) m_user
0982: .getAdditionalInfo(PREFERENCES
0983: + CmsWorkplaceConfiguration.N_DIALOGSDEFAULTSETTINGS
0984: + CmsWorkplaceConfiguration.N_PERMISSIONSINHERITONFOLDER))
0985: .booleanValue();
0986: } catch (Throwable t) {
0987: m_dialogPermissionsInheritOnFolder = OpenCms
0988: .getWorkplaceManager().getDefaultUserSettings()
0989: .getDialogPermissionsInheritOnFolder();
0990: }
0991: // dialog expand inherited permissions mode
0992: try {
0993: m_dialogExpandInheritedPermissions = ((Boolean) m_user
0994: .getAdditionalInfo(PREFERENCES
0995: + CmsWorkplaceConfiguration.N_DIALOGSDEFAULTSETTINGS
0996: + CmsWorkplaceConfiguration.N_EXPANDPERMISSIONSINHERITED))
0997: .booleanValue();
0998: } catch (Throwable t) {
0999: m_dialogExpandInheritedPermissions = OpenCms
1000: .getWorkplaceManager().getDefaultUserSettings()
1001: .getDialogExpandInheritedPermissions();
1002: }
1003: // dialog expand users permissions mode
1004: try {
1005: m_dialogExpandUserPermissions = ((Boolean) m_user
1006: .getAdditionalInfo(PREFERENCES
1007: + CmsWorkplaceConfiguration.N_DIALOGSDEFAULTSETTINGS
1008: + CmsWorkplaceConfiguration.N_EXPANDPERMISSIONSUSER))
1009: .booleanValue();
1010: } catch (Throwable t) {
1011: m_dialogExpandUserPermissions = OpenCms
1012: .getWorkplaceManager().getDefaultUserSettings()
1013: .getDialogExpandUserPermissions();
1014: }
1015: // editor button style
1016: try {
1017: m_editorButtonStyle = ((Integer) m_user
1018: .getAdditionalInfo(PREFERENCES
1019: + CmsWorkplaceConfiguration.N_EDITORGENERALOPTIONS
1020: + CmsWorkplaceConfiguration.N_BUTTONSTYLE))
1021: .intValue();
1022: } catch (Throwable t) {
1023: m_editorButtonStyle = OpenCms.getWorkplaceManager()
1024: .getDefaultUserSettings().getEditorButtonStyle();
1025: }
1026: // direct edit button style
1027: try {
1028: m_directeditButtonStyle = ((Integer) m_user
1029: .getAdditionalInfo(PREFERENCES
1030: + CmsWorkplaceConfiguration.N_EDITORGENERALOPTIONS
1031: + CmsWorkplaceConfiguration.N_DIRECTEDITSTYLE))
1032: .intValue();
1033: } catch (Throwable t) {
1034: m_directeditButtonStyle = OpenCms.getWorkplaceManager()
1035: .getDefaultUserSettings()
1036: .getDirectEditButtonStyle();
1037: }
1038: // editor settings
1039: m_editorSettings = new TreeMap();
1040: Iterator itKeys = m_user.getAdditionalInfo().keySet()
1041: .iterator();
1042: while (itKeys.hasNext()) {
1043: String key = (String) itKeys.next();
1044: if (key
1045: .startsWith(PREFERENCES
1046: + CmsWorkplaceConfiguration.N_EDITORPREFERREDEDITORS)) {
1047: String editKey = key
1048: .substring((PREFERENCES + CmsWorkplaceConfiguration.N_EDITORPREFERREDEDITORS)
1049: .length());
1050: m_editorSettings.put(editKey, m_user
1051: .getAdditionalInfo(key));
1052: }
1053: }
1054: if (m_editorSettings.isEmpty()) {
1055: m_editorSettings = new TreeMap(OpenCms
1056: .getWorkplaceManager().getDefaultUserSettings()
1057: .getEditorSettings());
1058: }
1059: // start site
1060: m_startSite = (String) m_user.getAdditionalInfo(PREFERENCES
1061: + CmsWorkplaceConfiguration.N_WORKPLACESTARTUPSETTINGS
1062: + I_CmsXmlConfiguration.N_SITE);
1063: if (m_startSite == null) {
1064: m_startSite = OpenCms.getWorkplaceManager()
1065: .getDefaultUserSettings().getStartSite();
1066: }
1067: // start folder
1068: m_startFolder = (String) m_user.getAdditionalInfo(PREFERENCES
1069: + CmsWorkplaceConfiguration.N_WORKPLACESTARTUPSETTINGS
1070: + CmsWorkplaceConfiguration.N_FOLDER);
1071: if (m_startFolder == null) {
1072: m_startFolder = OpenCms.getWorkplaceManager()
1073: .getDefaultUserSettings().getStartFolder();
1074: }
1075: // restrict explorer folder view
1076: try {
1077: m_restrictExplorerView = ((Boolean) m_user
1078: .getAdditionalInfo(PREFERENCES
1079: + CmsWorkplaceConfiguration.N_WORKPLACESTARTUPSETTINGS
1080: + CmsWorkplaceConfiguration.N_RESTRICTEXPLORERVIEW))
1081: .booleanValue();
1082: } catch (Throwable t) {
1083: m_restrictExplorerView = OpenCms.getWorkplaceManager()
1084: .getDefaultUserSettings().getRestrictExplorerView();
1085: }
1086: // workplace search
1087: m_workplaceSearchIndexName = OpenCms.getWorkplaceManager()
1088: .getDefaultUserSettings().getWorkplaceSearchIndexName();
1089:
1090: m_workplaceSearchViewStyle = CmsSearchResultStyle
1091: .valueOf((String) m_user.getAdditionalInfo(PREFERENCES
1092: + CmsWorkplaceConfiguration.N_WORKPLACESEARCH
1093: + CmsWorkplaceConfiguration.N_SEARCHVIEWSTYLE));
1094: if (m_workplaceSearchViewStyle == null) {
1095: m_workplaceSearchViewStyle = OpenCms.getWorkplaceManager()
1096: .getDefaultUserSettings()
1097: .getWorkplaceSearchViewStyle();
1098: }
1099: // synchronize settings
1100: try {
1101: boolean enabled = ((Boolean) m_user
1102: .getAdditionalInfo(PREFERENCES + SYNC_SETTINGS
1103: + SYNC_ENABLED)).booleanValue();
1104: String destination = (String) m_user
1105: .getAdditionalInfo(PREFERENCES + SYNC_SETTINGS
1106: + SYNC_DESTINATION);
1107: List vfsList = CmsStringUtil.splitAsList((String) m_user
1108: .getAdditionalInfo(PREFERENCES + SYNC_SETTINGS
1109: + SYNC_VFS_LIST), '|');
1110: m_synchronizeSettings = new CmsSynchronizeSettings();
1111: m_synchronizeSettings.setEnabled(enabled);
1112: m_synchronizeSettings.setDestinationPathInRfs(destination);
1113: m_synchronizeSettings.setSourceListInVfs(vfsList);
1114: } catch (Throwable t) {
1115: // default is to disable the synchronize settings
1116: m_synchronizeSettings = null;
1117: }
1118: // upload applet client folder path
1119: m_uploadAppletClientFolder = (String) m_user
1120: .getAdditionalInfo(ADDITIONAL_INFO_UPLOADAPPLET_CLIENTFOLDER);
1121:
1122: try {
1123: save(null);
1124: } catch (CmsException e) {
1125: // ignore
1126: if (LOG.isWarnEnabled()) {
1127: LOG.warn(e.getLocalizedMessage(), e);
1128: }
1129: }
1130: }
1131:
1132: /**
1133: * Saves the changed settings of the user to the users {@link CmsUser#getAdditionalInfo()} map.<p>
1134: *
1135: * If the given CmsObject is <code>null</code>, the additional user infos are only updated in memory
1136: * and not saved into the database.<p>
1137: *
1138: * @param cms the CmsObject needed to write the user to the db
1139: *
1140: * @throws CmsException if user cannot be written to the db
1141: */
1142: public void save(CmsObject cms) throws CmsException {
1143:
1144: // only set those values that are different than the default values
1145: // if the user info should be written to the database (if the CmsObject != null)
1146: // all values that are equal to the default values must be deleted from the additional info
1147: // user settings.
1148:
1149: // workplace button style
1150: if (getWorkplaceButtonStyle() != OpenCms.getWorkplaceManager()
1151: .getDefaultUserSettings().getWorkplaceButtonStyle()) {
1152: m_user
1153: .setAdditionalInfo(
1154: PREFERENCES
1155: + CmsWorkplaceConfiguration.N_WORKPLACEGENERALOPTIONS
1156: + CmsWorkplaceConfiguration.N_BUTTONSTYLE,
1157: new Integer(getWorkplaceButtonStyle()));
1158: } else if (cms != null) {
1159: m_user
1160: .deleteAdditionalInfo(PREFERENCES
1161: + CmsWorkplaceConfiguration.N_WORKPLACEGENERALOPTIONS
1162: + CmsWorkplaceConfiguration.N_BUTTONSTYLE);
1163: }
1164: // workplace report type
1165: if (!getWorkplaceReportType().equals(
1166: OpenCms.getWorkplaceManager().getDefaultUserSettings()
1167: .getWorkplaceReportType())) {
1168: m_user
1169: .setAdditionalInfo(
1170: PREFERENCES
1171: + CmsWorkplaceConfiguration.N_WORKPLACEGENERALOPTIONS
1172: + CmsWorkplaceConfiguration.N_REPORTTYPE,
1173: getWorkplaceReportType());
1174: } else if (cms != null) {
1175: m_user
1176: .deleteAdditionalInfo(PREFERENCES
1177: + CmsWorkplaceConfiguration.N_WORKPLACEGENERALOPTIONS
1178: + CmsWorkplaceConfiguration.N_REPORTTYPE);
1179: }
1180: // workplace upload applet
1181: if (useUploadApplet() != OpenCms.getWorkplaceManager()
1182: .getDefaultUserSettings().useUploadApplet()) {
1183: m_user
1184: .setAdditionalInfo(
1185: PREFERENCES
1186: + CmsWorkplaceConfiguration.N_WORKPLACEGENERALOPTIONS
1187: + CmsWorkplaceConfiguration.N_UPLOADAPPLET,
1188: Boolean.valueOf(useUploadApplet()));
1189: } else if (cms != null) {
1190: m_user
1191: .deleteAdditionalInfo(PREFERENCES
1192: + CmsWorkplaceConfiguration.N_WORKPLACEGENERALOPTIONS
1193: + CmsWorkplaceConfiguration.N_UPLOADAPPLET);
1194: }
1195: // publish notification
1196: if (getShowPublishNotification() != OpenCms
1197: .getWorkplaceManager().getDefaultUserSettings()
1198: .getShowPublishNotification()) {
1199: m_user
1200: .setAdditionalInfo(
1201: PREFERENCES
1202: + CmsWorkplaceConfiguration.N_WORKPLACEGENERALOPTIONS
1203: + CmsWorkplaceConfiguration.N_PUBLISHNOTIFICATION,
1204: Boolean
1205: .valueOf(getShowPublishNotification()));
1206: } else if (cms != null) {
1207: m_user
1208: .deleteAdditionalInfo(PREFERENCES
1209: + CmsWorkplaceConfiguration.N_WORKPLACEGENERALOPTIONS
1210: + CmsWorkplaceConfiguration.N_PUBLISHNOTIFICATION);
1211: }
1212: // locale
1213: if (!getLocale().equals(
1214: OpenCms.getWorkplaceManager().getDefaultUserSettings()
1215: .getLocale())) {
1216: m_user
1217: .setAdditionalInfo(
1218: PREFERENCES
1219: + CmsWorkplaceConfiguration.N_WORKPLACESTARTUPSETTINGS
1220: + CmsWorkplaceConfiguration.N_LOCALE,
1221: getLocale().toString());
1222: } else if (cms != null) {
1223: m_user
1224: .deleteAdditionalInfo(PREFERENCES
1225: + CmsWorkplaceConfiguration.N_WORKPLACESTARTUPSETTINGS
1226: + CmsWorkplaceConfiguration.N_LOCALE);
1227: }
1228: // start project
1229: if (!getStartProject().equals(
1230: OpenCms.getWorkplaceManager().getDefaultUserSettings()
1231: .getStartProject())) {
1232: try {
1233: // be sure the project is valid
1234: if (cms != null) {
1235: cms.readProject(getStartProject());
1236: }
1237: m_user
1238: .setAdditionalInfo(
1239: PREFERENCES
1240: + CmsWorkplaceConfiguration.N_WORKPLACESTARTUPSETTINGS
1241: + CmsWorkplaceConfiguration.N_PROJECT,
1242: getStartProject());
1243: } catch (Exception e) {
1244: if (cms != null) {
1245: m_user
1246: .deleteAdditionalInfo(PREFERENCES
1247: + CmsWorkplaceConfiguration.N_WORKPLACESTARTUPSETTINGS
1248: + CmsWorkplaceConfiguration.N_PROJECT);
1249: }
1250: }
1251: } else if (cms != null) {
1252: m_user
1253: .deleteAdditionalInfo(PREFERENCES
1254: + CmsWorkplaceConfiguration.N_WORKPLACESTARTUPSETTINGS
1255: + CmsWorkplaceConfiguration.N_PROJECT);
1256: }
1257: // view
1258: if (!getStartView().equals(
1259: OpenCms.getWorkplaceManager().getDefaultUserSettings()
1260: .getStartView())) {
1261: m_user
1262: .setAdditionalInfo(
1263: PREFERENCES
1264: + CmsWorkplaceConfiguration.N_WORKPLACESTARTUPSETTINGS
1265: + CmsWorkplaceConfiguration.N_WORKPLACEVIEW,
1266: getStartView());
1267: } else if (cms != null) {
1268: m_user
1269: .deleteAdditionalInfo(PREFERENCES
1270: + CmsWorkplaceConfiguration.N_WORKPLACESTARTUPSETTINGS
1271: + CmsWorkplaceConfiguration.N_WORKPLACEVIEW);
1272: }
1273: // start site
1274: if (!getStartSite().equals(
1275: OpenCms.getWorkplaceManager().getDefaultUserSettings()
1276: .getStartSite())) {
1277: m_user
1278: .setAdditionalInfo(
1279: PREFERENCES
1280: + CmsWorkplaceConfiguration.N_WORKPLACESTARTUPSETTINGS
1281: + I_CmsXmlConfiguration.N_SITE,
1282: getStartSite());
1283: } else if (cms != null) {
1284: m_user
1285: .deleteAdditionalInfo(PREFERENCES
1286: + CmsWorkplaceConfiguration.N_WORKPLACESTARTUPSETTINGS
1287: + I_CmsXmlConfiguration.N_SITE);
1288: }
1289: // start folder
1290: if (CmsStringUtil.isNotEmptyOrWhitespaceOnly(getStartFolder())
1291: && !getStartFolder().equals(
1292: OpenCms.getWorkplaceManager()
1293: .getDefaultUserSettings()
1294: .getStartFolder())) {
1295: m_user
1296: .setAdditionalInfo(
1297: PREFERENCES
1298: + CmsWorkplaceConfiguration.N_WORKPLACESTARTUPSETTINGS
1299: + CmsWorkplaceConfiguration.N_FOLDER,
1300: getStartFolder());
1301: } else if (cms != null) {
1302: m_user
1303: .deleteAdditionalInfo(PREFERENCES
1304: + CmsWorkplaceConfiguration.N_WORKPLACESTARTUPSETTINGS
1305: + CmsWorkplaceConfiguration.N_FOLDER);
1306: }
1307: // restrict explorer folder view
1308: if (getRestrictExplorerView() != OpenCms.getWorkplaceManager()
1309: .getDefaultUserSettings().getRestrictExplorerView()) {
1310: m_user
1311: .setAdditionalInfo(
1312: PREFERENCES
1313: + CmsWorkplaceConfiguration.N_WORKPLACESTARTUPSETTINGS
1314: + CmsWorkplaceConfiguration.N_RESTRICTEXPLORERVIEW,
1315: Boolean.valueOf(getRestrictExplorerView()));
1316: } else if (cms != null) {
1317: m_user
1318: .deleteAdditionalInfo(PREFERENCES
1319: + CmsWorkplaceConfiguration.N_WORKPLACESTARTUPSETTINGS
1320: + CmsWorkplaceConfiguration.N_RESTRICTEXPLORERVIEW);
1321: }
1322: // explorer button style
1323: if (getExplorerButtonStyle() != OpenCms.getWorkplaceManager()
1324: .getDefaultUserSettings().getExplorerButtonStyle()) {
1325: m_user
1326: .setAdditionalInfo(
1327: PREFERENCES
1328: + CmsWorkplaceConfiguration.N_EXPLORERGENERALOPTIONS
1329: + CmsWorkplaceConfiguration.N_BUTTONSTYLE,
1330: new Integer(getExplorerButtonStyle()));
1331: } else if (cms != null) {
1332: m_user
1333: .deleteAdditionalInfo(PREFERENCES
1334: + CmsWorkplaceConfiguration.N_EXPLORERGENERALOPTIONS
1335: + CmsWorkplaceConfiguration.N_BUTTONSTYLE);
1336: }
1337: // explorer file entries
1338: if (getExplorerFileEntries() != OpenCms.getWorkplaceManager()
1339: .getDefaultUserSettings().getExplorerFileEntries()) {
1340: m_user
1341: .setAdditionalInfo(
1342: PREFERENCES
1343: + CmsWorkplaceConfiguration.N_EXPLORERGENERALOPTIONS
1344: + CmsWorkplaceConfiguration.N_ENTRIES,
1345: new Integer(getExplorerFileEntries()));
1346: } else if (cms != null) {
1347: m_user
1348: .deleteAdditionalInfo(PREFERENCES
1349: + CmsWorkplaceConfiguration.N_EXPLORERGENERALOPTIONS
1350: + CmsWorkplaceConfiguration.N_ENTRIES);
1351: }
1352: // explorer settings
1353: if (getExplorerSettings() != OpenCms.getWorkplaceManager()
1354: .getDefaultUserSettings().getExplorerSettings()) {
1355: m_user
1356: .setAdditionalInfo(
1357: PREFERENCES
1358: + CmsWorkplaceConfiguration.N_EXPLORERGENERALOPTIONS
1359: + CmsWorkplaceConfiguration.N_EXPLORERDISPLAYOPTIONS,
1360: new Integer(getExplorerSettings()));
1361: } else if (cms != null) {
1362: m_user
1363: .deleteAdditionalInfo(PREFERENCES
1364: + CmsWorkplaceConfiguration.N_EXPLORERGENERALOPTIONS
1365: + CmsWorkplaceConfiguration.N_EXPLORERDISPLAYOPTIONS);
1366: }
1367: // dialog file copy mode
1368: if (getDialogCopyFileMode() != OpenCms.getWorkplaceManager()
1369: .getDefaultUserSettings().getDialogCopyFileMode()) {
1370: m_user
1371: .setAdditionalInfo(
1372: PREFERENCES
1373: + CmsWorkplaceConfiguration.N_DIALOGSDEFAULTSETTINGS
1374: + CmsWorkplaceConfiguration.N_FILECOPY,
1375: new Integer(getDialogCopyFileMode()
1376: .getMode()));
1377: } else if (cms != null) {
1378: m_user
1379: .deleteAdditionalInfo(PREFERENCES
1380: + CmsWorkplaceConfiguration.N_DIALOGSDEFAULTSETTINGS
1381: + CmsWorkplaceConfiguration.N_FILECOPY);
1382: }
1383: // dialog folder copy mode
1384: if (getDialogCopyFolderMode() != OpenCms.getWorkplaceManager()
1385: .getDefaultUserSettings().getDialogCopyFolderMode()) {
1386: m_user
1387: .setAdditionalInfo(
1388: PREFERENCES
1389: + CmsWorkplaceConfiguration.N_DIALOGSDEFAULTSETTINGS
1390: + CmsWorkplaceConfiguration.N_FOLDERCOPY,
1391: new Integer(getDialogCopyFolderMode()
1392: .getMode()));
1393: } else if (cms != null) {
1394: m_user
1395: .deleteAdditionalInfo(PREFERENCES
1396: + CmsWorkplaceConfiguration.N_DIALOGSDEFAULTSETTINGS
1397: + CmsWorkplaceConfiguration.N_FOLDERCOPY);
1398: }
1399: // dialog file delete mode
1400: if (getDialogDeleteFileMode() != OpenCms.getWorkplaceManager()
1401: .getDefaultUserSettings().getDialogDeleteFileMode()) {
1402: m_user
1403: .setAdditionalInfo(
1404: PREFERENCES
1405: + CmsWorkplaceConfiguration.N_DIALOGSDEFAULTSETTINGS
1406: + CmsWorkplaceConfiguration.N_FILEDELETION,
1407: new Integer(getDialogDeleteFileMode()
1408: .getMode()));
1409: } else if (cms != null) {
1410: m_user
1411: .deleteAdditionalInfo(PREFERENCES
1412: + CmsWorkplaceConfiguration.N_DIALOGSDEFAULTSETTINGS
1413: + CmsWorkplaceConfiguration.N_FILEDELETION);
1414: }
1415: // dialog direct publish mode
1416: if (getDialogPublishSiblings() != OpenCms.getWorkplaceManager()
1417: .getDefaultUserSettings().getDialogPublishSiblings()) {
1418: m_user
1419: .setAdditionalInfo(
1420: PREFERENCES
1421: + CmsWorkplaceConfiguration.N_DIALOGSDEFAULTSETTINGS
1422: + CmsWorkplaceConfiguration.N_DIRECTPUBLISH,
1423: Boolean.valueOf(getDialogPublishSiblings()));
1424: } else if (cms != null) {
1425: m_user
1426: .deleteAdditionalInfo(PREFERENCES
1427: + CmsWorkplaceConfiguration.N_DIALOGSDEFAULTSETTINGS
1428: + CmsWorkplaceConfiguration.N_DIRECTPUBLISH);
1429: }
1430: // dialog show lock mode
1431: if (getDialogShowLock() != OpenCms.getWorkplaceManager()
1432: .getDefaultUserSettings().getDialogShowLock()) {
1433: m_user
1434: .setAdditionalInfo(
1435: PREFERENCES
1436: + CmsWorkplaceConfiguration.N_DIALOGSDEFAULTSETTINGS
1437: + CmsWorkplaceConfiguration.N_SHOWLOCK,
1438: Boolean.valueOf(getDialogShowLock()));
1439: } else if (cms != null) {
1440: m_user
1441: .deleteAdditionalInfo(PREFERENCES
1442: + CmsWorkplaceConfiguration.N_DIALOGSDEFAULTSETTINGS
1443: + CmsWorkplaceConfiguration.N_SHOWLOCK);
1444: }
1445: // dialog permissions inheritation mode
1446: if (getDialogPermissionsInheritOnFolder() != OpenCms
1447: .getWorkplaceManager().getDefaultUserSettings()
1448: .getDialogPermissionsInheritOnFolder()) {
1449: m_user
1450: .setAdditionalInfo(
1451: PREFERENCES
1452: + CmsWorkplaceConfiguration.N_DIALOGSDEFAULTSETTINGS
1453: + CmsWorkplaceConfiguration.N_PERMISSIONSINHERITONFOLDER,
1454: Boolean
1455: .valueOf(getDialogPermissionsInheritOnFolder()));
1456: } else if (cms != null) {
1457: m_user
1458: .deleteAdditionalInfo(PREFERENCES
1459: + CmsWorkplaceConfiguration.N_DIALOGSDEFAULTSETTINGS
1460: + CmsWorkplaceConfiguration.N_PERMISSIONSINHERITONFOLDER);
1461: }
1462: // dialog expand inherited permissions mode
1463: if (getDialogExpandInheritedPermissions() != OpenCms
1464: .getWorkplaceManager().getDefaultUserSettings()
1465: .getDialogExpandInheritedPermissions()) {
1466: m_user
1467: .setAdditionalInfo(
1468: PREFERENCES
1469: + CmsWorkplaceConfiguration.N_DIALOGSDEFAULTSETTINGS
1470: + CmsWorkplaceConfiguration.N_EXPANDPERMISSIONSINHERITED,
1471: Boolean
1472: .valueOf(getDialogExpandInheritedPermissions()));
1473: } else if (cms != null) {
1474: m_user
1475: .deleteAdditionalInfo(PREFERENCES
1476: + CmsWorkplaceConfiguration.N_DIALOGSDEFAULTSETTINGS
1477: + CmsWorkplaceConfiguration.N_EXPANDPERMISSIONSINHERITED);
1478: }
1479: // dialog expand users permissions mode
1480: if (getDialogExpandUserPermissions() != OpenCms
1481: .getWorkplaceManager().getDefaultUserSettings()
1482: .getDialogExpandUserPermissions()) {
1483: m_user
1484: .setAdditionalInfo(
1485: PREFERENCES
1486: + CmsWorkplaceConfiguration.N_DIALOGSDEFAULTSETTINGS
1487: + CmsWorkplaceConfiguration.N_EXPANDPERMISSIONSUSER,
1488: Boolean
1489: .valueOf(getDialogExpandUserPermissions()));
1490: } else if (cms != null) {
1491: m_user
1492: .deleteAdditionalInfo(PREFERENCES
1493: + CmsWorkplaceConfiguration.N_DIALOGSDEFAULTSETTINGS
1494: + CmsWorkplaceConfiguration.N_EXPANDPERMISSIONSUSER);
1495: }
1496: // editor button style
1497: if (getEditorButtonStyle() != OpenCms.getWorkplaceManager()
1498: .getDefaultUserSettings().getEditorButtonStyle()) {
1499: m_user.setAdditionalInfo(PREFERENCES
1500: + CmsWorkplaceConfiguration.N_EDITORGENERALOPTIONS
1501: + CmsWorkplaceConfiguration.N_BUTTONSTYLE,
1502: new Integer(getEditorButtonStyle()));
1503: } else if (cms != null) {
1504: m_user.deleteAdditionalInfo(PREFERENCES
1505: + CmsWorkplaceConfiguration.N_EDITORGENERALOPTIONS
1506: + CmsWorkplaceConfiguration.N_BUTTONSTYLE);
1507: }
1508: // direct edit button style
1509: if (getDirectEditButtonStyle() != OpenCms.getWorkplaceManager()
1510: .getDefaultUserSettings().getDirectEditButtonStyle()) {
1511: m_user.setAdditionalInfo(PREFERENCES
1512: + CmsWorkplaceConfiguration.N_EDITORGENERALOPTIONS
1513: + CmsWorkplaceConfiguration.N_DIRECTEDITSTYLE,
1514: new Integer(getDirectEditButtonStyle()));
1515: } else if (cms != null) {
1516: m_user.deleteAdditionalInfo(PREFERENCES
1517: + CmsWorkplaceConfiguration.N_EDITORGENERALOPTIONS
1518: + CmsWorkplaceConfiguration.N_DIRECTEDITSTYLE);
1519: }
1520: // editor settings
1521: if (m_editorSettings.size() > 0) {
1522: Iterator itEntries = m_editorSettings.entrySet().iterator();
1523: while (itEntries.hasNext()) {
1524: Map.Entry entry = (Map.Entry) itEntries.next();
1525: if (entry.getValue() != null) {
1526: m_user
1527: .setAdditionalInfo(
1528: PREFERENCES
1529: + CmsWorkplaceConfiguration.N_EDITORPREFERREDEDITORS
1530: + entry.getKey(), entry
1531: .getValue().toString());
1532: } else {
1533: m_user
1534: .deleteAdditionalInfo(PREFERENCES
1535: + CmsWorkplaceConfiguration.N_EDITORPREFERREDEDITORS
1536: + entry.getKey());
1537: }
1538: }
1539: } else if (cms != null) {
1540: Iterator itKeys = m_user.getAdditionalInfo().keySet()
1541: .iterator();
1542: while (itKeys.hasNext()) {
1543: String key = (String) itKeys.next();
1544: if (key
1545: .startsWith(PREFERENCES
1546: + CmsWorkplaceConfiguration.N_EDITORPREFERREDEDITORS)) {
1547: m_user.deleteAdditionalInfo(key);
1548: }
1549: }
1550: }
1551: // workplace search
1552: if (getWorkplaceSearchViewStyle() != null) {
1553: m_user.setAdditionalInfo(PREFERENCES
1554: + CmsWorkplaceConfiguration.N_WORKPLACESEARCH
1555: + CmsWorkplaceConfiguration.N_SEARCHVIEWSTYLE,
1556: getWorkplaceSearchViewStyle().toString());
1557: }
1558: // synchronize settings
1559: if (getSynchronizeSettings() != null) {
1560: m_user.setAdditionalInfo(PREFERENCES + SYNC_SETTINGS
1561: + SYNC_ENABLED, Boolean
1562: .valueOf(getSynchronizeSettings().isEnabled()));
1563: m_user.setAdditionalInfo(PREFERENCES + SYNC_SETTINGS
1564: + SYNC_DESTINATION, getSynchronizeSettings()
1565: .getDestinationPathInRfs());
1566: m_user
1567: .setAdditionalInfo(PREFERENCES + SYNC_SETTINGS
1568: + SYNC_VFS_LIST, CmsStringUtil
1569: .collectionAsString(
1570: getSynchronizeSettings()
1571: .getSourceListInVfs(), "|"));
1572: } else {
1573: m_user.deleteAdditionalInfo(PREFERENCES + SYNC_SETTINGS
1574: + SYNC_ENABLED);
1575: m_user.deleteAdditionalInfo(PREFERENCES + SYNC_SETTINGS
1576: + SYNC_DESTINATION);
1577: m_user.deleteAdditionalInfo(PREFERENCES + SYNC_SETTINGS
1578: + SYNC_VFS_LIST);
1579: }
1580: // upload applet client folder path
1581: if (CmsStringUtil
1582: .isNotEmptyOrWhitespaceOnly(m_uploadAppletClientFolder)) {
1583: m_user.setAdditionalInfo(
1584: ADDITIONAL_INFO_UPLOADAPPLET_CLIENTFOLDER,
1585: m_uploadAppletClientFolder);
1586: } else {
1587: m_user
1588: .deleteAdditionalInfo(ADDITIONAL_INFO_UPLOADAPPLET_CLIENTFOLDER);
1589: }
1590: // workplace user surf time (time warp)
1591: if (getTimeWarp() != CmsContextInfo.CURRENT_TIME) {
1592: m_user.setAdditionalInfo(ADDITIONAL_INFO_TIMEWARP,
1593: new Long(getTimeWarp()));
1594: } else if (cms != null) {
1595: m_user.deleteAdditionalInfo(ADDITIONAL_INFO_TIMEWARP);
1596: }
1597:
1598: // only write the updated user to the DB if we have the cms object
1599: if (cms != null) {
1600: cms.writeUser(m_user);
1601: }
1602: }
1603:
1604: /**
1605: * Sets the default copy mode when copying a file of the user.<p>
1606: *
1607: * @param mode the default copy mode when copying a file of the user
1608: */
1609: public void setDialogCopyFileMode(CmsResourceCopyMode mode) {
1610:
1611: m_dialogFileCopy = mode;
1612: }
1613:
1614: /**
1615: * Sets the default copy mode when copying a folder of the user.<p>
1616: *
1617: * @param mode the default copy mode when copying a folder of the user
1618: */
1619: public void setDialogCopyFolderMode(CmsResourceCopyMode mode) {
1620:
1621: m_dialogFolderCopy = mode;
1622: }
1623:
1624: /**
1625: * Sets the default setting for file deletion.<p>
1626: *
1627: * @param mode the default setting for file deletion
1628: */
1629: public void setDialogDeleteFileMode(CmsResourceDeleteMode mode) {
1630:
1631: m_dialogFileDelete = mode;
1632: }
1633:
1634: /**
1635: * Sets the default setting for expanding inherited permissions in the dialog.<p>
1636: *
1637: * @param dialogShowInheritedPermissions the default setting for expanding inherited permissions in the dialog
1638: */
1639: public void setDialogExpandInheritedPermissions(
1640: boolean dialogShowInheritedPermissions) {
1641:
1642: m_dialogExpandInheritedPermissions = dialogShowInheritedPermissions;
1643: }
1644:
1645: /**
1646: * Sets the default setting for expanding the users permissions in the dialog.<p>
1647: *
1648: * @param dialogShowUserPermissions the default setting for expanding the users permissions in the dialog
1649: */
1650: public void setDialogExpandUserPermissions(
1651: boolean dialogShowUserPermissions) {
1652:
1653: m_dialogExpandUserPermissions = dialogShowUserPermissions;
1654: }
1655:
1656: /**
1657: * Sets the default setting for inheriting permissions on folders.<p>
1658: *
1659: * @param dialogPermissionsInheritOnFolder the default setting for inheriting permissions on folders
1660: */
1661: public void setDialogPermissionsInheritOnFolder(
1662: boolean dialogPermissionsInheritOnFolder) {
1663:
1664: m_dialogPermissionsInheritOnFolder = dialogPermissionsInheritOnFolder;
1665: }
1666:
1667: /**
1668: * Sets the default setting for direct publishing.<p>
1669: *
1670: * @param publishSiblings the default setting for direct publishing: true if siblings should be published, otherwise false
1671: */
1672: public void setDialogPublishSiblings(boolean publishSiblings) {
1673:
1674: m_dialogDirectpublish = publishSiblings;
1675: }
1676:
1677: /**
1678: * Sets if the export setting part of the secure/export dialog should be shown.<p>
1679: *
1680: * @param show true if the export dialog should be shown, otherwise false
1681: */
1682: public void setDialogShowExportSettings(boolean show) {
1683:
1684: m_showExportSettings = show;
1685: }
1686:
1687: /**
1688: * Sets if the lock dialog should be shown.<p>
1689: *
1690: * @param show true if the lock dialog should be shown, otherwise false
1691: */
1692: public void setDialogShowLock(boolean show) {
1693:
1694: m_showLock = show;
1695: }
1696:
1697: /**
1698: * Sets the style of the direct edit buttons of the user.<p>
1699: *
1700: * @param style the style of the direct edit buttons of the user
1701: */
1702: public void setDirectEditButtonStyle(int style) {
1703:
1704: m_directeditButtonStyle = style;
1705: }
1706:
1707: /**
1708: * Sets the style of the editor buttons of the user.<p>
1709: *
1710: * @param style the style of the editor buttons of the user
1711: */
1712: public void setEditorButtonStyle(int style) {
1713:
1714: m_editorButtonStyle = style;
1715: }
1716:
1717: /**
1718: * Sets the editor settings of the user.<p>
1719: *
1720: * @param settings the editor settings of the user
1721: */
1722: public void setEditorSettings(Map settings) {
1723:
1724: m_editorSettings = new TreeMap(settings);
1725: }
1726:
1727: /**
1728: * Sets the style of the explorer buttons of the user.<p>
1729: *
1730: * @param style the style of the explorer buttons of the user
1731: */
1732: public void setExplorerButtonStyle(int style) {
1733:
1734: m_explorerButtonStyle = style;
1735: }
1736:
1737: /**
1738: * Sets the number of displayed files per page of the user.<p>
1739: *
1740: * @param entries the number of displayed files per page of the user
1741: */
1742: public void setExplorerFileEntries(int entries) {
1743:
1744: m_explorerFileEntries = entries;
1745: }
1746:
1747: /**
1748: * Sets the explorer start settings.<p>
1749: *
1750: * @param settings explorer start settings to use
1751: */
1752: public void setExplorerSettings(int settings) {
1753:
1754: m_explorerSettings = settings;
1755: }
1756:
1757: /**
1758: * Sets the exporerFileEntryOptions.<p>
1759: *
1760: * @param exporerFileEntryOptions the exporerFileEntryOptions to set
1761: */
1762: public void setExporerFileEntryOptions(
1763: String exporerFileEntryOptions) {
1764:
1765: m_exporerFileEntryOptions = exporerFileEntryOptions;
1766: }
1767:
1768: /**
1769: * Sets the locale of the user.<p>
1770: *
1771: * @param locale the locale of the user
1772: */
1773: public void setLocale(Locale locale) {
1774:
1775: m_locale = locale;
1776: }
1777:
1778: /**
1779: * Sets if the "create index page" check box in the new folder
1780: * dialog should be initially be checked or not. <p>
1781: *
1782: * @param setting if the "create index page" check box in the new folder
1783: * dialog should be initially be checked or not.
1784: */
1785: public void setNewFolderCreateIndexPage(Boolean setting) {
1786:
1787: m_newFolderCreateIndexPage = setting;
1788: }
1789:
1790: /**
1791: * Sets if the "edit properties" check box in the new folder
1792: * dialog should be initially be checked or not. <p>
1793: *
1794: * @param setting if the "edit properties" check box in the new folder
1795: * dialog should be initially be checked or not.
1796: */
1797: public void setNewFolderEditPropertes(Boolean setting) {
1798:
1799: m_newFolderEditProperties = setting;
1800: }
1801:
1802: /**
1803: * Sets the preferred editor for the given resource type of the user.<p>
1804: *
1805: * @param resourceType the resource type
1806: * @param editorUri the editor URI
1807: */
1808: public void setPreferredEditor(String resourceType, String editorUri) {
1809:
1810: if (editorUri == null) {
1811: m_editorSettings.remove(resourceType);
1812: }
1813: m_editorSettings.put(resourceType, editorUri);
1814: }
1815:
1816: /**
1817: * Sets the appearance of the "publish project" button.<p>
1818: *
1819: * Allowed values are either {@link CmsDefaultUserSettings#PUBLISHBUTTON_SHOW_ALWAYS},
1820: * {@link CmsDefaultUserSettings#PUBLISHBUTTON_SHOW_AUTO} or
1821: * {@link CmsDefaultUserSettings#PUBLISHBUTTON_SHOW_NEVER}.<p>
1822: *
1823: * @param publishButtonAppearance the appearance of the "publish project" button
1824: */
1825: public void setPublishButtonAppearance(
1826: String publishButtonAppearance) {
1827:
1828: String value = CmsDefaultUserSettings.PUBLISHBUTTON_SHOW_ALWAYS;
1829: if (CmsStringUtil
1830: .isNotEmptyOrWhitespaceOnly(publishButtonAppearance)) {
1831: publishButtonAppearance = publishButtonAppearance.trim()
1832: .toLowerCase();
1833: if (CmsDefaultUserSettings.PUBLISHBUTTON_SHOW_AUTO
1834: .equals(publishButtonAppearance)) {
1835: value = CmsDefaultUserSettings.PUBLISHBUTTON_SHOW_AUTO;
1836: } else if (CmsDefaultUserSettings.PUBLISHBUTTON_SHOW_NEVER
1837: .equals(publishButtonAppearance)) {
1838: value = CmsDefaultUserSettings.PUBLISHBUTTON_SHOW_NEVER;
1839: }
1840: }
1841: m_publishButtonAppearance = value;
1842: }
1843:
1844: /**
1845: * Sets if the explorer view is restricted to the defined site and folder.<p>
1846: *
1847: * @param restrict true if the explorer view is restricted, otherwise false
1848: */
1849: public void setRestrictExplorerView(boolean restrict) {
1850:
1851: m_restrictExplorerView = restrict;
1852: }
1853:
1854: /**
1855: * Sets if the file creation date should be shown in explorer view.<p>
1856: *
1857: * @param show true if the file creation date should be shown, otherwise false
1858: */
1859: public void setShowExplorerFileDateCreated(boolean show) {
1860:
1861: setExplorerSetting(show, CmsUserSettings.FILELIST_DATE_CREATED);
1862: }
1863:
1864: /**
1865: * Sets if the file expire date should be shown in explorer view.<p>
1866: *
1867: * @param show true if the file expire date should be shown, otherwise false
1868: */
1869: public void setShowExplorerFileDateExpired(boolean show) {
1870:
1871: setExplorerSetting(show, CmsUserSettings.FILELIST_DATE_EXPIRED);
1872: }
1873:
1874: /**
1875: * Sets if the file last modified date state should be shown in explorer view.<p>
1876: *
1877: * @param show true if the file last modified date should be shown, otherwise false
1878: */
1879: public void setShowExplorerFileDateLastModified(boolean show) {
1880:
1881: setExplorerSetting(show,
1882: CmsUserSettings.FILELIST_DATE_LASTMODIFIED);
1883: }
1884:
1885: /**
1886: * Sets if the file release date should be shown in explorer view.<p>
1887: *
1888: * @param show true if the file release date should be shown, otherwise false
1889: */
1890: public void setShowExplorerFileDateReleased(boolean show) {
1891:
1892: setExplorerSetting(show, CmsUserSettings.FILELIST_DATE_RELEASED);
1893: }
1894:
1895: /**
1896: * Sets if the file locked by should be shown in explorer view.<p>
1897: *
1898: * @param show true if the file locked by should be shown, otherwise false
1899: */
1900: public void setShowExplorerFileLockedBy(boolean show) {
1901:
1902: setExplorerSetting(show, CmsUserSettings.FILELIST_LOCKEDBY);
1903: }
1904:
1905: /**
1906: * Sets if the file navtext should be shown in explorer view.<p>
1907: *
1908: * @param show true if the file navtext should be shown, otherwise false
1909: */
1910: public void setShowExplorerFileNavText(boolean show) {
1911:
1912: setExplorerSetting(show, CmsUserSettings.FILELIST_NAVTEXT);
1913: }
1914:
1915: /**
1916: * Sets if the file permissions should be shown in explorer view.<p>
1917: *
1918: * @param show true if the file permissions should be shown, otherwise false
1919: */
1920: public void setShowExplorerFilePermissions(boolean show) {
1921:
1922: setExplorerSetting(show, CmsUserSettings.FILELIST_PERMISSIONS);
1923: }
1924:
1925: /**
1926: * Sets if the file size should be shown in explorer view.<p>
1927: *
1928: * @param show true if the file size should be shown, otherwise false
1929: */
1930: public void setShowExplorerFileSize(boolean show) {
1931:
1932: setExplorerSetting(show, CmsUserSettings.FILELIST_SIZE);
1933: }
1934:
1935: /**
1936: * Sets if the file state should be shown in explorer view.<p>
1937: *
1938: * @param show true if the state size should be shown, otherwise false
1939: */
1940: public void setShowExplorerFileState(boolean show) {
1941:
1942: setExplorerSetting(show, CmsUserSettings.FILELIST_STATE);
1943: }
1944:
1945: /**
1946: * Sets if the file title should be shown in explorer view.<p>
1947: *
1948: * @param show true if the file title should be shown, otherwise false
1949: */
1950: public void setShowExplorerFileTitle(boolean show) {
1951:
1952: setExplorerSetting(show, CmsUserSettings.FILELIST_TITLE);
1953: }
1954:
1955: /**
1956: * Sets if the file type should be shown in explorer view.<p>
1957: *
1958: * @param show true if the file type should be shown, otherwise false
1959: */
1960: public void setShowExplorerFileType(boolean show) {
1961:
1962: setExplorerSetting(show, CmsUserSettings.FILELIST_TYPE);
1963: }
1964:
1965: /**
1966: * Sets if the file creator should be shown in explorer view.<p>
1967: *
1968: * @param show true if the file creator should be shown, otherwise false
1969: */
1970: public void setShowExplorerFileUserCreated(boolean show) {
1971:
1972: setExplorerSetting(show, CmsUserSettings.FILELIST_USER_CREATED);
1973: }
1974:
1975: /**
1976: * Sets if the file last modified by should be shown in explorer view.<p>
1977: *
1978: * @param show true if the file last modified by should be shown, otherwise false
1979: */
1980: public void setShowExplorerFileUserLastModified(boolean show) {
1981:
1982: setExplorerSetting(show,
1983: CmsUserSettings.FILELIST_USER_LASTMODIFIED);
1984: }
1985:
1986: /**
1987: * Controls whether to display a file upload icon or not.<p>
1988: *
1989: * @param flag <code>true</code> or <code>false</code> to flag the use of the file upload button
1990: */
1991: public void setShowFileUploadButton(boolean flag) {
1992:
1993: m_showFileUploadButton = flag;
1994: }
1995:
1996: /**
1997: * Sets if the publish notifications should be shown or not.<p>
1998: *
1999: * @param showPublishNotification true if the publish notifications should be shown, otherwise false
2000: */
2001: public void setShowPublishNotification(
2002: boolean showPublishNotification) {
2003:
2004: m_showPublishNotification = showPublishNotification;
2005: }
2006:
2007: /**
2008: * Sets if the resource type selection dialog should
2009: * be shown in the file upload process (non - applet version) or not. <p>
2010: *
2011: * @param showUploadTypeDialog if the resource type selection dialog should
2012: * be shown in the file upload process (non - applet version)
2013: */
2014: public void setShowUploadTypeDialog(Boolean showUploadTypeDialog) {
2015:
2016: m_showUploadTypeDialog = showUploadTypeDialog;
2017: }
2018:
2019: /**
2020: * Sets the start folder of the user.<p>
2021: *
2022: * @param folder the start folder of the user
2023: */
2024: public void setStartFolder(String folder) {
2025:
2026: m_startFolder = folder;
2027: }
2028:
2029: /**
2030: * Sets the start project of the user.<p>
2031: *
2032: * @param project the start project id of the user
2033: */
2034: public void setStartProject(String project) {
2035:
2036: m_project = project;
2037: }
2038:
2039: /**
2040: * Sets the start site of the user.<p>
2041: *
2042: * @param site the start site of the user
2043: */
2044: public void setStartSite(String site) {
2045:
2046: m_startSite = site;
2047: }
2048:
2049: /**
2050: * Sets the current start view of the user.<p>
2051: *
2052: * @param view the current start view of the user
2053: */
2054: public void setStartView(String view) {
2055:
2056: m_view = view;
2057: }
2058:
2059: /**
2060: * Sets the (optional) workplace synchronize settings.<p>
2061: *
2062: * @param synchronizeSettings the (optional) workplace synchronize settings to set
2063: */
2064: public void setSynchronizeSettings(
2065: CmsSynchronizeSettings synchronizeSettings) {
2066:
2067: m_synchronizeSettings = synchronizeSettings;
2068: }
2069:
2070: /**
2071: * Sets the user specific custom "time warp" time.<p>
2072: *
2073: * Use {@link org.opencms.main.CmsContextInfo#CURRENT_TIME} to disable this feature, ie. enable the
2074: * current time for each new request.<p>
2075: *
2076: * If this value is set, auto time warping will be disabled: Clicking on a resource that
2077: * has not been released at the given time or is already expired at the given time will not
2078: * be shown - an error message will pop up ("out of time window").<p>
2079: *
2080: * @param timewarp the time warp time to set
2081: */
2082: public void setTimeWarp(long timewarp) {
2083:
2084: m_timeWarp = timewarp;
2085: }
2086:
2087: /**
2088: * Sets the folder path of the upload applet on the client machine.<p>
2089: *
2090: * @param uploadAppletClientFolder the folder path of the upload applet on the client machine
2091: */
2092: public void setUploadAppletClientFolder(
2093: String uploadAppletClientFolder) {
2094:
2095: m_uploadAppletClientFolder = uploadAppletClientFolder;
2096: }
2097:
2098: /**
2099: * Sets the current user for the settings.<p>
2100: *
2101: * @param user the CmsUser
2102: */
2103: public void setUser(CmsUser user) {
2104:
2105: m_user = user;
2106: }
2107:
2108: /**
2109: * Sets if the upload applet should be used.<p>
2110: *
2111: * @param use true if the upload applet should be used, otherwise false
2112: */
2113: public void setUseUploadApplet(boolean use) {
2114:
2115: m_uploadApplet = use;
2116: }
2117:
2118: /**
2119: * Sets the style of the workplace buttons of the user.<p>
2120: *
2121: * @param style the style of the workplace buttons of the user
2122: */
2123: public void setWorkplaceButtonStyle(int style) {
2124:
2125: m_workplaceButtonStyle = style;
2126: }
2127:
2128: /**
2129: * Sets the type of the report (simple or extended) of the user.<p>
2130: *
2131: * @param type the type of the report (simple or extended) of the user
2132: */
2133: public void setWorkplaceReportType(String type) {
2134:
2135: m_workplaceReportType = type;
2136: }
2137:
2138: /**
2139: * Sets the name of the search index to use in the workplace.<p>
2140: *
2141: * @param workplaceSearchIndexName the name of the search index to use in the workplace to set
2142: */
2143: public void setWorkplaceSearchIndexName(
2144: String workplaceSearchIndexName) {
2145:
2146: m_workplaceSearchIndexName = workplaceSearchIndexName;
2147: }
2148:
2149: /**
2150: * Sets the workplace search result list view style.<p>
2151: *
2152: * @param workplaceSearchViewStyle the workplace search result list view style to set
2153: */
2154: public void setWorkplaceSearchViewStyle(
2155: CmsSearchResultStyle workplaceSearchViewStyle) {
2156:
2157: m_workplaceSearchViewStyle = workplaceSearchViewStyle;
2158: }
2159:
2160: /**
2161: * Determines if the file creation date should be shown in explorer view.<p>
2162: *
2163: * @return true if the file creation date should be shown, otherwise false
2164: */
2165: public boolean showExplorerFileDateCreated() {
2166:
2167: return ((m_explorerSettings & CmsUserSettings.FILELIST_DATE_CREATED) > 0);
2168: }
2169:
2170: /**
2171: * Determines if the file date expired should be shown in explorer view.<p>
2172: *
2173: * @return true if the file date expired should be shown, otherwise false
2174: */
2175: public boolean showExplorerFileDateExpired() {
2176:
2177: return ((m_explorerSettings & CmsUserSettings.FILELIST_DATE_EXPIRED) > 0);
2178: }
2179:
2180: /**
2181: * Determines if the file last modified date should be shown in explorer view.<p>
2182: *
2183: * @return true if the file last modified date should be shown, otherwise false
2184: */
2185: public boolean showExplorerFileDateLastModified() {
2186:
2187: return ((m_explorerSettings & CmsUserSettings.FILELIST_DATE_LASTMODIFIED) > 0);
2188: }
2189:
2190: /**
2191: * Determines if the file date released should be shown in explorer view.<p>
2192: *
2193: * @return true if the file date released should be shown, otherwise false
2194: */
2195: public boolean showExplorerFileDateReleased() {
2196:
2197: return ((m_explorerSettings & CmsUserSettings.FILELIST_DATE_RELEASED) > 0);
2198: }
2199:
2200: /**
2201: * Determines if the file locked by should be shown in explorer view.<p>
2202: *
2203: * @return true if the file locked by should be shown, otherwise false
2204: */
2205: public boolean showExplorerFileLockedBy() {
2206:
2207: return ((m_explorerSettings & CmsUserSettings.FILELIST_LOCKEDBY) > 0);
2208: }
2209:
2210: /**
2211: * Determines if the file navigation text should be shown in explorer view.<p>
2212: *
2213: * @return true if the file navigation text should be shown, otherwise false
2214: */
2215: public boolean showExplorerFileNavText() {
2216:
2217: return ((m_explorerSettings & CmsUserSettings.FILELIST_NAVTEXT) > 0);
2218: }
2219:
2220: /**
2221: * Determines if the file permissions should be shown in explorer view.<p>
2222: *
2223: * @return true if the file permissions should be shown, otherwise false
2224: */
2225: public boolean showExplorerFilePermissions() {
2226:
2227: return ((m_explorerSettings & CmsUserSettings.FILELIST_PERMISSIONS) > 0);
2228: }
2229:
2230: /**
2231: * Determines if the file size should be shown in explorer view.<p>
2232: *
2233: * @return true if the file size should be shown, otherwise false
2234: */
2235: public boolean showExplorerFileSize() {
2236:
2237: return ((m_explorerSettings & CmsUserSettings.FILELIST_SIZE) > 0);
2238: }
2239:
2240: /**
2241: * Determines if the file state should be shown in explorer view.<p>
2242: *
2243: * @return true if the file state should be shown, otherwise false
2244: */
2245: public boolean showExplorerFileState() {
2246:
2247: return ((m_explorerSettings & CmsUserSettings.FILELIST_STATE) > 0);
2248: }
2249:
2250: /**
2251: * Determines if the file title should be shown in explorer view.<p>
2252: *
2253: * @return true if the file title should be shown, otherwise false
2254: */
2255: public boolean showExplorerFileTitle() {
2256:
2257: return ((m_explorerSettings & CmsUserSettings.FILELIST_TITLE) > 0);
2258: }
2259:
2260: /**
2261: * Determines if the file type should be shown in explorer view.<p>
2262: *
2263: * @return true if the file type should be shown, otherwise false
2264: */
2265: public boolean showExplorerFileType() {
2266:
2267: return ((m_explorerSettings & CmsUserSettings.FILELIST_TYPE) > 0);
2268: }
2269:
2270: /**
2271: * Determines if the file creator should be shown in explorer view.<p>
2272: *
2273: * @return true if the file creator should be shown, otherwise false
2274: */
2275: public boolean showExplorerFileUserCreated() {
2276:
2277: return ((m_explorerSettings & CmsUserSettings.FILELIST_USER_CREATED) > 0);
2278: }
2279:
2280: /**
2281: * Determines if the file last modified by should be shown in explorer view.<p>
2282: *
2283: * @return true if the file last modified by should be shown, otherwise false
2284: */
2285: public boolean showExplorerFileUserLastModified() {
2286:
2287: return ((m_explorerSettings & CmsUserSettings.FILELIST_USER_LASTMODIFIED) > 0);
2288: }
2289:
2290: /**
2291: * Determines if the upload applet should be used.<p>
2292: *
2293: * @return true if the if the upload applet should be used, otherwise false
2294: */
2295: public boolean useUploadApplet() {
2296:
2297: return m_uploadApplet;
2298: }
2299:
2300: /**
2301: * Sets a specific explorer setting depending on the set parameter.<p>
2302: *
2303: * @param set true if the setting should be set, otherwise false
2304: * @param setting the settings constant value for the explorer settings
2305: */
2306: private void setExplorerSetting(boolean set, int setting) {
2307:
2308: if (set) {
2309: m_explorerSettings |= setting;
2310: } else {
2311: m_explorerSettings &= ~setting;
2312: }
2313: }
2314: }
|