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