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