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