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