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