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, 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.ade.sitemap.shared; 029 030import org.opencms.gwt.shared.CmsContextMenuEntryBean; 031import org.opencms.gwt.shared.CmsListInfoBean; 032import org.opencms.gwt.shared.property.CmsClientProperty; 033import org.opencms.gwt.shared.property.CmsClientTemplateBean; 034import org.opencms.util.CmsUUID; 035import org.opencms.xml.content.CmsXmlContentProperty; 036 037import java.util.List; 038import java.util.Map; 039 040import com.google.gwt.user.client.rpc.IsSerializable; 041 042/** 043 * Sitemap initialization data bean for prefetching.<p> 044 * 045 * @since 8.0 046 */ 047public class CmsSitemapData implements IsSerializable { 048 049 /** The sitemap editor modes. */ 050 public enum EditorMode { 051 /** The categories mode. */ 052 categories, 053 /** Locale comparison mode. */ 054 compareLocales, 055 /** The galleries mode. */ 056 galleries, 057 /** The model page mode. */ 058 modelpages, 059 060 /** The navigation mode. */ 061 navigation, 062 063 /** The VFS mode. */ 064 vfs; 065 } 066 067 /** Name of the used js variable. */ 068 public static final String DICT_NAME = "org_opencms_ade_sitemap"; 069 070 /** The URL of the JSP used to import aliases. */ 071 private String m_aliasImportUrl; 072 073 /** The list of property names. */ 074 private List<String> m_allPropertyNames; 075 076 /** Flag to indicate whether the user can open the alias editor. */ 077 private boolean m_canEditAliases; 078 079 /** Flag to indicate whether detail pages can be edited. */ 080 private boolean m_canEditDetailPages; 081 082 /** Flag indicating whether user is category manager. */ 083 private boolean m_categoryManager; 084 085 /** The clipboard data. */ 086 private CmsSitemapClipboardData m_clipboardData; 087 088 /** The sitemap context menu entries. */ 089 private List<CmsContextMenuEntryBean> m_contextMenuEntries; 090 091 /** A flag which controls whether a new folder should be created for subsitemaps. */ 092 private boolean m_createNewFolderForSubsitemap; 093 094 /** The default gallery parent folder. */ 095 private String m_defaultGalleryFolder; 096 097 /** The default info bean for new elements. **/ 098 private CmsNewResourceInfo m_defaultNewElementInfo; 099 100 /** The detail page table. */ 101 private CmsDetailPageTable m_detailPageTable; 102 103 /** Flag to control the display of the toolbar. */ 104 private boolean m_displayToolbar; 105 106 /** The editor mode. */ 107 private EditorMode m_editorMode; 108 109 /** The export RFS prefix. */ 110 private String m_exportRfsPrefix; 111 112 /** Flag indicating whether user is gallery manager. */ 113 private boolean m_galleryManager; 114 115 /** A flag which indicates whether the site which contains the sitemap is a secure site. */ 116 private boolean m_isSecure; 117 118 /** Flag which controls if the 'locale compare mode' should be available. */ 119 private boolean m_localeComparisonEnabled; 120 121 /** The maximum sitemap depth. */ 122 private int m_maxDepth; 123 124 /** The new element information. */ 125 private List<CmsNewResourceInfo> m_newElementInfos; 126 127 /** The new navigation level element info. */ 128 private CmsNewResourceInfo m_newNavigatioLevelElementInfo; 129 130 /** The new redirect element info. */ 131 private CmsNewResourceInfo m_newRedirectElementInfo; 132 133 /** The reason why the current sitemap is not editable. */ 134 private String m_noEditReason; 135 136 /** The path at which the sitemap should be opened, or null. */ 137 private String m_openPath; 138 139 /** The properties of the root's parent. */ 140 private Map<String, CmsClientProperty> m_parentProperties; 141 142 /** The path to the parent sitemap or <code>null</code>. */ 143 private String m_parentSitemap; 144 145 /** The sitemap properties. */ 146 private Map<String, CmsXmlContentProperty> m_properties; 147 148 /** The resource type information. */ 149 private List<CmsNewResourceInfo> m_resourceTypeInfos; 150 151 /** The return page code. */ 152 private String m_returnCode; 153 154 /** The sitemap root. */ 155 private CmsClientSitemapEntry m_root; 156 157 /** The show model edit confirm dialog flag. */ 158 private boolean m_showModelEditConfirm; 159 160 /** The list info beans for possible sitemap folder types. */ 161 private List<CmsListInfoBean> m_sitemapFolderTypeInfos; 162 163 /** The sitemap info. */ 164 private CmsSitemapInfo m_sitemapInfo; 165 166 /** The structure id of the site root. */ 167 private CmsUUID m_siteRootId; 168 169 /** The available templates. */ 170 private Map<String, CmsClientTemplateBean> m_templates; 171 172 /** 173 * Constructor.<p> 174 */ 175 public CmsSitemapData() { 176 177 // empty 178 } 179 180 /** 181 * Constructor.<p> 182 * 183 * @param templates the available templates 184 * @param properties the properties 185 * @param clipboardData the clipboard data 186 * @param contextMenuEntries the sitemap context menu entries 187 * @param parentProperties the root entry's parent's inherited properties 188 * @param allPropNames the names of all properties 189 * @param exportRfsPrefix the export RFS prefix 190 * @param isSecure true if there is a secure server configuration for the site which contains the sitemap 191 * @param noEditReason the reason why the current sitemap is not editable 192 * @param displayToolbar the flag to control the display of the toolbar 193 * @param defaultNewElementInfo the type of the container page resource 194 * @param newElementInfos the new element information 195 * @param newRedirectElementInfo the new redirect element info 196 * @param newNavigationLevelElementInfo the new navigation level element info 197 * @param sitemapInfo the sitemap info bean 198 * @param parentSitemap the path to the parent sitemap or <code>null</code> 199 * @param root the sitemap root 200 * @param openPath the path at which the sitemap should be opened 201 * @param maxDepth the maximum sitemap depth 202 * @param detailPageTable the detail page table 203 * @param resourceTypeInfos the resource type information for the detail pages 204 * @param returnCode return page code 205 * @param canEditDetailPages flag to indicate whether detail pages can be edited 206 * @param aliasImportUrl the URL of the JSP used to import aliases 207 * @param canEditAliases flag to indicate whether the current user can edit the alias table 208 * @param createNewFoldersForSubsitemaps flag to control whether new folders should be created for subsitemaps 209 * @param galleryManager true if the user is a gallery manager 210 * @param categoryManager true if the user is a category manager 211 * @param subsitemapTypeInfos the type information beans for the available subsitemap folder types 212 * @param editorMode the editor mode 213 * @param defaultGalleryFolder default gallery parent folder 214 * @param showModelEditConfirm the show model edit confirm dialog flag 215 */ 216 public CmsSitemapData( 217 Map<String, CmsClientTemplateBean> templates, 218 Map<String, CmsXmlContentProperty> properties, 219 CmsSitemapClipboardData clipboardData, 220 List<CmsContextMenuEntryBean> contextMenuEntries, 221 Map<String, CmsClientProperty> parentProperties, 222 List<String> allPropNames, 223 String exportRfsPrefix, 224 boolean isSecure, 225 String noEditReason, 226 boolean displayToolbar, 227 CmsNewResourceInfo defaultNewElementInfo, 228 List<CmsNewResourceInfo> newElementInfos, 229 CmsNewResourceInfo newRedirectElementInfo, 230 CmsNewResourceInfo newNavigationLevelElementInfo, 231 CmsSitemapInfo sitemapInfo, 232 String parentSitemap, 233 CmsClientSitemapEntry root, 234 String openPath, 235 int maxDepth, 236 CmsDetailPageTable detailPageTable, 237 List<CmsNewResourceInfo> resourceTypeInfos, 238 String returnCode, 239 boolean canEditDetailPages, 240 String aliasImportUrl, 241 boolean canEditAliases, 242 boolean createNewFoldersForSubsitemaps, 243 boolean galleryManager, 244 boolean categoryManager, 245 List<CmsListInfoBean> subsitemapTypeInfos, 246 EditorMode editorMode, 247 String defaultGalleryFolder, 248 boolean showModelEditConfirm) { 249 250 m_templates = templates; 251 m_properties = properties; 252 m_clipboardData = clipboardData; 253 m_contextMenuEntries = contextMenuEntries; 254 m_noEditReason = noEditReason; 255 m_displayToolbar = displayToolbar; 256 m_defaultNewElementInfo = defaultNewElementInfo; 257 m_sitemapInfo = sitemapInfo; 258 m_parentSitemap = parentSitemap; 259 m_parentProperties = parentProperties; 260 m_root = root; 261 m_openPath = openPath; 262 m_exportRfsPrefix = exportRfsPrefix; 263 m_isSecure = isSecure; 264 m_maxDepth = maxDepth; 265 m_detailPageTable = detailPageTable; 266 m_resourceTypeInfos = resourceTypeInfos; 267 m_canEditDetailPages = canEditDetailPages; 268 m_allPropertyNames = allPropNames; 269 m_returnCode = returnCode; 270 m_newElementInfos = newElementInfos; 271 m_newRedirectElementInfo = newRedirectElementInfo; 272 m_newNavigatioLevelElementInfo = newNavigationLevelElementInfo; 273 m_aliasImportUrl = aliasImportUrl; 274 m_canEditAliases = canEditAliases; 275 m_createNewFolderForSubsitemap = createNewFoldersForSubsitemaps; 276 m_galleryManager = galleryManager; 277 m_categoryManager = categoryManager; 278 m_sitemapFolderTypeInfos = subsitemapTypeInfos; 279 m_editorMode = editorMode; 280 m_defaultGalleryFolder = defaultGalleryFolder; 281 m_showModelEditConfirm = showModelEditConfirm; 282 } 283 284 /** 285 * Checks whether the current user can edit the aliases.<p> 286 * 287 * @return true if the current user can edit the aliases 288 */ 289 public boolean canEditAliases() { 290 291 return m_canEditAliases; 292 293 } 294 295 /** 296 * Returns true if the detail pages can be edited. 297 * 298 * @return true if the detail pages can be edited 299 */ 300 public boolean canEditDetailPages() { 301 302 return m_canEditDetailPages && (m_resourceTypeInfos != null) && !m_resourceTypeInfos.isEmpty(); 303 } 304 305 /** 306 * Gets the URL of the JSP used to import aliases.<p> 307 * 308 * @return the alias import URL 309 */ 310 public String getAliasImportUrl() { 311 312 return m_aliasImportUrl; 313 } 314 315 /** 316 * Returns the names of all properties.<p> 317 * 318 * @return the names of all properties 319 */ 320 public List<String> getAllPropertyNames() { 321 322 return m_allPropertyNames; 323 } 324 325 /** 326 * Returns the clipboard data.<p> 327 * 328 * @return the clipboard data 329 */ 330 public CmsSitemapClipboardData getClipboardData() { 331 332 return m_clipboardData; 333 } 334 335 /** 336 * Returns the sitemap context menu entries.<p> 337 * 338 * @return the sitemap context menu entries 339 */ 340 public List<CmsContextMenuEntryBean> getContextMenuEntries() { 341 342 return m_contextMenuEntries; 343 } 344 345 /** 346 * Returns the default gallery parent folder.<p> 347 * 348 * @return the default gallery parent folder 349 */ 350 public String getDefaultGalleryFolder() { 351 352 return m_defaultGalleryFolder; 353 } 354 355 /** 356 * Returns the type of the container page resource.<p> 357 * 358 * @return the type of the container page resource 359 */ 360 public CmsNewResourceInfo getDefaultNewElementInfo() { 361 362 return m_defaultNewElementInfo; 363 } 364 365 /** 366 * Gets the detail page table. 367 * 368 * @return the detail page table 369 */ 370 public CmsDetailPageTable getDetailPageTable() { 371 372 return m_detailPageTable; 373 } 374 375 /** 376 * Returns the editor mode.<p> 377 * 378 * @return the editor mode 379 */ 380 public EditorMode getEditorMode() { 381 382 return m_editorMode; 383 } 384 385 /** 386 * Returns the export RFS prefix.<p> 387 * 388 * @return the export RFS prefix 389 */ 390 public String getExportRfsPrefix() { 391 392 return m_exportRfsPrefix; 393 } 394 395 /** 396 * Returns the maximum sitemap depth.<p> 397 * 398 * @return the maximum sitemap depth 399 */ 400 public int getMaxDepth() { 401 402 return m_maxDepth; 403 } 404 405 /** 406 * Returns the new element information.<p> 407 * 408 * @return the new element information 409 */ 410 public List<CmsNewResourceInfo> getNewElementInfos() { 411 412 return m_newElementInfos; 413 } 414 415 /** 416 * Returns the new navigation level element info.<p> 417 * 418 * @return the new navigation level element info 419 */ 420 public CmsNewResourceInfo getNewNavigationLevelElementInfo() { 421 422 return m_newNavigatioLevelElementInfo; 423 } 424 425 /** 426 * Returns the new redirect element info.<p> 427 * 428 * @return the new redirect element info 429 */ 430 public CmsNewResourceInfo getNewRedirectElementInfo() { 431 432 return m_newRedirectElementInfo; 433 } 434 435 /** 436 * Gets the new resource info with a given structure id.<p> 437 * 438 * @param id the structure id 439 * 440 * @return the new resource info with the given id 441 */ 442 public CmsNewResourceInfo getNewResourceInfoById(CmsUUID id) { 443 444 if (m_newElementInfos != null) { 445 for (CmsNewResourceInfo info : m_newElementInfos) { 446 if (info.getCopyResourceId().equals(id)) { 447 return info; 448 } 449 } 450 } 451 return null; 452 } 453 454 /** 455 * Returns the reason why the current sitemap is not editable.<p> 456 * 457 * @return the reason why the current sitemap is not editable 458 */ 459 public String getNoEditReason() { 460 461 return m_noEditReason; 462 } 463 464 /** 465 * Gets the path at which the sitemap should be opened (may be null).<p> 466 * 467 * @return the path at which the sitemap should be opened 468 */ 469 public String getOpenPath() { 470 471 return m_openPath; 472 } 473 474 /** 475 * Returns the properties of the sitemap root's parent.<p> 476 * 477 * @return the properties of the sitemap root'S parent 478 */ 479 public Map<String, CmsClientProperty> getParentProperties() { 480 481 return m_parentProperties; 482 } 483 484 /** 485 * Returns the path to the parent sitemap or <code>null</code>.<p> 486 * 487 * @return the path to the parent sitemap or <code>null</code> 488 */ 489 public String getParentSitemap() { 490 491 return m_parentSitemap; 492 } 493 494 /** 495 * Returns the properties.<p> 496 * 497 * @return the properties 498 */ 499 public Map<String, CmsXmlContentProperty> getProperties() { 500 501 return m_properties; 502 } 503 504 /** 505 * Gets the resource type info beans for the detail pages.<p> 506 * 507 * @return the resource type info beans for the detail pages 508 */ 509 public List<CmsNewResourceInfo> getResourceTypeInfos() { 510 511 return m_resourceTypeInfos; 512 } 513 514 /** 515 * Returns the return page code.<p> 516 * 517 * @return the return page code 518 */ 519 public String getReturnCode() { 520 521 return m_returnCode; 522 } 523 524 /** 525 * Returns the sitemap root.<p> 526 * 527 * @return the sitemap root 528 */ 529 public CmsClientSitemapEntry getRoot() { 530 531 return m_root; 532 } 533 534 /** 535 * Returns the sitemap info.<p> 536 * 537 * @return the sitemap info 538 */ 539 public CmsSitemapInfo getSitemapInfo() { 540 541 return m_sitemapInfo; 542 } 543 544 /** 545 * Gets the structure id of the site root.<p> 546 * 547 * @return the structure id of the site root 548 */ 549 public CmsUUID getSiteRootId() { 550 551 return m_siteRootId; 552 } 553 554 /** 555 * Returns the list info beans for the available sitemap folder types.<p> 556 * 557 * @return the list info beans for the available sitemap folder types 558 */ 559 public List<CmsListInfoBean> getSubsitemapFolderTypeInfos() { 560 561 return m_sitemapFolderTypeInfos; 562 } 563 564 /** 565 * Returns the available templates.<p> 566 * 567 * @return the available templates 568 */ 569 public Map<String, CmsClientTemplateBean> getTemplates() { 570 571 return m_templates; 572 } 573 574 /** 575 * Returns if the current user has the category manager role.<p> 576 * 577 * @return if the current user has the category manager role 578 */ 579 public boolean isCategoryManager() { 580 581 return m_categoryManager; 582 } 583 584 /** 585 * Returns true if new folders should be created for subsitemaps.<p> 586 * 587 * @return true if new folders should be created for subsitemaps 588 */ 589 public boolean isCreateNewFoldersForSubsitemaps() { 590 591 return m_createNewFolderForSubsitemap; 592 } 593 594 /** 595 * Checks if to display the toolbar.<p> 596 * 597 * @return <code>true</code> if to display the toolbar 598 */ 599 public boolean isDisplayToolbar() { 600 601 return m_displayToolbar; 602 } 603 604 /** 605 * Returns if the current user has the gallery manager role.<p> 606 * 607 * @return if the current user has the gallery manager role 608 */ 609 public boolean isGalleryManager() { 610 611 return m_galleryManager; 612 } 613 614 /** 615 * Returns true if the locale compare mode is enabled.<p> 616 * 617 * @return true if the locale compare mode is enabled 618 */ 619 public boolean isLocaleComparisonEnabled() { 620 621 return m_localeComparisonEnabled; 622 } 623 624 /** 625 * Returns true if there is a secure server configured for the site which contains the sitemap.<p> 626 * 627 * @return true if there is a secure server configured for the site which contains the sitemap 628 */ 629 public boolean isSecure() { 630 631 return m_isSecure; 632 } 633 634 /** 635 * Returns the show model edit confirm dialog flag.<p> 636 * 637 * @return the show model edit confirm dialog flag 638 */ 639 public boolean isShowModelEditConfirm() { 640 641 return m_showModelEditConfirm; 642 } 643 644 /** 645 * Sets the 'locale comparison mode enabled' flag.<p> 646 * 647 * @param enabled the new flag value 648 */ 649 public void setLocaleComparisonEnabled(boolean enabled) { 650 651 m_localeComparisonEnabled = enabled; 652 } 653 654 /** 655 * Sets the new element infos.<p> 656 * 657 * @param newElementInfos the new element infos 658 */ 659 public void setNewElementInfos(List<CmsNewResourceInfo> newElementInfos) { 660 661 m_newElementInfos = newElementInfos; 662 } 663 664 /** 665 * Sets the return page code.<p> 666 * 667 * @param returnCode the return page code to set 668 */ 669 public void setReturnCode(String returnCode) { 670 671 m_returnCode = returnCode; 672 } 673 674 /** 675 * Sets the site root structure id .<p> 676 * 677 * @param id the site root id 678 */ 679 public void setSiteRootId(CmsUUID id) { 680 681 m_siteRootId = id; 682 } 683 684}