/
CmsUserSettings.java
2511 lines (2149 loc) · 91 KB
/
CmsUserSettings.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/*
* This library is part of OpenCms -
* the Open Source Content Management System
*
* Copyright (c) Alkacon Software GmbH & Co. KG (http://www.alkacon.com)
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* For further information about Alkacon Software GmbH & Co. KG, please see the
* company website: http://www.alkacon.com
*
* For further information about OpenCms, please see the
* project website: http://www.opencms.org
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
package org.opencms.db;
import org.opencms.configuration.CmsDefaultUserSettings;
import org.opencms.configuration.CmsWorkplaceConfiguration;
import org.opencms.configuration.I_CmsXmlConfiguration;
import org.opencms.configuration.preferences.I_CmsPreference;
import org.opencms.file.CmsObject;
import org.opencms.file.CmsResource.CmsResourceCopyMode;
import org.opencms.file.CmsResource.CmsResourceDeleteMode;
import org.opencms.file.CmsUser;
import org.opencms.i18n.CmsLocaleManager;
import org.opencms.main.CmsContextInfo;
import org.opencms.main.CmsException;
import org.opencms.main.CmsLog;
import org.opencms.main.OpenCms;
import org.opencms.report.I_CmsReport;
import org.opencms.synchronize.CmsSynchronizeSettings;
import org.opencms.util.A_CmsModeStringEnumeration;
import org.opencms.util.CmsStringUtil;
import org.opencms.workplace.CmsWorkplace;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.Set;
import java.util.SortedMap;
import java.util.TreeMap;
import org.apache.commons.logging.Log;
import com.google.common.collect.Maps;
/**
* Object to conveniently access and modify the users workplace settings.<p>
*
* @since 6.0.0
*/
public class CmsUserSettings {
/**
* Enumeration class for workplace search result styles.<p>
*/
public static final class CmsSearchResultStyle extends A_CmsModeStringEnumeration {
/** Workplace search result style explorer view. */
public static final CmsSearchResultStyle STYLE_EXPLORER = new CmsSearchResultStyle(
"explorer",
Messages.GUI_WORKPLACE_SEARCH_STYLE_EXPLORER_0);
/** Workplace search result style list view with excerpts. */
public static final CmsSearchResultStyle STYLE_LIST_WITH_EXCERPTS = new CmsSearchResultStyle(
"list-with-excerpts",
Messages.GUI_WORKPLACE_SEARCH_STYLE_LIST_WITH_EXCERPTS_0);
/** Workplace search result style list view without excerpts. */
public static final CmsSearchResultStyle STYLE_LIST_WITHOUT_EXCERPTS = new CmsSearchResultStyle(
"list-without-excerpts",
Messages.GUI_WORKPLACE_SEARCH_STYLE_LIST_WITHOUT_EXCERPTS_0);
/** Serializable version id. */
private static final long serialVersionUID = 6611568161885127011L;
/** The localization key for this style. */
private final String m_key;
/**
* Private constructor.<p>
*
* @param style the workplace search result style string representation
* @param key the localization key for this style
*/
private CmsSearchResultStyle(String style, String key) {
super(style);
m_key = key;
}
/**
* Returns the copy mode object from the old copy mode integer.<p>
*
* @param mode the old copy mode integer
*
* @return the copy mode object
*/
public static CmsSearchResultStyle valueOf(String mode) {
if (STYLE_LIST_WITHOUT_EXCERPTS.getMode().equals(mode)) {
return STYLE_LIST_WITHOUT_EXCERPTS;
} else if (STYLE_LIST_WITH_EXCERPTS.getMode().equals(mode)) {
return STYLE_LIST_WITH_EXCERPTS;
} else {
return STYLE_EXPLORER;
}
}
/**
* Returns the localization key for this style.<p>
*
* @return the localization key for this style
*/
public String getKey() {
return m_key;
}
}
/** A enum for the different upload variants. */
public enum UploadVariant {
/** The default html upload. */
basic,
/** The gwt upload. */
gwt
}
/** Key for additional info address. */
public static final String ADDITIONAL_INFO_ADDRESS = "USER_ADDRESS";
/** Key for additional info city. */
public static final String ADDITIONAL_INFO_CITY = "USER_TOWN"; // Value must unfortunately still be "USER_TOWN" or existing serialized user information will be lost
/** Key for additional info of resources that were confirmed by the user. */
public static final String ADDITIONAL_INFO_CONFIRMED_RESOURCES = "ADDITIONAL_INFO_CONFIRMED_RESOURCES";
/** Key for additional info address. */
public static final String ADDITIONAL_INFO_COUNTRY = "USER_COUNTRY";
/** Key for additional info default group. */
public static final String ADDITIONAL_INFO_DEFAULTGROUP = "USER_DEFAULTGROUP";
/** Key for additional info address. */
public static final String ADDITIONAL_INFO_DESCRIPTION = "USER_DESCRIPTION";
/** Key for additional info explorer settings. */
public static final String ADDITIONAL_INFO_EXPLORERSETTINGS = "USER_EXPLORERSETTINGS";
/** Key for additional info institution. */
public static final String ADDITIONAL_INFO_INSTITUTION = "USER_INSTITUTION";
/** Key for last password change additional info. */
public static final String ADDITIONAL_INFO_LAST_PASSWORD_CHANGE = "LAST_PASSWORD_CHANGE";
/** Key for last user data check additional info. */
public static final String ADDITIONAL_INFO_LAST_USER_DATA_CHECK = "ADDITIONAL_INFO_LAST_USER_DATA_CHECK";
/**Additional info which indicates, that a password was reset by an admin. */
public static final String ADDITIONAL_INFO_PASSWORD_RESET = "RESET_PASSWORD";
/** Key for additional info flags. */
public static final String ADDITIONAL_INFO_PREFERENCES = "USER_PREFERENCES";
/** Key for additional info start settings. */
public static final String ADDITIONAL_INFO_STARTSETTINGS = "USER_STARTSETTINGS";
/** Key for additional info time warp. */
public static final String ADDITIONAL_INFO_TIMEWARP = "USER_TIMEWARP";
/** Key for additional info upload applet client folder path. */
public static final String ADDITIONAL_INFO_UPLOADAPPLET_CLIENTFOLDER = "USER_UPLOADAPPLET_CLIENTFOLDER";
/** Key for additional info address. */
public static final String ADDITIONAL_INFO_ZIPCODE = "USER_ZIPCODE";
/** Flag for displaying the date created column. */
public static final int FILELIST_DATE_CREATED = 1024;
/** Flag for displaying the date expired column. */
public static final int FILELIST_DATE_EXPIRED = 8192;
/** Flag for displaying the changed column. */
public static final int FILELIST_DATE_LASTMODIFIED = 4;
/** Flag for displaying the date released column. */
public static final int FILELIST_DATE_RELEASED = 4096;
/** Flag for displaying the locked column. */
public static final int FILELIST_LOCKEDBY = 256;
/** Flag for displaying the name column. */
public static final int FILELIST_NAME = 512;
/** Flag for displaying the navigation text column. */
public static final int FILELIST_NAVTEXT = 64;
/** Flag for displaying the access column. */
public static final int FILELIST_PERMISSIONS = 128;
/** Flag for displaying the size column. */
public static final int FILELIST_SIZE = 8;
/** Flag for displaying the state column. */
public static final int FILELIST_STATE = 16;
/** Flag for displaying the title column. */
public static final int FILELIST_TITLE = 1;
/** Flag for displaying the file type column. */
public static final int FILELIST_TYPE = 2;
/** Flag for displaying the owner column. */
public static final int FILELIST_USER_CREATED = 32;
/** Flag for displaying the user who last modified column. */
public static final int FILELIST_USER_LASTMODIFIED = 2048;
/** Identifier for the login user agreement accepted information. */
public static final String LOGIN_USERAGREEMENT_ACCEPTED = "LOGIN_UA_ACCEPTED";
/** Preference for setting which workplace to open on startup. */
public static final String PREF_WORKPLACE_MODE = "workplaceMode";
/** Identifier prefix for all keys in the user additional info table. */
public static final String PREFERENCES = "USERPREFERENCES_";
/** Prefix for additional info key for user defined preferences. */
public static final String PREFERENCES_ADDITIONAL_PREFIX = PREFERENCES + "additional_";
/** Identifier for the synchronize setting key. */
public static final String SYNC_DESTINATION = "DESTINATION";
/** Identifier for the synchronize setting key. */
public static final String SYNC_ENABLED = "ENABLED";
/** Identifier for the synchronize setting key. */
public static final String SYNC_SETTINGS = "SYNC_SETTINGS_";
/** Identifier for the synchronize setting key. */
public static final String SYNC_VFS_LIST = "VFS_LIST";
/** Preference value for new workplace. */
public static final String WORKPLACE_MODE_NEW = "new";
/** Preference value for new workplace. */
public static final String WORKPLACE_MODE_OLD = "old";
/** The default button style. */
private static final int BUTTONSTYLE_DEFAULT = 1;
/** The default number of entries per page. */
private static final int ENTRYS_PER_PAGE_DEFAULT = 50;
/** The log object for this class. */
private static final Log LOG = CmsLog.getLog(CmsUserSettings.class);
/** Default workplace search index name. */
private static final String SEARCH_INDEX_DEFAULT = "Offline project (VFS)";
/** Map used to store user-defined preferences. */
private Map<String, String> m_additionalPreferences = new LinkedHashMap<String, String>();
/** The direct publish setting. */
private boolean m_dialogDirectpublish;
/** The expand inherited permissions setting. */
private boolean m_dialogExpandInheritedPermissions;
/** The expand user permissions setting. */
private boolean m_dialogExpandUserPermissions;
/** The resource copy mode setting. */
private CmsResourceCopyMode m_dialogFileCopy;
/** The resource delete mode setting. */
private CmsResourceDeleteMode m_dialogFileDelete;
/** The folder copy mode setting. */
private CmsResourceCopyMode m_dialogFolderCopy;
/** The inherit permission on folder setting. */
private boolean m_dialogPermissionsInheritOnFolder;
/** The direct edit button setting. */
private int m_directeditButtonStyle;
/** The editor button style setting. */
private int m_editorButtonStyle;
/** The editor settings. */
private SortedMap<String, String> m_editorSettings;
/** The explorer button style. */
private int m_explorerButtonStyle;
/** The explorer file entries setting. */
private int m_explorerFileEntries;
/** The list of numbers in the preferences dialog, how much entries shown on a page. */
private String m_explorerFileEntryOptions;
/** The explorer setting. */
private int m_explorerSettings;
/** Flag to determine if all projects should be list. */
private boolean m_listAllProjects;
/** The locale.*/
private Locale m_locale;
/** Controls if the "create index page" check box in the new folder dialog should be initially be checked or not. */
private Boolean m_newFolderCreateIndexPage;
/** Controls if the "edit properties" check box in the new folder dialog should be initially be checked or not. */
private Boolean m_newFolderEditProperties;
/** The project. */
private String m_project;
/** Controls appearance of the publish button. */
private String m_publishButtonAppearance;
/** The restricted explorer view setting. */
private boolean m_restrictExplorerView;
/** The show export setting. */
private boolean m_showExportSettings;
/** Flag that controls display of the file upload button. */
private boolean m_showFileUploadButton;
/** The show lock setting. */
private boolean m_showLock;
/** Flag to determine if the publish notifications should be shown. */
private boolean m_showPublishNotification;
/** Controls if the resource type dialog for uploaded resources (not the applet) is shown or not. */
private Boolean m_showUploadTypeDialog;
/** The start folder. */
private String m_startFolder;
/** Contains the key value entries with start setting for different gallery types. */
private SortedMap<String, String> m_startGalleriesSettings;
/** The start site. */
private String m_startSite;
/** The synchronize settings. */
private CmsSynchronizeSettings m_synchronizeSettings;
/** The custom user surf time. */
private long m_timeWarp;
/** The path of the preselected folder for the upload applet on the client machine. */
private String m_uploadAppletClientFolder;
/** Stores the upload variant enum. */
private UploadVariant m_uploadVariant;
/** The user. */
private CmsUser m_user;
/** The view. */
private String m_view;
/** The workplace button style. */
private int m_workplaceButtonStyle;
/** The workplace report type. */
private String m_workplaceReportType;
/** The name of the search index to use in the workplace. */
private String m_workplaceSearchIndexName;
/** Workplace search result list view style. */
private CmsSearchResultStyle m_workplaceSearchViewStyle;
/**
* Creates an empty new user settings object.<p>
*/
public CmsUserSettings() {
m_workplaceButtonStyle = CmsUserSettings.BUTTONSTYLE_DEFAULT;
m_workplaceReportType = I_CmsReport.REPORT_TYPE_SIMPLE;
m_explorerButtonStyle = CmsUserSettings.BUTTONSTYLE_DEFAULT;
m_explorerFileEntries = CmsUserSettings.ENTRYS_PER_PAGE_DEFAULT;
m_explorerSettings = CmsUserSettings.FILELIST_NAME;
m_editorSettings = new TreeMap<String, String>();
m_startGalleriesSettings = new TreeMap<String, String>();
m_showFileUploadButton = true;
m_showPublishNotification = false;
m_listAllProjects = false;
m_uploadVariant = UploadVariant.gwt;
m_publishButtonAppearance = CmsDefaultUserSettings.PUBLISHBUTTON_SHOW_ALWAYS;
m_newFolderCreateIndexPage = Boolean.TRUE;
m_newFolderEditProperties = Boolean.TRUE;
m_showUploadTypeDialog = Boolean.TRUE;
m_workplaceSearchIndexName = SEARCH_INDEX_DEFAULT;
m_workplaceSearchViewStyle = CmsSearchResultStyle.STYLE_EXPLORER;
}
/**
* Creates a user settings object with initialized settings of the current user.<p>
*
* @param cms the OpenCms context
*/
public CmsUserSettings(CmsObject cms) {
this(cms.getRequestContext().getCurrentUser());
}
/**
* Creates a user settings object with initialized settings of the user.<p>
*
* Some default settings will not be set, if no cms object is given.<p>
*
* @param user the current CmsUser
*
* @see #CmsUserSettings(CmsObject)
*/
public CmsUserSettings(CmsUser user) {
init(user);
}
/**
* Gets a configured preference.<p>
*
* @param cms the cms context
* @param key the settings key
* @param useDefault true if we want the default value if no value is configured
*
* @return the preference value
*/
public static String getAdditionalPreference(CmsObject cms, String key, boolean useDefault) {
CmsUser user = cms.getRequestContext().getCurrentUser();
CmsUserSettings settings = new CmsUserSettings(user);
return settings.getAdditionalPreference(key, useDefault);
}
/**
* Sets a configured preference.<p>
*
* @param cms the Cms context
* @param key the setting name
* @param value the value
*/
public static void setAdditionalPreference(CmsObject cms, String key, String value) {
CmsUser user = cms.getRequestContext().getCurrentUser();
CmsUserSettings settings = new CmsUserSettings(user);
settings.setAdditionalPreference(key, value);
try {
settings.save(cms);
} catch (CmsException e) {
LOG.error("Could not store preference " + key + ": " + e.getLocalizedMessage(), e);
}
}
/**
* Gets the value for a user defined preference.<p>
*
* @param name the name of the preference
* @param useDefault true if the default value should be returned in case the preference is not set
*
* @return the preference value
*/
public String getAdditionalPreference(String name, boolean useDefault) {
String value = m_additionalPreferences.get(name);
if ((value == null) && useDefault) {
I_CmsPreference pref = OpenCms.getWorkplaceManager().getDefaultUserSettings().getPreferences().get(name);
if (pref != null) {
value = pref.getDefaultValue();
}
}
return value;
}
/**
* Gets the default copy mode when copying a file of the user.<p>
*
* @return the default copy mode when copying a file of the user
*/
public CmsResourceCopyMode getDialogCopyFileMode() {
return m_dialogFileCopy;
}
/**
* Gets the default copy mode when copying a folder of the user.<p>
*
* @return the default copy mode when copying a folder of the user
*/
public CmsResourceCopyMode getDialogCopyFolderMode() {
return m_dialogFolderCopy;
}
/**
* Returns the default setting for file deletion.<p>
*
* @return the default setting for file deletion
*/
public CmsResourceDeleteMode getDialogDeleteFileMode() {
return m_dialogFileDelete;
}
/**
* Returns the default setting for expanding inherited permissions in the dialog.<p>
*
* @return true if inherited permissions should be expanded, otherwise false
*/
public boolean getDialogExpandInheritedPermissions() {
return m_dialogExpandInheritedPermissions;
}
/**
* Returns the default setting for expanding the users permissions in the dialog.<p>
*
* @return true if the users permissions should be expanded, otherwise false
*/
public boolean getDialogExpandUserPermissions() {
return m_dialogExpandUserPermissions;
}
/**
* Returns the default setting for inheriting permissions on folders.<p>
*
* @return true if permissions should be inherited on folders, otherwise false
*/
public boolean getDialogPermissionsInheritOnFolder() {
return m_dialogPermissionsInheritOnFolder;
}
/**
* Returns the default setting for direct publishing.<p>
*
* @return the default setting for direct publishing: true if siblings should be published, otherwise false
*/
public boolean getDialogPublishSiblings() {
return m_dialogDirectpublish;
}
/**
* Determines if the export part of the secure/export dialog should be shown.<p>
*
* @return true if the export dialog is shown, otherwise false
*/
public boolean getDialogShowExportSettings() {
return m_showExportSettings;
}
/**
* Determines if the lock dialog should be shown.<p>
*
* @return true if the lock dialog is shown, otherwise false
*/
public boolean getDialogShowLock() {
return m_showLock;
}
/**
* Returns the style of the direct edit buttons of the user.<p>
*
* @return the style of the direct edit buttons of the user
*/
public int getDirectEditButtonStyle() {
return m_directeditButtonStyle;
}
/**
* Returns the style of the editor buttons of the user.<p>
*
* @return the style of the editor buttons of the user
*/
public int getEditorButtonStyle() {
return m_editorButtonStyle;
}
/**
* Returns the editor settings of the user.<p>
*
* @return the editor settings of the user
*/
public Map<String, String> getEditorSettings() {
return m_editorSettings;
}
/**
* Returns the style of the explorer buttons of the user.<p>
*
* @return the style of the explorer buttons of the user
*/
public int getExplorerButtonStyle() {
return m_explorerButtonStyle;
}
/**
* Returns the number of displayed files per page of the user.<p>
*
* @return the number of displayed files per page of the user
*/
public int getExplorerFileEntries() {
return m_explorerFileEntries;
}
/**
* Returns the explorerFileEntryOptions.<p>
*
* @return the explorerFileEntryOptions
*/
public String getExplorerFileEntryOptions() {
return m_explorerFileEntryOptions;
}
/**
* Returns the explorer start settings.<p>
*
* @return the explorer start settings
*/
public int getExplorerSettings() {
return m_explorerSettings;
}
/**
* Returns if all projects should be listed or only the ones in the current ou.<p>
*
* @return true if all projects should be listed, otherwise false
*/
public boolean getListAllProjects() {
return m_listAllProjects;
}
/**
* Returns the locale of the user.<p>
*
* @return the locale of the user
*/
public Locale getLocale() {
return m_locale;
}
/**
* Returns <code>{@link Boolean#TRUE}</code> if the "create index page" check box in the new folder
* dialog should be initially be checked. <p>
*
* @return <code>{@link Boolean#TRUE}</code> if the "create index page" check box in the new folder
* dialog should be initially be checked.
*/
public Boolean getNewFolderCreateIndexPage() {
return m_newFolderCreateIndexPage;
}
/**
* Returns <code>{@link Boolean#TRUE}</code> if the "edit properties" check box in the new folder
* dialog should be initially be checked. <p>
*
* @return <code>{@link Boolean#TRUE}</code> if the "edit properties" check box in the new folder
* dialog should be initially be checked.
*/
public Boolean getNewFolderEditProperties() {
return m_newFolderEditProperties;
}
/**
* Returns the preferred editor for the given resource type of the user.<p>
*
* @param resourceType the resource type
* @return the preferred editor for the resource type or null, if not specified
*/
public String getPreferredEditor(String resourceType) {
return m_editorSettings.get(resourceType);
}
/**
* Returns the appearance of the "publish project" button.<p>
*
* This can be either {@link CmsDefaultUserSettings#PUBLISHBUTTON_SHOW_ALWAYS},
* {@link CmsDefaultUserSettings#PUBLISHBUTTON_SHOW_AUTO} or
* {@link CmsDefaultUserSettings#PUBLISHBUTTON_SHOW_NEVER}.<p>
*
* @return the appearance of the "publish project" button
*/
public String getPublishButtonAppearance() {
return m_publishButtonAppearance;
}
/**
* Sets if the explorer view is restricted to the defined site and folder.<p>
*
* @return true if the explorer view is restricted, otherwise false
*/
public boolean getRestrictExplorerView() {
return m_restrictExplorerView;
}
/**
* Returns <code>true</code> if the file upload button should be shown or <code>false</code> otherwise.<p>
*
* @return the showFileUpload
*/
public boolean getShowFileUploadButton() {
return m_showFileUploadButton;
}
/**
* Returns if the publish notifications should be shown or not.<p>
*
* @return true if the publish notifications should be shown, otherwise false
*/
public boolean getShowPublishNotification() {
return m_showPublishNotification;
}
/**
* Returns <code>{@link Boolean#TRUE}</code> if the resource type selection dialog should
* be shown in the file upload process (non - applet version). <p>
*
* @return <code>{@link Boolean#TRUE}</code> if the resource type selection dialog should
* be shown in the file upload process (non - applet version).
*/
public Boolean getShowUploadTypeDialog() {
return m_showUploadTypeDialog;
}
/**
* Returns the start folder of the user.<p>
*
* @return the start folder of the user
*/
public String getStartFolder() {
return m_startFolder;
}
/**
* The start galleries settings of the user.<p>
*
* @return the start galleries settings of the user
*/
public Map<String, String> getStartGalleriesSettings() {
return m_startGalleriesSettings;
}
/**
* Returns the path to the start gallery of the user.<p>
*
* @param galleryType the type of the gallery
* @return the path to the start gallery or null, if no key
*/
public String getStartGallery(String galleryType) {
return m_startGalleriesSettings.get(galleryType);
}
/**
* Returns the root site path to the start gallery of the user or the constant CmsPreferences.INPUT_DEFAULT.<p>
*
* @param galleryType the type of the gallery
* @param cms Cms object
* @return the root site path to the start gallery or the default key, null if "not set"
*/
public String getStartGallery(String galleryType, CmsObject cms) {
String startGallerySetting = getStartGallery(galleryType);
String pathSetting = null;
// if a custom path to the gallery is selected
if ((startGallerySetting != null) && !startGallerySetting.equals(CmsWorkplace.INPUT_NONE)) {
String sitePath = cms.getRequestContext().removeSiteRoot(startGallerySetting);
if (cms.existsResource(sitePath)) {
pathSetting = startGallerySetting;
} else {
pathSetting = CmsWorkplace.INPUT_DEFAULT;
}
// global default settings
} else if (startGallerySetting == null) {
pathSetting = CmsWorkplace.INPUT_DEFAULT;
}
return pathSetting;
}
/**
* Returns the start project of the user.<p>
*
* @return the start project of the user
*/
public String getStartProject() {
return m_project;
}
/**
* Returns the start site of the user.<p>
*
* @return the start site of the user
*/
public String getStartSite() {
return m_startSite;
}
/**
* Returns the current start view of the user.<p>
*
* @return the current start view of the user
*/
public String getStartView() {
return m_view;
}
/**
* Returns the (optional) workplace synchronize settings.<p>
*
* @return the (optional) workplace synchronize settings
*/
public CmsSynchronizeSettings getSynchronizeSettings() {
return m_synchronizeSettings;
}
/**
* Returns the current users time warp time, or
* {@link org.opencms.main.CmsContextInfo#CURRENT_TIME} if this feature is disabled and the current time
* is used for each user request.<p>
*
* @return the current users time warp time, or
* {@link org.opencms.main.CmsContextInfo#CURRENT_TIME} if this feature is disabled
*/
public long getTimeWarp() {
return m_timeWarp;
}
/**
* Returns the folder path of the upload applet on the client machine.<p>
*
* @return the folder path of the upload applet on the client machine
*/
public String getUploadAppletClientFolder() {
return m_uploadAppletClientFolder;
}
/**
* Returns the uploadVariant.<p>
*
* @return the uploadVariant
*/
public UploadVariant getUploadVariant() {
return m_uploadVariant;
}
/**
* Returns the current user for the settings.<p>
*
* @return the CmsUser
*/
public CmsUser getUser() {
return m_user;
}
/**
* Returns the style of the workplace buttons of the user.<p>
*
* @return the style of the workplace buttons of the user
*/
public int getWorkplaceButtonStyle() {
return m_workplaceButtonStyle;
}
/**
* Returns the type of the report (simple or extended) of the user.<p>
*
* @return the type of the report (simple or extended) of the user
*/
public String getWorkplaceReportType() {
return m_workplaceReportType;
}
/**
* Returns the name of the search index to use in the workplace.<p>
*
* @return the name of the search index to use in the workplace
*/
public String getWorkplaceSearchIndexName() {
return m_workplaceSearchIndexName;
}
/**
* Returns the workplace search result list view style.<p>
*
* @return the workplace search result list view style
*/
public CmsSearchResultStyle getWorkplaceSearchViewStyle() {
return m_workplaceSearchViewStyle;
}
/**
* Initializes the user settings with the given users setting parameters.<p>
*
* @param user the current CmsUser
*/
public void init(CmsUser user) {
m_user = user;
// try to initialize the User Settings with the values stored in the user object.
// if no values are found, the default user settings will be used.
// workplace button style
try {
m_workplaceButtonStyle = ((Integer)m_user.getAdditionalInfo(
PREFERENCES
+ CmsWorkplaceConfiguration.N_WORKPLACEGENERALOPTIONS
+ CmsWorkplaceConfiguration.N_BUTTONSTYLE)).intValue();
} catch (Throwable t) {
m_workplaceButtonStyle = OpenCms.getWorkplaceManager().getDefaultUserSettings().getWorkplaceButtonStyle();
}
// workplace time warp setting
Object timeWarpObj = m_user.getAdditionalInfo(ADDITIONAL_INFO_TIMEWARP);
try {
m_timeWarp = ((Long)timeWarpObj).longValue();
} catch (ClassCastException e) {
try {
m_timeWarp = Long.parseLong((String)timeWarpObj);
if (m_timeWarp < 0) {
m_timeWarp = CmsContextInfo.CURRENT_TIME;
}
} catch (Throwable t) {
m_timeWarp = CmsContextInfo.CURRENT_TIME;
}
} catch (Throwable t) {
m_timeWarp = CmsContextInfo.CURRENT_TIME;
}
// workplace report type
m_workplaceReportType = (String)m_user.getAdditionalInfo(
PREFERENCES + CmsWorkplaceConfiguration.N_WORKPLACEGENERALOPTIONS + CmsWorkplaceConfiguration.N_REPORTTYPE);
if (m_workplaceReportType == null) {
m_workplaceReportType = OpenCms.getWorkplaceManager().getDefaultUserSettings().getWorkplaceReportType();
}
// workplace list all projects
try {
m_listAllProjects = ((Boolean)m_user.getAdditionalInfo(
PREFERENCES