1 31 32 package org.opencms.workplace; 33 34 import org.opencms.db.CmsPublishList; 35 import org.opencms.db.CmsUserSettings; 36 import org.opencms.file.CmsResource; 37 import org.opencms.file.CmsUser; 38 import org.opencms.file.collectors.I_CmsResourceCollector; 39 import org.opencms.i18n.CmsMessageContainer; 40 import org.opencms.main.OpenCms; 41 import org.opencms.workplace.explorer.CmsExplorer; 42 import org.opencms.workplace.tools.CmsToolUserData; 43 44 import java.util.HashMap ; 45 import java.util.Map ; 46 47 57 public class CmsWorkplaceSettings { 58 59 private I_CmsResourceCollector m_collector; 60 private String m_currentSite; 61 private Object m_dialogObject; 62 private CmsMessageContainer m_errorMessage; 63 private String m_explorerFlaturl; 64 private String m_explorerMode; 65 private int m_explorerPage; 66 private String m_explorerProjectFilter; 67 private int m_explorerProjectId; 68 private Map m_explorerResource; 69 private boolean m_explorerShowLinks; 70 private Map m_frameUris; 71 private String m_galleryType; 72 private Map m_lastUsedGalleries; 73 private Object m_listObject; 74 private String m_permissionDetailView; 75 private int m_project; 76 private CmsPublishList m_publishList; 77 private Map m_resourceTypes; 78 private CmsToolUserData m_toolUserData; 79 private Map m_treeSite; 80 private Map m_treeType; 81 private CmsUser m_user; 82 private CmsUserSettings m_userSettings; 83 private String m_viewStartup; 84 private String m_viewUri; 85 86 89 CmsWorkplaceSettings() { 90 91 m_explorerPage = 1; 92 m_explorerResource = new HashMap (); 93 m_treeType = new HashMap (); 94 m_treeSite = new HashMap (); 95 m_resourceTypes = new HashMap (); 96 m_frameUris = new HashMap (); 97 m_lastUsedGalleries = new HashMap (); 98 m_currentSite = OpenCms.getSiteManager().getDefaultSite().getSiteRoot(); 99 } 100 101 109 public I_CmsResourceCollector getCollector() { 110 111 return m_collector; 112 } 113 114 123 public Object getDialogObject() { 124 125 return m_dialogObject; 126 } 127 128 133 public CmsMessageContainer getErrorMessage() { 134 135 return m_errorMessage; 136 } 137 138 143 public String getExplorerFlaturl() { 144 145 return m_explorerFlaturl; 146 } 147 148 153 public String getExplorerMode() { 154 155 return m_explorerMode; 156 } 157 158 163 public int getExplorerPage() { 164 165 return m_explorerPage; 166 } 167 168 176 public String getExplorerProjectFilter() { 177 178 return m_explorerProjectFilter; 179 } 180 181 189 public int getExplorerProjectId() { 190 191 return m_explorerProjectId; 192 } 193 194 199 public String getExplorerResource() { 200 201 String mode = getExplorerMode(); 203 if (mode == null) { 204 mode = CmsExplorer.VIEW_EXPLORER; 205 } 206 if (CmsExplorer.VIEW_EXPLORER.equals(mode)) { 207 mode += "_" + getSite() + "/"; 209 } 210 String resource = (String )m_explorerResource.get(mode); 212 if (resource == null) { 213 resource = "/"; 214 } 215 return resource; 216 } 217 218 223 public boolean getExplorerShowLinks() { 224 225 return m_explorerShowLinks; 226 } 227 228 233 public Map getFrameUris() { 234 235 return m_frameUris; 236 } 237 238 243 public String getGalleryType() { 244 245 return m_galleryType; 246 } 247 248 254 public String getLastUsedGallery(int galleryTypeId) { 255 256 return (String )m_lastUsedGalleries.get(String.valueOf(galleryTypeId)); 257 } 258 259 271 public Object getListObject() { 272 273 return m_listObject; 274 } 275 276 281 public String getPermissionDetailView() { 282 283 return m_permissionDetailView; 284 } 285 286 291 public int getProject() { 292 293 return m_project; 294 } 295 296 301 public CmsPublishList getPublishList() { 302 303 return m_publishList; 304 } 305 306 311 public Map getResourceTypes() { 312 313 return m_resourceTypes; 314 } 315 316 321 public String getSite() { 322 323 return m_currentSite; 324 } 325 326 331 public CmsToolUserData getToolUserData() { 332 333 return m_toolUserData; 334 } 335 336 342 public String getTreeResource(String type) { 343 344 String result = (String )m_treeType.get(type); 345 if (result == null) { 346 result = "/"; 347 } 348 return result; 349 } 350 351 357 public String getTreeSite(String type) { 358 359 String result = (String )m_treeSite.get(type); 360 return result; 361 } 362 363 368 public CmsUser getUser() { 369 370 return m_user; 371 } 372 373 378 public CmsUserSettings getUserSettings() { 379 380 return m_userSettings; 381 } 382 383 391 public String getViewStartup() { 392 393 return m_viewStartup; 394 } 395 396 401 public String getViewUri() { 402 403 return m_viewUri; 404 } 405 406 411 public boolean isViewAdministration() { 412 413 return (getViewUri().endsWith("/system/workplace/action/administration.html") || getViewUri().endsWith( 414 "/system/workplace/action/tasks.html")); 415 } 416 417 422 public boolean isViewExplorer() { 423 424 return getViewUri().endsWith(CmsWorkplace.FILE_EXPLORER_FILELIST); 425 } 426 427 435 public void setCollector(I_CmsResourceCollector collector) { 436 437 m_collector = collector; 438 } 439 440 449 public void setDialogObject(Object dialogObject) { 450 451 m_dialogObject = dialogObject; 452 } 453 454 459 public void setErrorMessage(CmsMessageContainer errorMessage) { 460 461 m_errorMessage = errorMessage; 462 } 463 464 469 public void setExplorerFlaturl(String value) { 470 471 m_explorerFlaturl = value; 472 } 473 474 479 public void setExplorerMode(String value) { 480 481 m_explorerMode = value; 482 } 483 484 489 public void setExplorerPage(int page) { 490 491 m_explorerPage = page; 492 } 493 494 499 public void setExplorerProjectFilter(String value) { 500 501 m_explorerProjectFilter = value; 502 } 503 504 509 public void setExplorerProjectId(int value) { 510 511 m_explorerProjectId = value; 512 } 513 514 519 public synchronized void setExplorerResource(String value) { 520 521 if (value == null) { 522 return; 523 } 524 String mode = getExplorerMode(); 526 if (mode == null) { 527 mode = CmsExplorer.VIEW_EXPLORER; 528 } 529 if (CmsExplorer.VIEW_EXPLORER.equals(mode)) { 530 mode += "_" + getSite() + "/"; 532 } 533 534 if (value.startsWith(CmsResource.VFS_FOLDER_SYSTEM + "/") 536 && (!value.startsWith(m_currentSite)) 537 && (!CmsExplorer.VIEW_GALLERY.equals(getExplorerMode()))) { 538 m_explorerResource.put(mode, "/"); 540 } else { 541 m_explorerResource.put(mode, value); 542 } 543 } 544 545 550 public void setExplorerShowLinks(boolean b) { 551 552 m_explorerShowLinks = b; 553 } 554 555 560 public void setGalleryType(String currentGallery) { 561 562 m_galleryType = currentGallery; 563 } 564 565 571 public void setLastUsedGallery(int galleryTypeId, String gallerypath) { 572 573 m_lastUsedGalleries.put(String.valueOf(galleryTypeId), gallerypath); 574 } 575 576 588 public void setListObject(Object listObject) { 589 590 m_listObject = listObject; 591 } 592 593 598 public void setPermissionDetailView(String value) { 599 600 m_permissionDetailView = value; 601 } 602 603 608 public void setProject(int project) { 609 610 m_project = project; 611 } 612 613 618 public void setPublishList(CmsPublishList publishList) { 619 620 m_publishList = publishList; 621 } 622 623 628 public void setResourceTypes(Map value) { 629 630 m_resourceTypes = value; 631 } 632 633 638 public void setSite(String value) { 639 640 if ((value != null) && !value.equals(m_currentSite)) { 641 m_currentSite = value; 642 m_treeType = new HashMap (); 643 } 644 } 645 646 651 public void setToolUserData(CmsToolUserData toolUserData) { 652 653 m_toolUserData = toolUserData; 654 } 655 656 662 public void setTreeResource(String type, String value) { 663 664 if (value == null) { 665 return; 666 } 667 if (value.startsWith(CmsResource.VFS_FOLDER_SYSTEM + "/") && (!value.startsWith(m_currentSite))) { 668 value = "/"; 670 } 671 m_treeType.put(type, value); 672 } 673 674 680 public void setTreeSite(String type, String value) { 681 682 if (value == null) { 683 return; 684 } 685 m_treeSite.put(type, value); 686 } 687 688 693 public void setUser(CmsUser user) { 694 695 m_user = user; 696 } 697 698 703 public void setUserSettings(CmsUserSettings userSettings) { 704 705 m_userSettings = userSettings; 706 } 707 708 716 public void setViewStartup(String viewStartup) { 717 718 m_viewStartup = viewStartup; 719 } 720 721 726 public void setViewUri(String string) { 727 728 m_viewUri = string; 729 } 730 } | Popular Tags |