001/* 002 * This library is part of OpenCms - 003 * the Open Source Content Management System 004 * 005 * Copyright (c) Alkacon Software GmbH & Co. KG (http://www.alkacon.com) 006 * 007 * This library is free software; you can redistribute it and/or 008 * modify it under the terms of the GNU Lesser General Public 009 * License as published by the Free Software Foundation; either 010 * version 2.1 of the License, or (at your option) any later version. 011 * 012 * This library is distributed in the hope that it will be useful, 013 * but WITHOUT ANY WARRANTY; without even the implied warranty of 014 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 015 * Lesser General Public License for more details. 016 * 017 * For further information about Alkacon Software GmbH & Co. KG, please see the 018 * company website: http://www.alkacon.com 019 * 020 * For further information about OpenCms, please see the 021 * project website: http://www.opencms.org 022 * 023 * You should have received a copy of the GNU Lesser General Public 024 * License along with this library; if not, write to the Free Software 025 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 026 */ 027 028package org.opencms.db; 029 030import org.opencms.configuration.CmsDefaultUserSettings; 031import org.opencms.configuration.CmsWorkplaceConfiguration; 032import org.opencms.configuration.I_CmsXmlConfiguration; 033import org.opencms.configuration.preferences.I_CmsPreference; 034import org.opencms.file.CmsObject; 035import org.opencms.file.CmsResource.CmsResourceCopyMode; 036import org.opencms.file.CmsResource.CmsResourceDeleteMode; 037import org.opencms.file.CmsUser; 038import org.opencms.i18n.CmsLocaleManager; 039import org.opencms.main.CmsContextInfo; 040import org.opencms.main.CmsException; 041import org.opencms.main.CmsLog; 042import org.opencms.main.OpenCms; 043import org.opencms.report.I_CmsReport; 044import org.opencms.synchronize.CmsSynchronizeSettings; 045import org.opencms.util.A_CmsModeStringEnumeration; 046import org.opencms.util.CmsStringUtil; 047import org.opencms.workplace.CmsWorkplace; 048 049import java.util.ArrayList; 050import java.util.HashSet; 051import java.util.Iterator; 052import java.util.LinkedHashMap; 053import java.util.List; 054import java.util.Locale; 055import java.util.Map; 056import java.util.Set; 057import java.util.SortedMap; 058import java.util.TreeMap; 059 060import org.apache.commons.logging.Log; 061 062import com.google.common.collect.Maps; 063 064/** 065 * Object to conveniently access and modify the users workplace settings.<p> 066 * 067 * @since 6.0.0 068 */ 069public class CmsUserSettings { 070 071 /** 072 * Enumeration class for workplace search result styles.<p> 073 */ 074 public static final class CmsSearchResultStyle extends A_CmsModeStringEnumeration { 075 076 /** Workplace search result style explorer view. */ 077 public static final CmsSearchResultStyle STYLE_EXPLORER = new CmsSearchResultStyle( 078 "explorer", 079 Messages.GUI_WORKPLACE_SEARCH_STYLE_EXPLORER_0); 080 081 /** Workplace search result style list view with excerpts. */ 082 public static final CmsSearchResultStyle STYLE_LIST_WITH_EXCERPTS = new CmsSearchResultStyle( 083 "list-with-excerpts", 084 Messages.GUI_WORKPLACE_SEARCH_STYLE_LIST_WITH_EXCERPTS_0); 085 086 /** Workplace search result style list view without excerpts. */ 087 public static final CmsSearchResultStyle STYLE_LIST_WITHOUT_EXCERPTS = new CmsSearchResultStyle( 088 "list-without-excerpts", 089 Messages.GUI_WORKPLACE_SEARCH_STYLE_LIST_WITHOUT_EXCERPTS_0); 090 091 /** Serializable version id. */ 092 private static final long serialVersionUID = 6611568161885127011L; 093 094 /** The localization key for this style. */ 095 private final String m_key; 096 097 /** 098 * Private constructor.<p> 099 * 100 * @param style the workplace search result style string representation 101 * @param key the localization key for this style 102 */ 103 private CmsSearchResultStyle(String style, String key) { 104 105 super(style); 106 m_key = key; 107 } 108 109 /** 110 * Returns the copy mode object from the old copy mode integer.<p> 111 * 112 * @param mode the old copy mode integer 113 * 114 * @return the copy mode object 115 */ 116 public static CmsSearchResultStyle valueOf(String mode) { 117 118 if (STYLE_LIST_WITHOUT_EXCERPTS.getMode().equals(mode)) { 119 return STYLE_LIST_WITHOUT_EXCERPTS; 120 } else if (STYLE_LIST_WITH_EXCERPTS.getMode().equals(mode)) { 121 return STYLE_LIST_WITH_EXCERPTS; 122 } else { 123 return STYLE_EXPLORER; 124 } 125 } 126 127 /** 128 * Returns the localization key for this style.<p> 129 * 130 * @return the localization key for this style 131 */ 132 public String getKey() { 133 134 return m_key; 135 } 136 } 137 138 /** A enum for the different upload variants. */ 139 public enum UploadVariant { 140 /** The default html upload. */ 141 basic, 142 /** The gwt upload. */ 143 gwt 144 } 145 146 /** Key for additional info address. */ 147 public static final String ADDITIONAL_INFO_ADDRESS = "USER_ADDRESS"; 148 149 /** Key for additional info city. */ 150 public static final String ADDITIONAL_INFO_CITY = "USER_TOWN"; // Value must unfortunately still be "USER_TOWN" or existing serialized user information will be lost 151 152 /** Key for additional info of resources that were confirmed by the user. */ 153 public static final String ADDITIONAL_INFO_CONFIRMED_RESOURCES = "ADDITIONAL_INFO_CONFIRMED_RESOURCES"; 154 155 /** Key for additional info address. */ 156 public static final String ADDITIONAL_INFO_COUNTRY = "USER_COUNTRY"; 157 158 /** Key for additional info default group. */ 159 public static final String ADDITIONAL_INFO_DEFAULTGROUP = "USER_DEFAULTGROUP"; 160 161 /** Key for additional info address. */ 162 public static final String ADDITIONAL_INFO_DESCRIPTION = "USER_DESCRIPTION"; 163 164 /** Key for additional info explorer settings. */ 165 public static final String ADDITIONAL_INFO_EXPLORERSETTINGS = "USER_EXPLORERSETTINGS"; 166 167 /** Key for additional info institution. */ 168 public static final String ADDITIONAL_INFO_INSTITUTION = "USER_INSTITUTION"; 169 170 /** Key for last password change additional info. */ 171 public static final String ADDITIONAL_INFO_LAST_PASSWORD_CHANGE = "LAST_PASSWORD_CHANGE"; 172 173 /** Key for last user data check additional info. */ 174 public static final String ADDITIONAL_INFO_LAST_USER_DATA_CHECK = "ADDITIONAL_INFO_LAST_USER_DATA_CHECK"; 175 176 /**Additional info which indicates, that a password was reset by an admin. */ 177 public static final String ADDITIONAL_INFO_PASSWORD_RESET = "RESET_PASSWORD"; 178 179 /** Key for additional info flags. */ 180 public static final String ADDITIONAL_INFO_PREFERENCES = "USER_PREFERENCES"; 181 182 /** Key for additional info start settings. */ 183 public static final String ADDITIONAL_INFO_STARTSETTINGS = "USER_STARTSETTINGS"; 184 185 /** Key for additional info time warp. */ 186 public static final String ADDITIONAL_INFO_TIMEWARP = "USER_TIMEWARP"; 187 188 /** Key for additional info upload applet client folder path. */ 189 public static final String ADDITIONAL_INFO_UPLOADAPPLET_CLIENTFOLDER = "USER_UPLOADAPPLET_CLIENTFOLDER"; 190 191 /** Key for additional info address. */ 192 public static final String ADDITIONAL_INFO_ZIPCODE = "USER_ZIPCODE"; 193 194 /** Flag for displaying the date created column. */ 195 public static final int FILELIST_DATE_CREATED = 1024; 196 197 /** Flag for displaying the date expired column. */ 198 public static final int FILELIST_DATE_EXPIRED = 8192; 199 200 /** Flag for displaying the changed column. */ 201 public static final int FILELIST_DATE_LASTMODIFIED = 4; 202 203 /** Flag for displaying the date released column. */ 204 public static final int FILELIST_DATE_RELEASED = 4096; 205 206 /** Flag for displaying the locked column. */ 207 public static final int FILELIST_LOCKEDBY = 256; 208 209 /** Flag for displaying the name column. */ 210 public static final int FILELIST_NAME = 512; 211 212 /** Flag for displaying the navigation text column. */ 213 public static final int FILELIST_NAVTEXT = 64; 214 215 /** Flag for displaying the access column. */ 216 public static final int FILELIST_PERMISSIONS = 128; 217 218 /** Flag for displaying the size column. */ 219 public static final int FILELIST_SIZE = 8; 220 221 /** Flag for displaying the state column. */ 222 public static final int FILELIST_STATE = 16; 223 224 /** Flag for displaying the title column. */ 225 public static final int FILELIST_TITLE = 1; 226 227 /** Flag for displaying the file type column. */ 228 public static final int FILELIST_TYPE = 2; 229 230 /** Flag for displaying the owner column. */ 231 public static final int FILELIST_USER_CREATED = 32; 232 233 /** Flag for displaying the user who last modified column. */ 234 public static final int FILELIST_USER_LASTMODIFIED = 2048; 235 236 /** Identifier for the login user agreement accepted information. */ 237 public static final String LOGIN_USERAGREEMENT_ACCEPTED = "LOGIN_UA_ACCEPTED"; 238 239 /** Preference for setting which workplace to open on startup. */ 240 public static final String PREF_WORKPLACE_MODE = "workplaceMode"; 241 242 /** Identifier prefix for all keys in the user additional info table. */ 243 public static final String PREFERENCES = "USERPREFERENCES_"; 244 245 /** Prefix for additional info key for user defined preferences. */ 246 public static final String PREFERENCES_ADDITIONAL_PREFIX = PREFERENCES + "additional_"; 247 248 /** Identifier for the synchronize setting key. */ 249 public static final String SYNC_DESTINATION = "DESTINATION"; 250 251 /** Identifier for the synchronize setting key. */ 252 public static final String SYNC_ENABLED = "ENABLED"; 253 254 /** Identifier for the synchronize setting key. */ 255 public static final String SYNC_SETTINGS = "SYNC_SETTINGS_"; 256 257 /** Identifier for the synchronize setting key. */ 258 public static final String SYNC_VFS_LIST = "VFS_LIST"; 259 260 /** Preference value for new workplace. */ 261 public static final String WORKPLACE_MODE_NEW = "new"; 262 263 /** Preference value for new workplace. */ 264 public static final String WORKPLACE_MODE_OLD = "old"; 265 266 /** The default button style. */ 267 private static final int BUTTONSTYLE_DEFAULT = 1; 268 269 /** The default number of entries per page. */ 270 private static final int ENTRYS_PER_PAGE_DEFAULT = 50; 271 272 /** The log object for this class. */ 273 private static final Log LOG = CmsLog.getLog(CmsUserSettings.class); 274 275 /** Default workplace search index name. */ 276 private static final String SEARCH_INDEX_DEFAULT = "Offline project (VFS)"; 277 278 /** Map used to store user-defined preferences. */ 279 private Map<String, String> m_additionalPreferences = new LinkedHashMap<String, String>(); 280 281 /** The direct publish setting. */ 282 private boolean m_dialogDirectpublish; 283 284 /** The expand inherited permissions setting. */ 285 private boolean m_dialogExpandInheritedPermissions; 286 287 /** The expand user permissions setting. */ 288 private boolean m_dialogExpandUserPermissions; 289 290 /** The resource copy mode setting. */ 291 private CmsResourceCopyMode m_dialogFileCopy; 292 293 /** The resource delete mode setting. */ 294 private CmsResourceDeleteMode m_dialogFileDelete; 295 296 /** The folder copy mode setting. */ 297 private CmsResourceCopyMode m_dialogFolderCopy; 298 299 /** The inherit permission on folder setting. */ 300 private boolean m_dialogPermissionsInheritOnFolder; 301 302 /** The direct edit button setting. */ 303 private int m_directeditButtonStyle; 304 305 /** The editor button style setting. */ 306 private int m_editorButtonStyle; 307 308 /** The editor settings. */ 309 private SortedMap<String, String> m_editorSettings; 310 311 /** The explorer button style. */ 312 private int m_explorerButtonStyle; 313 314 /** The explorer file entries setting. */ 315 private int m_explorerFileEntries; 316 317 /** The list of numbers in the preferences dialog, how much entries shown on a page. */ 318 private String m_explorerFileEntryOptions; 319 320 /** The explorer setting. */ 321 private int m_explorerSettings; 322 323 /** Flag to determine if all projects should be list. */ 324 private boolean m_listAllProjects; 325 326 /** The locale.*/ 327 private Locale m_locale; 328 329 /** Controls if the "create index page" check box in the new folder dialog should be initially be checked or not. */ 330 private Boolean m_newFolderCreateIndexPage; 331 332 /** Controls if the "edit properties" check box in the new folder dialog should be initially be checked or not. */ 333 private Boolean m_newFolderEditProperties; 334 335 /** The project. */ 336 private String m_project; 337 338 /** Controls appearance of the publish button. */ 339 private String m_publishButtonAppearance; 340 341 /** The restricted explorer view setting. */ 342 private boolean m_restrictExplorerView; 343 344 /** The show export setting. */ 345 private boolean m_showExportSettings; 346 347 /** Flag that controls display of the file upload button. */ 348 private boolean m_showFileUploadButton; 349 350 /** The show lock setting. */ 351 private boolean m_showLock; 352 353 /** Flag to determine if the publish notifications should be shown. */ 354 private boolean m_showPublishNotification; 355 356 /** Controls if the resource type dialog for uploaded resources (not the applet) is shown or not. */ 357 private Boolean m_showUploadTypeDialog; 358 359 /** The start folder. */ 360 private String m_startFolder; 361 362 /** Contains the key value entries with start setting for different gallery types. */ 363 private SortedMap<String, String> m_startGalleriesSettings; 364 365 /** The start site. */ 366 private String m_startSite; 367 368 /** The synchronize settings. */ 369 private CmsSynchronizeSettings m_synchronizeSettings; 370 371 /** The custom user surf time. */ 372 private long m_timeWarp; 373 374 /** The path of the preselected folder for the upload applet on the client machine. */ 375 private String m_uploadAppletClientFolder; 376 377 /** Stores the upload variant enum. */ 378 private UploadVariant m_uploadVariant; 379 380 /** The user. */ 381 private CmsUser m_user; 382 383 /** The view. */ 384 private String m_view; 385 386 /** The workplace button style. */ 387 private int m_workplaceButtonStyle; 388 389 /** The workplace report type. */ 390 private String m_workplaceReportType; 391 392 /** The name of the search index to use in the workplace. */ 393 private String m_workplaceSearchIndexName; 394 395 /** Workplace search result list view style. */ 396 private CmsSearchResultStyle m_workplaceSearchViewStyle; 397 398 /** 399 * Creates an empty new user settings object.<p> 400 */ 401 public CmsUserSettings() { 402 403 m_workplaceButtonStyle = CmsUserSettings.BUTTONSTYLE_DEFAULT; 404 m_workplaceReportType = I_CmsReport.REPORT_TYPE_SIMPLE; 405 m_explorerButtonStyle = CmsUserSettings.BUTTONSTYLE_DEFAULT; 406 m_explorerFileEntries = CmsUserSettings.ENTRYS_PER_PAGE_DEFAULT; 407 m_explorerSettings = CmsUserSettings.FILELIST_NAME; 408 m_editorSettings = new TreeMap<String, String>(); 409 m_startGalleriesSettings = new TreeMap<String, String>(); 410 m_showFileUploadButton = true; 411 m_showPublishNotification = false; 412 m_listAllProjects = false; 413 m_uploadVariant = UploadVariant.gwt; 414 m_publishButtonAppearance = CmsDefaultUserSettings.PUBLISHBUTTON_SHOW_ALWAYS; 415 m_newFolderCreateIndexPage = Boolean.TRUE; 416 m_newFolderEditProperties = Boolean.TRUE; 417 m_showUploadTypeDialog = Boolean.TRUE; 418 m_workplaceSearchIndexName = SEARCH_INDEX_DEFAULT; 419 m_workplaceSearchViewStyle = CmsSearchResultStyle.STYLE_EXPLORER; 420 } 421 422 /** 423 * Creates a user settings object with initialized settings of the current user.<p> 424 * 425 * @param cms the OpenCms context 426 */ 427 public CmsUserSettings(CmsObject cms) { 428 429 this(cms.getRequestContext().getCurrentUser()); 430 } 431 432 /** 433 * Creates a user settings object with initialized settings of the user.<p> 434 * 435 * Some default settings will not be set, if no cms object is given.<p> 436 * 437 * @param user the current CmsUser 438 * 439 * @see #CmsUserSettings(CmsObject) 440 */ 441 public CmsUserSettings(CmsUser user) { 442 443 init(user); 444 } 445 446 /** 447 * Gets a configured preference.<p> 448 * 449 * @param cms the cms context 450 * @param key the settings key 451 * @param useDefault true if we want the default value if no value is configured 452 * 453 * @return the preference value 454 */ 455 public static String getAdditionalPreference(CmsObject cms, String key, boolean useDefault) { 456 457 CmsUser user = cms.getRequestContext().getCurrentUser(); 458 CmsUserSettings settings = new CmsUserSettings(user); 459 return settings.getAdditionalPreference(key, useDefault); 460 } 461 462 /** 463 * Sets a configured preference.<p> 464 * 465 * @param cms the Cms context 466 * @param key the setting name 467 * @param value the value 468 */ 469 public static void setAdditionalPreference(CmsObject cms, String key, String value) { 470 471 CmsUser user = cms.getRequestContext().getCurrentUser(); 472 CmsUserSettings settings = new CmsUserSettings(user); 473 settings.setAdditionalPreference(key, value); 474 try { 475 settings.save(cms); 476 } catch (CmsException e) { 477 LOG.error("Could not store preference " + key + ": " + e.getLocalizedMessage(), e); 478 } 479 } 480 481 /** 482 * Gets the value for a user defined preference.<p> 483 * 484 * @param name the name of the preference 485 * @param useDefault true if the default value should be returned in case the preference is not set 486 * 487 * @return the preference value 488 */ 489 public String getAdditionalPreference(String name, boolean useDefault) { 490 491 String value = m_additionalPreferences.get(name); 492 if ((value == null) && useDefault) { 493 I_CmsPreference pref = OpenCms.getWorkplaceManager().getDefaultUserSettings().getPreferences().get(name); 494 if (pref != null) { 495 value = pref.getDefaultValue(); 496 } 497 } 498 return value; 499 } 500 501 /** 502 * Gets the default copy mode when copying a file of the user.<p> 503 * 504 * @return the default copy mode when copying a file of the user 505 */ 506 public CmsResourceCopyMode getDialogCopyFileMode() { 507 508 return m_dialogFileCopy; 509 } 510 511 /** 512 * Gets the default copy mode when copying a folder of the user.<p> 513 * 514 * @return the default copy mode when copying a folder of the user 515 */ 516 public CmsResourceCopyMode getDialogCopyFolderMode() { 517 518 return m_dialogFolderCopy; 519 } 520 521 /** 522 * Returns the default setting for file deletion.<p> 523 * 524 * @return the default setting for file deletion 525 */ 526 public CmsResourceDeleteMode getDialogDeleteFileMode() { 527 528 return m_dialogFileDelete; 529 } 530 531 /** 532 * Returns the default setting for expanding inherited permissions in the dialog.<p> 533 * 534 * @return true if inherited permissions should be expanded, otherwise false 535 */ 536 public boolean getDialogExpandInheritedPermissions() { 537 538 return m_dialogExpandInheritedPermissions; 539 } 540 541 /** 542 * Returns the default setting for expanding the users permissions in the dialog.<p> 543 * 544 * @return true if the users permissions should be expanded, otherwise false 545 */ 546 public boolean getDialogExpandUserPermissions() { 547 548 return m_dialogExpandUserPermissions; 549 } 550 551 /** 552 * Returns the default setting for inheriting permissions on folders.<p> 553 * 554 * @return true if permissions should be inherited on folders, otherwise false 555 */ 556 public boolean getDialogPermissionsInheritOnFolder() { 557 558 return m_dialogPermissionsInheritOnFolder; 559 } 560 561 /** 562 * Returns the default setting for direct publishing.<p> 563 * 564 * @return the default setting for direct publishing: true if siblings should be published, otherwise false 565 */ 566 public boolean getDialogPublishSiblings() { 567 568 return m_dialogDirectpublish; 569 } 570 571 /** 572 * Determines if the export part of the secure/export dialog should be shown.<p> 573 * 574 * @return true if the export dialog is shown, otherwise false 575 */ 576 public boolean getDialogShowExportSettings() { 577 578 return m_showExportSettings; 579 } 580 581 /** 582 * Determines if the lock dialog should be shown.<p> 583 * 584 * @return true if the lock dialog is shown, otherwise false 585 */ 586 public boolean getDialogShowLock() { 587 588 return m_showLock; 589 } 590 591 /** 592 * Returns the style of the direct edit buttons of the user.<p> 593 * 594 * @return the style of the direct edit buttons of the user 595 */ 596 public int getDirectEditButtonStyle() { 597 598 return m_directeditButtonStyle; 599 } 600 601 /** 602 * Returns the style of the editor buttons of the user.<p> 603 * 604 * @return the style of the editor buttons of the user 605 */ 606 public int getEditorButtonStyle() { 607 608 return m_editorButtonStyle; 609 } 610 611 /** 612 * Returns the editor settings of the user.<p> 613 * 614 * @return the editor settings of the user 615 */ 616 public Map<String, String> getEditorSettings() { 617 618 return m_editorSettings; 619 } 620 621 /** 622 * Returns the style of the explorer buttons of the user.<p> 623 * 624 * @return the style of the explorer buttons of the user 625 */ 626 public int getExplorerButtonStyle() { 627 628 return m_explorerButtonStyle; 629 } 630 631 /** 632 * Returns the number of displayed files per page of the user.<p> 633 * 634 * @return the number of displayed files per page of the user 635 */ 636 public int getExplorerFileEntries() { 637 638 return m_explorerFileEntries; 639 } 640 641 /** 642 * Returns the explorerFileEntryOptions.<p> 643 * 644 * @return the explorerFileEntryOptions 645 */ 646 public String getExplorerFileEntryOptions() { 647 648 return m_explorerFileEntryOptions; 649 } 650 651 /** 652 * Returns the explorer start settings.<p> 653 * 654 * @return the explorer start settings 655 */ 656 public int getExplorerSettings() { 657 658 return m_explorerSettings; 659 } 660 661 /** 662 * Returns if all projects should be listed or only the ones in the current ou.<p> 663 * 664 * @return true if all projects should be listed, otherwise false 665 */ 666 public boolean getListAllProjects() { 667 668 return m_listAllProjects; 669 } 670 671 /** 672 * Returns the locale of the user.<p> 673 * 674 * @return the locale of the user 675 */ 676 public Locale getLocale() { 677 678 return m_locale; 679 } 680 681 /** 682 * Returns <code>{@link Boolean#TRUE}</code> if the "create index page" check box in the new folder 683 * dialog should be initially be checked. <p> 684 * 685 * @return <code>{@link Boolean#TRUE}</code> if the "create index page" check box in the new folder 686 * dialog should be initially be checked. 687 */ 688 public Boolean getNewFolderCreateIndexPage() { 689 690 return m_newFolderCreateIndexPage; 691 } 692 693 /** 694 * Returns <code>{@link Boolean#TRUE}</code> if the "edit properties" check box in the new folder 695 * dialog should be initially be checked. <p> 696 * 697 * @return <code>{@link Boolean#TRUE}</code> if the "edit properties" check box in the new folder 698 * dialog should be initially be checked. 699 */ 700 public Boolean getNewFolderEditProperties() { 701 702 return m_newFolderEditProperties; 703 } 704 705 /** 706 * Returns the preferred editor for the given resource type of the user.<p> 707 * 708 * @param resourceType the resource type 709 * @return the preferred editor for the resource type or null, if not specified 710 */ 711 public String getPreferredEditor(String resourceType) { 712 713 return m_editorSettings.get(resourceType); 714 } 715 716 /** 717 * Returns the appearance of the "publish project" button.<p> 718 * 719 * This can be either {@link CmsDefaultUserSettings#PUBLISHBUTTON_SHOW_ALWAYS}, 720 * {@link CmsDefaultUserSettings#PUBLISHBUTTON_SHOW_AUTO} or 721 * {@link CmsDefaultUserSettings#PUBLISHBUTTON_SHOW_NEVER}.<p> 722 * 723 * @return the appearance of the "publish project" button 724 */ 725 public String getPublishButtonAppearance() { 726 727 return m_publishButtonAppearance; 728 } 729 730 /** 731 * Sets if the explorer view is restricted to the defined site and folder.<p> 732 * 733 * @return true if the explorer view is restricted, otherwise false 734 */ 735 public boolean getRestrictExplorerView() { 736 737 return m_restrictExplorerView; 738 } 739 740 /** 741 * Returns <code>true</code> if the file upload button should be shown or <code>false</code> otherwise.<p> 742 * 743 * @return the showFileUpload 744 */ 745 public boolean getShowFileUploadButton() { 746 747 return m_showFileUploadButton; 748 } 749 750 /** 751 * Returns if the publish notifications should be shown or not.<p> 752 * 753 * @return true if the publish notifications should be shown, otherwise false 754 */ 755 public boolean getShowPublishNotification() { 756 757 return m_showPublishNotification; 758 } 759 760 /** 761 * Returns <code>{@link Boolean#TRUE}</code> if the resource type selection dialog should 762 * be shown in the file upload process (non - applet version). <p> 763 * 764 * @return <code>{@link Boolean#TRUE}</code> if the resource type selection dialog should 765 * be shown in the file upload process (non - applet version). 766 */ 767 public Boolean getShowUploadTypeDialog() { 768 769 return m_showUploadTypeDialog; 770 } 771 772 /** 773 * Returns the start folder of the user.<p> 774 * 775 * @return the start folder of the user 776 */ 777 public String getStartFolder() { 778 779 return m_startFolder; 780 } 781 782 /** 783 * The start galleries settings of the user.<p> 784 * 785 * @return the start galleries settings of the user 786 */ 787 public Map<String, String> getStartGalleriesSettings() { 788 789 return m_startGalleriesSettings; 790 } 791 792 /** 793 * Returns the path to the start gallery of the user.<p> 794 * 795 * @param galleryType the type of the gallery 796 * @return the path to the start gallery or null, if no key 797 */ 798 public String getStartGallery(String galleryType) { 799 800 return m_startGalleriesSettings.get(galleryType); 801 802 } 803 804 /** 805 * Returns the root site path to the start gallery of the user or the constant CmsPreferences.INPUT_DEFAULT.<p> 806 * 807 * @param galleryType the type of the gallery 808 * @param cms Cms object 809 * @return the root site path to the start gallery or the default key, null if "not set" 810 */ 811 public String getStartGallery(String galleryType, CmsObject cms) { 812 813 String startGallerySetting = getStartGallery(galleryType); 814 String pathSetting = null; 815 // if a custom path to the gallery is selected 816 if ((startGallerySetting != null) && !startGallerySetting.equals(CmsWorkplace.INPUT_NONE)) { 817 String sitePath = cms.getRequestContext().removeSiteRoot(startGallerySetting); 818 if (cms.existsResource(sitePath)) { 819 pathSetting = startGallerySetting; 820 } else { 821 pathSetting = CmsWorkplace.INPUT_DEFAULT; 822 } 823 // global default settings 824 } else if (startGallerySetting == null) { 825 pathSetting = CmsWorkplace.INPUT_DEFAULT; 826 } 827 return pathSetting; 828 829 } 830 831 /** 832 * Returns the start project of the user.<p> 833 * 834 * @return the start project of the user 835 */ 836 public String getStartProject() { 837 838 return m_project; 839 } 840 841 /** 842 * Returns the start site of the user.<p> 843 * 844 * @return the start site of the user 845 */ 846 public String getStartSite() { 847 848 return m_startSite; 849 } 850 851 /** 852 * Returns the current start view of the user.<p> 853 * 854 * @return the current start view of the user 855 */ 856 public String getStartView() { 857 858 return m_view; 859 } 860 861 /** 862 * Returns the (optional) workplace synchronize settings.<p> 863 * 864 * @return the (optional) workplace synchronize settings 865 */ 866 public CmsSynchronizeSettings getSynchronizeSettings() { 867 868 return m_synchronizeSettings; 869 } 870 871 /** 872 * Returns the current users time warp time, or 873 * {@link org.opencms.main.CmsContextInfo#CURRENT_TIME} if this feature is disabled and the current time 874 * is used for each user request.<p> 875 * 876 * @return the current users time warp time, or 877 * {@link org.opencms.main.CmsContextInfo#CURRENT_TIME} if this feature is disabled 878 */ 879 public long getTimeWarp() { 880 881 return m_timeWarp; 882 } 883 884 /** 885 * Returns the folder path of the upload applet on the client machine.<p> 886 * 887 * @return the folder path of the upload applet on the client machine 888 */ 889 public String getUploadAppletClientFolder() { 890 891 return m_uploadAppletClientFolder; 892 } 893 894 /** 895 * Returns the uploadVariant.<p> 896 * 897 * @return the uploadVariant 898 */ 899 public UploadVariant getUploadVariant() { 900 901 return m_uploadVariant; 902 } 903 904 /** 905 * Returns the current user for the settings.<p> 906 * 907 * @return the CmsUser 908 */ 909 public CmsUser getUser() { 910 911 return m_user; 912 } 913 914 /** 915 * Returns the style of the workplace buttons of the user.<p> 916 * 917 * @return the style of the workplace buttons of the user 918 */ 919 public int getWorkplaceButtonStyle() { 920 921 return m_workplaceButtonStyle; 922 } 923 924 /** 925 * Returns the type of the report (simple or extended) of the user.<p> 926 * 927 * @return the type of the report (simple or extended) of the user 928 */ 929 public String getWorkplaceReportType() { 930 931 return m_workplaceReportType; 932 } 933 934 /** 935 * Returns the name of the search index to use in the workplace.<p> 936 * 937 * @return the name of the search index to use in the workplace 938 */ 939 public String getWorkplaceSearchIndexName() { 940 941 return m_workplaceSearchIndexName; 942 } 943 944 /** 945 * Returns the workplace search result list view style.<p> 946 * 947 * @return the workplace search result list view style 948 */ 949 public CmsSearchResultStyle getWorkplaceSearchViewStyle() { 950 951 return m_workplaceSearchViewStyle; 952 } 953 954 /** 955 * Initializes the user settings with the given users setting parameters.<p> 956 * 957 * @param user the current CmsUser 958 */ 959 public void init(CmsUser user) { 960 961 m_user = user; 962 963 // try to initialize the User Settings with the values stored in the user object. 964 // if no values are found, the default user settings will be used. 965 966 // workplace button style 967 try { 968 m_workplaceButtonStyle = ((Integer)m_user.getAdditionalInfo( 969 PREFERENCES 970 + CmsWorkplaceConfiguration.N_WORKPLACEGENERALOPTIONS 971 + CmsWorkplaceConfiguration.N_BUTTONSTYLE)).intValue(); 972 } catch (Throwable t) { 973 m_workplaceButtonStyle = OpenCms.getWorkplaceManager().getDefaultUserSettings().getWorkplaceButtonStyle(); 974 } 975 // workplace time warp setting 976 Object timeWarpObj = m_user.getAdditionalInfo(ADDITIONAL_INFO_TIMEWARP); 977 try { 978 m_timeWarp = ((Long)timeWarpObj).longValue(); 979 } catch (ClassCastException e) { 980 try { 981 m_timeWarp = Long.parseLong((String)timeWarpObj); 982 if (m_timeWarp < 0) { 983 m_timeWarp = CmsContextInfo.CURRENT_TIME; 984 } 985 } catch (Throwable t) { 986 m_timeWarp = CmsContextInfo.CURRENT_TIME; 987 } 988 } catch (Throwable t) { 989 m_timeWarp = CmsContextInfo.CURRENT_TIME; 990 } 991 // workplace report type 992 m_workplaceReportType = (String)m_user.getAdditionalInfo( 993 PREFERENCES + CmsWorkplaceConfiguration.N_WORKPLACEGENERALOPTIONS + CmsWorkplaceConfiguration.N_REPORTTYPE); 994 if (m_workplaceReportType == null) { 995 m_workplaceReportType = OpenCms.getWorkplaceManager().getDefaultUserSettings().getWorkplaceReportType(); 996 } 997 // workplace list all projects 998 try { 999 m_listAllProjects = ((Boolean)m_user.getAdditionalInfo( 1000 PREFERENCES 1001 + CmsWorkplaceConfiguration.N_WORKPLACEGENERALOPTIONS 1002 + CmsWorkplaceConfiguration.N_LISTALLPROJECTS)).booleanValue(); 1003 } catch (Throwable t) { 1004 m_listAllProjects = OpenCms.getWorkplaceManager().getDefaultUserSettings().getListAllProjects(); 1005 } 1006 // workplace show publish notification 1007 try { 1008 m_showPublishNotification = ((Boolean)m_user.getAdditionalInfo( 1009 PREFERENCES 1010 + CmsWorkplaceConfiguration.N_WORKPLACEGENERALOPTIONS 1011 + CmsWorkplaceConfiguration.N_PUBLISHNOTIFICATION)).booleanValue(); 1012 } catch (Throwable t) { 1013 m_showPublishNotification = OpenCms.getWorkplaceManager().getDefaultUserSettings().getShowPublishNotification(); 1014 } 1015 // workplace upload applet mode 1016 setUploadVariant( 1017 String.valueOf( 1018 m_user.getAdditionalInfo( 1019 PREFERENCES 1020 + CmsWorkplaceConfiguration.N_WORKPLACEGENERALOPTIONS 1021 + CmsWorkplaceConfiguration.N_UPLOADAPPLET))); 1022 1023 // locale 1024 Object obj = m_user.getAdditionalInfo( 1025 PREFERENCES + CmsWorkplaceConfiguration.N_WORKPLACESTARTUPSETTINGS + CmsWorkplaceConfiguration.N_LOCALE); 1026 if (obj == null) { 1027 m_locale = null; 1028 } else { 1029 m_locale = CmsLocaleManager.getLocale(String.valueOf(obj)); 1030 } 1031 if (m_locale == null) { 1032 m_locale = OpenCms.getWorkplaceManager().getDefaultUserSettings().getLocale(); 1033 } 1034 // start project 1035 try { 1036 m_project = (String)m_user.getAdditionalInfo( 1037 PREFERENCES 1038 + CmsWorkplaceConfiguration.N_WORKPLACESTARTUPSETTINGS 1039 + CmsWorkplaceConfiguration.N_PROJECT); 1040 } catch (Throwable t) { 1041 m_project = null; 1042 } 1043 if (m_project == null) { 1044 m_project = OpenCms.getWorkplaceManager().getDefaultUserSettings().getStartProject(); 1045 String ou = user.getOuFqn(); 1046 if (ou == null) { 1047 ou = ""; 1048 } 1049 m_project = user.getOuFqn() + m_project; 1050 } 1051 // start view 1052 m_view = (String)m_user.getAdditionalInfo( 1053 PREFERENCES 1054 + CmsWorkplaceConfiguration.N_WORKPLACESTARTUPSETTINGS 1055 + CmsWorkplaceConfiguration.N_WORKPLACEVIEW); 1056 if (m_view == null) { 1057 m_view = OpenCms.getWorkplaceManager().getDefaultUserSettings().getStartView(); 1058 } 1059 // explorer button style 1060 try { 1061 m_explorerButtonStyle = ((Integer)m_user.getAdditionalInfo( 1062 PREFERENCES 1063 + CmsWorkplaceConfiguration.N_EXPLORERGENERALOPTIONS 1064 + CmsWorkplaceConfiguration.N_BUTTONSTYLE)).intValue(); 1065 } catch (Throwable t) { 1066 m_explorerButtonStyle = OpenCms.getWorkplaceManager().getDefaultUserSettings().getExplorerButtonStyle(); 1067 } 1068 // explorer file entries 1069 try { 1070 m_explorerFileEntries = ((Integer)m_user.getAdditionalInfo( 1071 PREFERENCES 1072 + CmsWorkplaceConfiguration.N_EXPLORERGENERALOPTIONS 1073 + CmsWorkplaceConfiguration.N_ENTRIES)).intValue(); 1074 } catch (Throwable t) { 1075 m_explorerFileEntries = OpenCms.getWorkplaceManager().getDefaultUserSettings().getExplorerFileEntries(); 1076 } 1077 // explorer settings 1078 try { 1079 m_explorerSettings = ((Integer)m_user.getAdditionalInfo( 1080 PREFERENCES 1081 + CmsWorkplaceConfiguration.N_EXPLORERGENERALOPTIONS 1082 + CmsWorkplaceConfiguration.N_EXPLORERDISPLAYOPTIONS)).intValue(); 1083 } catch (Throwable t) { 1084 m_explorerSettings = OpenCms.getWorkplaceManager().getDefaultUserSettings().getExplorerSettings(); 1085 } 1086 // dialog file copy mode 1087 try { 1088 m_dialogFileCopy = CmsResourceCopyMode.valueOf( 1089 ((Integer)m_user.getAdditionalInfo( 1090 PREFERENCES 1091 + CmsWorkplaceConfiguration.N_DIALOGSDEFAULTSETTINGS 1092 + CmsWorkplaceConfiguration.N_FILECOPY)).intValue()); 1093 } catch (Throwable t) { 1094 m_dialogFileCopy = OpenCms.getWorkplaceManager().getDefaultUserSettings().getDialogCopyFileMode(); 1095 } 1096 // dialog folder copy mode 1097 try { 1098 m_dialogFolderCopy = CmsResourceCopyMode.valueOf( 1099 ((Integer)m_user.getAdditionalInfo( 1100 PREFERENCES 1101 + CmsWorkplaceConfiguration.N_DIALOGSDEFAULTSETTINGS 1102 + CmsWorkplaceConfiguration.N_FOLDERCOPY)).intValue()); 1103 } catch (Throwable t) { 1104 m_dialogFolderCopy = OpenCms.getWorkplaceManager().getDefaultUserSettings().getDialogCopyFolderMode(); 1105 } 1106 // dialog file delete mode 1107 try { 1108 m_dialogFileDelete = CmsResourceDeleteMode.valueOf( 1109 ((Integer)m_user.getAdditionalInfo( 1110 PREFERENCES 1111 + CmsWorkplaceConfiguration.N_DIALOGSDEFAULTSETTINGS 1112 + CmsWorkplaceConfiguration.N_FILEDELETION)).intValue()); 1113 } catch (Throwable t) { 1114 m_dialogFileDelete = OpenCms.getWorkplaceManager().getDefaultUserSettings().getDialogDeleteFileMode(); 1115 } 1116 // dialog direct publish mode 1117 try { 1118 m_dialogDirectpublish = ((Boolean)m_user.getAdditionalInfo( 1119 PREFERENCES 1120 + CmsWorkplaceConfiguration.N_DIALOGSDEFAULTSETTINGS 1121 + CmsWorkplaceConfiguration.N_DIRECTPUBLISH)).booleanValue(); 1122 } catch (Throwable t) { 1123 m_dialogDirectpublish = OpenCms.getWorkplaceManager().getDefaultUserSettings().getDialogPublishSiblings(); 1124 } 1125 // dialog show lock mode 1126 try { 1127 m_showLock = ((Boolean)m_user.getAdditionalInfo( 1128 PREFERENCES 1129 + CmsWorkplaceConfiguration.N_DIALOGSDEFAULTSETTINGS 1130 + CmsWorkplaceConfiguration.N_SHOWLOCK)).booleanValue(); 1131 } catch (Throwable t) { 1132 m_showLock = OpenCms.getWorkplaceManager().getDefaultUserSettings().getDialogShowLock(); 1133 } 1134 // dialog show export settings mode 1135 try { 1136 m_showExportSettings = ((Boolean)m_user.getAdditionalInfo( 1137 PREFERENCES 1138 + CmsWorkplaceConfiguration.N_DIALOGSDEFAULTSETTINGS 1139 + CmsWorkplaceConfiguration.N_SHOWEXPORTSETTINGS)).booleanValue(); 1140 } catch (Throwable t) { 1141 m_showExportSettings = OpenCms.getWorkplaceManager().getDefaultUserSettings().getDialogShowExportSettings(); 1142 } 1143 // dialog permissions inheriting mode 1144 try { 1145 m_dialogPermissionsInheritOnFolder = ((Boolean)m_user.getAdditionalInfo( 1146 PREFERENCES 1147 + CmsWorkplaceConfiguration.N_DIALOGSDEFAULTSETTINGS 1148 + CmsWorkplaceConfiguration.N_PERMISSIONSINHERITONFOLDER)).booleanValue(); 1149 } catch (Throwable t) { 1150 m_dialogPermissionsInheritOnFolder = OpenCms.getWorkplaceManager().getDefaultUserSettings().getDialogPermissionsInheritOnFolder(); 1151 } 1152 // dialog expand inherited permissions mode 1153 try { 1154 m_dialogExpandInheritedPermissions = ((Boolean)m_user.getAdditionalInfo( 1155 PREFERENCES 1156 + CmsWorkplaceConfiguration.N_DIALOGSDEFAULTSETTINGS 1157 + CmsWorkplaceConfiguration.N_EXPANDPERMISSIONSINHERITED)).booleanValue(); 1158 } catch (Throwable t) { 1159 m_dialogExpandInheritedPermissions = OpenCms.getWorkplaceManager().getDefaultUserSettings().getDialogExpandInheritedPermissions(); 1160 } 1161 // dialog expand users permissions mode 1162 try { 1163 m_dialogExpandUserPermissions = ((Boolean)m_user.getAdditionalInfo( 1164 PREFERENCES 1165 + CmsWorkplaceConfiguration.N_DIALOGSDEFAULTSETTINGS 1166 + CmsWorkplaceConfiguration.N_EXPANDPERMISSIONSUSER)).booleanValue(); 1167 } catch (Throwable t) { 1168 m_dialogExpandUserPermissions = OpenCms.getWorkplaceManager().getDefaultUserSettings().getDialogExpandUserPermissions(); 1169 } 1170 // editor button style 1171 try { 1172 m_editorButtonStyle = ((Integer)m_user.getAdditionalInfo( 1173 PREFERENCES 1174 + CmsWorkplaceConfiguration.N_EDITORGENERALOPTIONS 1175 + CmsWorkplaceConfiguration.N_BUTTONSTYLE)).intValue(); 1176 } catch (Throwable t) { 1177 m_editorButtonStyle = OpenCms.getWorkplaceManager().getDefaultUserSettings().getEditorButtonStyle(); 1178 } 1179 // direct edit button style 1180 try { 1181 m_directeditButtonStyle = ((Integer)m_user.getAdditionalInfo( 1182 PREFERENCES 1183 + CmsWorkplaceConfiguration.N_EDITORGENERALOPTIONS 1184 + CmsWorkplaceConfiguration.N_DIRECTEDITSTYLE)).intValue(); 1185 } catch (Throwable t) { 1186 m_directeditButtonStyle = OpenCms.getWorkplaceManager().getDefaultUserSettings().getDirectEditButtonStyle(); 1187 } 1188 // editor settings 1189 m_editorSettings = new TreeMap<String, String>(); 1190 Iterator<String> itKeys = m_user.getAdditionalInfo().keySet().iterator(); 1191 while (itKeys.hasNext()) { 1192 String key = itKeys.next(); 1193 if (key.startsWith(PREFERENCES + CmsWorkplaceConfiguration.N_EDITORPREFERREDEDITORS)) { 1194 String editKey = key.substring( 1195 (PREFERENCES + CmsWorkplaceConfiguration.N_EDITORPREFERREDEDITORS).length()); 1196 m_editorSettings.put(editKey, m_user.getAdditionalInfo(key).toString()); 1197 } 1198 } 1199 if (m_editorSettings.isEmpty()) { 1200 m_editorSettings = new TreeMap<String, String>( 1201 OpenCms.getWorkplaceManager().getDefaultUserSettings().getEditorSettings()); 1202 1203 } 1204 // start gallery settings 1205 m_startGalleriesSettings = new TreeMap<String, String>(); 1206 Iterator<String> gKeys = m_user.getAdditionalInfo().keySet().iterator(); 1207 while (gKeys.hasNext()) { 1208 String key = gKeys.next(); 1209 if (key.startsWith(PREFERENCES + CmsWorkplaceConfiguration.N_STARTGALLERIES)) { 1210 String editKey = key.substring((PREFERENCES + CmsWorkplaceConfiguration.N_STARTGALLERIES).length()); 1211 m_startGalleriesSettings.put(editKey, m_user.getAdditionalInfo(key).toString()); 1212 } 1213 } 1214 if (m_startGalleriesSettings.isEmpty()) { 1215 m_startGalleriesSettings = new TreeMap<String, String>( 1216 OpenCms.getWorkplaceManager().getDefaultUserSettings().getStartGalleriesSettings()); 1217 } 1218 1219 // start site 1220 m_startSite = (String)m_user.getAdditionalInfo( 1221 PREFERENCES + CmsWorkplaceConfiguration.N_WORKPLACESTARTUPSETTINGS + I_CmsXmlConfiguration.N_SITE); 1222 if (m_startSite == null) { 1223 m_startSite = OpenCms.getWorkplaceManager().getDefaultUserSettings().getStartSite(); 1224 } 1225 // start folder, we use the setter here for default logic in case of illegal folder string: 1226 String startFolder = (String)m_user.getAdditionalInfo( 1227 PREFERENCES + CmsWorkplaceConfiguration.N_WORKPLACESTARTUPSETTINGS + CmsWorkplaceConfiguration.N_FOLDER); 1228 if (startFolder == null) { 1229 startFolder = OpenCms.getWorkplaceManager().getDefaultUserSettings().getStartFolder(); 1230 } 1231 setStartFolder(startFolder); 1232 1233 // restrict explorer folder view 1234 try { 1235 m_restrictExplorerView = ((Boolean)m_user.getAdditionalInfo( 1236 PREFERENCES 1237 + CmsWorkplaceConfiguration.N_WORKPLACESTARTUPSETTINGS 1238 + CmsWorkplaceConfiguration.N_RESTRICTEXPLORERVIEW)).booleanValue(); 1239 } catch (Throwable t) { 1240 m_restrictExplorerView = OpenCms.getWorkplaceManager().getDefaultUserSettings().getRestrictExplorerView(); 1241 } 1242 // workplace search 1243 m_workplaceSearchIndexName = OpenCms.getWorkplaceManager().getDefaultUserSettings().getWorkplaceSearchIndexName(); 1244 1245 m_workplaceSearchViewStyle = CmsSearchResultStyle.valueOf( 1246 (String)m_user.getAdditionalInfo( 1247 PREFERENCES 1248 + CmsWorkplaceConfiguration.N_WORKPLACESEARCH 1249 + CmsWorkplaceConfiguration.N_SEARCHVIEWSTYLE)); 1250 if (m_workplaceSearchViewStyle == null) { 1251 m_workplaceSearchViewStyle = OpenCms.getWorkplaceManager().getDefaultUserSettings().getWorkplaceSearchViewStyle(); 1252 } 1253 // synchronize settings 1254 try { 1255 boolean enabled = ((Boolean)m_user.getAdditionalInfo( 1256 PREFERENCES + SYNC_SETTINGS + SYNC_ENABLED)).booleanValue(); 1257 String destination = (String)m_user.getAdditionalInfo(PREFERENCES + SYNC_SETTINGS + SYNC_DESTINATION); 1258 List<String> vfsList = CmsStringUtil.splitAsList( 1259 (String)m_user.getAdditionalInfo(PREFERENCES + SYNC_SETTINGS + SYNC_VFS_LIST), 1260 '|'); 1261 m_synchronizeSettings = new CmsSynchronizeSettings(); 1262 m_synchronizeSettings.setEnabled(enabled); 1263 m_synchronizeSettings.setDestinationPathInRfs(destination); 1264 m_synchronizeSettings.setSourceListInVfs(vfsList); 1265 } catch (Throwable t) { 1266 // default is to disable the synchronize settings 1267 m_synchronizeSettings = null; 1268 } 1269 // upload applet client folder path 1270 m_uploadAppletClientFolder = (String)m_user.getAdditionalInfo(ADDITIONAL_INFO_UPLOADAPPLET_CLIENTFOLDER); 1271 1272 for (Map.Entry<String, Object> entry : m_user.getAdditionalInfo().entrySet()) { 1273 String key = entry.getKey(); 1274 if (key.startsWith(CmsUserSettings.PREFERENCES_ADDITIONAL_PREFIX)) { 1275 try { 1276 String value = (String)entry.getValue(); 1277 m_additionalPreferences.put( 1278 key.substring(CmsUserSettings.PREFERENCES_ADDITIONAL_PREFIX.length()), 1279 value); 1280 } catch (ClassCastException e) { 1281 LOG.warn(e.getLocalizedMessage(), e); 1282 } 1283 } 1284 } 1285 1286 try { 1287 save(null); 1288 } catch (CmsException e) { 1289 // ignore 1290 if (LOG.isWarnEnabled()) { 1291 LOG.warn(e.getLocalizedMessage(), e); 1292 } 1293 } 1294 } 1295 1296 /** 1297 * Saves the changed settings of the user to the users {@link CmsUser#getAdditionalInfo()} map.<p> 1298 * 1299 * If the given CmsObject is <code>null</code>, the additional user infos are only updated in memory 1300 * and not saved into the database.<p> 1301 * 1302 * @param cms the CmsObject needed to write the user to the db 1303 * 1304 * @throws CmsException if user cannot be written to the db 1305 */ 1306 public void save(CmsObject cms) throws CmsException { 1307 1308 // only set those values that are different than the default values 1309 // if the user info should be written to the database (if the CmsObject != null) 1310 // all values that are equal to the default values must be deleted from the additional info 1311 // user settings. 1312 1313 // workplace button style 1314 if (getWorkplaceButtonStyle() != OpenCms.getWorkplaceManager().getDefaultUserSettings().getWorkplaceButtonStyle()) { 1315 m_user.setAdditionalInfo( 1316 PREFERENCES 1317 + CmsWorkplaceConfiguration.N_WORKPLACEGENERALOPTIONS 1318 + CmsWorkplaceConfiguration.N_BUTTONSTYLE, 1319 new Integer(getWorkplaceButtonStyle())); 1320 } else if (cms != null) { 1321 m_user.deleteAdditionalInfo( 1322 PREFERENCES 1323 + CmsWorkplaceConfiguration.N_WORKPLACEGENERALOPTIONS 1324 + CmsWorkplaceConfiguration.N_BUTTONSTYLE); 1325 } 1326 // workplace report type 1327 if (!getWorkplaceReportType().equals( 1328 OpenCms.getWorkplaceManager().getDefaultUserSettings().getWorkplaceReportType())) { 1329 m_user.setAdditionalInfo( 1330 PREFERENCES 1331 + CmsWorkplaceConfiguration.N_WORKPLACEGENERALOPTIONS 1332 + CmsWorkplaceConfiguration.N_REPORTTYPE, 1333 getWorkplaceReportType()); 1334 } else if (cms != null) { 1335 m_user.deleteAdditionalInfo( 1336 PREFERENCES 1337 + CmsWorkplaceConfiguration.N_WORKPLACEGENERALOPTIONS 1338 + CmsWorkplaceConfiguration.N_REPORTTYPE); 1339 } 1340 // workplace upload applet 1341 if (getUploadVariant() != OpenCms.getWorkplaceManager().getDefaultUserSettings().getUploadVariant()) { 1342 m_user.setAdditionalInfo( 1343 PREFERENCES 1344 + CmsWorkplaceConfiguration.N_WORKPLACEGENERALOPTIONS 1345 + CmsWorkplaceConfiguration.N_UPLOADAPPLET, 1346 getUploadVariant().name()); 1347 } else if (cms != null) { 1348 m_user.deleteAdditionalInfo( 1349 PREFERENCES 1350 + CmsWorkplaceConfiguration.N_WORKPLACEGENERALOPTIONS 1351 + CmsWorkplaceConfiguration.N_UPLOADAPPLET); 1352 } 1353 // list all projects 1354 if (getListAllProjects() != OpenCms.getWorkplaceManager().getDefaultUserSettings().getListAllProjects()) { 1355 m_user.setAdditionalInfo( 1356 PREFERENCES 1357 + CmsWorkplaceConfiguration.N_WORKPLACEGENERALOPTIONS 1358 + CmsWorkplaceConfiguration.N_LISTALLPROJECTS, 1359 Boolean.valueOf(getListAllProjects())); 1360 } else if (cms != null) { 1361 m_user.deleteAdditionalInfo( 1362 PREFERENCES 1363 + CmsWorkplaceConfiguration.N_WORKPLACEGENERALOPTIONS 1364 + CmsWorkplaceConfiguration.N_LISTALLPROJECTS); 1365 } 1366 // publish notification 1367 if (getShowPublishNotification() != OpenCms.getWorkplaceManager().getDefaultUserSettings().getShowPublishNotification()) { 1368 m_user.setAdditionalInfo( 1369 PREFERENCES 1370 + CmsWorkplaceConfiguration.N_WORKPLACEGENERALOPTIONS 1371 + CmsWorkplaceConfiguration.N_PUBLISHNOTIFICATION, 1372 Boolean.valueOf(getShowPublishNotification())); 1373 } else if (cms != null) { 1374 m_user.deleteAdditionalInfo( 1375 PREFERENCES 1376 + CmsWorkplaceConfiguration.N_WORKPLACEGENERALOPTIONS 1377 + CmsWorkplaceConfiguration.N_PUBLISHNOTIFICATION); 1378 } 1379 // locale 1380 if (!getLocale().equals(OpenCms.getWorkplaceManager().getDefaultUserSettings().getLocale())) { 1381 m_user.setAdditionalInfo( 1382 PREFERENCES + CmsWorkplaceConfiguration.N_WORKPLACESTARTUPSETTINGS + CmsWorkplaceConfiguration.N_LOCALE, 1383 getLocale().toString()); 1384 } else if (cms != null) { 1385 m_user.deleteAdditionalInfo( 1386 PREFERENCES 1387 + CmsWorkplaceConfiguration.N_WORKPLACESTARTUPSETTINGS 1388 + CmsWorkplaceConfiguration.N_LOCALE); 1389 } 1390 // start project 1391 if (!getStartProject().equals(OpenCms.getWorkplaceManager().getDefaultUserSettings().getStartProject())) { 1392 try { 1393 // be sure the project is valid 1394 if (cms != null) { 1395 cms.readProject(getStartProject()); 1396 } 1397 m_user.setAdditionalInfo( 1398 PREFERENCES 1399 + CmsWorkplaceConfiguration.N_WORKPLACESTARTUPSETTINGS 1400 + CmsWorkplaceConfiguration.N_PROJECT, 1401 getStartProject()); 1402 } catch (Exception e) { 1403 if (cms != null) { 1404 m_user.deleteAdditionalInfo( 1405 PREFERENCES 1406 + CmsWorkplaceConfiguration.N_WORKPLACESTARTUPSETTINGS 1407 + CmsWorkplaceConfiguration.N_PROJECT); 1408 } 1409 } 1410 } else if (cms != null) { 1411 m_user.deleteAdditionalInfo( 1412 PREFERENCES 1413 + CmsWorkplaceConfiguration.N_WORKPLACESTARTUPSETTINGS 1414 + CmsWorkplaceConfiguration.N_PROJECT); 1415 } 1416 // view 1417 if (!getStartView().equals(OpenCms.getWorkplaceManager().getDefaultUserSettings().getStartView())) { 1418 m_user.setAdditionalInfo( 1419 PREFERENCES 1420 + CmsWorkplaceConfiguration.N_WORKPLACESTARTUPSETTINGS 1421 + CmsWorkplaceConfiguration.N_WORKPLACEVIEW, 1422 getStartView()); 1423 } else if (cms != null) { 1424 m_user.deleteAdditionalInfo( 1425 PREFERENCES 1426 + CmsWorkplaceConfiguration.N_WORKPLACESTARTUPSETTINGS 1427 + CmsWorkplaceConfiguration.N_WORKPLACEVIEW); 1428 } 1429 // start site 1430 if (!getStartSite().equals(OpenCms.getWorkplaceManager().getDefaultUserSettings().getStartSite())) { 1431 m_user.setAdditionalInfo( 1432 PREFERENCES + CmsWorkplaceConfiguration.N_WORKPLACESTARTUPSETTINGS + I_CmsXmlConfiguration.N_SITE, 1433 getStartSite()); 1434 } else if (cms != null) { 1435 m_user.deleteAdditionalInfo( 1436 PREFERENCES + CmsWorkplaceConfiguration.N_WORKPLACESTARTUPSETTINGS + I_CmsXmlConfiguration.N_SITE); 1437 } 1438 // start folder 1439 if (CmsStringUtil.isNotEmptyOrWhitespaceOnly(getStartFolder()) 1440 && !getStartFolder().equals(OpenCms.getWorkplaceManager().getDefaultUserSettings().getStartFolder())) { 1441 m_user.setAdditionalInfo( 1442 PREFERENCES + CmsWorkplaceConfiguration.N_WORKPLACESTARTUPSETTINGS + CmsWorkplaceConfiguration.N_FOLDER, 1443 getStartFolder()); 1444 } else if (cms != null) { 1445 m_user.deleteAdditionalInfo( 1446 PREFERENCES 1447 + CmsWorkplaceConfiguration.N_WORKPLACESTARTUPSETTINGS 1448 + CmsWorkplaceConfiguration.N_FOLDER); 1449 } 1450 // restrict explorer folder view 1451 if (getRestrictExplorerView() != OpenCms.getWorkplaceManager().getDefaultUserSettings().getRestrictExplorerView()) { 1452 m_user.setAdditionalInfo( 1453 PREFERENCES 1454 + CmsWorkplaceConfiguration.N_WORKPLACESTARTUPSETTINGS 1455 + CmsWorkplaceConfiguration.N_RESTRICTEXPLORERVIEW, 1456 Boolean.valueOf(getRestrictExplorerView())); 1457 } else if (cms != null) { 1458 m_user.deleteAdditionalInfo( 1459 PREFERENCES 1460 + CmsWorkplaceConfiguration.N_WORKPLACESTARTUPSETTINGS 1461 + CmsWorkplaceConfiguration.N_RESTRICTEXPLORERVIEW); 1462 } 1463 // explorer button style 1464 if (getExplorerButtonStyle() != OpenCms.getWorkplaceManager().getDefaultUserSettings().getExplorerButtonStyle()) { 1465 m_user.setAdditionalInfo( 1466 PREFERENCES 1467 + CmsWorkplaceConfiguration.N_EXPLORERGENERALOPTIONS 1468 + CmsWorkplaceConfiguration.N_BUTTONSTYLE, 1469 new Integer(getExplorerButtonStyle())); 1470 } else if (cms != null) { 1471 m_user.deleteAdditionalInfo( 1472 PREFERENCES 1473 + CmsWorkplaceConfiguration.N_EXPLORERGENERALOPTIONS 1474 + CmsWorkplaceConfiguration.N_BUTTONSTYLE); 1475 } 1476 // explorer file entries 1477 if (getExplorerFileEntries() != OpenCms.getWorkplaceManager().getDefaultUserSettings().getExplorerFileEntries()) { 1478 m_user.setAdditionalInfo( 1479 PREFERENCES + CmsWorkplaceConfiguration.N_EXPLORERGENERALOPTIONS + CmsWorkplaceConfiguration.N_ENTRIES, 1480 new Integer(getExplorerFileEntries())); 1481 } else if (cms != null) { 1482 m_user.deleteAdditionalInfo( 1483 PREFERENCES + CmsWorkplaceConfiguration.N_EXPLORERGENERALOPTIONS + CmsWorkplaceConfiguration.N_ENTRIES); 1484 } 1485 // explorer settings 1486 if (getExplorerSettings() != OpenCms.getWorkplaceManager().getDefaultUserSettings().getExplorerSettings()) { 1487 m_user.setAdditionalInfo( 1488 PREFERENCES 1489 + CmsWorkplaceConfiguration.N_EXPLORERGENERALOPTIONS 1490 + CmsWorkplaceConfiguration.N_EXPLORERDISPLAYOPTIONS, 1491 new Integer(getExplorerSettings())); 1492 } else if (cms != null) { 1493 m_user.deleteAdditionalInfo( 1494 PREFERENCES 1495 + CmsWorkplaceConfiguration.N_EXPLORERGENERALOPTIONS 1496 + CmsWorkplaceConfiguration.N_EXPLORERDISPLAYOPTIONS); 1497 } 1498 // dialog file copy mode 1499 if (getDialogCopyFileMode() != OpenCms.getWorkplaceManager().getDefaultUserSettings().getDialogCopyFileMode()) { 1500 m_user.setAdditionalInfo( 1501 PREFERENCES + CmsWorkplaceConfiguration.N_DIALOGSDEFAULTSETTINGS + CmsWorkplaceConfiguration.N_FILECOPY, 1502 new Integer(getDialogCopyFileMode().getMode())); 1503 } else if (cms != null) { 1504 m_user.deleteAdditionalInfo( 1505 PREFERENCES 1506 + CmsWorkplaceConfiguration.N_DIALOGSDEFAULTSETTINGS 1507 + CmsWorkplaceConfiguration.N_FILECOPY); 1508 } 1509 // dialog folder copy mode 1510 if (getDialogCopyFolderMode() != OpenCms.getWorkplaceManager().getDefaultUserSettings().getDialogCopyFolderMode()) { 1511 m_user.setAdditionalInfo( 1512 PREFERENCES 1513 + CmsWorkplaceConfiguration.N_DIALOGSDEFAULTSETTINGS 1514 + CmsWorkplaceConfiguration.N_FOLDERCOPY, 1515 new Integer(getDialogCopyFolderMode().getMode())); 1516 } else if (cms != null) { 1517 m_user.deleteAdditionalInfo( 1518 PREFERENCES 1519 + CmsWorkplaceConfiguration.N_DIALOGSDEFAULTSETTINGS 1520 + CmsWorkplaceConfiguration.N_FOLDERCOPY); 1521 } 1522 // dialog file delete mode 1523 if (getDialogDeleteFileMode() != OpenCms.getWorkplaceManager().getDefaultUserSettings().getDialogDeleteFileMode()) { 1524 m_user.setAdditionalInfo( 1525 PREFERENCES 1526 + CmsWorkplaceConfiguration.N_DIALOGSDEFAULTSETTINGS 1527 + CmsWorkplaceConfiguration.N_FILEDELETION, 1528 new Integer(getDialogDeleteFileMode().getMode())); 1529 } else if (cms != null) { 1530 m_user.deleteAdditionalInfo( 1531 PREFERENCES 1532 + CmsWorkplaceConfiguration.N_DIALOGSDEFAULTSETTINGS 1533 + CmsWorkplaceConfiguration.N_FILEDELETION); 1534 } 1535 // dialog direct publish mode 1536 if (getDialogPublishSiblings() != OpenCms.getWorkplaceManager().getDefaultUserSettings().getDialogPublishSiblings()) { 1537 m_user.setAdditionalInfo( 1538 PREFERENCES 1539 + CmsWorkplaceConfiguration.N_DIALOGSDEFAULTSETTINGS 1540 + CmsWorkplaceConfiguration.N_DIRECTPUBLISH, 1541 Boolean.valueOf(getDialogPublishSiblings())); 1542 } else if (cms != null) { 1543 m_user.deleteAdditionalInfo( 1544 PREFERENCES 1545 + CmsWorkplaceConfiguration.N_DIALOGSDEFAULTSETTINGS 1546 + CmsWorkplaceConfiguration.N_DIRECTPUBLISH); 1547 } 1548 // dialog show lock mode 1549 if (getDialogShowLock() != OpenCms.getWorkplaceManager().getDefaultUserSettings().getDialogShowLock()) { 1550 m_user.setAdditionalInfo( 1551 PREFERENCES + CmsWorkplaceConfiguration.N_DIALOGSDEFAULTSETTINGS + CmsWorkplaceConfiguration.N_SHOWLOCK, 1552 Boolean.valueOf(getDialogShowLock())); 1553 } else if (cms != null) { 1554 m_user.deleteAdditionalInfo( 1555 PREFERENCES 1556 + CmsWorkplaceConfiguration.N_DIALOGSDEFAULTSETTINGS 1557 + CmsWorkplaceConfiguration.N_SHOWLOCK); 1558 } 1559 // dialog permissions inheritation mode 1560 if (getDialogPermissionsInheritOnFolder() != OpenCms.getWorkplaceManager().getDefaultUserSettings().getDialogPermissionsInheritOnFolder()) { 1561 m_user.setAdditionalInfo( 1562 PREFERENCES 1563 + CmsWorkplaceConfiguration.N_DIALOGSDEFAULTSETTINGS 1564 + CmsWorkplaceConfiguration.N_PERMISSIONSINHERITONFOLDER, 1565 Boolean.valueOf(getDialogPermissionsInheritOnFolder())); 1566 } else if (cms != null) { 1567 m_user.deleteAdditionalInfo( 1568 PREFERENCES 1569 + CmsWorkplaceConfiguration.N_DIALOGSDEFAULTSETTINGS 1570 + CmsWorkplaceConfiguration.N_PERMISSIONSINHERITONFOLDER); 1571 } 1572 // dialog expand inherited permissions mode 1573 if (getDialogExpandInheritedPermissions() != OpenCms.getWorkplaceManager().getDefaultUserSettings().getDialogExpandInheritedPermissions()) { 1574 m_user.setAdditionalInfo( 1575 PREFERENCES 1576 + CmsWorkplaceConfiguration.N_DIALOGSDEFAULTSETTINGS 1577 + CmsWorkplaceConfiguration.N_EXPANDPERMISSIONSINHERITED, 1578 Boolean.valueOf(getDialogExpandInheritedPermissions())); 1579 } else if (cms != null) { 1580 m_user.deleteAdditionalInfo( 1581 PREFERENCES 1582 + CmsWorkplaceConfiguration.N_DIALOGSDEFAULTSETTINGS 1583 + CmsWorkplaceConfiguration.N_EXPANDPERMISSIONSINHERITED); 1584 } 1585 // dialog expand users permissions mode 1586 if (getDialogExpandUserPermissions() != OpenCms.getWorkplaceManager().getDefaultUserSettings().getDialogExpandUserPermissions()) { 1587 m_user.setAdditionalInfo( 1588 PREFERENCES 1589 + CmsWorkplaceConfiguration.N_DIALOGSDEFAULTSETTINGS 1590 + CmsWorkplaceConfiguration.N_EXPANDPERMISSIONSUSER, 1591 Boolean.valueOf(getDialogExpandUserPermissions())); 1592 } else if (cms != null) { 1593 m_user.deleteAdditionalInfo( 1594 PREFERENCES 1595 + CmsWorkplaceConfiguration.N_DIALOGSDEFAULTSETTINGS 1596 + CmsWorkplaceConfiguration.N_EXPANDPERMISSIONSUSER); 1597 } 1598 // editor button style 1599 if (getEditorButtonStyle() != OpenCms.getWorkplaceManager().getDefaultUserSettings().getEditorButtonStyle()) { 1600 m_user.setAdditionalInfo( 1601 PREFERENCES 1602 + CmsWorkplaceConfiguration.N_EDITORGENERALOPTIONS 1603 + CmsWorkplaceConfiguration.N_BUTTONSTYLE, 1604 new Integer(getEditorButtonStyle())); 1605 } else if (cms != null) { 1606 m_user.deleteAdditionalInfo( 1607 PREFERENCES 1608 + CmsWorkplaceConfiguration.N_EDITORGENERALOPTIONS 1609 + CmsWorkplaceConfiguration.N_BUTTONSTYLE); 1610 } 1611 // direct edit button style 1612 if (getDirectEditButtonStyle() != OpenCms.getWorkplaceManager().getDefaultUserSettings().getDirectEditButtonStyle()) { 1613 m_user.setAdditionalInfo( 1614 PREFERENCES 1615 + CmsWorkplaceConfiguration.N_EDITORGENERALOPTIONS 1616 + CmsWorkplaceConfiguration.N_DIRECTEDITSTYLE, 1617 new Integer(getDirectEditButtonStyle())); 1618 } else if (cms != null) { 1619 m_user.deleteAdditionalInfo( 1620 PREFERENCES 1621 + CmsWorkplaceConfiguration.N_EDITORGENERALOPTIONS 1622 + CmsWorkplaceConfiguration.N_DIRECTEDITSTYLE); 1623 } 1624 // editor settings 1625 if (m_editorSettings.size() > 0) { 1626 Iterator<Map.Entry<String, String>> itEntries = m_editorSettings.entrySet().iterator(); 1627 while (itEntries.hasNext()) { 1628 Map.Entry<String, String> entry = itEntries.next(); 1629 if (entry.getValue() != null) { 1630 m_user.setAdditionalInfo( 1631 PREFERENCES + CmsWorkplaceConfiguration.N_EDITORPREFERREDEDITORS + entry.getKey(), 1632 entry.getValue()); 1633 } else { 1634 m_user.deleteAdditionalInfo( 1635 PREFERENCES + CmsWorkplaceConfiguration.N_EDITORPREFERREDEDITORS + entry.getKey()); 1636 } 1637 } 1638 } else if (cms != null) { 1639 Iterator<String> itKeys = m_user.getAdditionalInfo().keySet().iterator(); 1640 List<String> keysToDelete = new ArrayList<String>(3); 1641 while (itKeys.hasNext()) { 1642 String key = itKeys.next(); 1643 if (key.startsWith(PREFERENCES + CmsWorkplaceConfiguration.N_EDITORPREFERREDEDITORS)) { 1644 keysToDelete.add(key); 1645 } 1646 } 1647 for (String key : keysToDelete) { 1648 m_user.deleteAdditionalInfo(key); 1649 } 1650 } 1651 // start settings for galleries 1652 if (m_startGalleriesSettings.size() > 0) { 1653 Iterator<Map.Entry<String, String>> itEntries = m_startGalleriesSettings.entrySet().iterator(); 1654 while (itEntries.hasNext()) { 1655 Map.Entry<String, String> entry = itEntries.next(); 1656 if ((entry.getValue() != null) && !entry.getValue().equals(CmsWorkplace.INPUT_DEFAULT)) { 1657 m_user.setAdditionalInfo( 1658 PREFERENCES + CmsWorkplaceConfiguration.N_STARTGALLERIES + entry.getKey(), 1659 entry.getValue()); 1660 } else { 1661 // delete from user settings if value of the entry is null or "default" 1662 m_user.deleteAdditionalInfo( 1663 PREFERENCES + CmsWorkplaceConfiguration.N_STARTGALLERIES + entry.getKey()); 1664 } 1665 } 1666 } else if (cms != null) { 1667 Iterator<String> itKeys = m_user.getAdditionalInfo().keySet().iterator(); 1668 while (itKeys.hasNext()) { 1669 String key = itKeys.next(); 1670 if (key.startsWith(PREFERENCES + CmsWorkplaceConfiguration.N_STARTGALLERIES)) { 1671 m_user.deleteAdditionalInfo(key); 1672 } 1673 } 1674 1675 } 1676 1677 // workplace search 1678 if (getWorkplaceSearchViewStyle() != null) { 1679 m_user.setAdditionalInfo( 1680 PREFERENCES + CmsWorkplaceConfiguration.N_WORKPLACESEARCH + CmsWorkplaceConfiguration.N_SEARCHVIEWSTYLE, 1681 getWorkplaceSearchViewStyle().toString()); 1682 } 1683 // synchronize settings 1684 if (getSynchronizeSettings() != null) { 1685 m_user.setAdditionalInfo( 1686 PREFERENCES + SYNC_SETTINGS + SYNC_ENABLED, 1687 Boolean.valueOf(getSynchronizeSettings().isEnabled())); 1688 m_user.setAdditionalInfo( 1689 PREFERENCES + SYNC_SETTINGS + SYNC_DESTINATION, 1690 getSynchronizeSettings().getDestinationPathInRfs()); 1691 m_user.setAdditionalInfo( 1692 PREFERENCES + SYNC_SETTINGS + SYNC_VFS_LIST, 1693 CmsStringUtil.collectionAsString(getSynchronizeSettings().getSourceListInVfs(), "|")); 1694 } else { 1695 m_user.deleteAdditionalInfo(PREFERENCES + SYNC_SETTINGS + SYNC_ENABLED); 1696 m_user.deleteAdditionalInfo(PREFERENCES + SYNC_SETTINGS + SYNC_DESTINATION); 1697 m_user.deleteAdditionalInfo(PREFERENCES + SYNC_SETTINGS + SYNC_VFS_LIST); 1698 } 1699 // upload applet client folder path 1700 if (CmsStringUtil.isNotEmptyOrWhitespaceOnly(m_uploadAppletClientFolder)) { 1701 m_user.setAdditionalInfo(ADDITIONAL_INFO_UPLOADAPPLET_CLIENTFOLDER, m_uploadAppletClientFolder); 1702 } else { 1703 m_user.deleteAdditionalInfo(ADDITIONAL_INFO_UPLOADAPPLET_CLIENTFOLDER); 1704 } 1705 // workplace user surf time (time warp) 1706 if (getTimeWarp() != CmsContextInfo.CURRENT_TIME) { 1707 m_user.setAdditionalInfo(ADDITIONAL_INFO_TIMEWARP, new Long(getTimeWarp())); 1708 } else if (cms != null) { 1709 m_user.deleteAdditionalInfo(ADDITIONAL_INFO_TIMEWARP); 1710 } 1711 1712 Set<String> additionalInfosToDelete = new HashSet<String>(); 1713 for (String key : m_user.getAdditionalInfo().keySet()) { 1714 if (key.startsWith(PREFERENCES_ADDITIONAL_PREFIX) 1715 && !m_additionalPreferences.containsKey(key.substring(PREFERENCES_ADDITIONAL_PREFIX.length()))) { 1716 additionalInfosToDelete.add(key); 1717 } 1718 } 1719 for (String key : additionalInfosToDelete) { 1720 m_user.deleteAdditionalInfo(key); 1721 } 1722 for (Map.Entry<String, String> entry : m_additionalPreferences.entrySet()) { 1723 String key = entry.getKey(); 1724 String value = entry.getValue(); 1725 m_user.setAdditionalInfo(PREFERENCES_ADDITIONAL_PREFIX + key, value); 1726 } 1727 1728 // only write the updated user to the DB if we have the cms object 1729 if (cms != null) { 1730 cms.writeUser(m_user); 1731 } 1732 } 1733 1734 /** 1735 * Sets an additional preference value.<p> 1736 * 1737 * @param name the additional preference name 1738 * @param value the preference value 1739 */ 1740 public void setAdditionalPreference(String name, String value) { 1741 1742 if (value == null) { 1743 m_additionalPreferences.remove(name); 1744 } else { 1745 m_additionalPreferences.put(name, value); 1746 } 1747 } 1748 1749 /** 1750 * Sets this settings object's additional preferences to that of another one.<p> 1751 * 1752 * @param userSettings the user settings 1753 */ 1754 public void setAdditionalPreferencesFrom(CmsUserSettings userSettings) { 1755 1756 m_additionalPreferences = Maps.newLinkedHashMap(userSettings.m_additionalPreferences); 1757 } 1758 1759 /** 1760 * Sets the default copy mode when copying a file of the user.<p> 1761 * 1762 * @param mode the default copy mode when copying a file of the user 1763 */ 1764 public void setDialogCopyFileMode(CmsResourceCopyMode mode) { 1765 1766 m_dialogFileCopy = mode; 1767 } 1768 1769 /** 1770 * Sets the default copy mode when copying a folder of the user.<p> 1771 * 1772 * @param mode the default copy mode when copying a folder of the user 1773 */ 1774 public void setDialogCopyFolderMode(CmsResourceCopyMode mode) { 1775 1776 m_dialogFolderCopy = mode; 1777 } 1778 1779 /** 1780 * Sets the default setting for file deletion.<p> 1781 * 1782 * @param mode the default setting for file deletion 1783 */ 1784 public void setDialogDeleteFileMode(CmsResourceDeleteMode mode) { 1785 1786 m_dialogFileDelete = mode; 1787 } 1788 1789 /** 1790 * Sets the default setting for expanding inherited permissions in the dialog.<p> 1791 * 1792 * @param dialogShowInheritedPermissions the default setting for expanding inherited permissions in the dialog 1793 */ 1794 public void setDialogExpandInheritedPermissions(boolean dialogShowInheritedPermissions) { 1795 1796 m_dialogExpandInheritedPermissions = dialogShowInheritedPermissions; 1797 } 1798 1799 /** 1800 * Sets the default setting for expanding the users permissions in the dialog.<p> 1801 * 1802 * @param dialogShowUserPermissions the default setting for expanding the users permissions in the dialog 1803 */ 1804 public void setDialogExpandUserPermissions(boolean dialogShowUserPermissions) { 1805 1806 m_dialogExpandUserPermissions = dialogShowUserPermissions; 1807 } 1808 1809 /** 1810 * Sets the default setting for inheriting permissions on folders.<p> 1811 * 1812 * @param dialogPermissionsInheritOnFolder the default setting for inheriting permissions on folders 1813 */ 1814 public void setDialogPermissionsInheritOnFolder(boolean dialogPermissionsInheritOnFolder) { 1815 1816 m_dialogPermissionsInheritOnFolder = dialogPermissionsInheritOnFolder; 1817 } 1818 1819 /** 1820 * Sets the default setting for direct publishing.<p> 1821 * 1822 * @param publishSiblings the default setting for direct publishing: true if siblings should be published, otherwise false 1823 */ 1824 public void setDialogPublishSiblings(boolean publishSiblings) { 1825 1826 m_dialogDirectpublish = publishSiblings; 1827 } 1828 1829 /** 1830 * Sets if the export setting part of the secure/export dialog should be shown.<p> 1831 * 1832 * @param show true if the export dialog should be shown, otherwise false 1833 */ 1834 public void setDialogShowExportSettings(boolean show) { 1835 1836 m_showExportSettings = show; 1837 } 1838 1839 /** 1840 * Sets if the lock dialog should be shown.<p> 1841 * 1842 * @param show true if the lock dialog should be shown, otherwise false 1843 */ 1844 public void setDialogShowLock(boolean show) { 1845 1846 m_showLock = show; 1847 } 1848 1849 /** 1850 * Sets the style of the direct edit buttons of the user.<p> 1851 * 1852 * @param style the style of the direct edit buttons of the user 1853 */ 1854 public void setDirectEditButtonStyle(int style) { 1855 1856 m_directeditButtonStyle = style; 1857 } 1858 1859 /** 1860 * Sets the style of the editor buttons of the user.<p> 1861 * 1862 * @param style the style of the editor buttons of the user 1863 */ 1864 public void setEditorButtonStyle(int style) { 1865 1866 m_editorButtonStyle = style; 1867 } 1868 1869 /** 1870 * Sets the editor settings of the user.<p> 1871 * 1872 * @param settings the editor settings of the user 1873 */ 1874 public void setEditorSettings(Map<String, String> settings) { 1875 1876 m_editorSettings = new TreeMap<String, String>(settings); 1877 } 1878 1879 /** 1880 * Sets the style of the explorer buttons of the user.<p> 1881 * 1882 * @param style the style of the explorer buttons of the user 1883 */ 1884 public void setExplorerButtonStyle(int style) { 1885 1886 m_explorerButtonStyle = style; 1887 } 1888 1889 /** 1890 * Sets the number of displayed files per page of the user.<p> 1891 * 1892 * @param entries the number of displayed files per page of the user 1893 */ 1894 public void setExplorerFileEntries(int entries) { 1895 1896 m_explorerFileEntries = entries; 1897 } 1898 1899 /** 1900 * Sets the explorerFileEntryOptions.<p> 1901 * 1902 * @param explorerFileEntryOptions the explorerFileEntryOptions to set 1903 */ 1904 public void setExplorerFileEntryOptions(String explorerFileEntryOptions) { 1905 1906 m_explorerFileEntryOptions = explorerFileEntryOptions; 1907 } 1908 1909 /** 1910 * Sets the explorer start settings.<p> 1911 * 1912 * @param settings explorer start settings to use 1913 */ 1914 public void setExplorerSettings(int settings) { 1915 1916 m_explorerSettings = settings; 1917 } 1918 1919 /** 1920 * Sets if all the projects should be shown or not.<p> 1921 * 1922 * @param listAllProjects true if all the projects should be shown, otherwise false 1923 */ 1924 public void setListAllProjects(boolean listAllProjects) { 1925 1926 m_listAllProjects = listAllProjects; 1927 } 1928 1929 /** 1930 * Sets the locale of the user.<p> 1931 * 1932 * @param locale the locale of the user 1933 */ 1934 public void setLocale(Locale locale) { 1935 1936 m_locale = locale; 1937 } 1938 1939 /** 1940 * Sets if the "create index page" check box in the new folder 1941 * dialog should be initially be checked or not. <p> 1942 * 1943 * @param setting if the "create index page" check box in the new folder 1944 * dialog should be initially be checked or not. 1945 */ 1946 public void setNewFolderCreateIndexPage(Boolean setting) { 1947 1948 m_newFolderCreateIndexPage = setting; 1949 } 1950 1951 /** 1952 * Sets if the "edit properties" check box in the new folder 1953 * dialog should be initially be checked or not. <p> 1954 * 1955 * @param setting if the "edit properties" check box in the new folder 1956 * dialog should be initially be checked or not. 1957 */ 1958 public void setNewFolderEditPropertes(Boolean setting) { 1959 1960 m_newFolderEditProperties = setting; 1961 } 1962 1963 /** 1964 * Sets the preferred editor for the given resource type of the user.<p> 1965 * 1966 * @param resourceType the resource type 1967 * @param editorUri the editor URI 1968 */ 1969 public void setPreferredEditor(String resourceType, String editorUri) { 1970 1971 if (editorUri == null) { 1972 m_editorSettings.remove(resourceType); 1973 } else { 1974 m_editorSettings.put(resourceType, editorUri); 1975 } 1976 } 1977 1978 /** 1979 * Sets the appearance of the "publish project" button.<p> 1980 * 1981 * Allowed values are either {@link CmsDefaultUserSettings#PUBLISHBUTTON_SHOW_ALWAYS}, 1982 * {@link CmsDefaultUserSettings#PUBLISHBUTTON_SHOW_AUTO} or 1983 * {@link CmsDefaultUserSettings#PUBLISHBUTTON_SHOW_NEVER}.<p> 1984 * 1985 * @param publishButtonAppearance the appearance of the "publish project" button 1986 */ 1987 public void setPublishButtonAppearance(String publishButtonAppearance) { 1988 1989 String value = CmsDefaultUserSettings.PUBLISHBUTTON_SHOW_ALWAYS; 1990 if (CmsStringUtil.isNotEmptyOrWhitespaceOnly(publishButtonAppearance)) { 1991 publishButtonAppearance = publishButtonAppearance.trim().toLowerCase(); 1992 if (CmsDefaultUserSettings.PUBLISHBUTTON_SHOW_AUTO.equals(publishButtonAppearance)) { 1993 value = CmsDefaultUserSettings.PUBLISHBUTTON_SHOW_AUTO; 1994 } else if (CmsDefaultUserSettings.PUBLISHBUTTON_SHOW_NEVER.equals(publishButtonAppearance)) { 1995 value = CmsDefaultUserSettings.PUBLISHBUTTON_SHOW_NEVER; 1996 } 1997 } 1998 m_publishButtonAppearance = value; 1999 } 2000 2001 /** 2002 * Sets if the explorer view is restricted to the defined site and folder.<p> 2003 * 2004 * @param restrict true if the explorer view is restricted, otherwise false 2005 */ 2006 public void setRestrictExplorerView(boolean restrict) { 2007 2008 m_restrictExplorerView = restrict; 2009 } 2010 2011 /** 2012 * Sets if the file creation date should be shown in explorer view.<p> 2013 * 2014 * @param show true if the file creation date should be shown, otherwise false 2015 */ 2016 public void setShowExplorerFileDateCreated(boolean show) { 2017 2018 setExplorerSetting(show, CmsUserSettings.FILELIST_DATE_CREATED); 2019 } 2020 2021 /** 2022 * Sets if the file expire date should be shown in explorer view.<p> 2023 * 2024 * @param show true if the file expire date should be shown, otherwise false 2025 */ 2026 public void setShowExplorerFileDateExpired(boolean show) { 2027 2028 setExplorerSetting(show, CmsUserSettings.FILELIST_DATE_EXPIRED); 2029 } 2030 2031 /** 2032 * Sets if the file last modified date state should be shown in explorer view.<p> 2033 * 2034 * @param show true if the file last modified date should be shown, otherwise false 2035 */ 2036 public void setShowExplorerFileDateLastModified(boolean show) { 2037 2038 setExplorerSetting(show, CmsUserSettings.FILELIST_DATE_LASTMODIFIED); 2039 } 2040 2041 /** 2042 * Sets if the file release date should be shown in explorer view.<p> 2043 * 2044 * @param show true if the file release date should be shown, otherwise false 2045 */ 2046 public void setShowExplorerFileDateReleased(boolean show) { 2047 2048 setExplorerSetting(show, CmsUserSettings.FILELIST_DATE_RELEASED); 2049 } 2050 2051 /** 2052 * Sets if the file locked by should be shown in explorer view.<p> 2053 * 2054 * @param show true if the file locked by should be shown, otherwise false 2055 */ 2056 public void setShowExplorerFileLockedBy(boolean show) { 2057 2058 setExplorerSetting(show, CmsUserSettings.FILELIST_LOCKEDBY); 2059 } 2060 2061 /** 2062 * Sets if the file navtext should be shown in explorer view.<p> 2063 * 2064 * @param show true if the file navtext should be shown, otherwise false 2065 */ 2066 public void setShowExplorerFileNavText(boolean show) { 2067 2068 setExplorerSetting(show, CmsUserSettings.FILELIST_NAVTEXT); 2069 } 2070 2071 /** 2072 * Sets if the file permissions should be shown in explorer view.<p> 2073 * 2074 * @param show true if the file permissions should be shown, otherwise false 2075 */ 2076 public void setShowExplorerFilePermissions(boolean show) { 2077 2078 setExplorerSetting(show, CmsUserSettings.FILELIST_PERMISSIONS); 2079 } 2080 2081 /** 2082 * Sets if the file size should be shown in explorer view.<p> 2083 * 2084 * @param show true if the file size should be shown, otherwise false 2085 */ 2086 public void setShowExplorerFileSize(boolean show) { 2087 2088 setExplorerSetting(show, CmsUserSettings.FILELIST_SIZE); 2089 } 2090 2091 /** 2092 * Sets if the file state should be shown in explorer view.<p> 2093 * 2094 * @param show true if the state size should be shown, otherwise false 2095 */ 2096 public void setShowExplorerFileState(boolean show) { 2097 2098 setExplorerSetting(show, CmsUserSettings.FILELIST_STATE); 2099 } 2100 2101 /** 2102 * Sets if the file title should be shown in explorer view.<p> 2103 * 2104 * @param show true if the file title should be shown, otherwise false 2105 */ 2106 public void setShowExplorerFileTitle(boolean show) { 2107 2108 setExplorerSetting(show, CmsUserSettings.FILELIST_TITLE); 2109 } 2110 2111 /** 2112 * Sets if the file type should be shown in explorer view.<p> 2113 * 2114 * @param show true if the file type should be shown, otherwise false 2115 */ 2116 public void setShowExplorerFileType(boolean show) { 2117 2118 setExplorerSetting(show, CmsUserSettings.FILELIST_TYPE); 2119 } 2120 2121 /** 2122 * Sets if the file creator should be shown in explorer view.<p> 2123 * 2124 * @param show true if the file creator should be shown, otherwise false 2125 */ 2126 public void setShowExplorerFileUserCreated(boolean show) { 2127 2128 setExplorerSetting(show, CmsUserSettings.FILELIST_USER_CREATED); 2129 } 2130 2131 /** 2132 * Sets if the file last modified by should be shown in explorer view.<p> 2133 * 2134 * @param show true if the file last modified by should be shown, otherwise false 2135 */ 2136 public void setShowExplorerFileUserLastModified(boolean show) { 2137 2138 setExplorerSetting(show, CmsUserSettings.FILELIST_USER_LASTMODIFIED); 2139 } 2140 2141 /** 2142 * Controls whether to display a file upload icon or not.<p> 2143 * 2144 * @param flag <code>true</code> or <code>false</code> to flag the use of the file upload button 2145 */ 2146 public void setShowFileUploadButton(boolean flag) { 2147 2148 m_showFileUploadButton = flag; 2149 } 2150 2151 /** 2152 * Sets if the publish notifications should be shown or not.<p> 2153 * 2154 * @param showPublishNotification true if the publish notifications should be shown, otherwise false 2155 */ 2156 public void setShowPublishNotification(boolean showPublishNotification) { 2157 2158 m_showPublishNotification = showPublishNotification; 2159 } 2160 2161 /** 2162 * Sets if the resource type selection dialog should 2163 * be shown in the file upload process (non - applet version) or not. <p> 2164 * 2165 * @param showUploadTypeDialog if the resource type selection dialog should 2166 * be shown in the file upload process (non - applet version) 2167 */ 2168 public void setShowUploadTypeDialog(Boolean showUploadTypeDialog) { 2169 2170 m_showUploadTypeDialog = showUploadTypeDialog; 2171 } 2172 2173 /** 2174 * Sets the start folder of the user.<p> 2175 * 2176 * @param folder the start folder of the user 2177 */ 2178 public void setStartFolder(String folder) { 2179 2180 if (!folder.startsWith("/")) { 2181 folder = "/" + folder; 2182 } 2183 if (!folder.endsWith("/")) { 2184 folder = folder + "/"; 2185 } 2186 m_startFolder = folder; 2187 } 2188 2189 /** 2190 * Sets the start galleries settings of the user.<p> 2191 * 2192 * @param settings the start galleries setting of the user 2193 */ 2194 public void setStartGalleriesSetting(Map<String, String> settings) { 2195 2196 m_startGalleriesSettings = new TreeMap<String, String>(settings); 2197 } 2198 2199 /** 2200 * Sets the path to the start gallery of the user or removes the entry from user settings if no path is null.<p> 2201 * 2202 * @param galleryType the type of the gallery 2203 * @param galleryUri the gallery URI 2204 */ 2205 public void setStartGallery(String galleryType, String galleryUri) { 2206 2207 if (galleryUri == null) { 2208 m_startGalleriesSettings.remove(galleryType); 2209 } else { 2210 m_startGalleriesSettings.put(galleryType, galleryUri); 2211 } 2212 } 2213 2214 /** 2215 * Sets the start project of the user.<p> 2216 * 2217 * @param project the start project name of the user 2218 */ 2219 public void setStartProject(String project) { 2220 2221 m_project = project; 2222 } 2223 2224 /** 2225 * Sets the start site of the user.<p> 2226 * 2227 * @param site the start site of the user 2228 */ 2229 public void setStartSite(String site) { 2230 2231 m_startSite = site; 2232 } 2233 2234 /** 2235 * Sets the current start view of the user.<p> 2236 * 2237 * @param view the current start view of the user 2238 */ 2239 public void setStartView(String view) { 2240 2241 m_view = view; 2242 } 2243 2244 /** 2245 * Sets the (optional) workplace synchronize settings.<p> 2246 * 2247 * @param synchronizeSettings the (optional) workplace synchronize settings to set 2248 */ 2249 public void setSynchronizeSettings(CmsSynchronizeSettings synchronizeSettings) { 2250 2251 m_synchronizeSettings = synchronizeSettings; 2252 } 2253 2254 /** 2255 * Sets the user specific custom "time warp" time.<p> 2256 * 2257 * Use {@link org.opencms.main.CmsContextInfo#CURRENT_TIME} to disable this feature, ie. enable the 2258 * current time for each new request.<p> 2259 * 2260 * If this value is set, auto time warping will be disabled: Clicking on a resource that 2261 * has not been released at the given time or is already expired at the given time will not 2262 * be shown - an error message will pop up ("out of time window").<p> 2263 * 2264 * @param timewarp the time warp time to set 2265 */ 2266 public void setTimeWarp(long timewarp) { 2267 2268 if (timewarp < 0) { 2269 timewarp = CmsContextInfo.CURRENT_TIME; // other negative values will break the workplace 2270 } 2271 m_timeWarp = timewarp; 2272 } 2273 2274 /** 2275 * Sets the folder path of the upload applet on the client machine.<p> 2276 * 2277 * @param uploadAppletClientFolder the folder path of the upload applet on the client machine 2278 */ 2279 public void setUploadAppletClientFolder(String uploadAppletClientFolder) { 2280 2281 m_uploadAppletClientFolder = uploadAppletClientFolder; 2282 } 2283 2284 /** 2285 * Sets the upload variant.<p> 2286 * 2287 * @param uploadVariant the upload variant as String 2288 */ 2289 public void setUploadVariant(String uploadVariant) { 2290 2291 UploadVariant upload = null; 2292 try { 2293 upload = UploadVariant.valueOf(uploadVariant); 2294 } catch (Exception e) { 2295 // may happen, set default 2296 if (upload == null) { 2297 upload = OpenCms.getWorkplaceManager().getDefaultUserSettings().getUploadVariant(); 2298 } 2299 if (upload == null) { 2300 upload = UploadVariant.gwt; 2301 } 2302 } 2303 setUploadVariant(upload); 2304 } 2305 2306 /** 2307 * Sets the upload variant.<p> 2308 * 2309 * @param uploadVariant the upload variant 2310 */ 2311 public void setUploadVariant(UploadVariant uploadVariant) { 2312 2313 m_uploadVariant = uploadVariant; 2314 } 2315 2316 /** 2317 * Sets the current user for the settings.<p> 2318 * 2319 * @param user the CmsUser 2320 */ 2321 public void setUser(CmsUser user) { 2322 2323 m_user = user; 2324 } 2325 2326 /** 2327 * Sets the style of the workplace buttons of the user.<p> 2328 * 2329 * @param style the style of the workplace buttons of the user 2330 */ 2331 public void setWorkplaceButtonStyle(int style) { 2332 2333 m_workplaceButtonStyle = style; 2334 } 2335 2336 /** 2337 * Sets the type of the report (simple or extended) of the user.<p> 2338 * 2339 * @param type the type of the report (simple or extended) of the user 2340 */ 2341 public void setWorkplaceReportType(String type) { 2342 2343 m_workplaceReportType = type; 2344 } 2345 2346 /** 2347 * Sets the name of the search index to use in the workplace.<p> 2348 * 2349 * @param workplaceSearchIndexName the name of the search index to use in the workplace to set 2350 */ 2351 public void setWorkplaceSearchIndexName(String workplaceSearchIndexName) { 2352 2353 m_workplaceSearchIndexName = workplaceSearchIndexName; 2354 } 2355 2356 /** 2357 * Sets the workplace search result list view style.<p> 2358 * 2359 * @param workplaceSearchViewStyle the workplace search result list view style to set 2360 */ 2361 public void setWorkplaceSearchViewStyle(CmsSearchResultStyle workplaceSearchViewStyle) { 2362 2363 m_workplaceSearchViewStyle = workplaceSearchViewStyle; 2364 } 2365 2366 /** 2367 * Determines if the file creation date should be shown in explorer view.<p> 2368 * 2369 * @return true if the file creation date should be shown, otherwise false 2370 */ 2371 public boolean showExplorerFileDateCreated() { 2372 2373 return ((m_explorerSettings & CmsUserSettings.FILELIST_DATE_CREATED) > 0); 2374 } 2375 2376 /** 2377 * Determines if the file date expired should be shown in explorer view.<p> 2378 * 2379 * @return true if the file date expired should be shown, otherwise false 2380 */ 2381 public boolean showExplorerFileDateExpired() { 2382 2383 return ((m_explorerSettings & CmsUserSettings.FILELIST_DATE_EXPIRED) > 0); 2384 } 2385 2386 /** 2387 * Determines if the file last modified date should be shown in explorer view.<p> 2388 * 2389 * @return true if the file last modified date should be shown, otherwise false 2390 */ 2391 public boolean showExplorerFileDateLastModified() { 2392 2393 return ((m_explorerSettings & CmsUserSettings.FILELIST_DATE_LASTMODIFIED) > 0); 2394 } 2395 2396 /** 2397 * Determines if the file date released should be shown in explorer view.<p> 2398 * 2399 * @return true if the file date released should be shown, otherwise false 2400 */ 2401 public boolean showExplorerFileDateReleased() { 2402 2403 return ((m_explorerSettings & CmsUserSettings.FILELIST_DATE_RELEASED) > 0); 2404 } 2405 2406 /** 2407 * Determines if the file locked by should be shown in explorer view.<p> 2408 * 2409 * @return true if the file locked by should be shown, otherwise false 2410 */ 2411 public boolean showExplorerFileLockedBy() { 2412 2413 return ((m_explorerSettings & CmsUserSettings.FILELIST_LOCKEDBY) > 0); 2414 } 2415 2416 /** 2417 * Determines if the file navigation text should be shown in explorer view.<p> 2418 * 2419 * @return true if the file navigation text should be shown, otherwise false 2420 */ 2421 public boolean showExplorerFileNavText() { 2422 2423 return ((m_explorerSettings & CmsUserSettings.FILELIST_NAVTEXT) > 0); 2424 } 2425 2426 /** 2427 * Determines if the file permissions should be shown in explorer view.<p> 2428 * 2429 * @return true if the file permissions should be shown, otherwise false 2430 */ 2431 public boolean showExplorerFilePermissions() { 2432 2433 return ((m_explorerSettings & CmsUserSettings.FILELIST_PERMISSIONS) > 0); 2434 } 2435 2436 /** 2437 * Determines if the file size should be shown in explorer view.<p> 2438 * 2439 * @return true if the file size should be shown, otherwise false 2440 */ 2441 public boolean showExplorerFileSize() { 2442 2443 return ((m_explorerSettings & CmsUserSettings.FILELIST_SIZE) > 0); 2444 } 2445 2446 /** 2447 * Determines if the file state should be shown in explorer view.<p> 2448 * 2449 * @return true if the file state should be shown, otherwise false 2450 */ 2451 public boolean showExplorerFileState() { 2452 2453 return ((m_explorerSettings & CmsUserSettings.FILELIST_STATE) > 0); 2454 } 2455 2456 /** 2457 * Determines if the file title should be shown in explorer view.<p> 2458 * 2459 * @return true if the file title should be shown, otherwise false 2460 */ 2461 public boolean showExplorerFileTitle() { 2462 2463 return ((m_explorerSettings & CmsUserSettings.FILELIST_TITLE) > 0); 2464 } 2465 2466 /** 2467 * Determines if the file type should be shown in explorer view.<p> 2468 * 2469 * @return true if the file type should be shown, otherwise false 2470 */ 2471 public boolean showExplorerFileType() { 2472 2473 return ((m_explorerSettings & CmsUserSettings.FILELIST_TYPE) > 0); 2474 } 2475 2476 /** 2477 * Determines if the file creator should be shown in explorer view.<p> 2478 * 2479 * @return true if the file creator should be shown, otherwise false 2480 */ 2481 public boolean showExplorerFileUserCreated() { 2482 2483 return ((m_explorerSettings & CmsUserSettings.FILELIST_USER_CREATED) > 0); 2484 } 2485 2486 /** 2487 * Determines if the file last modified by should be shown in explorer view.<p> 2488 * 2489 * @return true if the file last modified by should be shown, otherwise false 2490 */ 2491 public boolean showExplorerFileUserLastModified() { 2492 2493 return ((m_explorerSettings & CmsUserSettings.FILELIST_USER_LASTMODIFIED) > 0); 2494 } 2495 2496 /** 2497 * Sets a specific explorer setting depending on the set parameter.<p> 2498 * 2499 * @param set true if the setting should be set, otherwise false 2500 * @param setting the settings constant value for the explorer settings 2501 */ 2502 private void setExplorerSetting(boolean set, int setting) { 2503 2504 if (set) { 2505 m_explorerSettings |= setting; 2506 } else { 2507 m_explorerSettings &= ~setting; 2508 } 2509 } 2510 2511}