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.configuration;
029
030import org.opencms.ade.containerpage.shared.CmsCntPageData.ElementDeleteMode;
031import org.opencms.configuration.preferences.I_CmsPreference;
032import org.opencms.db.CmsExportPoint;
033import org.opencms.file.types.CmsResourceTypeSubsitemapContentFolder;
034import org.opencms.gwt.shared.CmsGwtConstants;
035import org.opencms.main.CmsLog;
036import org.opencms.main.OpenCms;
037import org.opencms.relations.CmsCategoryService;
038import org.opencms.util.CmsRfsFileViewer;
039import org.opencms.util.CmsStringUtil;
040import org.opencms.workplace.CmsAccountInfo;
041import org.opencms.workplace.CmsWorkplaceManager;
042import org.opencms.workplace.CmsWorkplaceUserInfoBlock;
043import org.opencms.workplace.CmsWorkplaceUserInfoEntry;
044import org.opencms.workplace.CmsWorkplaceUserInfoManager;
045import org.opencms.workplace.I_CmsDialogHandler;
046import org.opencms.workplace.editors.I_CmsEditorCssHandler;
047import org.opencms.workplace.editors.I_CmsPreEditorActionDefinition;
048import org.opencms.workplace.explorer.CmsExplorerTypeAccess;
049import org.opencms.workplace.explorer.CmsExplorerTypeSettings;
050import org.opencms.workplace.explorer.CmsIconRule;
051import org.opencms.workplace.tools.CmsToolManager;
052import org.opencms.workplace.tools.CmsToolRootHandler;
053
054import java.util.ArrayList;
055import java.util.Arrays;
056import java.util.Collections;
057import java.util.Iterator;
058import java.util.List;
059import java.util.Map;
060import java.util.Set;
061
062import org.apache.commons.digester3.CallMethodRule;
063import org.apache.commons.digester3.Digester;
064import org.apache.commons.digester3.Rule;
065
066import org.dom4j.Element;
067import org.xml.sax.Attributes;
068
069import com.google.common.base.Function;
070import com.google.common.collect.Multimap;
071import com.google.common.collect.Multimaps;
072
073/**
074 * Import/Export master configuration class.<p>
075 *
076 * @since 6.0.0
077 */
078public class CmsWorkplaceConfiguration extends A_CmsXmlConfiguration {
079
080    /** The name of the attribute addinfo-key for account infos. */
081    public static final String A_ADD_INFO_KEY = "addinfo-key";
082
083    /** The "autosetnavigation" attribute. */
084    public static final String A_AUTOSETNAVIGATION = "autosetnavigation";
085
086    /** The "autosettitle" attribute. */
087    public static final String A_AUTOSETTITLE = "autosettitle";
088
089    /** The name of the attribute containing the name of the big icon. */
090    public static final String A_BIGICON = "bigicon";
091
092    /** The name of the attribute containing the name of the big icon style class. */
093    public static final String A_BIGICONSTYLE = "bigiconstyle";
094
095    /** The 'creatable' attribute. */
096    public static final String A_CREATABLE = "creatable";
097
098    /** The 'description' attribute. */
099    public static final String A_DESCRIPTION = "description";
100
101    /** The "displayByRepository" attribute. */
102    public static final String A_DISPLAY_BY_REPOSITORY = "displayByRepository";
103
104    /** The "displayCollapsed" attribute. */
105    public static final String A_DISPLAY_COLLAPSED = "displayCollapsed";
106
107    /** The name of the attribute editable for account infos. */
108    public static final String A_EDITABLE = "editable";
109
110    /** The 'error' attribute. */
111    public static final String A_ERROR = "error";
112
113    /** The name of the attribute for file extensions in icon rules. */
114    public static final String A_EXTENSION = "extension";
115
116    /** The name of the attribute field for account infos. */
117    public static final String A_FIELD = "field";
118
119    /** The "info" attribute. */
120    public static final String A_INFO = "info";
121
122    /** The isview attribute. */
123    public static final String A_ISVIEW = "isview";
124
125    /** The name pattern attrribute. */
126    public static final String A_NAME_PATTERN = "name-pattern";
127
128    /** The 'widget-config' attribute. */
129    public static final String A_NICE_NAME = "nice-name";
130
131    /** The attribute name of the optional attribute for the user-info node. */
132    public static final String A_OPTIONAL = "optional";
133
134    /** The "page" attribute. */
135    public static final String A_PAGE = "page";
136
137    /** The "params" attribute. */
138    public static final String A_PARAMS = "params";
139
140    /** The "parent" attribute. */
141    public static final String A_PARENT = "parent";
142
143    /** The "path" attribute. */
144    public static final String A_PATH = "path";
145
146    /** The "permissions" attribute. */
147    public static final String A_PERMISSIONS = "permissions";
148
149    /** The "principal" attribute. */
150    public static final String A_PRINCIPAL = "principal";
151
152    /** The "reference" attribute. */
153    public static final String A_REFERENCE = "reference";
154
155    /** The "replace" attribute. */
156    public static final String A_REPLACE = "replace";
157
158    /** The "rule" attribute. */
159    public static final String A_RULE = "rule";
160
161    /** The 'rule-regex' attribute. */
162    public static final String A_RULE_REGEX = "rule-regex";
163
164    /** The "rules" attribute. */
165    public static final String A_RULES = "rules";
166
167    /** The "shownavigation" attribute. */
168    public static final String A_SHOWNAVIGATION = "shownavigation";
169
170    /** The name of the attribute containing the name of the small icon style class. */
171    public static final String A_SMALLICONSTYLE = "smalliconstyle";
172
173    /** The "tab" attribute. */
174    public static final String A_TAB = "tab";
175
176    /** The "target" attribute. */
177    public static final String A_TARGET = "target";
178
179    /** Name of the attribute used to determine order of types in element views. */
180    public static final String A_VIEW_ORDER = "view-order";
181
182    /** The attribute name of the widget attribute for the user-info node. */
183    public static final String A_WIDGET = "widget";
184
185    /** The 'widget-config' attribute. */
186    public static final String A_WIDGET_CONFIG = "widget-config";
187
188    /** The name of the DTD for this configuration. */
189    public static final String CONFIGURATION_DTD_NAME = "opencms-workplace.dtd";
190
191    /** The name of the default XML file for this configuration. */
192    public static final String DEFAULT_XML_FILE_NAME = "opencms-workplace.xml";
193
194    /** Name of the acacia-unlock node. */
195    public static final String N_ACACIA_UNLOCK = "acacia-unlock";
196
197    /** The name of the access control node. */
198    public static final String N_ACCESSCONTROL = "accesscontrol";
199
200    /** The name of the access entry node. */
201    public static final String N_ACCESSENTRY = "accessentry";
202
203    /** The name of the account info node. */
204    public static final String N_ACCOUNTINFO = "account-info";
205
206    /** The name of the account infos node. */
207    public static final String N_ACCOUNTINFOS = "account-infos";
208
209    /** The name of the "allow broken relations" node. */
210    public static final String N_ALLOWBROKENRELATIONS = "allowbrokenrelations";
211
212    /** The name of the autolock node. */
213    public static final String N_AUTOLOCK = "autolock";
214
215    /** The name of the background color node. */
216    public static final String N_BACKGROUNDCOLOR = "background-color";
217
218    /** The node name of the buttonstyle node. */
219    public static final String N_BUTTONSTYLE = "buttonstyle";
220
221    /** The name of the category display options node. */
222    public static final String N_CATEGORYDISPLAYOPTIONS = "categorydisplayoptions";
223
224    /** The name of the category folder node. */
225    public static final String N_CATEGORYFOLDER = "categoryfolder";
226
227    /** The name of the color node. */
228    public static final String N_COLOR = "color";
229
230    /** The node name of the datecreated column node. */
231    public static final String N_DATECREATED = "show-datecreated";
232
233    /** The node name of the date expired column node. */
234    public static final String N_DATEEXPIRED = "show-dateexpired";
235
236    /** The node name of the datelastmodified column node. */
237    public static final String N_DATELASTMODIFIED = "show-datelastmodified";
238
239    /** The node name of the date released  column node. */
240    public static final String N_DATERELEASED = "show-datereleased";
241
242    /** The name of the default access control node. */
243    public static final String N_DEFAULTACCESSCONTROL = "defaultaccesscontrol";
244
245    /** The name of the node for the default locale. */
246    public static final String N_DEFAULTLOCALE = "defaultlocale";
247
248    /** The node name of the default preferences node. */
249    public static final String N_DEFAULTPREFERENCES = "default-preferences";
250
251    /** The name of the default properties node. */
252    public static final String N_DEFAULTPROPERTIES = "defaultproperties";
253
254    /** The name of the default properties on structure node. */
255    public static final String N_DEFAULTPROPERTIESONSTRUCTURE = "defaultpropertiesonstructure";
256
257    /** The name of the default property node. */
258    public static final String N_DEFAULTPROPERTY = "defaultproperty";
259
260    /** Individual workplace handler node name. */
261    public static final String N_DIALOGHANDLER = "dialoghandler";
262
263    /** The main workplace handler node name. */
264    public static final String N_DIALOGHANDLERS = "dialoghandlers";
265
266    /** The node name of the dialogs defaultsettings node. */
267    public static final String N_DIALOGSDEFAULTSETTINGS = "dialogs-defaultsettings";
268
269    /** The node name of the dialogs preferences node. */
270    public static final String N_DIALOGSPREFERENCES = "dialogs-preferences";
271
272    /** The node name of the direct edit provider node. */
273    public static final String N_DIRECTEDITPROVIDER = "directeditprovider";
274
275    /** The node name of the directedit style node. */
276    public static final String N_DIRECTEDITSTYLE = "directeditstyle";
277
278    /** The node name of the directpublish node. */
279    public static final String N_DIRECTPUBLISH = "directpublish";
280
281    /** The name of the edit options node. */
282    public static final String N_EDITOPTIONS = "editoptions";
283
284    /** The node name of the editor node. */
285    public static final String N_EDITOR = "editor";
286
287    /** The name of the editor action node. */
288    public static final String N_EDITORACTION = "editoraction";
289
290    /** The name of the editor css handler node. */
291    public static final String N_EDITORCSSHANDLER = "editorcsshandler";
292
293    /** The name of the editor css handlers node. */
294    public static final String N_EDITORCSSHANDLERS = "editorcsshandlers";
295
296    /** The node name of the editors general options node. */
297    public static final String N_EDITORGENERALOPTIONS = "editors-generaloptions";
298
299    /** The name of the editor handler node. */
300    public static final String N_EDITORHANDLER = "editorhandler";
301
302    /** The name of the editorprecondition node. */
303    public static final String N_EDITORPRECONDITION = "editorprecondition";
304
305    /** The name of the editorpreconditions node. */
306    public static final String N_EDITORPRECONDITIONS = "editorpreconditions";
307
308    /** The node name of the editors preferences node. */
309    public static final String N_EDITORPREFERENCES = "editors-preferences";
310
311    /** The node name of the editors preferred editors node. */
312    public static final String N_EDITORPREFERREDEDITORS = "editors-preferrededitors";
313
314    /** The element delete mode node name. */
315    public static final String N_ELEMENT_DELETE_MODE = "element-delete-mode";
316
317    /** The name of the "enable advanced property tabs" node. */
318    public static final String N_ENABLEADVANCEDPROPERTYTABS = "enableadvancedpropertytabs";
319
320    /** The subname of the rfsfilesettings/enabled node. */
321    public static final String N_ENABLED = "enabled";
322
323    /** The name of the "user management enabled" node. */
324    public static final String N_ENABLEUSERMGMT = "enableusermanagement";
325
326    /** The node name of the file entries node. */
327    public static final String N_ENTRIES = "entries";
328
329    /** The name of the entry node. */
330    public static final String N_ENTRY = "entry";
331
332    /** The node name of the file entryoptions node. */
333    public static final String N_ENTRYOPTIONS = "entryoptions";
334
335    /** The name of the exclude-pattern node. */
336    public static final String N_EXCLUDEPATTERN = "exclude-pattern";
337
338    /** The name of the expand inherited permissions node. */
339    public static final String N_EXPANDPERMISSIONSINHERITED = "expand-permissionsinherited";
340
341    /** The name of the expand user permissions node. */
342    public static final String N_EXPANDPERMISSIONSUSER = "expand-permissionsuser";
343
344    /** The node name of the explorer displayoptions node. */
345    public static final String N_EXPLORERDISPLAYOPTIONS = "explorer-displayoptions";
346
347    /** The node name of the explorer generaloptions node. */
348    public static final String N_EXPLORERGENERALOPTIONS = "explorer-generaloptions";
349
350    /** The node name of the explorer preferences node. */
351    public static final String N_EXPLORERPREFERENCES = "explorer-preferences";
352
353    /** The name of the explorer type node. */
354    public static final String N_EXPLORERTYPE = "explorertype";
355
356    /** The name of the explorer types node. */
357    public static final String N_EXPLORERTYPES = "explorertypes";
358
359    /** The node name of the file copy node. */
360    public static final String N_FILECOPY = "filecopy";
361
362    /** The node name of the file deletion node. */
363    public static final String N_FILEDELETION = "filedeletion";
364
365    /** The subname of the rfsfilesettings/fileEncoding node. */
366    public static final String N_FILEENCODING = "fileEncoding";
367
368    /** The subname of the rfsfilesettings/filePath node. */
369    public static final String N_FILEPATH = "filePath";
370
371    /** The node name of the start folder node. */
372    public static final String N_FOLDER = "folder";
373
374    /** The node name of the folder copy node. */
375    public static final String N_FOLDERCOPY = "foldercopy";
376
377    /** The node name of the gallery preferences node. */
378    public static final String N_GALLERIESPREFERENCES = "galleries-preferences";
379
380    /** Node name. */
381    public static final String N_GALLERY_DEFAULT_SCOPE = "gallery-default-scope";
382
383    /** The node name of the group-translation node. */
384    public static final String N_GROUP_TRANSLATION = "group-translation";
385
386    /** The node name of the helptext node. */
387    public static final String N_HELPTEXT = "helptext";
388
389    /** The name of the icon rule node. */
390    public static final String N_ICONRULE = "iconrule";
391
392    /** The name of the icon rules node. */
393    public static final String N_ICONRULES = "iconrules";
394
395    /** The node name of the info-block node. */
396    public static final String N_INFOBLOCK = "info-block";
397
398    /** The subname of the rfsfilesettings/isLogfile node. */
399    public static final String N_ISLOGFILE = "isLogfile";
400
401    /** Name of the "keep alive" setting node. */
402    public static final String N_KEEP_ALIVE = "keep-alive";
403
404    /** The node name of the key node. */
405    public static final String N_KEY = "key";
406
407    /** The name of the "labeled folders" node. */
408    public static final String N_LABELEDFOLDERS = "labeledfolders";
409
410    /** The node name of the list all projects node. */
411    public static final String N_LISTALLPROJECTS = "listallprojects";
412
413    /** The node name of the locale node. */
414    public static final String N_LOCALE = "locale";
415
416    /** The name of the "localized folders" node. */
417    public static final String N_LOCALIZEDFOLDERS = "localizedfolders";
418
419    /** The node name of the lockedby column node. */
420    public static final String N_LOCKEDBY = "show-lockedby";
421
422    /** The name of the "max file upload size" node. */
423    public static final String N_MAXUPLOADSIZE = "maxfileuploadsize";
424
425    /** The node name of the navtext column node. */
426    public static final String N_NAVTEXT = "show-navtext";
427
428    /** The name of the "create new folder with index page" node. */
429    public static final String N_NEWFOLDERCREATEINDEXPAGE = "newfolder-createindexpage";
430
431    /** The name of the "create new folder with edit properties" node. */
432    public static final String N_NEWFOLDEREDITPROPERTIES = "newfolder-editproperties";
433
434    /** The name of the new resource node. */
435    public static final String N_NEWRESOURCE = "newresource";
436
437    /** The node name of the permissions column node. */
438    public static final String N_PERMISSIONS = "show-permissions";
439
440    /** The name of the inherit permissions on folder node. */
441    public static final String N_PERMISSIONSINHERITONFOLDER = "permissions-inheritonfolder";
442
443    /** The name of the editor handler node. */
444    public static final String N_POSTUPLOADHANDLER = "postuploadhandler";
445
446    /** The node name for a preference. */
447    public static final String N_PREFERENCE = "preference";
448
449    /** The name of the preference-tab element. */
450    public static final String N_PREFERENCE_TAB = "preference-tab";
451
452    /** The node name of the project node. */
453    public static final String N_PROJECT = "project";
454
455    /** The node name of the publish button appearance node. */
456    public static final String N_PUBLISHBUTTONAPPEARANCE = "publishbuttonappearance";
457
458    /** The node name of the publish notification node. */
459    public static final String N_PUBLISHNOTIFICATION = "publishnotification";
460
461    /** The name of the "publish related resources" node. */
462    public static final String N_PUBLISHRELATEDRESOURCES = "publishrelatedresources";
463
464    /** The node name of the report type node. */
465    public static final String N_REPORTTYPE = "reporttype";
466
467    /** The node name of the gallery upload folder handler node. */
468    public static final String N_REPOSITORY_FOLDER = "repositoryfolder";
469
470    /** The node name of the restrict explorer view node. */
471    public static final String N_RESTRICTEXPLORERVIEW = "restrictexplorerview";
472
473    /** The node name of the rfsfileviewsettings node. */
474    public static final String N_RFSFILEVIEWESETTINGS = "rfsfileviewsettings";
475
476    /** The node name of the root node. */
477    public static final String N_ROOT = "root";
478
479    /** The subname of the rfsfilesettings/rootPath node. */
480    public static final String N_ROOTPATH = "rootPath";
481
482    /** The node name of the roots node. */
483    public static final String N_ROOTS = "roots";
484
485    /** The node name of the searchindex-name node. */
486    public static final String N_SEARCHINDEXNAME = "searchindex-name";
487
488    /** The node name of the searchview-style node. */
489    public static final String N_SEARCHVIEWSTYLE = "searchview-style";
490
491    /** The name of the separator node. */
492    public static final String N_SEPARATOR = "separator";
493
494    /** The node name of the show lock node. */
495    public static final String N_SHOWEXPORTSETTINGS = "showexportsettings";
496
497    /** The node name of the "show file upload button" option. */
498    public static final String N_SHOWFILEUPLOADBUTTON = "show-fileuploadbutton";
499
500    /** The node name of the show lock node. */
501    public static final String N_SHOWLOCK = "showlock";
502
503    /** The node name of the show messages node. */
504    public static final String N_SHOWMESSAGES = "showmessages";
505
506    /** The name of the "create new folder with index page" node. */
507    public static final String N_SHOWUPLOADTYPEDIALOG = "show-uploadtypedialog";
508
509    /** The node name of the size column node. */
510    public static final String N_SIZE = "show-size";
511
512    /** The node name of the galleries start setting node. */
513    public static final String N_STARTGALLERIES = "startgalleries";
514
515    /** The node name of the start gallery node. */
516    public static final String N_STARTGALLERY = "startgallery";
517
518    /** The node name of the state column node. */
519    public static final String N_STATE = "show-state";
520
521    /** The node name for the subsitemap creation mode setting. */
522    public static final String N_SUBSITEMAP_CREATION_MODE = "subsitemap-creation-mode";
523
524    /** The name of the synchronization node. */
525    public static final String N_SYNCHRONIZATION = "synchronization";
526
527    /** The name of the text node. */
528    public static final String N_TEXT = "text";
529
530    /** The node name of the title column node. */
531    public static final String N_TITLE = "show-title";
532
533    /** The node name of the tool-manager node. */
534    public static final String N_TOOLMANAGER = "tool-manager";
535
536    /** The node name of the type column node. */
537    public static final String N_TYPE = "show-type";
538
539    /** The node name of the uploadapplet node. */
540    public static final String N_UPLOADAPPLET = "uploadapplet";
541
542    /** The node name of the uri node. */
543    public static final String N_URI = "uri";
544
545    /** The name of the user-lists node. */
546    public static final String N_USER_LISTS = "user-lists";
547
548    /** The node name of the user created node. */
549    public static final String N_USERCREATED = "show-usercreated";
550
551    /** The node name of the user-info node. */
552    public static final String N_USERINFO = "user-info";
553
554    /** The node name of the user-infos node. */
555    public static final String N_USERINFOS = "user-infos";
556
557    /** The node name of the user lastmodified node. */
558    public static final String N_USERLASTMODIFIED = "show-userlastmodified";
559
560    /** The subname of the rfsfilesettings/windowSize node. */
561    public static final String N_WINDOWSIZE = "windowSize";
562
563    /** The node name of the master workplace node. */
564    public static final String N_WORKPLACE = "workplace";
565
566    /** The node name of the workplace general options node. */
567    public static final String N_WORKPLACEGENERALOPTIONS = "workplace-generaloptions";
568
569    /** The node name of the workplace preferences node. */
570    public static final String N_WORKPLACEPREFERENCES = "workplace-preferences";
571
572    /** The node name of the workplace-search node. */
573    public static final String N_WORKPLACESEARCH = "workplace-search";
574
575    /** The node name of the workplace startup settings node. */
576    public static final String N_WORKPLACESTARTUPSETTINGS = "workplace-startupsettings";
577
578    /** The node name of the view node. */
579    public static final String N_WORKPLACEVIEW = "workplaceview";
580
581    /** The name of the xmlcontentautocorrection node. */
582    public static final String N_XMLCONTENTAUTOCORRECTION = "xmlcontentautocorrection";
583
584    /** The elementview attribute. */
585    private static final String A_ELEMENTVIEW = "elementview";
586
587    /** The requiredOnUpload attribute. */
588    private static final String A_REQUIRED_ON_UPLOAD = "requiredOnUpload";
589     
590    /** Configuration node name for setting the default value for the 'use formatter keys' in sitemap configurations created with new subsitemap folders. */ 
591    private static final String N_USE_FORMATTER_KEYS_FOR_NEW_SITES = "use-formatter-keys-for-new-sites";
592
593    /** The configured workplace manager. */
594    private CmsWorkplaceManager m_workplaceManager;
595
596    /**
597     * Adds the explorer type rules to the given digester.<p>
598     *
599     * @param digester the digester to add the rules to
600     */
601    public static void addExplorerTypeXmlRules(Digester digester) {
602
603        //TODO: remove workflow nodes from the dtd, there are just there for compatibility reasons
604
605        // add explorer type settings
606        digester.addObjectCreate("*/" + N_EXPLORERTYPE, CmsExplorerTypeSettings.class);
607        digester.addSetNext("*/" + N_EXPLORERTYPE, "addExplorerTypeSetting");
608
609        digester.addCallMethod("*/" + N_EXPLORERTYPE, "setTypeAttributes", 11);
610        digester.addCallParam("*/" + N_EXPLORERTYPE, 0, A_NAME);
611        digester.addCallParam("*/" + N_EXPLORERTYPE, 1, A_KEY);
612        digester.addCallParam("*/" + N_EXPLORERTYPE, 2, A_ICON);
613        digester.addCallParam("*/" + N_EXPLORERTYPE, 3, A_BIGICON);
614        digester.addCallParam("*/" + N_EXPLORERTYPE, 4, A_SMALLICONSTYLE);
615        digester.addCallParam("*/" + N_EXPLORERTYPE, 5, A_BIGICONSTYLE);
616        digester.addCallParam("*/" + N_EXPLORERTYPE, 6, A_REFERENCE);
617        digester.addCallParam("*/" + N_EXPLORERTYPE, 7, A_ELEMENTVIEW);
618        digester.addCallParam("*/" + N_EXPLORERTYPE, 8, A_ISVIEW);
619        digester.addCallParam("*/" + N_EXPLORERTYPE, 9, A_NAME_PATTERN);
620        digester.addCallParam("*/" + N_EXPLORERTYPE, 10, A_VIEW_ORDER);
621
622        digester.addCallMethod("*/" + N_EXPLORERTYPE + "/" + N_ICONRULES + "/" + N_ICONRULE, "addIconRule", 5);
623        digester.addCallParam("*/" + N_EXPLORERTYPE + "/" + N_ICONRULES + "/" + N_ICONRULE, 0, A_EXTENSION);
624        digester.addCallParam("*/" + N_EXPLORERTYPE + "/" + N_ICONRULES + "/" + N_ICONRULE, 1, A_ICON);
625        digester.addCallParam("*/" + N_EXPLORERTYPE + "/" + N_ICONRULES + "/" + N_ICONRULE, 2, A_BIGICON);
626        digester.addCallParam("*/" + N_EXPLORERTYPE + "/" + N_ICONRULES + "/" + N_ICONRULE, 3, A_SMALLICONSTYLE);
627        digester.addCallParam("*/" + N_EXPLORERTYPE + "/" + N_ICONRULES + "/" + N_ICONRULE, 4, A_BIGICONSTYLE);
628
629        digester.addCallMethod("*/" + N_EXPLORERTYPE + "/" + N_NEWRESOURCE, "setCreatable", 1);
630        digester.addCallParam("*/" + N_EXPLORERTYPE + "/" + N_NEWRESOURCE, 0, A_CREATABLE);
631        digester.addCallMethod("*/" + N_EXPLORERTYPE + "/" + N_NEWRESOURCE, "setNewResourceOrder", 1);
632        digester.addCallParam("*/" + N_EXPLORERTYPE + "/" + N_NEWRESOURCE, 0, A_ORDER);
633
634        digester.addCallMethod("*/" + N_EXPLORERTYPE + "/" + N_NEWRESOURCE, "setAutoSetNavigation", 1);
635        digester.addCallParam("*/" + N_EXPLORERTYPE + "/" + N_NEWRESOURCE, 0, A_AUTOSETNAVIGATION);
636        digester.addCallMethod("*/" + N_EXPLORERTYPE + "/" + N_NEWRESOURCE, "setAutoSetTitle", 1);
637        digester.addCallParam("*/" + N_EXPLORERTYPE + "/" + N_NEWRESOURCE, 0, A_AUTOSETTITLE);
638        digester.addCallMethod("*/" + N_EXPLORERTYPE + "/" + N_NEWRESOURCE, "setInfo", 1);
639        digester.addCallParam("*/" + N_EXPLORERTYPE + "/" + N_NEWRESOURCE, 0, A_INFO);
640        digester.addCallMethod("*/" + N_EXPLORERTYPE + "/" + N_NEWRESOURCE, "setTitleKey", 1);
641        digester.addCallParam("*/" + N_EXPLORERTYPE + "/" + N_NEWRESOURCE, 0, A_KEY);
642
643        digester.addObjectCreate("*/" + N_EXPLORERTYPE + "/" + N_ACCESSCONTROL, CmsExplorerTypeAccess.class);
644        digester.addSetNext("*/" + N_EXPLORERTYPE + "/" + N_ACCESSCONTROL, "setAccess");
645
646        digester.addCallMethod(
647            "*/" + N_EXPLORERTYPE + "/" + N_ACCESSCONTROL + "/" + N_ACCESSENTRY,
648            "addAccessEntry",
649            2);
650        digester.addCallParam("*/" + N_EXPLORERTYPE + "/" + N_ACCESSCONTROL + "/" + N_ACCESSENTRY, 0, A_PRINCIPAL);
651        digester.addCallParam("*/" + N_EXPLORERTYPE + "/" + N_ACCESSCONTROL + "/" + N_ACCESSENTRY, 1, A_PERMISSIONS);
652
653        digester.addCallMethod(
654            "*/" + N_EXPLORERTYPE + "/" + N_EDITOPTIONS + "/" + N_DEFAULTPROPERTIES,
655            "setPropertyDefaults",
656            2);
657        digester.addCallParam("*/" + N_EXPLORERTYPE + "/" + N_EDITOPTIONS + "/" + N_DEFAULTPROPERTIES, 0, A_ENABLED);
658        digester.addCallParam(
659            "*/" + N_EXPLORERTYPE + "/" + N_EDITOPTIONS + "/" + N_DEFAULTPROPERTIES,
660            1,
661            A_SHOWNAVIGATION);
662
663        digester.addCallMethod(
664            "*/" + N_EXPLORERTYPE + "/" + N_EDITOPTIONS + "/" + N_DEFAULTPROPERTIES + "/" + N_PROPERTY,
665            "addProperty",
666            2);
667        digester.addCallParam(
668            "*/" + N_EXPLORERTYPE + "/" + N_EDITOPTIONS + "/" + N_DEFAULTPROPERTIES + "/" + N_PROPERTY,
669            0,
670            A_NAME);
671
672        digester.addCallParam(
673            "*/" + N_EXPLORERTYPE + "/" + N_EDITOPTIONS + "/" + N_DEFAULTPROPERTIES + "/" + N_PROPERTY,
674            1,
675            A_REQUIRED_ON_UPLOAD);
676
677        digester.addCallMethod(
678            "*/" + N_EXPLORERTYPE + "/" + N_EDITOPTIONS + "/" + N_DEFAULTPROPERTIES + "/" + N_DEFAULTPROPERTY,
679            "addProperty",
680            2);
681        digester.addCallParam(
682            "*/" + N_EXPLORERTYPE + "/" + N_EDITOPTIONS + "/" + N_DEFAULTPROPERTIES + "/" + N_DEFAULTPROPERTY,
683            0,
684            A_NAME);
685        digester.addCallParam(
686            "*/" + N_EXPLORERTYPE + "/" + N_EDITOPTIONS + "/" + N_DEFAULTPROPERTIES + "/" + N_DEFAULTPROPERTY,
687            1,
688            A_REQUIRED_ON_UPLOAD);
689
690        digester.addCallMethod("*/" + N_EXPLORERTYPE + "/" + N_EDITOPTIONS, "setEditOptions");
691    }
692
693    /**
694     * Creates the xml output for explorer type nodes.<p>
695     *
696     * @param startNode the startnode to add all rescource types to
697     * @param explorerTypes the list of explorer types
698     * @param module true if the XML tree for the module config should be generated, false otherwise
699     */
700    public static void generateExplorerTypesXml(
701        Element startNode,
702        List<CmsExplorerTypeSettings> explorerTypes,
703        boolean module) {
704
705        // we need the default access node later to check if the explorer type is an individual setting
706        CmsExplorerTypeAccess defaultAccess = null;
707        if (OpenCms.getWorkplaceManager() != null) {
708            defaultAccess = OpenCms.getWorkplaceManager().getDefaultAccess();
709        }
710        // get the menu rule translator to eliminate eventual legacy menu rules
711        Iterator<CmsExplorerTypeSettings> i = explorerTypes.iterator();
712        while (i.hasNext()) {
713            // create an explorer type node
714            CmsExplorerTypeSettings settings = i.next();
715
716            if (settings.isAddititionalModuleExplorerType() == module) {
717                Element explorerTypeElement = startNode.addElement(N_EXPLORERTYPE);
718                explorerTypeElement.addAttribute(A_NAME, settings.getName());
719                explorerTypeElement.addAttribute(A_KEY, settings.getKey());
720                String originalIcon = settings.getOriginalIcon();
721                if (CmsStringUtil.isNotEmpty(originalIcon)) {
722                    explorerTypeElement.addAttribute(A_ICON, settings.getOriginalIcon());
723                }
724                if (CmsStringUtil.isNotEmpty(settings.getBigIcon())) {
725                    explorerTypeElement.addAttribute(A_BIGICON, settings.getBigIcon());
726                }
727                if (CmsStringUtil.isNotEmpty(settings.getSmallIconStyle())) {
728                    explorerTypeElement.addAttribute(A_SMALLICONSTYLE, settings.getSmallIconStyle());
729                }
730                if (CmsStringUtil.isNotEmpty(settings.getBigIconStyle())) {
731                    explorerTypeElement.addAttribute(A_BIGICONSTYLE, settings.getBigIconStyle());
732                }
733
734                if (settings.getReference() != null) {
735                    explorerTypeElement.addAttribute(A_REFERENCE, settings.getReference());
736                }
737
738                if (settings.getElementView() != null) {
739                    explorerTypeElement.addAttribute(A_ELEMENTVIEW, settings.getElementView());
740                }
741
742                if (settings.isView()) {
743                    explorerTypeElement.addAttribute(A_ISVIEW, "true");
744                }
745
746                if (settings.getNamePattern() != null) {
747                    explorerTypeElement.addAttribute(A_NAME_PATTERN, settings.getNamePattern());
748                }
749
750                if (settings.getViewOrder(false) != null) {
751                    explorerTypeElement.addAttribute(A_VIEW_ORDER, "" + settings.getViewOrder(false));
752                }
753
754                // create subnode <newresource>
755                Element newResElement = explorerTypeElement.addElement(N_NEWRESOURCE);
756                newResElement.addAttribute(A_CREATABLE, String.valueOf(settings.isCreatable()));
757                newResElement.addAttribute(A_ORDER, settings.getNewResourceOrder());
758                newResElement.addAttribute(A_AUTOSETNAVIGATION, String.valueOf(settings.isAutoSetNavigation()));
759                newResElement.addAttribute(A_AUTOSETTITLE, String.valueOf(settings.isAutoSetTitle()));
760                newResElement.addAttribute(A_INFO, settings.getInfo());
761                newResElement.addAttribute(A_KEY, settings.getTitleKey());
762                // create subnode <accesscontrol>
763                CmsExplorerTypeAccess access = settings.getAccess();
764                if (access != defaultAccess) {
765                    // don't output the node if this is in fact the default access settings
766                    List<String> accessEntries = new ArrayList<String>(access.getAccessEntries().keySet());
767                    // sort accessEntries
768                    Collections.sort(accessEntries);
769                    if (accessEntries.size() > 0) {
770                        Element accessControlElement = explorerTypeElement.addElement(N_ACCESSCONTROL);
771                        Iterator<String> k = accessEntries.iterator();
772                        while (k.hasNext()) {
773                            String key = k.next();
774                            String value = settings.getAccess().getAccessEntries().get(key);
775                            Element accessEntryElement = accessControlElement.addElement(N_ACCESSENTRY);
776                            accessEntryElement.addAttribute(A_PRINCIPAL, key);
777                            accessEntryElement.addAttribute(A_PERMISSIONS, value);
778                        }
779                    }
780                }
781                // create subnode <editoptions>
782                if (settings.hasEditOptions()) {
783                    Element editOptionsElement = explorerTypeElement.addElement(N_EDITOPTIONS);
784                    Element defaultPropertiesElement = editOptionsElement.addElement(N_DEFAULTPROPERTIES);
785                    defaultPropertiesElement.addAttribute(A_ENABLED, String.valueOf(settings.isPropertiesEnabled()));
786                    defaultPropertiesElement.addAttribute(
787                        A_SHOWNAVIGATION,
788                        String.valueOf(settings.isShowNavigation()));
789                    Iterator<String> m = settings.getProperties().iterator();
790                    while (m.hasNext()) {
791                        Element propElem = defaultPropertiesElement.addElement(N_DEFAULTPROPERTY);
792                        String propName = m.next();
793                        if (settings.isPropertyRequiredOnUpload(propName)) {
794                            propElem.addAttribute(A_REQUIRED_ON_UPLOAD, "true");
795                        }
796                        propElem.addAttribute(A_NAME, propName);
797
798                    }
799                }
800
801                Map<String, CmsIconRule> iconRules = settings.getIconRules();
802                if ((iconRules != null) && !iconRules.isEmpty()) {
803                    Element iconRulesElem = explorerTypeElement.addElement(N_ICONRULES);
804                    for (Map.Entry<String, CmsIconRule> entry : iconRules.entrySet()) {
805                        CmsIconRule rule = entry.getValue();
806                        Element ruleElem = iconRulesElem.addElement(N_ICONRULE);
807                        String icon = rule.getIcon();
808                        String bigIcon = rule.getBigIcon();
809                        String extension = rule.getExtension();
810                        ruleElem.addAttribute(A_EXTENSION, extension);
811                        if (icon != null) {
812                            ruleElem.addAttribute(A_ICON, icon);
813                        }
814                        if (bigIcon != null) {
815                            ruleElem.addAttribute(A_BIGICON, bigIcon);
816                        }
817                        if (rule.getSmallIconStyle() != null) {
818                            ruleElem.addAttribute(A_SMALLICONSTYLE, rule.getSmallIconStyle());
819                        }
820                        if (rule.getBigIconStyle() != null) {
821                            ruleElem.addAttribute(A_BIGICONSTYLE, rule.getBigIconStyle());
822                        }
823                    }
824                }
825
826            }
827        }
828    }
829
830    /**
831     * @see org.opencms.configuration.I_CmsXmlConfiguration#addXmlDigesterRules(org.apache.commons.digester3.Digester)
832     */
833    public void addXmlDigesterRules(Digester digester) {
834
835        // add finish rule
836        digester.addCallMethod("*/" + N_WORKPLACE, "initializeFinished");
837
838        // generic <param> parameter rules
839        digester.addCallMethod(
840            "*/" + I_CmsXmlConfiguration.N_PARAM,
841            I_CmsConfigurationParameterHandler.ADD_PARAMETER_METHOD,
842            2);
843        digester.addCallParam("*/" + I_CmsXmlConfiguration.N_PARAM, 0, I_CmsXmlConfiguration.A_NAME);
844        digester.addCallParam("*/" + I_CmsXmlConfiguration.N_PARAM, 1);
845
846        // creation of the import/export manager
847        digester.addObjectCreate("*/" + N_WORKPLACE, CmsWorkplaceManager.class);
848        // import/export manager finished
849        digester.addSetNext("*/" + N_WORKPLACE, "setWorkplaceManager");
850
851        String path = "*/" + N_WORKPLACE + "/" + N_KEEP_ALIVE;
852        digester.addCallMethod(path, "setKeepAlive", 0);
853
854        // add exclude patterns
855        digester.addCallMethod(
856            "*/" + N_WORKPLACE + "/" + N_SYNCHRONIZATION + "/" + N_EXCLUDEPATTERN,
857            "addSynchronizeExcludePattern",
858            0);
859
860        digester.addCallMethod("*/" + N_WORKPLACE + "/" + N_GALLERY_DEFAULT_SCOPE, "setGalleryDefaultScope", 0);
861
862        digester.addCallMethod("*/" + N_WORKPLACE + "/" + N_ELEMENT_DELETE_MODE, "setElementDeleteMode", 0);
863
864        digester.addCallMethod("*/" + N_WORKPLACE + "/" + N_USER_LISTS, "setUserListMode", 1);
865        digester.addCallParam("*/" + N_WORKPLACE + "/" + N_USER_LISTS, 0, A_MODE);
866
867        // add default locale rule
868        digester.addCallMethod("*/" + N_WORKPLACE + "/" + N_DEFAULTLOCALE, "setDefaultLocale", 0);
869
870        // add default properties on structure setting
871        digester.addCallMethod(
872            "*/" + N_WORKPLACE + "/" + N_DEFAULTPROPERTIESONSTRUCTURE,
873            "setDefaultPropertiesOnStructure",
874            0);
875
876        // add default properties on structure setting
877        digester.addCallMethod(
878            "*/" + N_WORKPLACE + "/" + N_ENABLEADVANCEDPROPERTYTABS,
879            "setEnableAdvancedPropertyTabs",
880            0);
881
882        // add category folder rule
883        digester.addCallMethod("*/" + N_WORKPLACE + "/" + N_CATEGORYFOLDER, "setCategoryFolder", 0);
884
885        // add category display options
886        digester.addCallMethod("*/" + N_WORKPLACE + "/" + N_CATEGORYDISPLAYOPTIONS, "setCategoryDisplayOptions", 2);
887        digester.addCallParam("*/" + N_WORKPLACE + "/" + N_CATEGORYDISPLAYOPTIONS, 0, A_DISPLAY_BY_REPOSITORY);
888        digester.addCallParam("*/" + N_WORKPLACE + "/" + N_CATEGORYDISPLAYOPTIONS, 1, A_DISPLAY_COLLAPSED);
889
890        digester.addCallMethod("*/" + N_WORKPLACE + "/" + N_GROUP_TRANSLATION, "setGroupTranslationClass", 1);
891        digester.addCallParam("*/" + N_WORKPLACE + "/" + N_GROUP_TRANSLATION, 0, A_CLASS);
892
893        // add rules for dialog handlers
894        digester.addObjectCreate(
895            "*/" + N_WORKPLACE + "/" + N_DIALOGHANDLERS + "/" + N_DIALOGHANDLER,
896            CmsConfigurationException.class.getName(),
897            A_CLASS);
898        digester.addSetNext("*/" + N_WORKPLACE + "/" + N_DIALOGHANDLERS + "/" + N_DIALOGHANDLER, "addDialogHandler");
899        digester.addCallMethod(
900            "*/" + N_WORKPLACE + "/" + N_DIALOGHANDLERS + "/" + N_DIALOGHANDLER,
901            I_CmsConfigurationParameterHandler.INIT_CONFIGURATION_METHOD);
902
903        // add rules for editor handler
904        digester.addObjectCreate(
905            "*/" + N_WORKPLACE + "/" + N_EDITORHANDLER,
906            CmsConfigurationException.class.getName(),
907            A_CLASS);
908        digester.addSetNext("*/" + N_WORKPLACE + "/" + N_EDITORHANDLER, "setEditorHandler");
909
910        // add rules for editor handler
911        digester.addObjectCreate(
912            "*/" + N_WORKPLACE + "/" + N_POSTUPLOADHANDLER,
913            A_CLASS,
914            CmsConfigurationException.class);
915        digester.addSetNext("*/" + N_WORKPLACE + "/" + N_POSTUPLOADHANDLER, "setPostUploadHandler");
916
917        // add rules for editor action handler
918        digester.addObjectCreate(
919            "*/" + N_WORKPLACE + "/" + N_EDITORACTION,
920            CmsConfigurationException.class.getName(),
921            A_CLASS);
922        digester.addSetNext("*/" + N_WORKPLACE + "/" + N_EDITORACTION, "setEditorAction");
923
924        // add rules for editor css handler classes
925        digester.addCallMethod(
926            "*/" + N_WORKPLACE + "/" + N_EDITORCSSHANDLERS + "/" + N_EDITORCSSHANDLER,
927            "addEditorCssHandler",
928            1);
929        digester.addCallParam("*/" + N_WORKPLACE + "/" + N_EDITORCSSHANDLERS + "/" + N_EDITORCSSHANDLER, 0, A_CLASS);
930
931        // add rules for pre editor action classes
932        digester.addObjectCreate(
933            "*/" + N_WORKPLACE + "/" + N_EDITORPRECONDITIONS + "/" + N_EDITORPRECONDITION,
934            CmsConfigurationException.class.getName(),
935            A_CLASS);
936        digester.addSetNext(
937            "*/" + N_WORKPLACE + "/" + N_EDITORPRECONDITIONS + "/" + N_EDITORPRECONDITION,
938            "addPreEditorConditionDefinition");
939
940        digester.addCallMethod(
941            "*/" + N_WORKPLACE + "/" + N_EDITORPRECONDITIONS + "/" + N_EDITORPRECONDITION,
942            "setResourceTypeName",
943            1);
944        digester.addCallParam("*/" + N_WORKPLACE + "/" + N_EDITORPRECONDITIONS + "/" + N_EDITORPRECONDITION, 0, A_NAME);
945
946        digester.addCallMethod(
947            "*/" + N_WORKPLACE + "/" + N_EDITORPRECONDITIONS + "/" + N_EDITORPRECONDITION,
948            I_CmsConfigurationParameterHandler.INIT_CONFIGURATION_METHOD);
949
950        // add rules for direct edit provider
951        digester.addObjectCreate(
952            "*/" + N_WORKPLACE + "/" + N_DIRECTEDITPROVIDER,
953            CmsConfigurationException.class.getName(),
954            A_CLASS);
955        digester.addCallMethod(
956            "*/" + N_WORKPLACE + "/" + N_DIRECTEDITPROVIDER,
957            I_CmsConfigurationParameterHandler.INIT_CONFIGURATION_METHOD);
958        digester.addSetNext("*/" + N_WORKPLACE + "/" + N_DIRECTEDITPROVIDER, "setDirectEditProvider");
959
960        // add rules for the workplace export points
961        digester.addCallMethod("*/" + N_WORKPLACE + "/" + N_EXPORTPOINTS + "/" + N_EXPORTPOINT, "addExportPoint", 2);
962        digester.addCallParam("*/" + N_WORKPLACE + "/" + N_EXPORTPOINTS + "/" + N_EXPORTPOINT, 0, A_URI);
963        digester.addCallParam("*/" + N_WORKPLACE + "/" + N_EXPORTPOINTS + "/" + N_EXPORTPOINT, 1, A_DESTINATION);
964
965        // add autolock rule
966        digester.addCallMethod("*/" + N_WORKPLACE + "/" + N_AUTOLOCK, "setAutoLock", 0);
967
968        // acacia-unlock
969        digester.addCallMethod("*/" + N_WORKPLACE + "/" + N_ACACIA_UNLOCK, "setAcaciaUnlock", 0);
970
971        // add XML content auto correction rule
972        digester.addCallMethod("*/" + N_WORKPLACE + "/" + N_XMLCONTENTAUTOCORRECTION, "setXmlContentAutoCorrect", 0);
973
974        // add user management enabled rule
975        digester.addCallMethod("*/" + N_WORKPLACE + "/" + N_ENABLEUSERMGMT, "setUserManagementEnabled", 0);
976
977        // add max file upload size rule
978        digester.addCallMethod("*/" + N_WORKPLACE + "/" + N_MAXUPLOADSIZE, "setFileMaxUploadSize", 0);
979
980        // add labeled folders rule
981        digester.addCallMethod("*/" + N_WORKPLACE + "/" + N_LABELEDFOLDERS + "/" + N_RESOURCE, "addLabeledFolder", 1);
982        digester.addCallParam("*/" + N_WORKPLACE + "/" + N_LABELEDFOLDERS + "/" + N_RESOURCE, 0, A_URI);
983
984        // set the gallery upload folder handler
985        digester.addObjectCreate(
986            "*/" + N_WORKPLACE + "/" + N_REPOSITORY_FOLDER,
987            CmsConfigurationException.class.getName(),
988            A_CLASS);
989        digester.addSetNext("*/" + N_WORKPLACE + "/" + N_REPOSITORY_FOLDER, "setRepositoryFolderHandler");
990
991        // add localized folders rule
992        digester.addCallMethod(
993            "*/" + N_WORKPLACE + "/" + N_LOCALIZEDFOLDERS + "/" + N_RESOURCE,
994            "addLocalizedFolder",
995            1);
996        digester.addCallParam("*/" + N_WORKPLACE + "/" + N_LOCALIZEDFOLDERS + "/" + N_RESOURCE, 0, A_URI);
997
998        // add fileViewSettings rules
999        String xPathPrefix = "*/" + N_RFSFILEVIEWESETTINGS;
1000        digester.addObjectCreate(xPathPrefix, CmsRfsFileViewer.class);
1001        digester.addBeanPropertySetter(xPathPrefix + "/" + N_ROOTPATH);
1002        digester.addBeanPropertySetter(xPathPrefix + "/" + N_FILEPATH);
1003        digester.addBeanPropertySetter(xPathPrefix + "/" + N_ENABLED);
1004        digester.addBeanPropertySetter(xPathPrefix + "/" + N_FILEENCODING);
1005        digester.addBeanPropertySetter(xPathPrefix + "/" + N_ISLOGFILE);
1006        digester.addBeanPropertySetter(xPathPrefix + "/" + N_WINDOWSIZE);
1007
1008        // Cms specific rule similar to SetNextRule with implicit first CmsObject argument (remains null).
1009        digester.addRule(xPathPrefix, new CmsSetNextRule("setFileViewSettings", CmsRfsFileViewer.class));
1010
1011        // add explorer type rules
1012        addExplorerTypeXmlRules(digester);
1013        addDefaultAccessControlRules(digester);
1014        addUserInfoRules(digester);
1015        addAccountInfoRules(digester);
1016        addDefaultPreferencesRules(digester);
1017
1018        addToolManagerRules(digester);
1019        CmsAdditionalLogFolderConfig.ADD_LOG_FOLDER_HELPER.addRules(digester);
1020        digester.addSetNext(
1021            CmsAdditionalLogFolderConfig.ADD_LOG_FOLDER_HELPER.getBasePath(),
1022            "setAdditionalLogFolderConfiguration");
1023
1024        digester.addRule("*/" + N_WORKPLACE + "/" + N_USE_FORMATTER_KEYS_FOR_NEW_SITES, new Rule() {
1025
1026            @Override
1027            public void body(String namespace, String name, String text) throws Exception {
1028
1029                CmsResourceTypeSubsitemapContentFolder.setEnableNewPageFormatByDefault(Boolean.parseBoolean(text));
1030            }
1031        });
1032    }
1033
1034    /**
1035     * @see org.opencms.configuration.I_CmsXmlConfiguration#generateXml(org.dom4j.Element)
1036     */
1037    public Element generateXml(Element parent) {
1038
1039        // generate workplace node and subnodes
1040        Element workplaceElement = parent.addElement(N_WORKPLACE);
1041        // add default locale
1042        workplaceElement.addElement(N_DEFAULTLOCALE).setText(m_workplaceManager.getDefaultLocale().toString());
1043
1044        // add <localizedfolders> subnode
1045        Element localizedElement = workplaceElement.addElement(N_LOCALIZEDFOLDERS);
1046        Iterator<String> localizedIterator = m_workplaceManager.getLocalizedFolders().iterator();
1047        while (localizedIterator.hasNext()) {
1048            // add <resource uri=""/> element(s)
1049            localizedElement.addElement(N_RESOURCE).addAttribute(A_URI, localizedIterator.next());
1050        }
1051
1052        // add <dialoghandlers> subnode
1053        Element dialogElement = workplaceElement.addElement(N_DIALOGHANDLERS);
1054        Map<String, I_CmsDialogHandler> dialogs = m_workplaceManager.getDialogHandler();
1055        String[] keys = dialogs.keySet().toArray(new String[0]);
1056        Arrays.sort(keys);
1057        for (int j = 0; j < keys.length; j++) {
1058            String name = keys[j];
1059            // add <dialoghandler> subnode with class attribute
1060            Element dialogHandler = dialogElement.addElement(N_DIALOGHANDLER).addAttribute(
1061                A_CLASS,
1062                dialogs.get(name).getClass().getName());
1063            I_CmsDialogHandler daialogHandlerConfig = dialogs.get(name);
1064            CmsParameterConfiguration handlerConfig = daialogHandlerConfig.getConfiguration();
1065            if (handlerConfig != null) {
1066                handlerConfig.appendToXml(dialogHandler);
1067            }
1068        }
1069
1070        // add miscellaneous editor subnodes
1071        workplaceElement.addElement(N_EDITORHANDLER).addAttribute(
1072            A_CLASS,
1073            m_workplaceManager.getEditorHandler().getClass().getName());
1074        workplaceElement.addElement(N_EDITORACTION).addAttribute(
1075            A_CLASS,
1076            m_workplaceManager.getEditorActionHandler().getClass().getName());
1077
1078        if (m_workplaceManager.getPostUploadHandler() != null) {
1079            workplaceElement.addElement(N_POSTUPLOADHANDLER).addAttribute(
1080                A_CLASS,
1081                m_workplaceManager.getPostUploadHandler().getClass().getName());
1082        }
1083
1084        if (m_workplaceManager.getEditorCssHandlers().size() > 0) {
1085            Element editorCssHandlers = workplaceElement.addElement(N_EDITORCSSHANDLERS);
1086            Iterator<I_CmsEditorCssHandler> it = m_workplaceManager.getEditorCssHandlers().iterator();
1087            while (it.hasNext()) {
1088                I_CmsEditorCssHandler current = it.next();
1089                Element handler = editorCssHandlers.addElement(N_EDITORCSSHANDLER);
1090                handler.addAttribute(A_CLASS, current.getClass().getName());
1091            }
1092        }
1093
1094        if (m_workplaceManager.getPreEditorConditionDefinitions().size() > 0) {
1095            Element editorPreActions = workplaceElement.addElement(N_EDITORPRECONDITIONS);
1096            Iterator<I_CmsPreEditorActionDefinition> it = m_workplaceManager.getPreEditorConditionDefinitions().iterator();
1097            while (it.hasNext()) {
1098                I_CmsPreEditorActionDefinition current = it.next();
1099                Element action = editorPreActions.addElement(N_EDITORPRECONDITION);
1100                action.addAttribute(A_NAME, current.getResourceTypeName());
1101                action.addAttribute(A_CLASS, current.getClass().getName());
1102                // get the configuration parameters
1103                CmsParameterConfiguration config = current.getConfiguration();
1104                if ((config != null) && (config.size() > 0)) {
1105                    // append the configuration parameters
1106                    config.appendToXml(action);
1107                }
1108            }
1109        }
1110
1111        I_CmsConfigurationParameterHandler deProvider = m_workplaceManager.getDirectEditProvider();
1112        Element deProviderNode = workplaceElement.addElement(N_DIRECTEDITPROVIDER).addAttribute(
1113            A_CLASS,
1114            deProvider.getClass().getName());
1115        CmsParameterConfiguration deProviderConfig = deProvider.getConfiguration();
1116        if (deProviderConfig != null) {
1117            deProviderConfig.appendToXml(deProviderNode);
1118        }
1119
1120        // add <exportpoints> subnode
1121        Element resourceloadersElement = workplaceElement.addElement(N_EXPORTPOINTS);
1122        Set<CmsExportPoint> points = m_workplaceManager.getExportPoints();
1123        Iterator<CmsExportPoint> exportPoints = points.iterator();
1124        while (exportPoints.hasNext()) {
1125            CmsExportPoint point = exportPoints.next();
1126            resourceloadersElement.addElement(N_EXPORTPOINT).addAttribute(A_URI, point.getUri()).addAttribute(
1127                A_DESTINATION,
1128                point.getConfiguredDestination());
1129        }
1130
1131        // add miscellaneous configuration nodes
1132        workplaceElement.addElement(N_AUTOLOCK).setText(String.valueOf(m_workplaceManager.autoLockResources()));
1133        String acaciaUnlock = m_workplaceManager.getAcaciaUnlock();
1134        if (acaciaUnlock != null) {
1135            workplaceElement.addElement(N_ACACIA_UNLOCK).setText(acaciaUnlock);
1136        }
1137
1138        workplaceElement.addElement(N_XMLCONTENTAUTOCORRECTION).setText(
1139            String.valueOf(m_workplaceManager.isXmlContentAutoCorrect()));
1140        workplaceElement.addElement(N_ENABLEUSERMGMT).setText(String.valueOf(m_workplaceManager.showUserGroupIcon()));
1141        workplaceElement.addElement(N_DEFAULTPROPERTIESONSTRUCTURE).setText(
1142            String.valueOf(m_workplaceManager.isDefaultPropertiesOnStructure()));
1143        workplaceElement.addElement(N_ENABLEADVANCEDPROPERTYTABS).setText(
1144            String.valueOf(m_workplaceManager.isEnableAdvancedPropertyTabs()));
1145
1146        // add <categoryfolder> node
1147        if (CmsStringUtil.isNotEmptyOrWhitespaceOnly(m_workplaceManager.getCategoryFolder())
1148            && !CmsCategoryService.REPOSITORY_BASE_FOLDER.equals(m_workplaceManager.getCategoryFolder())) {
1149            workplaceElement.addElement(N_CATEGORYFOLDER).setText(
1150                String.valueOf(m_workplaceManager.getCategoryFolder()));
1151        }
1152
1153        // add <categorydisplayoptions> node
1154        if (m_workplaceManager.isDisplayCategoriesByRepository()
1155            || m_workplaceManager.isDisplayCategorySelectionCollapsed()) {
1156            Element categoryDisplayOptions = workplaceElement.addElement(N_CATEGORYDISPLAYOPTIONS);
1157            if (m_workplaceManager.isDisplayCategoriesByRepository()) {
1158                categoryDisplayOptions.addAttribute(A_DISPLAY_BY_REPOSITORY, "true");
1159            }
1160            if (m_workplaceManager.isDisplayCategorySelectionCollapsed()) {
1161                categoryDisplayOptions.addAttribute(A_DISPLAY_COLLAPSED, "true");
1162            }
1163        }
1164
1165        String groupTranslationClass = m_workplaceManager.getGroupTranslationClass();
1166        if (groupTranslationClass != null) {
1167            Element groupTranslationElement = workplaceElement.addElement(N_GROUP_TRANSLATION);
1168            groupTranslationElement.addAttribute(A_CLASS, groupTranslationClass);
1169        }
1170
1171        workplaceElement.addElement(N_MAXUPLOADSIZE).setText(String.valueOf(m_workplaceManager.getFileMaxUploadSize()));
1172
1173        // add <labeledfolders> resource list
1174        Element labeledElement = workplaceElement.addElement(N_LABELEDFOLDERS);
1175        Iterator<String> sitesFolders = m_workplaceManager.getLabelSiteFolders().iterator();
1176        while (sitesFolders.hasNext()) {
1177            labeledElement.addElement(N_RESOURCE).addAttribute(A_URI, sitesFolders.next());
1178        }
1179        // add the <galleryupload> node
1180        workplaceElement.addElement(N_REPOSITORY_FOLDER).addAttribute(
1181            A_CLASS,
1182            m_workplaceManager.getRepositoryFolderHandler().getClass().getName());
1183
1184        // add <rfsfileviewsettings> node
1185        CmsRfsFileViewer viewSettings = m_workplaceManager.getFileViewSettings();
1186        Element fileViewElement = workplaceElement.addElement(N_RFSFILEVIEWESETTINGS);
1187        String rootPath = viewSettings.getRootPath();
1188        if (rootPath != null) {
1189            fileViewElement.addElement(N_ROOTPATH).setText(rootPath);
1190        }
1191        String filePath = viewSettings.getFilePath();
1192        if (filePath != null) {
1193            fileViewElement.addElement(N_FILEPATH).setText(filePath);
1194        }
1195        fileViewElement.addElement(N_ENABLED).setText(String.valueOf(viewSettings.isEnabled()));
1196        fileViewElement.addElement(N_FILEENCODING).setText(viewSettings.getFileEncoding());
1197        fileViewElement.addElement(N_ISLOGFILE).setText(String.valueOf(viewSettings.getIsLogfile()));
1198        fileViewElement.addElement(N_WINDOWSIZE).setText(String.valueOf(viewSettings.getWindowSize()));
1199
1200        // add <explorertypes> node
1201        Element explorerTypesElement = workplaceElement.addElement(N_EXPLORERTYPES);
1202        List<CmsExplorerTypeSettings> explorerTypes = m_workplaceManager.getWorkplaceExplorerTypeSettings();
1203        generateExplorerTypesXml(explorerTypesElement, explorerTypes, false);
1204
1205        // add the <defaultaccesscontrol> node
1206        Element defaultAccessControlElement = explorerTypesElement.addElement(N_DEFAULTACCESSCONTROL);
1207        // create subnode <accesscontrol>
1208        List<String> accessEntries = new ArrayList<String>();
1209        // sort accessEntries
1210        CmsExplorerTypeAccess access = m_workplaceManager.getDefaultAccess();
1211        Iterator<String> iter = access.getAccessEntries().keySet().iterator();
1212        while (iter.hasNext()) {
1213            accessEntries.add(iter.next());
1214        }
1215        Collections.sort(accessEntries);
1216
1217        if (accessEntries.size() > 0) {
1218            Element accessControlElement = defaultAccessControlElement.addElement(N_ACCESSCONTROL);
1219            Iterator<String> k = accessEntries.iterator();
1220
1221            while (k.hasNext()) {
1222                String key = k.next();
1223                String value = m_workplaceManager.getDefaultAccess().getAccessEntries().get(key);
1224                Element accessEntryElement = accessControlElement.addElement(N_ACCESSENTRY);
1225                accessEntryElement.addAttribute(A_PRINCIPAL, key);
1226                accessEntryElement.addAttribute(A_PERMISSIONS, value);
1227            }
1228        }
1229
1230        // add the user-infos node
1231        if (m_workplaceManager.getUserInfoManager() != null) {
1232            Element userInfosElement = workplaceElement.addElement(N_USERINFOS);
1233            Iterator<CmsWorkplaceUserInfoBlock> infoBlocks = m_workplaceManager.getUserInfoManager().getBlocks().iterator();
1234            while (infoBlocks.hasNext()) {
1235                CmsWorkplaceUserInfoBlock block = infoBlocks.next();
1236                Element infoBlockElement = userInfosElement.addElement(N_INFOBLOCK);
1237                infoBlockElement.addAttribute(A_NAME, block.getTitle());
1238
1239                Iterator<CmsWorkplaceUserInfoEntry> itEntries = block.getEntries().iterator();
1240                while (itEntries.hasNext()) {
1241                    CmsWorkplaceUserInfoEntry entry = itEntries.next();
1242                    Element userInfoElement = infoBlockElement.addElement(N_USERINFO);
1243                    userInfoElement.addAttribute(A_KEY, entry.getKey());
1244                    if (entry.getType() != null) {
1245                        userInfoElement.addAttribute(A_TYPE, entry.getType());
1246                    }
1247                    if (entry.getWidget() != null) {
1248                        userInfoElement.addAttribute(A_WIDGET, entry.getWidget());
1249                    }
1250                    if (entry.getParams() != null) {
1251                        userInfoElement.addAttribute(A_PARAMS, entry.getParams());
1252                    }
1253                    if (entry.getOptional() != null) {
1254                        userInfoElement.addAttribute(A_OPTIONAL, entry.getOptional());
1255                    }
1256                }
1257            }
1258        }
1259
1260        List<CmsAccountInfo> accountInfos = m_workplaceManager.getConfiguredAccountInfos();
1261        if (accountInfos != null) {
1262            Element infosElement = workplaceElement.addElement(N_ACCOUNTINFOS);
1263            for (CmsAccountInfo info : accountInfos) {
1264                Element infoElement = infosElement.addElement(N_ACCOUNTINFO);
1265                infoElement.addAttribute(A_FIELD, info.getField().name());
1266                if (info.isAdditionalInfo()) {
1267                    infoElement.addAttribute(A_ADD_INFO_KEY, info.getAddInfoKey());
1268                }
1269                infoElement.addAttribute(A_EDITABLE, Boolean.toString(info.isEditable()));
1270            }
1271        }
1272
1273        // add the <default-preferences> user settings main node
1274        Element defaultPreferences = workplaceElement.addElement(N_DEFAULTPREFERENCES);
1275
1276        Multimap<String, I_CmsPreference> prefsByTab = Multimaps.index(
1277            m_workplaceManager.getDefaultUserSettings().getPreferences().values(),
1278            new Function<I_CmsPreference, String>() {
1279
1280                public String apply(I_CmsPreference input) {
1281
1282                    return input.getTab();
1283                }
1284            });
1285
1286        for (String tabName : new String[] {
1287            CmsGwtConstants.TAB_BASIC,
1288            CmsGwtConstants.TAB_EXTENDED,
1289            CmsGwtConstants.TAB_HIDDEN}) {
1290            Element preferenceTab = defaultPreferences.addElement(N_PREFERENCE_TAB).addAttribute("name", tabName);
1291            for (I_CmsPreference pref : prefsByTab.get(tabName)) {
1292                Element elem = pref.createConfigurationItem();
1293                if (elem != null) {
1294                    preferenceTab.add(elem);
1295                }
1296            }
1297        }
1298
1299        // add the tool-manager node
1300        Element toolManagerElement = workplaceElement.addElement(N_TOOLMANAGER);
1301        Element rootsElement = toolManagerElement.addElement(N_ROOTS);
1302        Iterator<CmsToolRootHandler> it = m_workplaceManager.getToolManager().getToolRoots().iterator();
1303        while (it.hasNext()) {
1304            CmsToolRootHandler root = it.next();
1305            Element rootElement = rootsElement.addElement(N_ROOT);
1306            rootElement.addElement(N_KEY).addText(root.getKey());
1307            rootElement.addElement(N_URI).addText(root.getUri());
1308            rootElement.addElement(N_NAME).addText(root.getName());
1309            rootElement.addElement(N_HELPTEXT).addText(root.getHelpText());
1310        }
1311        String userListsMode = m_workplaceManager.getUserListModeString();
1312        if (userListsMode != null) {
1313            Element userListsElem = workplaceElement.addElement(N_USER_LISTS);
1314            userListsElem.addAttribute(A_MODE, userListsMode);
1315        }
1316
1317        Boolean keepAlive = m_workplaceManager.isKeepAlive(false);
1318        if (keepAlive != null) {
1319            workplaceElement.addElement(N_KEEP_ALIVE).setText(keepAlive.toString());
1320        }
1321
1322        String defaultScope = m_workplaceManager.getGalleryDefaultScopeString();
1323        if (defaultScope != null) {
1324            workplaceElement.addElement(N_GALLERY_DEFAULT_SCOPE).setText(defaultScope);
1325        }
1326        ElementDeleteMode deleteMode = m_workplaceManager.getElementDeleteMode();
1327        if (deleteMode != null) {
1328            workplaceElement.addElement(N_ELEMENT_DELETE_MODE).setText(deleteMode.name());
1329        }
1330
1331        CmsAdditionalLogFolderConfig.ADD_LOG_FOLDER_HELPER.generateXml(
1332            workplaceElement,
1333            m_workplaceManager.getAdditionalLogFolderConfiguration());
1334
1335        boolean useKeysForNewSites = CmsResourceTypeSubsitemapContentFolder.isEnableNewPageFormatByDefault();
1336        workplaceElement.addElement(N_USE_FORMATTER_KEYS_FOR_NEW_SITES).setText("" + useKeysForNewSites);
1337
1338        // return the configured node
1339        return workplaceElement;
1340    }
1341
1342    /**
1343     * @see org.opencms.configuration.I_CmsXmlConfiguration#getDtdFilename()
1344     */
1345    public String getDtdFilename() {
1346
1347        return CONFIGURATION_DTD_NAME;
1348    }
1349
1350    /**
1351     * Returns the initialized workplace manager.<p>
1352     *
1353     * @return the initialized workplace manager
1354     */
1355    public CmsWorkplaceManager getWorkplaceManager() {
1356
1357        return m_workplaceManager;
1358    }
1359
1360    /**
1361     * Will be called when configuration of this object is finished.<p>
1362     */
1363    public void initializeFinished() {
1364
1365        if (CmsLog.INIT.isInfoEnabled()) {
1366            CmsLog.INIT.info(Messages.get().getBundle().key(Messages.INIT_WORKPLACE_FINISHED_0));
1367        }
1368    }
1369
1370    /**
1371     * Sets the generated workplace manager.<p>
1372     *
1373     * @param manager the workplace manager to set
1374     */
1375    public void setWorkplaceManager(CmsWorkplaceManager manager) {
1376
1377        m_workplaceManager = manager;
1378        if (CmsLog.INIT.isInfoEnabled()) {
1379            CmsLog.INIT.info(Messages.get().getBundle().key(Messages.INIT_WORKPLACE_INIT_FINISHED_0));
1380        }
1381    }
1382
1383    /**
1384     * Adds the digester rules for account info nodes.<p>
1385     *
1386     * @param digester the digester
1387     */
1388    protected void addAccountInfoRules(Digester digester) {
1389
1390        // add account info
1391        String rulePath = "*/" + N_ACCOUNTINFOS + "/" + N_ACCOUNTINFO;
1392        digester.addCallMethod(rulePath, "addAccountInfo", 3);
1393        digester.addCallParam(rulePath, 0, A_FIELD);
1394        digester.addCallParam(rulePath, 1, A_ADD_INFO_KEY);
1395        digester.addCallParam(rulePath, 2, A_EDITABLE);
1396    }
1397
1398    /**
1399     * Adds the digester rules for the defaultaccesscontrol node.<p>
1400     *
1401     * @param digester the digester object
1402     */
1403    protected void addDefaultAccessControlRules(Digester digester) {
1404
1405        digester.addObjectCreate(
1406            "*/" + N_WORKPLACE + "/" + N_EXPLORERTYPES + "/" + N_DEFAULTACCESSCONTROL + "/" + N_ACCESSCONTROL,
1407            CmsExplorerTypeAccess.class);
1408        digester.addSetNext(
1409            "*/" + N_WORKPLACE + "/" + N_EXPLORERTYPES + "/" + N_DEFAULTACCESSCONTROL + "/" + N_ACCESSCONTROL,
1410            "setDefaultAccess");
1411
1412        digester.addCallMethod(
1413            "*/"
1414                + N_WORKPLACE
1415                + "/"
1416                + N_EXPLORERTYPES
1417                + "/"
1418                + N_DEFAULTACCESSCONTROL
1419                + "/"
1420                + N_ACCESSCONTROL
1421                + "/"
1422                + N_ACCESSENTRY,
1423            "addAccessEntry",
1424            2);
1425        digester.addCallParam(
1426            "*/"
1427                + N_WORKPLACE
1428                + "/"
1429                + N_EXPLORERTYPES
1430                + "/"
1431                + N_DEFAULTACCESSCONTROL
1432                + "/"
1433                + N_ACCESSCONTROL
1434                + "/"
1435                + N_ACCESSENTRY,
1436            0,
1437            A_PRINCIPAL);
1438        digester.addCallParam(
1439            "*/"
1440                + N_WORKPLACE
1441                + "/"
1442                + N_EXPLORERTYPES
1443                + "/"
1444                + N_DEFAULTACCESSCONTROL
1445                + "/"
1446                + N_ACCESSCONTROL
1447                + "/"
1448                + N_ACCESSENTRY,
1449            1,
1450            A_PERMISSIONS);
1451    }
1452
1453    /**
1454     * Adds the digester rules for the default-preferences node.<p>
1455     *
1456     * @param digester the digester object
1457     */
1458    protected void addDefaultPreferencesRules(Digester digester) {
1459
1460        // creation of the default user settings
1461        digester.addObjectCreate("*/" + N_WORKPLACE + "/" + N_DEFAULTPREFERENCES, CmsDefaultUserSettings.class);
1462        digester.addSetNext("*/" + N_WORKPLACE + "/" + N_DEFAULTPREFERENCES, "setDefaultUserSettings");
1463
1464        // TODO: most of these settings are not user dependent, so they should not be stored in the CmsDefaultUserSettings class
1465
1466        // add workplace preferences general options rules
1467        String xPathPrefix = "*/"
1468            + N_WORKPLACE
1469            + "/"
1470            + N_DEFAULTPREFERENCES
1471            + "/"
1472            + N_WORKPLACEPREFERENCES
1473            + "/"
1474            + N_WORKPLACEGENERALOPTIONS;
1475        digester.addCallMethod(xPathPrefix + "/" + N_BUTTONSTYLE, "setWorkplaceButtonStyle", 0);
1476        digester.addCallMethod(xPathPrefix + "/" + N_REPORTTYPE, "setWorkplaceReportType", 0);
1477        digester.addCallMethod(xPathPrefix + "/" + N_UPLOADAPPLET, "setUploadVariant", 0);
1478        digester.addCallMethod(xPathPrefix + "/" + N_LISTALLPROJECTS, "setListAllProjects", 0);
1479        digester.addCallMethod(xPathPrefix + "/" + N_PUBLISHNOTIFICATION, "setShowPublishNotification", 0);
1480        digester.addCallMethod(xPathPrefix + "/" + N_PUBLISHBUTTONAPPEARANCE, "setPublishButtonAppearance", 0);
1481        digester.addCallMethod(xPathPrefix + "/" + N_SHOWFILEUPLOADBUTTON, "setShowFileUploadButton", 0);
1482
1483        // add allow broken relations rule
1484        digester.addCallMethod(xPathPrefix + "/" + N_ALLOWBROKENRELATIONS, "setAllowBrokenRelations", 0);
1485
1486        // add publish related resources rule
1487        digester.addCallMethod(xPathPrefix + "/" + N_PUBLISHRELATEDRESOURCES, "setPublishRelatedResourcesMode", 0);
1488
1489        // add rules for the new folder dialog settings
1490        digester.addCallMethod(xPathPrefix + "/" + N_NEWFOLDEREDITPROPERTIES, "setNewFolderEditProperties", 0);
1491        digester.addCallMethod(xPathPrefix + "/" + N_NEWFOLDERCREATEINDEXPAGE, "setNewFolderCreateIndexPage", 0);
1492        digester.addCallMethod(xPathPrefix + "/" + N_SHOWUPLOADTYPEDIALOG, "setShowUploadTypeDialog", 0);
1493        digester.addCallMethod(xPathPrefix + "/" + N_SUBSITEMAP_CREATION_MODE, "setSubsitemapCreationMode", 0);
1494
1495        // add workplace preferences startup settings rules
1496        xPathPrefix = "*/"
1497            + N_WORKPLACE
1498            + "/"
1499            + N_DEFAULTPREFERENCES
1500            + "/"
1501            + N_WORKPLACEPREFERENCES
1502            + "/"
1503            + N_WORKPLACESTARTUPSETTINGS;
1504        digester.addCallMethod(xPathPrefix + "/" + N_LOCALE, "setLocale", 0);
1505        digester.addCallMethod(xPathPrefix + "/" + N_PROJECT, "setStartProject", 0);
1506        digester.addCallMethod(xPathPrefix + "/" + N_WORKPLACEVIEW, "setStartView", 0);
1507        digester.addCallMethod(xPathPrefix + "/" + N_FOLDER, "setStartFolder", 0);
1508        digester.addCallMethod(xPathPrefix + "/" + N_SITE, "setStartSite", 0);
1509        digester.addCallMethod(xPathPrefix + "/" + N_RESTRICTEXPLORERVIEW, "setRestrictExplorerView", 0);
1510
1511        // add workplace search rules
1512        xPathPrefix = "*/"
1513            + N_WORKPLACE
1514            + "/"
1515            + N_DEFAULTPREFERENCES
1516            + "/"
1517            + N_WORKPLACEPREFERENCES
1518            + "/"
1519            + N_WORKPLACESEARCH;
1520        digester.addCallMethod(xPathPrefix + "/" + N_SEARCHINDEXNAME, "setWorkplaceSearchIndexName", 0);
1521        digester.addCallMethod(xPathPrefix + "/" + N_SEARCHVIEWSTYLE, "setWorkplaceSearchViewStyle", 0);
1522
1523        // add explorer preferences generaloptions rules
1524        xPathPrefix = "*/"
1525            + N_WORKPLACE
1526            + "/"
1527            + N_DEFAULTPREFERENCES
1528            + "/"
1529            + N_EXPLORERPREFERENCES
1530            + "/"
1531            + N_EXPLORERGENERALOPTIONS;
1532        digester.addCallMethod(xPathPrefix + "/" + N_BUTTONSTYLE, "setExplorerButtonStyle", 0);
1533        digester.addCallMethod(xPathPrefix + "/" + N_ENTRIES, "setExplorerFileEntries", 0);
1534        digester.addCallMethod(xPathPrefix + "/" + N_ENTRYOPTIONS, "setExplorerFileEntryOptions", 0);
1535
1536        // add explorer display options rules
1537        xPathPrefix = "*/"
1538            + N_WORKPLACE
1539            + "/"
1540            + N_DEFAULTPREFERENCES
1541            + "/"
1542            + N_EXPLORERPREFERENCES
1543            + "/"
1544            + N_EXPLORERDISPLAYOPTIONS;
1545        digester.addCallMethod(xPathPrefix + "/" + N_TITLE, "setShowExplorerFileTitle", 0);
1546        digester.addCallMethod(xPathPrefix + "/" + N_NAVTEXT, "setShowExplorerFileNavText", 0);
1547        digester.addCallMethod(xPathPrefix + "/" + N_TYPE, "setShowExplorerFileType", 0);
1548        digester.addCallMethod(xPathPrefix + "/" + N_DATELASTMODIFIED, "setShowExplorerFileDateLastModified", 0);
1549        digester.addCallMethod(xPathPrefix + "/" + N_DATECREATED, "setShowExplorerFileDateCreated", 0);
1550        digester.addCallMethod(xPathPrefix + "/" + N_LOCKEDBY, "setShowExplorerFileLockedBy", 0);
1551        digester.addCallMethod(xPathPrefix + "/" + N_PERMISSIONS, "setShowExplorerFilePermissions", 0);
1552        digester.addCallMethod(xPathPrefix + "/" + N_SIZE, "setShowExplorerFileSize", 0);
1553        digester.addCallMethod(xPathPrefix + "/" + N_STATE, "setShowExplorerFileState", 0);
1554        digester.addCallMethod(xPathPrefix + "/" + N_USERLASTMODIFIED, "setShowExplorerFileUserLastModified", 0);
1555        digester.addCallMethod(xPathPrefix + "/" + N_USERCREATED, "setShowExplorerFileUserCreated", 0);
1556        digester.addCallMethod(xPathPrefix + "/" + N_DATERELEASED, "setShowExplorerFileDateReleased", 0);
1557        digester.addCallMethod(xPathPrefix + "/" + N_DATEEXPIRED, "setShowExplorerFileDateExpired", 0);
1558
1559        // add dialog preferences rules
1560        xPathPrefix = "*/"
1561            + N_WORKPLACE
1562            + "/"
1563            + N_DEFAULTPREFERENCES
1564            + "/"
1565            + N_DIALOGSPREFERENCES
1566            + "/"
1567            + N_DIALOGSDEFAULTSETTINGS;
1568        digester.addCallMethod(xPathPrefix + "/" + N_FILECOPY, "setDialogCopyFileMode", 0);
1569        digester.addCallMethod(xPathPrefix + "/" + N_FOLDERCOPY, "setDialogCopyFolderMode", 0);
1570        digester.addCallMethod(xPathPrefix + "/" + N_FILEDELETION, "setDialogDeleteFileMode", 0);
1571        digester.addCallMethod(xPathPrefix + "/" + N_DIRECTPUBLISH, "setDialogPublishSiblings", 0);
1572        digester.addCallMethod(xPathPrefix + "/" + N_SHOWLOCK, "setShowLockDialog", 0);
1573        digester.addCallMethod(xPathPrefix + "/" + N_SHOWEXPORTSETTINGS, "setShowExportSettingsDialog", 0);
1574        digester.addCallMethod(
1575            xPathPrefix + "/" + N_PERMISSIONSINHERITONFOLDER,
1576            "setDialogPermissionsInheritOnFolder",
1577            0);
1578        digester.addCallMethod(
1579            xPathPrefix + "/" + N_EXPANDPERMISSIONSINHERITED,
1580            "setDialogExpandInheritedPermissions",
1581            0);
1582        digester.addCallMethod(xPathPrefix + "/" + N_EXPANDPERMISSIONSUSER, "setDialogExpandUserPermissions", 0);
1583
1584        // add editor generaloptions rules
1585        xPathPrefix = "*/"
1586            + N_WORKPLACE
1587            + "/"
1588            + N_DEFAULTPREFERENCES
1589            + "/"
1590            + N_EDITORPREFERENCES
1591            + "/"
1592            + N_EDITORGENERALOPTIONS;
1593        digester.addCallMethod(xPathPrefix + "/" + N_BUTTONSTYLE, "setEditorButtonStyle", 0);
1594        digester.addCallMethod(xPathPrefix + "/" + N_DIRECTEDITSTYLE, "setDirectEditButtonStyle", 0);
1595
1596        // add editor preferrededitor rules
1597        xPathPrefix = "*/"
1598            + N_WORKPLACE
1599            + "/"
1600            + N_DEFAULTPREFERENCES
1601            + "/"
1602            + N_EDITORPREFERENCES
1603            + "/"
1604            + N_EDITORPREFERREDEDITORS;
1605        digester.addCallMethod(xPathPrefix + "/" + N_EDITOR, "setPreferredEditor", 2);
1606        digester.addCallParam(xPathPrefix + "/" + N_EDITOR, 0, A_TYPE);
1607        digester.addCallParam(xPathPrefix + "/" + N_EDITOR, 1, A_VALUE);
1608
1609        // add startgallery rules
1610        xPathPrefix = "*/"
1611            + N_WORKPLACE
1612            + "/"
1613            + N_DEFAULTPREFERENCES
1614            + "/"
1615            + N_GALLERIESPREFERENCES
1616            + "/"
1617            + N_STARTGALLERIES;
1618        digester.addCallMethod(xPathPrefix + "/" + N_STARTGALLERY, "setStartGallery", 2);
1619        digester.addCallParam(xPathPrefix + "/" + N_STARTGALLERY, 0, A_TYPE);
1620        digester.addCallParam(xPathPrefix + "/" + N_STARTGALLERY, 1, A_PATH);
1621
1622        digester.addRule("*/" + N_WORKPLACE + "/" + N_DEFAULTPREFERENCES + "/preference-tab", new Rule() {
1623
1624            @Override
1625            public void begin(String namespace, String name, Attributes attributes) throws Exception {
1626
1627                getDigester().push(attributes.getValue("name"));
1628            }
1629
1630            @Override
1631            public void end(String namespace, String name) throws Exception {
1632
1633                getDigester().pop();
1634            }
1635        });
1636
1637        String prefPath = "*/" + N_WORKPLACE + "/" + N_DEFAULTPREFERENCES + "/preference-tab/" + N_PREFERENCE;
1638        digester.addRule(prefPath, new CallMethodRule(1, "addPreference", 9));
1639        digester.addCallParam(prefPath, 0, A_NAME);
1640        digester.addCallParam(prefPath, 1, A_VALUE);
1641        digester.addCallParam(prefPath, 2, A_WIDGET);
1642        digester.addCallParam(prefPath, 3, A_WIDGET_CONFIG);
1643        digester.addCallParam(prefPath, 4, A_NICE_NAME);
1644        digester.addCallParam(prefPath, 5, A_DESCRIPTION);
1645        digester.addCallParam(prefPath, 6, A_RULE_REGEX);
1646        digester.addCallParam(prefPath, 7, A_ERROR);
1647        digester.addCallParam(prefPath, 8, 0);
1648    }
1649
1650    /**
1651     * Adds the digester rules for the tool-manager node.<p>
1652     *
1653     * @param digester the digester object
1654     */
1655    protected void addToolManagerRules(Digester digester) {
1656
1657        // add tool-manager
1658        String rulePath = "*/" + N_TOOLMANAGER;
1659        digester.addObjectCreate(rulePath, CmsToolManager.class);
1660        digester.addSetNext(rulePath, "setToolManager");
1661        // add tool-manager roots
1662        rulePath += "/" + N_ROOTS + "/" + N_ROOT;
1663        digester.addObjectCreate(rulePath, CmsToolRootHandler.class);
1664        digester.addSetNext(rulePath, "addToolRoot");
1665        digester.addBeanPropertySetter(rulePath + "/" + N_KEY);
1666        digester.addBeanPropertySetter(rulePath + "/" + N_URI);
1667        digester.addBeanPropertySetter(rulePath + "/" + N_NAME);
1668        digester.addBeanPropertySetter(rulePath + "/" + N_HELPTEXT, "helpText");
1669    }
1670
1671    /**
1672     * Adds the digester rules for the user-infos node.<p>
1673     *
1674     * @param digester the digester object
1675     */
1676    protected void addUserInfoRules(Digester digester) {
1677
1678        // add user additional information
1679        String rulePath = "*/" + N_USERINFOS;
1680        digester.addObjectCreate(rulePath, CmsWorkplaceUserInfoManager.class);
1681        digester.addSetNext(rulePath, "setUserInfoManager");
1682        // create a new block
1683        rulePath += "/" + N_INFOBLOCK;
1684        digester.addObjectCreate(rulePath, CmsWorkplaceUserInfoBlock.class);
1685        // set the title
1686        digester.addCallMethod(rulePath, "setTitle", 1);
1687        digester.addCallParam(rulePath, 0, A_NAME);
1688        // add a new entry
1689        digester.addCallMethod(rulePath + "/" + N_USERINFO, "addEntry", 5);
1690        digester.addCallParam(rulePath + "/" + N_USERINFO, 0, A_KEY);
1691        digester.addCallParam(rulePath + "/" + N_USERINFO, 1, A_TYPE);
1692        digester.addCallParam(rulePath + "/" + N_USERINFO, 2, A_WIDGET);
1693        digester.addCallParam(rulePath + "/" + N_USERINFO, 3, A_PARAMS);
1694        digester.addCallParam(rulePath + "/" + N_USERINFO, 4, A_OPTIONAL);
1695        // add the new created block
1696        digester.addSetNext(rulePath, "addBlock");
1697    }
1698
1699    /**
1700     * @see org.opencms.configuration.A_CmsXmlConfiguration#initMembers()
1701     */
1702    @Override
1703    protected void initMembers() {
1704
1705        setXmlFileName(DEFAULT_XML_FILE_NAME);
1706        if (CmsLog.INIT.isInfoEnabled()) {
1707            CmsLog.INIT.info(Messages.get().getBundle().key(Messages.INIT_WORKPLACE_INIT_0));
1708        }
1709    }
1710
1711}