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 Integer.valueOf(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 if (getStartProject() != null) { 1391 // start project 1392 if (!getStartProject().equals(OpenCms.getWorkplaceManager().getDefaultUserSettings().getStartProject())) { 1393 try { 1394 // be sure the project is valid 1395 if (cms != null) { 1396 cms.readProject(getStartProject()); 1397 } 1398 m_user.setAdditionalInfo( 1399 PREFERENCES 1400 + CmsWorkplaceConfiguration.N_WORKPLACESTARTUPSETTINGS 1401 + CmsWorkplaceConfiguration.N_PROJECT, 1402 getStartProject()); 1403 } catch (Exception e) { 1404 if (cms != null) { 1405 m_user.deleteAdditionalInfo( 1406 PREFERENCES 1407 + CmsWorkplaceConfiguration.N_WORKPLACESTARTUPSETTINGS 1408 + CmsWorkplaceConfiguration.N_PROJECT); 1409 } 1410 } 1411 } else if (cms != null) { 1412 m_user.deleteAdditionalInfo( 1413 PREFERENCES 1414 + CmsWorkplaceConfiguration.N_WORKPLACESTARTUPSETTINGS 1415 + CmsWorkplaceConfiguration.N_PROJECT); 1416 } 1417 } 1418 // view 1419 if (getStartView() != null) { 1420 if (!getStartView().equals(OpenCms.getWorkplaceManager().getDefaultUserSettings().getStartView())) { 1421 m_user.setAdditionalInfo( 1422 PREFERENCES 1423 + CmsWorkplaceConfiguration.N_WORKPLACESTARTUPSETTINGS 1424 + CmsWorkplaceConfiguration.N_WORKPLACEVIEW, 1425 getStartView()); 1426 } else if (cms != null) { 1427 m_user.deleteAdditionalInfo( 1428 PREFERENCES 1429 + CmsWorkplaceConfiguration.N_WORKPLACESTARTUPSETTINGS 1430 + CmsWorkplaceConfiguration.N_WORKPLACEVIEW); 1431 } 1432 } 1433 if (getStartSite() != null) { 1434 // start site 1435 if (!getStartSite().equals(OpenCms.getWorkplaceManager().getDefaultUserSettings().getStartSite())) { 1436 m_user.setAdditionalInfo( 1437 PREFERENCES + CmsWorkplaceConfiguration.N_WORKPLACESTARTUPSETTINGS + I_CmsXmlConfiguration.N_SITE, 1438 getStartSite()); 1439 } else if (cms != null) { 1440 m_user.deleteAdditionalInfo( 1441 PREFERENCES + CmsWorkplaceConfiguration.N_WORKPLACESTARTUPSETTINGS + I_CmsXmlConfiguration.N_SITE); 1442 } 1443 } 1444 // start folder 1445 if (CmsStringUtil.isNotEmptyOrWhitespaceOnly(getStartFolder()) 1446 && !getStartFolder().equals(OpenCms.getWorkplaceManager().getDefaultUserSettings().getStartFolder())) { 1447 m_user.setAdditionalInfo( 1448 PREFERENCES + CmsWorkplaceConfiguration.N_WORKPLACESTARTUPSETTINGS + CmsWorkplaceConfiguration.N_FOLDER, 1449 getStartFolder()); 1450 } else if (cms != null) { 1451 m_user.deleteAdditionalInfo( 1452 PREFERENCES 1453 + CmsWorkplaceConfiguration.N_WORKPLACESTARTUPSETTINGS 1454 + CmsWorkplaceConfiguration.N_FOLDER); 1455 } 1456 // restrict explorer folder view 1457 if (getRestrictExplorerView() != OpenCms.getWorkplaceManager().getDefaultUserSettings().getRestrictExplorerView()) { 1458 m_user.setAdditionalInfo( 1459 PREFERENCES 1460 + CmsWorkplaceConfiguration.N_WORKPLACESTARTUPSETTINGS 1461 + CmsWorkplaceConfiguration.N_RESTRICTEXPLORERVIEW, 1462 Boolean.valueOf(getRestrictExplorerView())); 1463 } else if (cms != null) { 1464 m_user.deleteAdditionalInfo( 1465 PREFERENCES 1466 + CmsWorkplaceConfiguration.N_WORKPLACESTARTUPSETTINGS 1467 + CmsWorkplaceConfiguration.N_RESTRICTEXPLORERVIEW); 1468 } 1469 // explorer button style 1470 if (getExplorerButtonStyle() != OpenCms.getWorkplaceManager().getDefaultUserSettings().getExplorerButtonStyle()) { 1471 m_user.setAdditionalInfo( 1472 PREFERENCES 1473 + CmsWorkplaceConfiguration.N_EXPLORERGENERALOPTIONS 1474 + CmsWorkplaceConfiguration.N_BUTTONSTYLE, 1475 Integer.valueOf(getExplorerButtonStyle())); 1476 } else if (cms != null) { 1477 m_user.deleteAdditionalInfo( 1478 PREFERENCES 1479 + CmsWorkplaceConfiguration.N_EXPLORERGENERALOPTIONS 1480 + CmsWorkplaceConfiguration.N_BUTTONSTYLE); 1481 } 1482 // explorer file entries 1483 if (getExplorerFileEntries() != OpenCms.getWorkplaceManager().getDefaultUserSettings().getExplorerFileEntries()) { 1484 m_user.setAdditionalInfo( 1485 PREFERENCES + CmsWorkplaceConfiguration.N_EXPLORERGENERALOPTIONS + CmsWorkplaceConfiguration.N_ENTRIES, 1486 Integer.valueOf(getExplorerFileEntries())); 1487 } else if (cms != null) { 1488 m_user.deleteAdditionalInfo( 1489 PREFERENCES + CmsWorkplaceConfiguration.N_EXPLORERGENERALOPTIONS + CmsWorkplaceConfiguration.N_ENTRIES); 1490 } 1491 // explorer settings 1492 if (getExplorerSettings() != OpenCms.getWorkplaceManager().getDefaultUserSettings().getExplorerSettings()) { 1493 m_user.setAdditionalInfo( 1494 PREFERENCES 1495 + CmsWorkplaceConfiguration.N_EXPLORERGENERALOPTIONS 1496 + CmsWorkplaceConfiguration.N_EXPLORERDISPLAYOPTIONS, 1497 Integer.valueOf(getExplorerSettings())); 1498 } else if (cms != null) { 1499 m_user.deleteAdditionalInfo( 1500 PREFERENCES 1501 + CmsWorkplaceConfiguration.N_EXPLORERGENERALOPTIONS 1502 + CmsWorkplaceConfiguration.N_EXPLORERDISPLAYOPTIONS); 1503 } 1504 // dialog file copy mode 1505 if (getDialogCopyFileMode() != OpenCms.getWorkplaceManager().getDefaultUserSettings().getDialogCopyFileMode()) { 1506 m_user.setAdditionalInfo( 1507 PREFERENCES + CmsWorkplaceConfiguration.N_DIALOGSDEFAULTSETTINGS + CmsWorkplaceConfiguration.N_FILECOPY, 1508 Integer.valueOf(getDialogCopyFileMode().getMode())); 1509 } else if (cms != null) { 1510 m_user.deleteAdditionalInfo( 1511 PREFERENCES 1512 + CmsWorkplaceConfiguration.N_DIALOGSDEFAULTSETTINGS 1513 + CmsWorkplaceConfiguration.N_FILECOPY); 1514 } 1515 // dialog folder copy mode 1516 if (getDialogCopyFolderMode() != OpenCms.getWorkplaceManager().getDefaultUserSettings().getDialogCopyFolderMode()) { 1517 m_user.setAdditionalInfo( 1518 PREFERENCES 1519 + CmsWorkplaceConfiguration.N_DIALOGSDEFAULTSETTINGS 1520 + CmsWorkplaceConfiguration.N_FOLDERCOPY, 1521 Integer.valueOf(getDialogCopyFolderMode().getMode())); 1522 } else if (cms != null) { 1523 m_user.deleteAdditionalInfo( 1524 PREFERENCES 1525 + CmsWorkplaceConfiguration.N_DIALOGSDEFAULTSETTINGS 1526 + CmsWorkplaceConfiguration.N_FOLDERCOPY); 1527 } 1528 // dialog file delete mode 1529 if (getDialogDeleteFileMode() != OpenCms.getWorkplaceManager().getDefaultUserSettings().getDialogDeleteFileMode()) { 1530 m_user.setAdditionalInfo( 1531 PREFERENCES 1532 + CmsWorkplaceConfiguration.N_DIALOGSDEFAULTSETTINGS 1533 + CmsWorkplaceConfiguration.N_FILEDELETION, 1534 Integer.valueOf(getDialogDeleteFileMode().getMode())); 1535 } else if (cms != null) { 1536 m_user.deleteAdditionalInfo( 1537 PREFERENCES 1538 + CmsWorkplaceConfiguration.N_DIALOGSDEFAULTSETTINGS 1539 + CmsWorkplaceConfiguration.N_FILEDELETION); 1540 } 1541 // dialog direct publish mode 1542 if (getDialogPublishSiblings() != OpenCms.getWorkplaceManager().getDefaultUserSettings().getDialogPublishSiblings()) { 1543 m_user.setAdditionalInfo( 1544 PREFERENCES 1545 + CmsWorkplaceConfiguration.N_DIALOGSDEFAULTSETTINGS 1546 + CmsWorkplaceConfiguration.N_DIRECTPUBLISH, 1547 Boolean.valueOf(getDialogPublishSiblings())); 1548 } else if (cms != null) { 1549 m_user.deleteAdditionalInfo( 1550 PREFERENCES 1551 + CmsWorkplaceConfiguration.N_DIALOGSDEFAULTSETTINGS 1552 + CmsWorkplaceConfiguration.N_DIRECTPUBLISH); 1553 } 1554 // dialog show lock mode 1555 if (getDialogShowLock() != OpenCms.getWorkplaceManager().getDefaultUserSettings().getDialogShowLock()) { 1556 m_user.setAdditionalInfo( 1557 PREFERENCES + CmsWorkplaceConfiguration.N_DIALOGSDEFAULTSETTINGS + CmsWorkplaceConfiguration.N_SHOWLOCK, 1558 Boolean.valueOf(getDialogShowLock())); 1559 } else if (cms != null) { 1560 m_user.deleteAdditionalInfo( 1561 PREFERENCES 1562 + CmsWorkplaceConfiguration.N_DIALOGSDEFAULTSETTINGS 1563 + CmsWorkplaceConfiguration.N_SHOWLOCK); 1564 } 1565 // dialog permissions inheritation mode 1566 if (getDialogPermissionsInheritOnFolder() != OpenCms.getWorkplaceManager().getDefaultUserSettings().getDialogPermissionsInheritOnFolder()) { 1567 m_user.setAdditionalInfo( 1568 PREFERENCES 1569 + CmsWorkplaceConfiguration.N_DIALOGSDEFAULTSETTINGS 1570 + CmsWorkplaceConfiguration.N_PERMISSIONSINHERITONFOLDER, 1571 Boolean.valueOf(getDialogPermissionsInheritOnFolder())); 1572 } else if (cms != null) { 1573 m_user.deleteAdditionalInfo( 1574 PREFERENCES 1575 + CmsWorkplaceConfiguration.N_DIALOGSDEFAULTSETTINGS 1576 + CmsWorkplaceConfiguration.N_PERMISSIONSINHERITONFOLDER); 1577 } 1578 // dialog expand inherited permissions mode 1579 if (getDialogExpandInheritedPermissions() != OpenCms.getWorkplaceManager().getDefaultUserSettings().getDialogExpandInheritedPermissions()) { 1580 m_user.setAdditionalInfo( 1581 PREFERENCES 1582 + CmsWorkplaceConfiguration.N_DIALOGSDEFAULTSETTINGS 1583 + CmsWorkplaceConfiguration.N_EXPANDPERMISSIONSINHERITED, 1584 Boolean.valueOf(getDialogExpandInheritedPermissions())); 1585 } else if (cms != null) { 1586 m_user.deleteAdditionalInfo( 1587 PREFERENCES 1588 + CmsWorkplaceConfiguration.N_DIALOGSDEFAULTSETTINGS 1589 + CmsWorkplaceConfiguration.N_EXPANDPERMISSIONSINHERITED); 1590 } 1591 // dialog expand users permissions mode 1592 if (getDialogExpandUserPermissions() != OpenCms.getWorkplaceManager().getDefaultUserSettings().getDialogExpandUserPermissions()) { 1593 m_user.setAdditionalInfo( 1594 PREFERENCES 1595 + CmsWorkplaceConfiguration.N_DIALOGSDEFAULTSETTINGS 1596 + CmsWorkplaceConfiguration.N_EXPANDPERMISSIONSUSER, 1597 Boolean.valueOf(getDialogExpandUserPermissions())); 1598 } else if (cms != null) { 1599 m_user.deleteAdditionalInfo( 1600 PREFERENCES 1601 + CmsWorkplaceConfiguration.N_DIALOGSDEFAULTSETTINGS 1602 + CmsWorkplaceConfiguration.N_EXPANDPERMISSIONSUSER); 1603 } 1604 // editor button style 1605 if (getEditorButtonStyle() != OpenCms.getWorkplaceManager().getDefaultUserSettings().getEditorButtonStyle()) { 1606 m_user.setAdditionalInfo( 1607 PREFERENCES 1608 + CmsWorkplaceConfiguration.N_EDITORGENERALOPTIONS 1609 + CmsWorkplaceConfiguration.N_BUTTONSTYLE, 1610 Integer.valueOf(getEditorButtonStyle())); 1611 } else if (cms != null) { 1612 m_user.deleteAdditionalInfo( 1613 PREFERENCES 1614 + CmsWorkplaceConfiguration.N_EDITORGENERALOPTIONS 1615 + CmsWorkplaceConfiguration.N_BUTTONSTYLE); 1616 } 1617 // direct edit button style 1618 if (getDirectEditButtonStyle() != OpenCms.getWorkplaceManager().getDefaultUserSettings().getDirectEditButtonStyle()) { 1619 m_user.setAdditionalInfo( 1620 PREFERENCES 1621 + CmsWorkplaceConfiguration.N_EDITORGENERALOPTIONS 1622 + CmsWorkplaceConfiguration.N_DIRECTEDITSTYLE, 1623 Integer.valueOf(getDirectEditButtonStyle())); 1624 } else if (cms != null) { 1625 m_user.deleteAdditionalInfo( 1626 PREFERENCES 1627 + CmsWorkplaceConfiguration.N_EDITORGENERALOPTIONS 1628 + CmsWorkplaceConfiguration.N_DIRECTEDITSTYLE); 1629 } 1630 // editor settings 1631 if (m_editorSettings.size() > 0) { 1632 Iterator<Map.Entry<String, String>> itEntries = m_editorSettings.entrySet().iterator(); 1633 while (itEntries.hasNext()) { 1634 Map.Entry<String, String> entry = itEntries.next(); 1635 if (entry.getValue() != null) { 1636 m_user.setAdditionalInfo( 1637 PREFERENCES + CmsWorkplaceConfiguration.N_EDITORPREFERREDEDITORS + entry.getKey(), 1638 entry.getValue()); 1639 } else { 1640 m_user.deleteAdditionalInfo( 1641 PREFERENCES + CmsWorkplaceConfiguration.N_EDITORPREFERREDEDITORS + entry.getKey()); 1642 } 1643 } 1644 } else if (cms != null) { 1645 Iterator<String> itKeys = m_user.getAdditionalInfo().keySet().iterator(); 1646 List<String> keysToDelete = new ArrayList<String>(3); 1647 while (itKeys.hasNext()) { 1648 String key = itKeys.next(); 1649 if (key.startsWith(PREFERENCES + CmsWorkplaceConfiguration.N_EDITORPREFERREDEDITORS)) { 1650 keysToDelete.add(key); 1651 } 1652 } 1653 for (String key : keysToDelete) { 1654 m_user.deleteAdditionalInfo(key); 1655 } 1656 } 1657 // start settings for galleries 1658 if (m_startGalleriesSettings.size() > 0) { 1659 Iterator<Map.Entry<String, String>> itEntries = m_startGalleriesSettings.entrySet().iterator(); 1660 while (itEntries.hasNext()) { 1661 Map.Entry<String, String> entry = itEntries.next(); 1662 if ((entry.getValue() != null) && !entry.getValue().equals(CmsWorkplace.INPUT_DEFAULT)) { 1663 m_user.setAdditionalInfo( 1664 PREFERENCES + CmsWorkplaceConfiguration.N_STARTGALLERIES + entry.getKey(), 1665 entry.getValue()); 1666 } else { 1667 // delete from user settings if value of the entry is null or "default" 1668 m_user.deleteAdditionalInfo( 1669 PREFERENCES + CmsWorkplaceConfiguration.N_STARTGALLERIES + entry.getKey()); 1670 } 1671 } 1672 } else if (cms != null) { 1673 Iterator<String> itKeys = m_user.getAdditionalInfo().keySet().iterator(); 1674 while (itKeys.hasNext()) { 1675 String key = itKeys.next(); 1676 if (key.startsWith(PREFERENCES + CmsWorkplaceConfiguration.N_STARTGALLERIES)) { 1677 m_user.deleteAdditionalInfo(key); 1678 } 1679 } 1680 1681 } 1682 1683 // workplace search 1684 if (getWorkplaceSearchViewStyle() != null) { 1685 m_user.setAdditionalInfo( 1686 PREFERENCES + CmsWorkplaceConfiguration.N_WORKPLACESEARCH + CmsWorkplaceConfiguration.N_SEARCHVIEWSTYLE, 1687 getWorkplaceSearchViewStyle().toString()); 1688 } 1689 // synchronize settings 1690 if (getSynchronizeSettings() != null) { 1691 m_user.setAdditionalInfo( 1692 PREFERENCES + SYNC_SETTINGS + SYNC_ENABLED, 1693 Boolean.valueOf(getSynchronizeSettings().isEnabled())); 1694 m_user.setAdditionalInfo( 1695 PREFERENCES + SYNC_SETTINGS + SYNC_DESTINATION, 1696 getSynchronizeSettings().getDestinationPathInRfs()); 1697 m_user.setAdditionalInfo( 1698 PREFERENCES + SYNC_SETTINGS + SYNC_VFS_LIST, 1699 CmsStringUtil.collectionAsString(getSynchronizeSettings().getSourceListInVfs(), "|")); 1700 } else { 1701 m_user.deleteAdditionalInfo(PREFERENCES + SYNC_SETTINGS + SYNC_ENABLED); 1702 m_user.deleteAdditionalInfo(PREFERENCES + SYNC_SETTINGS + SYNC_DESTINATION); 1703 m_user.deleteAdditionalInfo(PREFERENCES + SYNC_SETTINGS + SYNC_VFS_LIST); 1704 } 1705 // upload applet client folder path 1706 if (CmsStringUtil.isNotEmptyOrWhitespaceOnly(m_uploadAppletClientFolder)) { 1707 m_user.setAdditionalInfo(ADDITIONAL_INFO_UPLOADAPPLET_CLIENTFOLDER, m_uploadAppletClientFolder); 1708 } else { 1709 m_user.deleteAdditionalInfo(ADDITIONAL_INFO_UPLOADAPPLET_CLIENTFOLDER); 1710 } 1711 // workplace user surf time (time warp) 1712 if (getTimeWarp() != CmsContextInfo.CURRENT_TIME) { 1713 m_user.setAdditionalInfo(ADDITIONAL_INFO_TIMEWARP, Long.valueOf(getTimeWarp())); 1714 } else if (cms != null) { 1715 m_user.deleteAdditionalInfo(ADDITIONAL_INFO_TIMEWARP); 1716 } 1717 1718 Set<String> additionalInfosToDelete = new HashSet<String>(); 1719 for (String key : m_user.getAdditionalInfo().keySet()) { 1720 if (key.startsWith(PREFERENCES_ADDITIONAL_PREFIX) 1721 && !m_additionalPreferences.containsKey(key.substring(PREFERENCES_ADDITIONAL_PREFIX.length()))) { 1722 additionalInfosToDelete.add(key); 1723 } 1724 } 1725 for (String key : additionalInfosToDelete) { 1726 m_user.deleteAdditionalInfo(key); 1727 } 1728 for (Map.Entry<String, String> entry : m_additionalPreferences.entrySet()) { 1729 String key = entry.getKey(); 1730 String value = entry.getValue(); 1731 m_user.setAdditionalInfo(PREFERENCES_ADDITIONAL_PREFIX + key, value); 1732 } 1733 1734 // only write the updated user to the DB if we have the cms object 1735 if (cms != null) { 1736 cms.writeUser(m_user); 1737 } 1738 } 1739 1740 /** 1741 * Sets an additional preference value.<p> 1742 * 1743 * @param name the additional preference name 1744 * @param value the preference value 1745 */ 1746 public void setAdditionalPreference(String name, String value) { 1747 1748 if (value == null) { 1749 m_additionalPreferences.remove(name); 1750 } else { 1751 m_additionalPreferences.put(name, value); 1752 } 1753 } 1754 1755 /** 1756 * Sets this settings object's additional preferences to that of another one.<p> 1757 * 1758 * @param userSettings the user settings 1759 */ 1760 public void setAdditionalPreferencesFrom(CmsUserSettings userSettings) { 1761 1762 m_additionalPreferences = Maps.newLinkedHashMap(userSettings.m_additionalPreferences); 1763 } 1764 1765 /** 1766 * Sets the default copy mode when copying a file of the user.<p> 1767 * 1768 * @param mode the default copy mode when copying a file of the user 1769 */ 1770 public void setDialogCopyFileMode(CmsResourceCopyMode mode) { 1771 1772 m_dialogFileCopy = mode; 1773 } 1774 1775 /** 1776 * Sets the default copy mode when copying a folder of the user.<p> 1777 * 1778 * @param mode the default copy mode when copying a folder of the user 1779 */ 1780 public void setDialogCopyFolderMode(CmsResourceCopyMode mode) { 1781 1782 m_dialogFolderCopy = mode; 1783 } 1784 1785 /** 1786 * Sets the default setting for file deletion.<p> 1787 * 1788 * @param mode the default setting for file deletion 1789 */ 1790 public void setDialogDeleteFileMode(CmsResourceDeleteMode mode) { 1791 1792 m_dialogFileDelete = mode; 1793 } 1794 1795 /** 1796 * Sets the default setting for expanding inherited permissions in the dialog.<p> 1797 * 1798 * @param dialogShowInheritedPermissions the default setting for expanding inherited permissions in the dialog 1799 */ 1800 public void setDialogExpandInheritedPermissions(boolean dialogShowInheritedPermissions) { 1801 1802 m_dialogExpandInheritedPermissions = dialogShowInheritedPermissions; 1803 } 1804 1805 /** 1806 * Sets the default setting for expanding the users permissions in the dialog.<p> 1807 * 1808 * @param dialogShowUserPermissions the default setting for expanding the users permissions in the dialog 1809 */ 1810 public void setDialogExpandUserPermissions(boolean dialogShowUserPermissions) { 1811 1812 m_dialogExpandUserPermissions = dialogShowUserPermissions; 1813 } 1814 1815 /** 1816 * Sets the default setting for inheriting permissions on folders.<p> 1817 * 1818 * @param dialogPermissionsInheritOnFolder the default setting for inheriting permissions on folders 1819 */ 1820 public void setDialogPermissionsInheritOnFolder(boolean dialogPermissionsInheritOnFolder) { 1821 1822 m_dialogPermissionsInheritOnFolder = dialogPermissionsInheritOnFolder; 1823 } 1824 1825 /** 1826 * Sets the default setting for direct publishing.<p> 1827 * 1828 * @param publishSiblings the default setting for direct publishing: true if siblings should be published, otherwise false 1829 */ 1830 public void setDialogPublishSiblings(boolean publishSiblings) { 1831 1832 m_dialogDirectpublish = publishSiblings; 1833 } 1834 1835 /** 1836 * Sets if the export setting part of the secure/export dialog should be shown.<p> 1837 * 1838 * @param show true if the export dialog should be shown, otherwise false 1839 */ 1840 public void setDialogShowExportSettings(boolean show) { 1841 1842 m_showExportSettings = show; 1843 } 1844 1845 /** 1846 * Sets if the lock dialog should be shown.<p> 1847 * 1848 * @param show true if the lock dialog should be shown, otherwise false 1849 */ 1850 public void setDialogShowLock(boolean show) { 1851 1852 m_showLock = show; 1853 } 1854 1855 /** 1856 * Sets the style of the direct edit buttons of the user.<p> 1857 * 1858 * @param style the style of the direct edit buttons of the user 1859 */ 1860 public void setDirectEditButtonStyle(int style) { 1861 1862 m_directeditButtonStyle = style; 1863 } 1864 1865 /** 1866 * Sets the style of the editor buttons of the user.<p> 1867 * 1868 * @param style the style of the editor buttons of the user 1869 */ 1870 public void setEditorButtonStyle(int style) { 1871 1872 m_editorButtonStyle = style; 1873 } 1874 1875 /** 1876 * Sets the editor settings of the user.<p> 1877 * 1878 * @param settings the editor settings of the user 1879 */ 1880 public void setEditorSettings(Map<String, String> settings) { 1881 1882 m_editorSettings = new TreeMap<String, String>(settings); 1883 } 1884 1885 /** 1886 * Sets the style of the explorer buttons of the user.<p> 1887 * 1888 * @param style the style of the explorer buttons of the user 1889 */ 1890 public void setExplorerButtonStyle(int style) { 1891 1892 m_explorerButtonStyle = style; 1893 } 1894 1895 /** 1896 * Sets the number of displayed files per page of the user.<p> 1897 * 1898 * @param entries the number of displayed files per page of the user 1899 */ 1900 public void setExplorerFileEntries(int entries) { 1901 1902 m_explorerFileEntries = entries; 1903 } 1904 1905 /** 1906 * Sets the explorerFileEntryOptions.<p> 1907 * 1908 * @param explorerFileEntryOptions the explorerFileEntryOptions to set 1909 */ 1910 public void setExplorerFileEntryOptions(String explorerFileEntryOptions) { 1911 1912 m_explorerFileEntryOptions = explorerFileEntryOptions; 1913 } 1914 1915 /** 1916 * Sets the explorer start settings.<p> 1917 * 1918 * @param settings explorer start settings to use 1919 */ 1920 public void setExplorerSettings(int settings) { 1921 1922 m_explorerSettings = settings; 1923 } 1924 1925 /** 1926 * Sets if all the projects should be shown or not.<p> 1927 * 1928 * @param listAllProjects true if all the projects should be shown, otherwise false 1929 */ 1930 public void setListAllProjects(boolean listAllProjects) { 1931 1932 m_listAllProjects = listAllProjects; 1933 } 1934 1935 /** 1936 * Sets the locale of the user.<p> 1937 * 1938 * @param locale the locale of the user 1939 */ 1940 public void setLocale(Locale locale) { 1941 1942 m_locale = locale; 1943 } 1944 1945 /** 1946 * Sets if the "create index page" check box in the new folder 1947 * dialog should be initially be checked or not. <p> 1948 * 1949 * @param setting if the "create index page" check box in the new folder 1950 * dialog should be initially be checked or not. 1951 */ 1952 public void setNewFolderCreateIndexPage(Boolean setting) { 1953 1954 m_newFolderCreateIndexPage = setting; 1955 } 1956 1957 /** 1958 * Sets if the "edit properties" check box in the new folder 1959 * dialog should be initially be checked or not. <p> 1960 * 1961 * @param setting if the "edit properties" check box in the new folder 1962 * dialog should be initially be checked or not. 1963 */ 1964 public void setNewFolderEditPropertes(Boolean setting) { 1965 1966 m_newFolderEditProperties = setting; 1967 } 1968 1969 /** 1970 * Sets the preferred editor for the given resource type of the user.<p> 1971 * 1972 * @param resourceType the resource type 1973 * @param editorUri the editor URI 1974 */ 1975 public void setPreferredEditor(String resourceType, String editorUri) { 1976 1977 if (editorUri == null) { 1978 m_editorSettings.remove(resourceType); 1979 } else { 1980 m_editorSettings.put(resourceType, editorUri); 1981 } 1982 } 1983 1984 /** 1985 * Sets the appearance of the "publish project" button.<p> 1986 * 1987 * Allowed values are either {@link CmsDefaultUserSettings#PUBLISHBUTTON_SHOW_ALWAYS}, 1988 * {@link CmsDefaultUserSettings#PUBLISHBUTTON_SHOW_AUTO} or 1989 * {@link CmsDefaultUserSettings#PUBLISHBUTTON_SHOW_NEVER}.<p> 1990 * 1991 * @param publishButtonAppearance the appearance of the "publish project" button 1992 */ 1993 public void setPublishButtonAppearance(String publishButtonAppearance) { 1994 1995 String value = CmsDefaultUserSettings.PUBLISHBUTTON_SHOW_ALWAYS; 1996 if (CmsStringUtil.isNotEmptyOrWhitespaceOnly(publishButtonAppearance)) { 1997 publishButtonAppearance = publishButtonAppearance.trim().toLowerCase(); 1998 if (CmsDefaultUserSettings.PUBLISHBUTTON_SHOW_AUTO.equals(publishButtonAppearance)) { 1999 value = CmsDefaultUserSettings.PUBLISHBUTTON_SHOW_AUTO; 2000 } else if (CmsDefaultUserSettings.PUBLISHBUTTON_SHOW_NEVER.equals(publishButtonAppearance)) { 2001 value = CmsDefaultUserSettings.PUBLISHBUTTON_SHOW_NEVER; 2002 } 2003 } 2004 m_publishButtonAppearance = value; 2005 } 2006 2007 /** 2008 * Sets if the explorer view is restricted to the defined site and folder.<p> 2009 * 2010 * @param restrict true if the explorer view is restricted, otherwise false 2011 */ 2012 public void setRestrictExplorerView(boolean restrict) { 2013 2014 m_restrictExplorerView = restrict; 2015 } 2016 2017 /** 2018 * Sets if the file creation date should be shown in explorer view.<p> 2019 * 2020 * @param show true if the file creation date should be shown, otherwise false 2021 */ 2022 public void setShowExplorerFileDateCreated(boolean show) { 2023 2024 setExplorerSetting(show, CmsUserSettings.FILELIST_DATE_CREATED); 2025 } 2026 2027 /** 2028 * Sets if the file expire date should be shown in explorer view.<p> 2029 * 2030 * @param show true if the file expire date should be shown, otherwise false 2031 */ 2032 public void setShowExplorerFileDateExpired(boolean show) { 2033 2034 setExplorerSetting(show, CmsUserSettings.FILELIST_DATE_EXPIRED); 2035 } 2036 2037 /** 2038 * Sets if the file last modified date state should be shown in explorer view.<p> 2039 * 2040 * @param show true if the file last modified date should be shown, otherwise false 2041 */ 2042 public void setShowExplorerFileDateLastModified(boolean show) { 2043 2044 setExplorerSetting(show, CmsUserSettings.FILELIST_DATE_LASTMODIFIED); 2045 } 2046 2047 /** 2048 * Sets if the file release date should be shown in explorer view.<p> 2049 * 2050 * @param show true if the file release date should be shown, otherwise false 2051 */ 2052 public void setShowExplorerFileDateReleased(boolean show) { 2053 2054 setExplorerSetting(show, CmsUserSettings.FILELIST_DATE_RELEASED); 2055 } 2056 2057 /** 2058 * Sets if the file locked by should be shown in explorer view.<p> 2059 * 2060 * @param show true if the file locked by should be shown, otherwise false 2061 */ 2062 public void setShowExplorerFileLockedBy(boolean show) { 2063 2064 setExplorerSetting(show, CmsUserSettings.FILELIST_LOCKEDBY); 2065 } 2066 2067 /** 2068 * Sets if the file navtext should be shown in explorer view.<p> 2069 * 2070 * @param show true if the file navtext should be shown, otherwise false 2071 */ 2072 public void setShowExplorerFileNavText(boolean show) { 2073 2074 setExplorerSetting(show, CmsUserSettings.FILELIST_NAVTEXT); 2075 } 2076 2077 /** 2078 * Sets if the file permissions should be shown in explorer view.<p> 2079 * 2080 * @param show true if the file permissions should be shown, otherwise false 2081 */ 2082 public void setShowExplorerFilePermissions(boolean show) { 2083 2084 setExplorerSetting(show, CmsUserSettings.FILELIST_PERMISSIONS); 2085 } 2086 2087 /** 2088 * Sets if the file size should be shown in explorer view.<p> 2089 * 2090 * @param show true if the file size should be shown, otherwise false 2091 */ 2092 public void setShowExplorerFileSize(boolean show) { 2093 2094 setExplorerSetting(show, CmsUserSettings.FILELIST_SIZE); 2095 } 2096 2097 /** 2098 * Sets if the file state should be shown in explorer view.<p> 2099 * 2100 * @param show true if the state size should be shown, otherwise false 2101 */ 2102 public void setShowExplorerFileState(boolean show) { 2103 2104 setExplorerSetting(show, CmsUserSettings.FILELIST_STATE); 2105 } 2106 2107 /** 2108 * Sets if the file title should be shown in explorer view.<p> 2109 * 2110 * @param show true if the file title should be shown, otherwise false 2111 */ 2112 public void setShowExplorerFileTitle(boolean show) { 2113 2114 setExplorerSetting(show, CmsUserSettings.FILELIST_TITLE); 2115 } 2116 2117 /** 2118 * Sets if the file type should be shown in explorer view.<p> 2119 * 2120 * @param show true if the file type should be shown, otherwise false 2121 */ 2122 public void setShowExplorerFileType(boolean show) { 2123 2124 setExplorerSetting(show, CmsUserSettings.FILELIST_TYPE); 2125 } 2126 2127 /** 2128 * Sets if the file creator should be shown in explorer view.<p> 2129 * 2130 * @param show true if the file creator should be shown, otherwise false 2131 */ 2132 public void setShowExplorerFileUserCreated(boolean show) { 2133 2134 setExplorerSetting(show, CmsUserSettings.FILELIST_USER_CREATED); 2135 } 2136 2137 /** 2138 * Sets if the file last modified by should be shown in explorer view.<p> 2139 * 2140 * @param show true if the file last modified by should be shown, otherwise false 2141 */ 2142 public void setShowExplorerFileUserLastModified(boolean show) { 2143 2144 setExplorerSetting(show, CmsUserSettings.FILELIST_USER_LASTMODIFIED); 2145 } 2146 2147 /** 2148 * Controls whether to display a file upload icon or not.<p> 2149 * 2150 * @param flag <code>true</code> or <code>false</code> to flag the use of the file upload button 2151 */ 2152 public void setShowFileUploadButton(boolean flag) { 2153 2154 m_showFileUploadButton = flag; 2155 } 2156 2157 /** 2158 * Sets if the publish notifications should be shown or not.<p> 2159 * 2160 * @param showPublishNotification true if the publish notifications should be shown, otherwise false 2161 */ 2162 public void setShowPublishNotification(boolean showPublishNotification) { 2163 2164 m_showPublishNotification = showPublishNotification; 2165 } 2166 2167 /** 2168 * Sets if the resource type selection dialog should 2169 * be shown in the file upload process (non - applet version) or not. <p> 2170 * 2171 * @param showUploadTypeDialog if the resource type selection dialog should 2172 * be shown in the file upload process (non - applet version) 2173 */ 2174 public void setShowUploadTypeDialog(Boolean showUploadTypeDialog) { 2175 2176 m_showUploadTypeDialog = showUploadTypeDialog; 2177 } 2178 2179 /** 2180 * Sets the start folder of the user.<p> 2181 * 2182 * @param folder the start folder of the user 2183 */ 2184 public void setStartFolder(String folder) { 2185 2186 if (!folder.startsWith("/")) { 2187 folder = "/" + folder; 2188 } 2189 if (!folder.endsWith("/")) { 2190 folder = folder + "/"; 2191 } 2192 m_startFolder = folder; 2193 } 2194 2195 /** 2196 * Sets the start galleries settings of the user.<p> 2197 * 2198 * @param settings the start galleries setting of the user 2199 */ 2200 public void setStartGalleriesSetting(Map<String, String> settings) { 2201 2202 m_startGalleriesSettings = new TreeMap<String, String>(settings); 2203 } 2204 2205 /** 2206 * Sets the path to the start gallery of the user or removes the entry from user settings if no path is null.<p> 2207 * 2208 * @param galleryType the type of the gallery 2209 * @param galleryUri the gallery URI 2210 */ 2211 public void setStartGallery(String galleryType, String galleryUri) { 2212 2213 if (galleryUri == null) { 2214 m_startGalleriesSettings.remove(galleryType); 2215 } else { 2216 m_startGalleriesSettings.put(galleryType, galleryUri); 2217 } 2218 } 2219 2220 /** 2221 * Sets the start project of the user.<p> 2222 * 2223 * @param project the start project name of the user 2224 */ 2225 public void setStartProject(String project) { 2226 2227 m_project = project; 2228 } 2229 2230 /** 2231 * Sets the start site of the user.<p> 2232 * 2233 * @param site the start site of the user 2234 */ 2235 public void setStartSite(String site) { 2236 2237 m_startSite = site; 2238 } 2239 2240 /** 2241 * Sets the current start view of the user.<p> 2242 * 2243 * @param view the current start view of the user 2244 */ 2245 public void setStartView(String view) { 2246 2247 m_view = view; 2248 } 2249 2250 /** 2251 * Sets the (optional) workplace synchronize settings.<p> 2252 * 2253 * @param synchronizeSettings the (optional) workplace synchronize settings to set 2254 */ 2255 public void setSynchronizeSettings(CmsSynchronizeSettings synchronizeSettings) { 2256 2257 m_synchronizeSettings = synchronizeSettings; 2258 } 2259 2260 /** 2261 * Sets the user specific custom "time warp" time.<p> 2262 * 2263 * Use {@link org.opencms.main.CmsContextInfo#CURRENT_TIME} to disable this feature, ie. enable the 2264 * current time for each new request.<p> 2265 * 2266 * If this value is set, auto time warping will be disabled: Clicking on a resource that 2267 * has not been released at the given time or is already expired at the given time will not 2268 * be shown - an error message will pop up ("out of time window").<p> 2269 * 2270 * @param timewarp the time warp time to set 2271 */ 2272 public void setTimeWarp(long timewarp) { 2273 2274 if (timewarp < 0) { 2275 timewarp = CmsContextInfo.CURRENT_TIME; // other negative values will break the workplace 2276 } 2277 m_timeWarp = timewarp; 2278 } 2279 2280 /** 2281 * Sets the folder path of the upload applet on the client machine.<p> 2282 * 2283 * @param uploadAppletClientFolder the folder path of the upload applet on the client machine 2284 */ 2285 public void setUploadAppletClientFolder(String uploadAppletClientFolder) { 2286 2287 m_uploadAppletClientFolder = uploadAppletClientFolder; 2288 } 2289 2290 /** 2291 * Sets the upload variant.<p> 2292 * 2293 * @param uploadVariant the upload variant as String 2294 */ 2295 public void setUploadVariant(String uploadVariant) { 2296 2297 UploadVariant upload = null; 2298 try { 2299 upload = UploadVariant.valueOf(uploadVariant); 2300 } catch (Exception e) { 2301 // may happen, set default 2302 if (upload == null) { 2303 upload = OpenCms.getWorkplaceManager().getDefaultUserSettings().getUploadVariant(); 2304 } 2305 if (upload == null) { 2306 upload = UploadVariant.gwt; 2307 } 2308 } 2309 setUploadVariant(upload); 2310 } 2311 2312 /** 2313 * Sets the upload variant.<p> 2314 * 2315 * @param uploadVariant the upload variant 2316 */ 2317 public void setUploadVariant(UploadVariant uploadVariant) { 2318 2319 m_uploadVariant = uploadVariant; 2320 } 2321 2322 /** 2323 * Sets the current user for the settings.<p> 2324 * 2325 * @param user the CmsUser 2326 */ 2327 public void setUser(CmsUser user) { 2328 2329 m_user = user; 2330 } 2331 2332 /** 2333 * Sets the style of the workplace buttons of the user.<p> 2334 * 2335 * @param style the style of the workplace buttons of the user 2336 */ 2337 public void setWorkplaceButtonStyle(int style) { 2338 2339 m_workplaceButtonStyle = style; 2340 } 2341 2342 /** 2343 * Sets the type of the report (simple or extended) of the user.<p> 2344 * 2345 * @param type the type of the report (simple or extended) of the user 2346 */ 2347 public void setWorkplaceReportType(String type) { 2348 2349 m_workplaceReportType = type; 2350 } 2351 2352 /** 2353 * Sets the name of the search index to use in the workplace.<p> 2354 * 2355 * @param workplaceSearchIndexName the name of the search index to use in the workplace to set 2356 */ 2357 public void setWorkplaceSearchIndexName(String workplaceSearchIndexName) { 2358 2359 m_workplaceSearchIndexName = workplaceSearchIndexName; 2360 } 2361 2362 /** 2363 * Sets the workplace search result list view style.<p> 2364 * 2365 * @param workplaceSearchViewStyle the workplace search result list view style to set 2366 */ 2367 public void setWorkplaceSearchViewStyle(CmsSearchResultStyle workplaceSearchViewStyle) { 2368 2369 m_workplaceSearchViewStyle = workplaceSearchViewStyle; 2370 } 2371 2372 /** 2373 * Determines if the file creation date should be shown in explorer view.<p> 2374 * 2375 * @return true if the file creation date should be shown, otherwise false 2376 */ 2377 public boolean showExplorerFileDateCreated() { 2378 2379 return ((m_explorerSettings & CmsUserSettings.FILELIST_DATE_CREATED) > 0); 2380 } 2381 2382 /** 2383 * Determines if the file date expired should be shown in explorer view.<p> 2384 * 2385 * @return true if the file date expired should be shown, otherwise false 2386 */ 2387 public boolean showExplorerFileDateExpired() { 2388 2389 return ((m_explorerSettings & CmsUserSettings.FILELIST_DATE_EXPIRED) > 0); 2390 } 2391 2392 /** 2393 * Determines if the file last modified date should be shown in explorer view.<p> 2394 * 2395 * @return true if the file last modified date should be shown, otherwise false 2396 */ 2397 public boolean showExplorerFileDateLastModified() { 2398 2399 return ((m_explorerSettings & CmsUserSettings.FILELIST_DATE_LASTMODIFIED) > 0); 2400 } 2401 2402 /** 2403 * Determines if the file date released should be shown in explorer view.<p> 2404 * 2405 * @return true if the file date released should be shown, otherwise false 2406 */ 2407 public boolean showExplorerFileDateReleased() { 2408 2409 return ((m_explorerSettings & CmsUserSettings.FILELIST_DATE_RELEASED) > 0); 2410 } 2411 2412 /** 2413 * Determines if the file locked by should be shown in explorer view.<p> 2414 * 2415 * @return true if the file locked by should be shown, otherwise false 2416 */ 2417 public boolean showExplorerFileLockedBy() { 2418 2419 return ((m_explorerSettings & CmsUserSettings.FILELIST_LOCKEDBY) > 0); 2420 } 2421 2422 /** 2423 * Determines if the file navigation text should be shown in explorer view.<p> 2424 * 2425 * @return true if the file navigation text should be shown, otherwise false 2426 */ 2427 public boolean showExplorerFileNavText() { 2428 2429 return ((m_explorerSettings & CmsUserSettings.FILELIST_NAVTEXT) > 0); 2430 } 2431 2432 /** 2433 * Determines if the file permissions should be shown in explorer view.<p> 2434 * 2435 * @return true if the file permissions should be shown, otherwise false 2436 */ 2437 public boolean showExplorerFilePermissions() { 2438 2439 return ((m_explorerSettings & CmsUserSettings.FILELIST_PERMISSIONS) > 0); 2440 } 2441 2442 /** 2443 * Determines if the file size should be shown in explorer view.<p> 2444 * 2445 * @return true if the file size should be shown, otherwise false 2446 */ 2447 public boolean showExplorerFileSize() { 2448 2449 return ((m_explorerSettings & CmsUserSettings.FILELIST_SIZE) > 0); 2450 } 2451 2452 /** 2453 * Determines if the file state should be shown in explorer view.<p> 2454 * 2455 * @return true if the file state should be shown, otherwise false 2456 */ 2457 public boolean showExplorerFileState() { 2458 2459 return ((m_explorerSettings & CmsUserSettings.FILELIST_STATE) > 0); 2460 } 2461 2462 /** 2463 * Determines if the file title should be shown in explorer view.<p> 2464 * 2465 * @return true if the file title should be shown, otherwise false 2466 */ 2467 public boolean showExplorerFileTitle() { 2468 2469 return ((m_explorerSettings & CmsUserSettings.FILELIST_TITLE) > 0); 2470 } 2471 2472 /** 2473 * Determines if the file type should be shown in explorer view.<p> 2474 * 2475 * @return true if the file type should be shown, otherwise false 2476 */ 2477 public boolean showExplorerFileType() { 2478 2479 return ((m_explorerSettings & CmsUserSettings.FILELIST_TYPE) > 0); 2480 } 2481 2482 /** 2483 * Determines if the file creator should be shown in explorer view.<p> 2484 * 2485 * @return true if the file creator should be shown, otherwise false 2486 */ 2487 public boolean showExplorerFileUserCreated() { 2488 2489 return ((m_explorerSettings & CmsUserSettings.FILELIST_USER_CREATED) > 0); 2490 } 2491 2492 /** 2493 * Determines if the file last modified by should be shown in explorer view.<p> 2494 * 2495 * @return true if the file last modified by should be shown, otherwise false 2496 */ 2497 public boolean showExplorerFileUserLastModified() { 2498 2499 return ((m_explorerSettings & CmsUserSettings.FILELIST_USER_LASTMODIFIED) > 0); 2500 } 2501 2502 /** 2503 * Sets a specific explorer setting depending on the set parameter.<p> 2504 * 2505 * @param set true if the setting should be set, otherwise false 2506 * @param setting the settings constant value for the explorer settings 2507 */ 2508 private void setExplorerSetting(boolean set, int setting) { 2509 2510 if (set) { 2511 m_explorerSettings |= setting; 2512 } else { 2513 m_explorerSettings &= ~setting; 2514 } 2515 } 2516 2517}