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