0001: /*
0002: * File : $Source: /usr/local/cvs/opencms/src/org/opencms/configuration/CmsDefaultUserSettings.java,v $
0003: * Date : $Date: 2008-02-27 12:05:47 $
0004: * Version: $Revision: 1.22 $
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.configuration;
0033:
0034: import org.opencms.db.CmsUserSettings;
0035: import org.opencms.file.CmsResource;
0036: import org.opencms.file.CmsResource.CmsResourceCopyMode;
0037: import org.opencms.file.CmsResource.CmsResourceDeleteMode;
0038: import org.opencms.i18n.CmsLocaleManager;
0039: import org.opencms.main.CmsLog;
0040: import org.opencms.util.A_CmsModeStringEnumeration;
0041: import org.opencms.util.CmsStringUtil;
0042:
0043: import java.util.Arrays;
0044: import java.util.Collections;
0045: import java.util.List;
0046:
0047: /**
0048: * Default user workplace settings, used as default values for worklace settings in the
0049: * user preferences.<p>
0050: *
0051: * @author Michael Emmerich
0052: * @author Andreas Zahner
0053: *
0054: * @version $Revision: 1.22 $
0055: *
0056: * @since 6.0.0
0057: */
0058: public class CmsDefaultUserSettings extends CmsUserSettings {
0059:
0060: /**
0061: * Enumeration class for defining the publish related resources mode.<p>
0062: */
0063: public static final class CmsPublishRelatedResourcesMode extends
0064: A_CmsModeStringEnumeration {
0065:
0066: /** Constant for the publish related resources mode, checkbox disabled by default. */
0067: protected static final CmsPublishRelatedResourcesMode MODE_FALSE = new CmsPublishRelatedResourcesMode(
0068: CmsStringUtil.FALSE);
0069:
0070: /**
0071: * Constant for the publish related resources mode, only {@link org.opencms.security.CmsRole#VFS_MANAGER}s
0072: * may publish resources without publishing the related resources.
0073: */
0074: protected static final CmsPublishRelatedResourcesMode MODE_FORCE = new CmsPublishRelatedResourcesMode(
0075: "FORCE");
0076:
0077: /** Constant for the publish related resources mode, checkbox enabled by default. */
0078: protected static final CmsPublishRelatedResourcesMode MODE_TRUE = new CmsPublishRelatedResourcesMode(
0079: CmsStringUtil.TRUE);
0080:
0081: /** The serial version id. */
0082: private static final long serialVersionUID = -2665888243460791770L;
0083:
0084: /**
0085: * Default constructor.<p>
0086: *
0087: * @param mode string representation
0088: */
0089: private CmsPublishRelatedResourcesMode(String mode) {
0090:
0091: super (mode);
0092: }
0093:
0094: /**
0095: * Returns the parsed mode object if the string representation matches, or <code>null</code> if not.<p>
0096: *
0097: * @param publishRelatedResourcesMode the string representation to parse
0098: *
0099: * @return the parsed mode object
0100: */
0101: public static CmsPublishRelatedResourcesMode valueOf(
0102: String publishRelatedResourcesMode) {
0103:
0104: if (publishRelatedResourcesMode == null) {
0105: return null;
0106: }
0107: if (publishRelatedResourcesMode.equalsIgnoreCase(MODE_FALSE
0108: .getMode())) {
0109: return MODE_FALSE;
0110: }
0111: if (publishRelatedResourcesMode.equalsIgnoreCase(MODE_TRUE
0112: .getMode())) {
0113: return MODE_TRUE;
0114: }
0115: if (publishRelatedResourcesMode.equalsIgnoreCase(MODE_FORCE
0116: .getMode())) {
0117: return MODE_FORCE;
0118: }
0119: return null;
0120: }
0121: }
0122:
0123: /** Constant for the publish related resources mode, checkbox disabled by default. */
0124: public static final CmsPublishRelatedResourcesMode PUBLISH_RELATED_RESOURCES_MODE_FALSE = CmsPublishRelatedResourcesMode.MODE_FALSE;
0125:
0126: /**
0127: * Constant for the publish related resources mode, only {@link org.opencms.security.CmsRole#VFS_MANAGER}s
0128: * may publish resources without publishing the related resources.
0129: */
0130: public static final CmsPublishRelatedResourcesMode PUBLISH_RELATED_RESOURCES_MODE_FORCE = CmsPublishRelatedResourcesMode.MODE_FORCE;
0131:
0132: /** Constant for the publish related resources mode, checkbox enabled by default. */
0133: public static final CmsPublishRelatedResourcesMode PUBLISH_RELATED_RESOURCES_MODE_TRUE = CmsPublishRelatedResourcesMode.MODE_TRUE;
0134:
0135: /** Publish button appearance: show always. */
0136: public static final String PUBLISHBUTTON_SHOW_ALWAYS = "always";
0137:
0138: /** Publish button appearance: show auto (only if user has publish permissions). */
0139: public static final String PUBLISHBUTTON_SHOW_AUTO = "auto";
0140:
0141: /** Publish button appearance: show never. */
0142: public static final String PUBLISHBUTTON_SHOW_NEVER = "never";
0143:
0144: /**
0145: * Array of the possible "button styles".
0146: * Must be private because of Findbugs rule "MS".
0147: */
0148: private static final String[] BUTTON_STYLES = { "image",
0149: "textimage", "text" };
0150:
0151: /** Array list for fast lookup of "button styles". */
0152: public static final List BUTTON_STYLES_LIST = Collections
0153: .unmodifiableList(Arrays.asList(BUTTON_STYLES));
0154:
0155: /** Parameter for buttonstyle text & image. */
0156: private static final int BUTTONSTYLE_TEXTIMAGE = 1;
0157:
0158: /** Value for preserving siblings in copy dialog settings. */
0159: private static final String COPYMODE_PRESERVE = "preservesiblings";
0160:
0161: /** Value for creating a resource in copy dialog settings. */
0162: private static final String COPYMODE_RESOURCE = "createresource";
0163:
0164: /** Value for creating a sibling in copy dialog settings. */
0165: private static final String COPYMODE_SIBLING = "createsibling";
0166:
0167: /** Value for deleting siblings in delete dialog settings. */
0168: private static final String DELETEMODE_DELETE = "deletesiblings";
0169:
0170: /** Value for preserving siblings in delete dialog settings. */
0171: private static final String DELETEMODE_PRESERVE = "preservesiblings";
0172:
0173: /** Value for publishing only resources in publish dialog settings. */
0174: private static final String PUBLISHMODE_ONLYRESOURCE = "onlyresource";
0175:
0176: /** Value for publishing siblings in publish dialog settings. */
0177: private static final String PUBLISHMODE_SIBLINGS = "allsiblings";
0178:
0179: /** The enable relation deletion flag. */
0180: private boolean m_allowBrokenRelations = true;
0181:
0182: /** The publish related resources mode. */
0183: private CmsPublishRelatedResourcesMode m_publishRelatedResourcesMode;
0184:
0185: /**
0186: * Gets the default copy mode when copying a file of the user.<p>
0187: *
0188: * @return the default copy mode when copying a file of the user
0189: */
0190: public String getDialogCopyFileModeString() {
0191:
0192: if (getDialogCopyFileMode() == CmsResource.COPY_AS_NEW) {
0193: return COPYMODE_RESOURCE;
0194: } else {
0195: return COPYMODE_SIBLING;
0196: }
0197: }
0198:
0199: /**
0200: * Gets the default copy mode when copying a folder of the user.<p>
0201: *
0202: * @return the default copy mode when copying a folder of the user
0203: */
0204: public String getDialogCopyFolderModeString() {
0205:
0206: if (getDialogCopyFolderMode() == CmsResource.COPY_AS_NEW) {
0207: return COPYMODE_RESOURCE;
0208: } else if (getDialogCopyFolderMode() == CmsResource.COPY_AS_SIBLING) {
0209: return COPYMODE_SIBLING;
0210: } else {
0211: return COPYMODE_PRESERVE;
0212: }
0213: }
0214:
0215: /**
0216: * Returns the default setting for file deletion.<p>
0217: *
0218: * @return the default setting for file deletion
0219: */
0220: public String getDialogDeleteFileModeString() {
0221:
0222: if (getDialogDeleteFileMode() == CmsResource.DELETE_REMOVE_SIBLINGS) {
0223: return DELETEMODE_DELETE;
0224: } else {
0225: return DELETEMODE_PRESERVE;
0226: }
0227: }
0228:
0229: /**
0230: * Returns the default setting for expanding inherited permissions in the dialog.<p>
0231: *
0232: * @return true if inherited permissions should be expanded, otherwise false
0233: *
0234: * @see #getDialogExpandInheritedPermissions()
0235: */
0236: public String getDialogExpandInheritedPermissionsString() {
0237:
0238: return String.valueOf(getDialogExpandInheritedPermissions());
0239: }
0240:
0241: /**
0242: * Returns the default setting for expanding the users permissions in the dialog.<p>
0243: *
0244: * @return true if the users permissions should be expanded, otherwise false
0245: *
0246: * @see #getDialogExpandUserPermissions()
0247: */
0248: public String getDialogExpandUserPermissionsString() {
0249:
0250: return String.valueOf(getDialogExpandUserPermissions());
0251: }
0252:
0253: /**
0254: * Returns the default setting for inheriting permissions on folders.<p>
0255: *
0256: * @return true if permissions should be inherited on folders, otherwise false
0257: */
0258: public String getDialogPermissionsInheritOnFolderString() {
0259:
0260: return String.valueOf(getDialogPermissionsInheritOnFolder());
0261: }
0262:
0263: /**
0264: * Returns the default setting for direct publishing.<p>
0265: *
0266: * @return the default setting for direct publishing
0267: */
0268: public String getDialogPublishSiblingsString() {
0269:
0270: if (getDialogPublishSiblings()) {
0271: return PUBLISHMODE_SIBLINGS;
0272: } else {
0273: return PUBLISHMODE_ONLYRESOURCE;
0274: }
0275: }
0276:
0277: /**
0278: * Determines if the export settings part of the secure/export dialog should be shown.<p>
0279: *
0280: * @return true if the export dialog is shown, otherwise false
0281: */
0282: public String getDialogShowExportSettingsString() {
0283:
0284: return String.valueOf(getDialogShowExportSettings());
0285: }
0286:
0287: /**
0288: * Determines if the lock dialog should be shown.<p>
0289: *
0290: * @return true if the lock dialog is shown, otherwise false
0291: */
0292: public String getDialogShowLockString() {
0293:
0294: return String.valueOf(getDialogShowLock());
0295: }
0296:
0297: /**
0298: * Returns a string representation of the direct edit button style.<p>
0299: *
0300: * @return string representation of the direct edit button style
0301: */
0302: public String getDirectEditButtonStyleString() {
0303:
0304: return BUTTON_STYLES[getDirectEditButtonStyle()];
0305: }
0306:
0307: /**
0308: * Returns a string representation of the editor button style.<p>
0309: *
0310: * @return string representation of the editor button style
0311: */
0312: public String getEditorButtonStyleString() {
0313:
0314: return BUTTON_STYLES[getEditorButtonStyle()];
0315: }
0316:
0317: /**
0318: * Returns a string representation of the explorer button style.<p>
0319: *
0320: * @return string representation of the explorer button style
0321: */
0322: public String getExplorerButtonStyleString() {
0323:
0324: return BUTTON_STYLES[getExplorerButtonStyle()];
0325: }
0326:
0327: /**
0328: * Returns the publish related resources mode.<p>
0329: *
0330: * @return the publish related resources mode
0331: */
0332: public CmsPublishRelatedResourcesMode getPublishRelatedResources() {
0333:
0334: return m_publishRelatedResourcesMode;
0335: }
0336:
0337: /**
0338: * Returns if the explorer view is restricted to the defined site and folder.<p>
0339: *
0340: * @return true if the explorer view is restricted, otherwise false
0341: */
0342: public String getRestrictExplorerViewString() {
0343:
0344: return String.valueOf(getRestrictExplorerView());
0345: }
0346:
0347: /**
0348: * Gets if the file creation date should be shown in explorer view.<p>
0349: *
0350: * @return <code>"true"</code> if the file creation date should be shown, otherwise <code>"false"</code>
0351: */
0352: public String getShowExplorerFileDateCreated() {
0353:
0354: return getExplorerSetting(CmsUserSettings.FILELIST_DATE_CREATED);
0355: }
0356:
0357: /**
0358: * Gets if the file expired by should be shown in explorer view.<p>
0359: *
0360: * @return <code>"true"</code> if the file date expired by should be shown, otherwise <code>"false"</code>
0361: */
0362: public String getShowExplorerFileDateExpired() {
0363:
0364: return getExplorerSetting(CmsUserSettings.FILELIST_DATE_EXPIRED);
0365: }
0366:
0367: /**
0368: * Gets if the file last modified date should be shown in explorer view.<p>
0369: *
0370: * @return <code>"true"</code> if the file last modified date should be shown, otherwise <code>"false"</code>
0371: */
0372: public String getShowExplorerFileDateLastModified() {
0373:
0374: return getExplorerSetting(CmsUserSettings.FILELIST_DATE_LASTMODIFIED);
0375: }
0376:
0377: /**
0378: * Gets if the file released by should be shown in explorer view.<p>
0379: *
0380: * @return <code>"true"</code> if the file date released by should be shown, otherwise <code>"false"</code>
0381: */
0382: public String getShowExplorerFileDateReleased() {
0383:
0384: return getExplorerSetting(CmsUserSettings.FILELIST_DATE_RELEASED);
0385: }
0386:
0387: /**
0388: * Gets if the file locked by should be shown in explorer view.<p>
0389: *
0390: * @return <code>"true"</code> if the file locked by should be shown, otherwise <code>"false"</code>
0391: */
0392: public String getShowExplorerFileLockedBy() {
0393:
0394: return getExplorerSetting(CmsUserSettings.FILELIST_LOCKEDBY);
0395: }
0396:
0397: /**
0398: * Gets if the file navtext should be shown in explorer view.<p>
0399: *
0400: * @return <code>"true"</code> if the file navtext should be shown, otherwise <code>"false"</code>
0401: */
0402: public String getShowExplorerFileNavText() {
0403:
0404: return getExplorerSetting(CmsUserSettings.FILELIST_NAVTEXT);
0405: }
0406:
0407: /**
0408: * Gets if the file permissions should be shown in explorer view.<p>
0409: *
0410: * @return <code>"true"</code> if the file permissions should be shown, otherwise <code>"false"</code>
0411: */
0412: public String getShowExplorerFilePermissions() {
0413:
0414: return getExplorerSetting(CmsUserSettings.FILELIST_PERMISSIONS);
0415: }
0416:
0417: /**
0418: * Gets if the file size should be shown in explorer view.<p>
0419: *
0420: * @return <code>"true"</code> if the file size should be shown, otherwise <code>"false"</code>
0421: */
0422: public String getShowExplorerFileSize() {
0423:
0424: return getExplorerSetting(CmsUserSettings.FILELIST_SIZE);
0425: }
0426:
0427: /**
0428: * Gets if the file state should be shown in explorer view.<p>
0429: *
0430: * @return <code>"true"</code> if the file state should be shown, otherwise <code>"false"</code>
0431: */
0432: public String getShowExplorerFileState() {
0433:
0434: return getExplorerSetting(CmsUserSettings.FILELIST_STATE);
0435: }
0436:
0437: /**
0438: * Gets if the file title should be shown in explorer view.<p>
0439: *
0440: * @return <code>"true"</code> if the file title should be shown, otherwise <code>"false"</code>
0441: */
0442: public String getShowExplorerFileTitle() {
0443:
0444: return getExplorerSetting(CmsUserSettings.FILELIST_TITLE);
0445: }
0446:
0447: /**
0448: * Gets if the file type should be shown in explorer view.<p>
0449: *
0450: * @return <code>"true"</code> if the file type should be shown, otherwise <code>"false"</code>
0451: */
0452: public String getShowExplorerFileType() {
0453:
0454: return getExplorerSetting(CmsUserSettings.FILELIST_TYPE);
0455: }
0456:
0457: /**
0458: * Gets if the file creator should be shown in explorer view.<p>
0459: *
0460: * @return <code>"true"</code> if the file creator should be shown, otherwise <code>"false"</code>
0461: */
0462: public String getShowExplorerFileUserCreated() {
0463:
0464: return getExplorerSetting(CmsUserSettings.FILELIST_USER_CREATED);
0465: }
0466:
0467: /**
0468: * Gets if the file last modified by should be shown in explorer view.<p>
0469: *
0470: * @return <code>"true"</code> if the file last modified by should be shown, otherwise <code>"false"</code>
0471: */
0472: public String getShowExplorerFileUserLastModified() {
0473:
0474: return getExplorerSetting(CmsUserSettings.FILELIST_USER_LASTMODIFIED);
0475: }
0476:
0477: /**
0478: * Returns a string representation of the show file upload button flag.<p>
0479: *
0480: * @return string representation of the show file upload button flag
0481: *
0482: * @see #getShowFileUploadButton()
0483: */
0484: public String getShowFileUploadButtonString() {
0485:
0486: return String.valueOf(getShowFileUploadButton());
0487: }
0488:
0489: /**
0490: * Returns a string representation of the publish notification flag.<p>
0491: *
0492: * @return string representation of the publish notification flag
0493: *
0494: * @see #getShowPublishNotification()
0495: */
0496: public String getShowPublishNotificationString() {
0497:
0498: return String.valueOf(getShowPublishNotification());
0499: }
0500:
0501: /**
0502: * Returns a string representation of the upload Applet flag.<p>
0503: *
0504: * @return string representation of the uploadApplet flag
0505: *
0506: * @see #useUploadApplet()
0507: */
0508: public String getUploadAppletString() {
0509:
0510: return String.valueOf(useUploadApplet());
0511: }
0512:
0513: /**
0514: * Returns a string representation of the workplace button style.<p>
0515: *
0516: * @return string representation of the workplace button style
0517: *
0518: * @see #getWorkplaceButtonStyle()
0519: */
0520: public String getWorkplaceButtonStyleString() {
0521:
0522: return BUTTON_STYLES[getWorkplaceButtonStyle()];
0523: }
0524:
0525: /**
0526: * Returns if the deletion of relation targets is enabled.<p>
0527: *
0528: * @return <code>true</code> if the deletion of relation targets is enabled, otherwise <code>false</code>
0529: */
0530: public boolean isAllowBrokenRelations() {
0531:
0532: return m_allowBrokenRelations;
0533: }
0534:
0535: /**
0536: * Sets if the deletion of relation targets is enabled.<p>
0537: *
0538: * @param allowBrokenRelations <code>true</code> if relation deletion should be enabled, otherwise <code>false</code>
0539: */
0540: public void setAllowBrokenRelations(String allowBrokenRelations) {
0541:
0542: m_allowBrokenRelations = Boolean.valueOf(allowBrokenRelations)
0543: .booleanValue();
0544: if (CmsLog.INIT.isInfoEnabled()) {
0545: CmsLog.INIT
0546: .info(Messages
0547: .get()
0548: .getBundle()
0549: .key(
0550: m_allowBrokenRelations ? Messages.INIT_RELATION_DELETION_ENABLED_0
0551: : Messages.INIT_RELATION_DELETION_DISABLED_0));
0552: }
0553: }
0554:
0555: /**
0556: * Sets the default copy mode when copying a file of the user.<p>
0557: *
0558: * @param mode the default copy mode when copying a file of the user
0559: */
0560: public void setDialogCopyFileMode(String mode) {
0561:
0562: CmsResourceCopyMode copyMode = CmsResource.COPY_AS_NEW;
0563: if (mode.equalsIgnoreCase(COPYMODE_SIBLING)) {
0564: copyMode = CmsResource.COPY_AS_SIBLING;
0565: }
0566: setDialogCopyFileMode(copyMode);
0567: }
0568:
0569: /**
0570: * Sets the default copy mode when copying a folder of the user.<p>
0571: *
0572: * @param mode the default copy mode when copying a folder of the user
0573: */
0574: public void setDialogCopyFolderMode(String mode) {
0575:
0576: CmsResourceCopyMode copyMode = CmsResource.COPY_AS_NEW;
0577: if (mode.equalsIgnoreCase(COPYMODE_SIBLING)) {
0578: copyMode = CmsResource.COPY_AS_SIBLING;
0579: } else if (mode.equalsIgnoreCase(COPYMODE_PRESERVE)) {
0580: copyMode = CmsResource.COPY_PRESERVE_SIBLING;
0581: }
0582: setDialogCopyFolderMode(copyMode);
0583: }
0584:
0585: /**
0586: * Sets the default setting for file deletion.<p>
0587: *
0588: * @param mode the default setting for file deletion
0589: */
0590: public void setDialogDeleteFileMode(String mode) {
0591:
0592: CmsResourceDeleteMode deleteMode = CmsResource.DELETE_PRESERVE_SIBLINGS;
0593: if (mode.equalsIgnoreCase(DELETEMODE_DELETE)) {
0594: deleteMode = CmsResource.DELETE_REMOVE_SIBLINGS;
0595: }
0596: setDialogDeleteFileMode(deleteMode);
0597: }
0598:
0599: /**
0600: * Sets the default setting for expanding inherited permissions in the dialog.<p>
0601: *
0602: * @param dialogExpandInheritedPermissions the default setting for expanding inherited permissions in the dialog
0603: */
0604: public void setDialogExpandInheritedPermissions(
0605: String dialogExpandInheritedPermissions) {
0606:
0607: setDialogExpandInheritedPermissions(Boolean.valueOf(
0608: dialogExpandInheritedPermissions).booleanValue());
0609: }
0610:
0611: /**
0612: * Sets the default setting for expanding the users permissions in the dialog.<p>
0613: *
0614: * @param dialogExpandUserPermissions the default setting for expanding the users permissions in the dialog
0615: */
0616: public void setDialogExpandUserPermissions(
0617: String dialogExpandUserPermissions) {
0618:
0619: setDialogExpandUserPermissions(Boolean.valueOf(
0620: dialogExpandUserPermissions).booleanValue());
0621: }
0622:
0623: /**
0624: * Sets the default setting for inheriting permissions on folders.<p>
0625: *
0626: * @param dialogPermissionsInheritOnFolder the default setting for inheriting permissions on folders
0627: */
0628: public void setDialogPermissionsInheritOnFolder(
0629: String dialogPermissionsInheritOnFolder) {
0630:
0631: setDialogPermissionsInheritOnFolder(Boolean.valueOf(
0632: dialogPermissionsInheritOnFolder).booleanValue());
0633: }
0634:
0635: /**
0636: * Sets the default setting for direct publishing.<p>
0637: *
0638: * @param mode the default setting for direct publishing
0639: */
0640: public void setDialogPublishSiblings(String mode) {
0641:
0642: boolean publishSiblings = false;
0643: if (mode.equalsIgnoreCase(PUBLISHMODE_SIBLINGS)) {
0644: publishSiblings = true;
0645: }
0646: setDialogPublishSiblings(publishSiblings);
0647: }
0648:
0649: /**
0650: * Sets the style of the direct edit buttons of the user.<p>
0651: *
0652: * @param buttonstyle the style of the direct edit buttons of the user
0653: */
0654: public void setDirectEditButtonStyle(String buttonstyle) {
0655:
0656: int buttonstyleValue = BUTTONSTYLE_TEXTIMAGE;
0657: try {
0658: if (buttonstyle != null) {
0659: buttonstyleValue = BUTTON_STYLES_LIST
0660: .indexOf(buttonstyle);
0661: }
0662: } catch (Exception e) {
0663: // do nothing, use the default value
0664: }
0665: setDirectEditButtonStyle(buttonstyleValue);
0666: }
0667:
0668: /**
0669: * Sets the style of the editor buttons of the user.<p>
0670: *
0671: * @param buttonstyle the style of the editor buttons of the user
0672: */
0673: public void setEditorButtonStyle(String buttonstyle) {
0674:
0675: int buttonstyleValue = BUTTONSTYLE_TEXTIMAGE;
0676: try {
0677: if (buttonstyle != null) {
0678: buttonstyleValue = BUTTON_STYLES_LIST
0679: .indexOf(buttonstyle);
0680: }
0681: } catch (Exception e) {
0682: // do nothing, use the default value
0683: }
0684: setEditorButtonStyle(buttonstyleValue);
0685: }
0686:
0687: /**
0688: * Sets the style of the explorer workplace buttons of the user.<p>
0689: *
0690: * @param buttonstyle the style of the explorer workplace buttons of the user
0691: */
0692: public void setExplorerButtonStyle(String buttonstyle) {
0693:
0694: int buttonstyleValue = BUTTONSTYLE_TEXTIMAGE;
0695: try {
0696: if (buttonstyle != null) {
0697: buttonstyleValue = BUTTON_STYLES_LIST
0698: .indexOf(buttonstyle);
0699: }
0700: } catch (Exception e) {
0701: // do nothing, use the default value
0702: }
0703: setExplorerButtonStyle(buttonstyleValue);
0704: }
0705:
0706: /**
0707: * Sets the number of displayed files per page of the user.<p>
0708: *
0709: * @param entries the number of displayed files per page of the user
0710: */
0711: public void setExplorerFileEntries(String entries) {
0712:
0713: try {
0714: setExplorerFileEntries(Integer.parseInt(entries));
0715: } catch (Throwable t) {
0716: // ignore this exception
0717: }
0718: }
0719:
0720: /**
0721: * Sets the workplace locale.<p>
0722: *
0723: * @param locale the workplace language default
0724: */
0725: public void setLocale(String locale) {
0726:
0727: // set the language
0728: setLocale(CmsLocaleManager.getLocale(locale));
0729: }
0730:
0731: /**
0732: * Digester support method for configuration if the "create index page" checkbox in the new folder
0733: * dialog should be initially be checked or not. <p>
0734: *
0735: * The given <code>String</code> value is interpreted as a {@link Boolean} by the means
0736: * of <code>{@link Boolean#valueOf(String)}</code>. <p>
0737: *
0738: * @param booleanValue a <code>String</code> that is interpred as a {@link Boolean} by the means
0739: * of <code>{@link Boolean#valueOf(String)}</code>
0740: */
0741: public void setNewFolderCreateIndexPage(String booleanValue) {
0742:
0743: setNewFolderCreateIndexPage(Boolean.valueOf(booleanValue));
0744: }
0745:
0746: /**
0747: * Digester support method for configuration if the "edit properties" checkbox in the new folder
0748: * dialog should be initially be checked or not. <p>
0749: *
0750: * The given <code>String</code> value is interpreted as a {@link Boolean} by the means
0751: * of <code>{@link Boolean#valueOf(String)}</code>. <p>
0752: *
0753: * @param booleanValue a <code>String</code> that is interpred as a {@link Boolean} by the means
0754: * of <code>{@link Boolean#valueOf(String)}</code>
0755: */
0756: public void setNewFolderEditProperties(String booleanValue) {
0757:
0758: setNewFolderEditPropertes(Boolean.valueOf(booleanValue));
0759: }
0760:
0761: /**
0762: * Sets the publish related resources mode.<p>
0763: *
0764: * @param publishRelatedResourcesMode the publish related resources mode to set
0765: */
0766: public void setPublishRelatedResourcesMode(
0767: String publishRelatedResourcesMode) {
0768:
0769: m_publishRelatedResourcesMode = CmsPublishRelatedResourcesMode
0770: .valueOf(publishRelatedResourcesMode);
0771: if ((m_publishRelatedResourcesMode != null)
0772: && CmsLog.INIT.isInfoEnabled()) {
0773: CmsLog.INIT.info(Messages.get().getBundle().key(
0774: Messages.INIT_PUBLISH_RELATED_RESOURCES_MODE_1,
0775: m_publishRelatedResourcesMode.toString()));
0776: }
0777: }
0778:
0779: /**
0780: * Sets if the explorer view is restricted to the defined site and folder.<p>
0781: *
0782: * @param restrict true if the explorer view is restricted, otherwise false
0783: */
0784: public void setRestrictExplorerView(String restrict) {
0785:
0786: setRestrictExplorerView(Boolean.valueOf(restrict)
0787: .booleanValue());
0788: }
0789:
0790: /**
0791: * Sets if the file creation date should be shown in explorer view.<p>
0792: *
0793: * @param show true if the file creation date should be shown, otherwise false
0794: */
0795: public void setShowExplorerFileDateCreated(String show) {
0796:
0797: setShowExplorerFileDateCreated(Boolean.valueOf(show)
0798: .booleanValue());
0799: }
0800:
0801: /**
0802: * Sets if the file expire date should be shown in explorer view.<p>
0803: *
0804: * @param show true if the file expire date should be shown, otherwise false
0805: */
0806: public void setShowExplorerFileDateExpired(String show) {
0807:
0808: setShowExplorerFileDateExpired(Boolean.valueOf(show)
0809: .booleanValue());
0810: }
0811:
0812: /**
0813: * Sets if the file last modified date should be shown in explorer view.<p>
0814: *
0815: * @param show true if the file last modified date should be shown, otherwise false
0816: */
0817: public void setShowExplorerFileDateLastModified(String show) {
0818:
0819: setShowExplorerFileDateLastModified(Boolean.valueOf(show)
0820: .booleanValue());
0821: }
0822:
0823: /**
0824: * Sets if the file release date should be shown in explorer view.<p>
0825: *
0826: * @param show true if the file relese date should be shown, otherwise false
0827: */
0828: public void setShowExplorerFileDateReleased(String show) {
0829:
0830: setShowExplorerFileDateReleased(Boolean.valueOf(show)
0831: .booleanValue());
0832: }
0833:
0834: /**
0835: * Sets if the file locked by should be shown in explorer view.<p>
0836: *
0837: * @param show true if the file locked by should be shown, otherwise false
0838: */
0839: public void setShowExplorerFileLockedBy(String show) {
0840:
0841: setShowExplorerFileLockedBy(Boolean.valueOf(show)
0842: .booleanValue());
0843: }
0844:
0845: /**
0846: * Sets if the file navtext should be shown in explorer view.<p>
0847: *
0848: * @param show true if the file locked by should be shown, otherwise false
0849: */
0850: public void setShowExplorerFileNavText(String show) {
0851:
0852: setShowExplorerFileNavText(Boolean.valueOf(show).booleanValue());
0853: }
0854:
0855: /**
0856: * Sets if the file permissions should be shown in explorer view.<p>
0857: *
0858: * @param show true if the file permissions should be shown, otherwise false
0859: */
0860: public void setShowExplorerFilePermissions(String show) {
0861:
0862: setShowExplorerFilePermissions(Boolean.valueOf(show)
0863: .booleanValue());
0864: }
0865:
0866: /**
0867: * Sets if the file size should be shown in explorer view.<p>
0868: *
0869: * @param show true if the file size should be shown, otherwise false
0870: */
0871: public void setShowExplorerFileSize(String show) {
0872:
0873: setShowExplorerFileSize(Boolean.valueOf(show).booleanValue());
0874: }
0875:
0876: /**
0877: * Sets if the file state should be shown in explorer view.<p>
0878: *
0879: * @param show true if the state size should be shown, otherwise false
0880: */
0881: public void setShowExplorerFileState(String show) {
0882:
0883: setShowExplorerFileState(Boolean.valueOf(show).booleanValue());
0884: }
0885:
0886: /**
0887: * Sets if the file title should be shown in explorer view.<p>
0888: *
0889: * @param show true if the file title should be shown, otherwise false
0890: */
0891: public void setShowExplorerFileTitle(String show) {
0892:
0893: setShowExplorerFileTitle(Boolean.valueOf(show).booleanValue());
0894: }
0895:
0896: /**
0897: * Sets if the file type should be shown in explorer view.<p>
0898: *
0899: * @param show true if the file type should be shown, otherwise false
0900: */
0901: public void setShowExplorerFileType(String show) {
0902:
0903: setShowExplorerFileType(Boolean.valueOf(show).booleanValue());
0904: }
0905:
0906: /**
0907: * Sets if the file creator should be shown in explorer view.<p>
0908: *
0909: * @param show true if the file creator should be shown, otherwise false
0910: */
0911: public void setShowExplorerFileUserCreated(String show) {
0912:
0913: setShowExplorerFileUserCreated(Boolean.valueOf(show)
0914: .booleanValue());
0915: }
0916:
0917: /**
0918: * Sets if the file last modified by should be shown in explorer view.<p>
0919: *
0920: * @param show true if the file last modified by should be shown, otherwise false
0921: */
0922: public void setShowExplorerFileUserLastModified(String show) {
0923:
0924: setShowExplorerFileUserLastModified(Boolean.valueOf(show)
0925: .booleanValue());
0926: }
0927:
0928: /**
0929: * Sets if the export part of the secure/export dialog should be shown.<p>
0930: *
0931: * @param mode true if the export dialog should be shown, otherwise false
0932: */
0933: public void setShowExportSettingsDialog(String mode) {
0934:
0935: setDialogShowExportSettings(Boolean.valueOf(mode)
0936: .booleanValue());
0937: }
0938:
0939: /**
0940: * Controls whether to display a file upload icon or not.<p>
0941: *
0942: * @param flag <code>"true"</code> or <code>"false"</code> to flag the use of the file upload button
0943: */
0944: public void setShowFileUploadButton(String flag) {
0945:
0946: setShowFileUploadButton(Boolean.valueOf(flag).booleanValue());
0947: }
0948:
0949: /**
0950: * Sets if the lock dialog should be shown.<p>
0951: *
0952: * @param mode true if the lock dialog should be shown, otherwise false
0953: */
0954: public void setShowLockDialog(String mode) {
0955:
0956: setDialogShowLock(Boolean.valueOf(mode).booleanValue());
0957: }
0958:
0959: /**
0960: * Sets if the publish notification should be shown for the user.<p>
0961: *
0962: * @param notification <code>"true"</code> or <code>"false"</code> to flag the notification
0963: */
0964: public void setShowPublishNotification(String notification) {
0965:
0966: // set if the publish notification should be shown
0967: setShowPublishNotification(Boolean.valueOf(notification)
0968: .booleanValue());
0969: }
0970:
0971: /**
0972: * Digester support method for configuration if the resource type selection checkbox should
0973: * show up when uploading a new file in non-applet mode.<p>
0974: *
0975: * The given <code>String</code> value is interpreted as a {@link Boolean} by the means
0976: * of <code>{@link Boolean#valueOf(String)}</code>. <p>
0977: *
0978: * @param booleanValue a <code>String</code> that is interpred as a {@link Boolean} by the means
0979: * of <code>{@link Boolean#valueOf(String)}</code>
0980: */
0981: public void setShowUploadTypeDialog(String booleanValue) {
0982:
0983: setShowUploadTypeDialog(Boolean.valueOf(booleanValue));
0984: }
0985:
0986: /**
0987: * Sets the usage of the upload applet for the user user.<p>
0988: *
0989: * @param applet <code>"true"</code> or <code>"false"</code> to flag the use of the applet
0990: */
0991: public void setUploadApplet(String applet) {
0992:
0993: // set the usage of the upload applet
0994: setUseUploadApplet(Boolean.valueOf(applet).booleanValue());
0995: }
0996:
0997: /**
0998: * Sets the style of the workplace buttons of the user.<p>
0999: *
1000: * @param buttonstyle the style of the workplace buttons of the user
1001: */
1002: public void setWorkplaceButtonStyle(String buttonstyle) {
1003:
1004: int buttonstyleValue = BUTTONSTYLE_TEXTIMAGE;
1005: try {
1006: if (buttonstyle != null) {
1007: buttonstyleValue = BUTTON_STYLES_LIST
1008: .indexOf(buttonstyle);
1009: }
1010: } catch (Exception e) {
1011: // do nothing, use the default value
1012: }
1013: setWorkplaceButtonStyle(buttonstyleValue);
1014: }
1015:
1016: /**
1017: * Sets the style of the workplace search default view.<p>
1018: *
1019: * @param viewStyle the style of the workplace search default view
1020: */
1021: public void setWorkplaceSearchViewStyle(String viewStyle) {
1022:
1023: setWorkplaceSearchViewStyle(CmsSearchResultStyle
1024: .valueOf(viewStyle));
1025: }
1026:
1027: /**
1028: * Checks if a specific explorer setting depending is set.<p>
1029: *
1030: * @param setting the settings constant value for the explorer settings
1031: * @return <code>"true"</code> if the explorer setting is set, otherwise <code>"false"</code>
1032: */
1033: private String getExplorerSetting(int setting) {
1034:
1035: return String.valueOf((getExplorerSettings() & setting) > 0);
1036: }
1037: }
|