001    /**
002     * Copyright (c) 2000-2011 Liferay, Inc. All rights reserved.
003     *
004     * This library is free software; you can redistribute it and/or modify it under
005     * the terms of the GNU Lesser General Public License as published by the Free
006     * Software Foundation; either version 2.1 of the License, or (at your option)
007     * any later version.
008     *
009     * This library is distributed in the hope that it will be useful, but WITHOUT
010     * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
011     * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
012     * details.
013     */
014    
015    package com.liferay.portal.theme;
016    
017    import com.liferay.portal.kernel.exception.PortalException;
018    import com.liferay.portal.kernel.exception.SystemException;
019    import com.liferay.portal.kernel.language.LanguageUtil;
020    import com.liferay.portal.kernel.log.Log;
021    import com.liferay.portal.kernel.log.LogFactoryUtil;
022    import com.liferay.portal.kernel.mobile.device.Device;
023    import com.liferay.portal.kernel.util.Http;
024    import com.liferay.portal.kernel.util.LocaleThreadLocal;
025    import com.liferay.portal.kernel.util.StringPool;
026    import com.liferay.portal.kernel.util.TimeZoneThreadLocal;
027    import com.liferay.portal.kernel.util.Validator;
028    import com.liferay.portal.model.Account;
029    import com.liferay.portal.model.ColorScheme;
030    import com.liferay.portal.model.Company;
031    import com.liferay.portal.model.Contact;
032    import com.liferay.portal.model.Group;
033    import com.liferay.portal.model.Layout;
034    import com.liferay.portal.model.LayoutSet;
035    import com.liferay.portal.model.LayoutTypePortlet;
036    import com.liferay.portal.model.Theme;
037    import com.liferay.portal.model.ThemeSetting;
038    import com.liferay.portal.model.User;
039    import com.liferay.portal.security.permission.PermissionChecker;
040    import com.liferay.portal.service.GroupLocalServiceUtil;
041    import com.liferay.portal.service.LayoutLocalServiceUtil;
042    import com.liferay.portlet.mobiledevicerules.model.MDRRuleGroupInstance;
043    
044    import java.io.Serializable;
045    
046    import java.util.List;
047    import java.util.Locale;
048    import java.util.Map;
049    import java.util.Properties;
050    import java.util.TimeZone;
051    
052    import javax.portlet.PortletURL;
053    
054    /**
055     * @author Brian Wing Shun Chan
056     */
057    public class ThemeDisplay implements Serializable {
058    
059            public ThemeDisplay() {
060                    if (_log.isDebugEnabled()) {
061                            _log.debug("Creating new instance " + hashCode());
062                    }
063    
064                    _portletDisplay.setThemeDisplay(this);
065            }
066    
067            public Account getAccount() {
068                    return _account;
069            }
070    
071            public String getCDNHost() {
072                    return _cdnHost;
073            }
074    
075            public ColorScheme getColorScheme() {
076                    return _colorScheme;
077            }
078    
079            public String getColorSchemeId() {
080                    return _colorScheme.getColorSchemeId();
081            }
082    
083            public Company getCompany() {
084                    return _company;
085            }
086    
087            public long getCompanyGroupId() {
088                    return _companyGroupId;
089            }
090    
091            public long getCompanyId() {
092                    return _company.getCompanyId();
093            }
094    
095            public String getCompanyLogo() {
096                    return _companyLogo;
097            }
098    
099            public int getCompanyLogoHeight() {
100                    return _companyLogoHeight;
101            }
102    
103            public int getCompanyLogoWidth() {
104                    return _companyLogoWidth;
105            }
106    
107            public Contact getContact() {
108                    return _contact;
109            }
110    
111            public String getControlPanelCategory() {
112                    return _controlPanelCategory;
113            }
114    
115            public User getDefaultUser() throws PortalException, SystemException {
116                    if (_defaultUser == null) {
117                            _defaultUser = _company.getDefaultUser();
118                    }
119    
120                    return _defaultUser;
121            }
122    
123            public long getDefaultUserId() throws PortalException, SystemException {
124                    return getDefaultUser().getUserId();
125            }
126    
127            public Device getDevice() {
128                    return _device;
129            }
130    
131            public long getDoAsGroupId() {
132                    return _doAsGroupId;
133            }
134    
135            public String getDoAsUserId() {
136                    return _doAsUserId;
137            }
138    
139            public String getDoAsUserLanguageId() {
140                    return _doAsUserLanguageId;
141            }
142    
143            public String getFacebookCanvasPageURL() {
144                    return _facebookCanvasPageURL;
145            }
146    
147            public String getI18nLanguageId() {
148                    return _i18nLanguageId;
149            }
150    
151            public String getI18nPath() {
152                    return _i18nPath;
153            }
154    
155            public String getLanguageId() {
156                    return _languageId;
157            }
158    
159            public Layout getLayout() {
160                    return _layout;
161            }
162    
163            public List<Layout> getLayouts() {
164                    return _layouts;
165            }
166    
167            public LayoutSet getLayoutSet() {
168                    return _layoutSet;
169            }
170    
171            public String getLayoutSetLogo() {
172                    return _layoutSetLogo;
173            }
174    
175            public LayoutTypePortlet getLayoutTypePortlet() {
176                    return _layoutTypePortlet;
177            }
178    
179            public String getLifecycle() {
180                    return _lifecycle;
181            }
182    
183            public Locale getLocale() {
184                    return _locale;
185            }
186    
187            public MDRRuleGroupInstance getMDRRuleGroupInstance() {
188                    return _mdrRuleGroupInstance;
189            }
190    
191            public Group getParentGroup() {
192                    return _parentGroup;
193            }
194    
195            public long getParentGroupId() {
196                    return _parentGroupId;
197            }
198    
199            public String getParentGroupName() throws PortalException, SystemException {
200                    if (_parentGroup == null) {
201                            return StringPool.BLANK;
202                    }
203                    else {
204                            return _parentGroup.getDescriptiveName();
205                    }
206            }
207    
208            public String getPathApplet() {
209                    return _pathApplet;
210            }
211    
212            public String getPathCms() {
213                    return _pathCms;
214            }
215    
216            public String getPathColorSchemeImages() {
217                    return _pathColorSchemeImages;
218            }
219    
220            public String getPathContext() {
221                    return _pathContext;
222            }
223    
224            public String getPathFlash() {
225                    return _pathFlash;
226            }
227    
228            public String getPathFriendlyURLPrivateGroup() {
229                    return _pathFriendlyURLPrivateGroup;
230            }
231    
232            public String getPathFriendlyURLPrivateUser() {
233                    return _pathFriendlyURLPrivateUser;
234            }
235    
236            public String getPathFriendlyURLPublic() {
237                    return _pathFriendlyURLPublic;
238            }
239    
240            public String getPathImage() {
241                    return _pathImage;
242            }
243    
244            public String getPathJavaScript() {
245                    return _pathJavaScript;
246            }
247    
248            public String getPathMain() {
249                    return _pathMain;
250            }
251    
252            public String getPathSound() {
253                    return _pathSound;
254            }
255    
256            public String getPathThemeCss() {
257                    return _pathThemeCss;
258            }
259    
260            /**
261             * @deprecated Use <code>getPathThemeImages</code>.
262             */
263            public String getPathThemeImage() {
264                    return getPathThemeImages();
265            }
266    
267            public String getPathThemeImages() {
268                    return _pathThemeImages;
269            }
270    
271            public String getPathThemeJavaScript() {
272                    return _pathThemeJavaScript;
273            }
274    
275            public String getPathThemeRoot() {
276                    return _pathThemeRoot;
277            }
278    
279            public String getPathThemeTemplates() {
280                    return _pathThemeTemplates;
281            }
282    
283            public PermissionChecker getPermissionChecker() {
284                    return _permissionChecker;
285            }
286    
287            public long getPlid() {
288                    return _plid;
289            }
290    
291            public String getPortalURL() {
292                    return _portalURL;
293            }
294    
295            public PortletDisplay getPortletDisplay() {
296                    return _portletDisplay;
297            }
298    
299            /**
300             * @deprecated Use <code>getScopeGroupId</code>.
301             */
302            public long getPortletGroupId() {
303                    return getScopeGroupId();
304            }
305    
306            public String getRealCompanyLogo() {
307                    return _realCompanyLogo;
308            }
309    
310            public int getRealCompanyLogoHeight() {
311                    return _realCompanyLogoHeight;
312            }
313    
314            public int getRealCompanyLogoWidth() {
315                    return _realCompanyLogoWidth;
316            }
317    
318            public User getRealUser() {
319                    return _realUser;
320            }
321    
322            public long getRealUserId() {
323                    return _realUser.getUserId();
324            }
325    
326            public long getRefererPlid() {
327                    return _refererPlid;
328            }
329    
330            public Group getScopeGroup() {
331                    return _scopeGroup;
332            }
333    
334            public long getScopeGroupId() {
335                    return _scopeGroupId;
336            }
337    
338            public String getScopeGroupName() throws PortalException, SystemException {
339                    if (_scopeGroup == null) {
340                            return StringPool.BLANK;
341                    }
342                    else {
343                            return _scopeGroup.getDescriptiveName();
344                    }
345            }
346    
347            public long getScopeGroupIdOrLiveGroupId()
348                    throws PortalException, SystemException {
349    
350                    if (_scopeGroupId == 0) {
351                            return _scopeGroupId;
352                    }
353    
354                    Group group = GroupLocalServiceUtil.getGroup(_scopeGroupId);
355    
356                    if (group.isStagingGroup()) {
357                            return group.getLiveGroupId();
358                    }
359                    else {
360                            return _scopeGroupId;
361                    }
362            }
363    
364            public Layout getScopeLayout() throws PortalException, SystemException {
365                    if (_layout.hasScopeGroup()) {
366                            return _layout;
367                    }
368                    else if (_scopeGroup.isLayout()) {
369                            return LayoutLocalServiceUtil.getLayout(_scopeGroup.getClassPK());
370                    }
371                    else {
372                            return null;
373                    }
374            }
375    
376            public String getServerName() {
377                    return _serverName;
378            }
379    
380            public int getServerPort() {
381                    return _serverPort;
382            }
383    
384            public String getSessionId() {
385                    return _sessionId;
386            }
387    
388            public Theme getTheme() {
389                    return _theme;
390            }
391    
392            public String getThemeId() {
393                    return _theme.getThemeId();
394            }
395    
396            public String getThemeSetting(String key) {
397                    Theme theme = getTheme();
398    
399                    String device = theme.getDevice();
400    
401                    Layout layout = getLayout();
402    
403                    return layout.getThemeSetting(key, device);
404            }
405    
406            public Properties getThemeSettings() {
407                    Theme theme = getTheme();
408    
409                    Properties properties = new Properties();
410    
411                    Map<String, ThemeSetting> themeSettings = theme.getSettings();
412    
413                    for (String key : themeSettings.keySet()) {
414                            ThemeSetting themeSetting = themeSettings.get(key);
415    
416                            String value = null;
417    
418                            if (themeSetting.isConfigurable()) {
419                                    value = getThemeSetting(key);
420                            }
421                            else {
422                                    value = themeSetting.getValue();
423                            }
424    
425                            if (value != null) {
426                                    properties.put(key, value);
427                            }
428                    }
429    
430                    return properties;
431            }
432    
433            public String getTilesContent() {
434                    return _tilesContent;
435            }
436    
437            public String getTilesTitle() {
438                    return _tilesTitle;
439            }
440    
441            public TimeZone getTimeZone() {
442                    return _timeZone;
443            }
444    
445            public List<Layout> getUnfilteredLayouts() {
446                    return _unfilteredLayouts;
447            }
448    
449            public String getURLAddContent() {
450                    return _urlAddContent;
451            }
452    
453            public String getURLControlPanel() {
454                    return _urlControlPanel;
455            }
456    
457            public String getURLCurrent() {
458                    return _urlCurrent;
459            }
460    
461            public String getURLHome() {
462                    return _urlHome;
463            }
464    
465            public String getURLLayoutTemplates() {
466                    return _urlLayoutTemplates;
467            }
468    
469            public PortletURL getURLManageSiteMemberships() {
470                    return _urlManageSiteMemberships;
471            }
472    
473            public PortletURL getURLMyAccount() {
474                    return _urlMyAccount;
475            }
476    
477            public PortletURL getURLPageSettings() {
478                    return _urlPageSettings;
479            }
480    
481            public String getURLPortal() {
482                    return _urlPortal;
483            }
484    
485            public PortletURL getURLPublishToLive() {
486                    return _urlPublishToLive;
487            }
488    
489            public String getURLSignIn() {
490                    return _urlSignIn;
491            }
492    
493            public String getURLSignOut() {
494                    return _urlSignOut;
495            }
496    
497            public String getURLSiteContent() {
498                    return _urlSiteContent;
499            }
500    
501            public PortletURL getURLSiteMapSettings() {
502                    return _urlSiteMapSettings;
503            }
504    
505            public PortletURL getURLSiteSettings() {
506                    return _urlSiteSettings;
507            }
508    
509            public PortletURL getURLUpdateManager() {
510                    return _urlUpdateManager;
511            }
512    
513            public User getUser() {
514                    return _user;
515            }
516    
517            public long getUserId() {
518                    return _user.getUserId();
519            }
520    
521            public boolean isAddSessionIdToURL() {
522                    return _addSessionIdToURL;
523            }
524    
525            public boolean isFacebook() {
526                    return _facebook;
527            }
528    
529            public boolean isFreeformLayout() {
530                    return _freeformLayout;
531            }
532    
533            public boolean isI18n() {
534                    return _i18n;
535            }
536    
537            public boolean isImpersonated() {
538                    if (getUserId() == getRealUserId()) {
539                            return false;
540                    }
541                    else {
542                            return true;
543                    }
544            }
545    
546            public boolean isIncludedJs(String js) {
547                    String path = getPathJavaScript();
548    
549                    if (isIncludePortletCssJs() &&
550                            js.startsWith(path + "/liferay/portlet_css.js")) {
551    
552                            return true;
553                    }
554                    else if (isIncludeServiceJs() &&
555                                     js.startsWith(path + "/liferay/service.js")) {
556    
557                            return true;
558                    }
559                    else {
560                            return false;
561                    }
562            }
563    
564            public boolean isIncludePortletCssJs() {
565                    return _includePortletCssJs;
566            }
567    
568            public boolean isIncludeServiceJs() {
569                    return _includeServiceJs;
570            }
571    
572            public boolean isIsolated() {
573                    return _isolated;
574            }
575    
576            public boolean isLifecycleAction() {
577                    return _lifecycleAction;
578            }
579    
580            public boolean isLifecycleRender() {
581                    return _lifecycleRender;
582            }
583    
584            public boolean isLifecycleResource() {
585                    return _lifecycleResource;
586            }
587    
588            public boolean isSecure() {
589                    return _secure;
590            }
591    
592            public boolean isShowAddContentIcon() {
593                    return _showAddContentIcon;
594            }
595    
596            public boolean isShowAddContentIconPermission() {
597                    return _showAddContentIconPermission;
598            }
599    
600            public boolean isShowControlPanelIcon() {
601                    return _showControlPanelIcon;
602            }
603    
604            public boolean isShowHomeIcon() {
605                    return _showHomeIcon;
606            }
607    
608            public boolean isShowLayoutTemplatesIcon() {
609                    return _showLayoutTemplatesIcon;
610            }
611    
612            public boolean isShowManageSiteMembershipsIcon() {
613                    return _showManageSiteMembershipsIcon;
614            }
615    
616            public boolean isShowMyAccountIcon() {
617                    return _showMyAccountIcon;
618            }
619    
620            public boolean isShowPageCustomizationIcon() {
621                    return _showPageCustomizationIcon;
622            }
623    
624            public boolean isShowPageSettingsIcon() {
625                    return _showPageSettingsIcon;
626            }
627    
628            public boolean isShowPortalIcon() {
629                    return _showPortalIcon;
630            }
631    
632            public boolean isShowSignInIcon() {
633                    return _showSignInIcon;
634            }
635    
636            public boolean isShowSignOutIcon() {
637                    return _showSignOutIcon;
638            }
639    
640            public boolean isShowSiteContentIcon() {
641                    return _showSiteContentIcon;
642            }
643    
644            public boolean isShowSiteMapSettingsIcon() {
645                    return _showSiteMapSettingsIcon;
646            }
647    
648            public boolean isShowSiteSettingsIcon() {
649                    return _showSiteSettingsIcon;
650            }
651    
652            public boolean isShowStagingIcon() {
653                    return _showStagingIcon;
654            }
655    
656            public boolean isSignedIn() {
657                    return _signedIn;
658            }
659    
660            public boolean isStateExclusive() {
661                    return _stateExclusive;
662            }
663    
664            public boolean isStateMaximized() {
665                    return _stateMaximized;
666            }
667    
668            public boolean isStatePopUp() {
669                    return _statePopUp;
670            }
671    
672            public boolean isThemeCssFastLoad() {
673                    return _themeCssFastLoad;
674            }
675    
676            public boolean isThemeImagesFastLoad() {
677                    return _themeImagesFastLoad;
678            }
679    
680            public boolean isThemeJsBarebone() {
681                    return _themeJsBarebone;
682            }
683    
684            public boolean isThemeJsFastLoad() {
685                    return _themeJsFastLoad;
686            }
687    
688            public boolean isTilesSelectable() {
689                    return _tilesSelectable;
690            }
691    
692            public boolean isWapTheme() {
693                    return _theme.isWapTheme();
694            }
695    
696            public boolean isWidget() {
697                    return _widget;
698            }
699    
700            public void setAccount(Account account) {
701                    _account = account;
702            }
703    
704            public void setAddSessionIdToURL(boolean addSessionIdToURL) {
705                    _addSessionIdToURL = addSessionIdToURL;
706            }
707    
708            public void setCDNHost(String cdnHost) {
709                    _cdnHost = cdnHost;
710            }
711    
712            public void setCompany(Company company)
713                    throws PortalException, SystemException {
714    
715                    _company = company;
716                    _companyGroupId = company.getGroup().getGroupId();
717    
718                    setAccount(company.getAccount());
719            }
720    
721            public void setCompanyLogo(String companyLogo) {
722                    _companyLogo = companyLogo;
723            }
724    
725            public void setCompanyLogoHeight(int companyLogoHeight) {
726                    _companyLogoHeight = companyLogoHeight;
727            }
728    
729            public void setCompanyLogoWidth(int companyLogoWidth) {
730                    _companyLogoWidth = companyLogoWidth;
731            }
732    
733            public void setContact(Contact contact) {
734                    _contact = contact;
735            }
736    
737            public void setControlPanelCategory(String controlPanelCategory) {
738                    _controlPanelCategory = controlPanelCategory;
739            }
740    
741            public void setDevice(Device device) {
742                    _device = device;
743            }
744    
745            public void setDoAsGroupId(long doAsGroupId) {
746                    _doAsGroupId = doAsGroupId;
747            }
748    
749            public void setDoAsUserId(String doAsUserId) {
750                    _doAsUserId = doAsUserId;
751            }
752    
753            public void setDoAsUserLanguageId(String doAsUserLanguageId) {
754                    _doAsUserLanguageId = doAsUserLanguageId;
755            }
756    
757            public void setFacebookCanvasPageURL(String facebookCanvasPageURL) {
758                    _facebookCanvasPageURL = facebookCanvasPageURL;
759    
760                    if (Validator.isNotNull(facebookCanvasPageURL)) {
761                            _facebook = true;
762                    }
763            }
764    
765            public void setFreeformLayout(boolean freeformLayout) {
766                    _freeformLayout = freeformLayout;
767            }
768    
769            public void setI18nLanguageId(String i18nLanguageId) {
770                    _i18nLanguageId = i18nLanguageId;
771    
772                    if (Validator.isNotNull(i18nLanguageId)) {
773                            _i18n = true;
774                    }
775                    else {
776                            _i18n = false;
777                    }
778            }
779    
780            public void setI18nPath(String i18nPath) {
781                    _i18nPath = i18nPath;
782    
783                    if (Validator.isNotNull(i18nPath)) {
784                            _i18n = true;
785                    }
786                    else {
787                            _i18n = false;
788                    }
789            }
790    
791            public void setIncludePortletCssJs(boolean includePortletCssJs) {
792                    _includePortletCssJs = includePortletCssJs;
793            }
794    
795            public void setIncludeServiceJs(boolean includeServiceJs) {
796                    _includeServiceJs = includeServiceJs;
797            }
798    
799            public void setIsolated(boolean isolated) {
800                    _isolated = isolated;
801            }
802    
803            public void setLanguageId(String languageId) {
804                    _languageId = languageId;
805            }
806    
807            public void setLayout(Layout layout) {
808                    _layout = layout;
809            }
810    
811            public void setLayouts(List<Layout> layouts) {
812                    _layouts = layouts;
813            }
814    
815            public void setLayoutSet(LayoutSet layoutSet) {
816                    _layoutSet = layoutSet;
817            }
818    
819            public void setLayoutSetLogo(String layoutSetLogo) {
820                    _layoutSetLogo = layoutSetLogo;
821            }
822    
823            public void setLayoutTypePortlet(LayoutTypePortlet layoutTypePortlet) {
824                    _layoutTypePortlet = layoutTypePortlet;
825            }
826    
827            public void setLifecycle(String lifecycle) {
828                    _lifecycle = lifecycle;
829            }
830    
831            public void setLifecycleAction(boolean lifecycleAction) {
832                    _lifecycleAction = lifecycleAction;
833            }
834    
835            public void setLifecycleRender(boolean lifecycleRender) {
836                    _lifecycleRender = lifecycleRender;
837            }
838    
839            public void setLifecycleResource(boolean lifecycleResource) {
840                    _lifecycleResource = lifecycleResource;
841            }
842    
843            public void setLocale(Locale locale) {
844                    _locale = locale;
845    
846                    LocaleThreadLocal.setThemeDisplayLocale(locale);
847            }
848    
849            public void setLookAndFeel(
850                    String contextPath, Theme theme, ColorScheme colorScheme) {
851    
852                    _theme = theme;
853                    _colorScheme = colorScheme;
854    
855                    if ((theme != null) && (colorScheme != null)) {
856                            String themeStaticResourcePath = theme.getStaticResourcePath();
857    
858                            String host = getCDNHost();
859    
860                            if (Validator.isNull(host) && isFacebook()) {
861                                    host = getPortalURL();
862                            }
863    
864                            setPathColorSchemeImages(
865                                    host + themeStaticResourcePath +
866                                            colorScheme.getColorSchemeImagesPath());
867    
868                            setPathThemeCss(
869                                    host + themeStaticResourcePath + theme.getCssPath());
870                            setPathThemeImages(
871                                    host + themeStaticResourcePath + theme.getImagesPath());
872                            setPathThemeJavaScript(
873                                    host + themeStaticResourcePath + theme.getJavaScriptPath());
874                            setPathThemeRoot(themeStaticResourcePath + theme.getRootPath());
875                            setPathThemeTemplates(
876                                    host + themeStaticResourcePath + theme.getTemplatesPath());
877                    }
878            }
879    
880            public void setLookAndFeel(Theme theme, ColorScheme colorScheme) {
881                    setLookAndFeel(getPathContext(), theme, colorScheme);
882            }
883    
884            public void setMDRRuleGroupInstance(
885                    MDRRuleGroupInstance mdrRuleGroupInstance) {
886    
887                    _mdrRuleGroupInstance = mdrRuleGroupInstance;
888            }
889    
890            public void setParentGroupId(long parentGroupId) {
891                    _parentGroupId = parentGroupId;
892    
893                    if (_parentGroupId > 0) {
894                            try {
895                                    _parentGroup = GroupLocalServiceUtil.getGroup(_parentGroupId);
896                            }
897                            catch (Exception e) {
898                                    _log.error(e, e);
899                            }
900                    }
901            }
902    
903            public void setPathApplet(String pathApplet) {
904                    _pathApplet = pathApplet;
905            }
906    
907            public void setPathCms(String pathCms) {
908                    _pathCms = pathCms;
909            }
910    
911            public void setPathColorSchemeImages(String pathColorSchemeImages) {
912                    _pathColorSchemeImages = pathColorSchemeImages;
913            }
914    
915            public void setPathContext(String pathContext) {
916                    _pathContext = pathContext;
917            }
918    
919            public void setPathFlash(String pathFlash) {
920                    _pathFlash = pathFlash;
921            }
922    
923            public void setPathFriendlyURLPrivateGroup(
924                    String pathFriendlyURLPrivateGroup) {
925    
926                    _pathFriendlyURLPrivateGroup = pathFriendlyURLPrivateGroup;
927            }
928    
929            public void setPathFriendlyURLPrivateUser(
930                    String pathFriendlyURLPrivateUser) {
931    
932                    _pathFriendlyURLPrivateUser = pathFriendlyURLPrivateUser;
933            }
934    
935            public void setPathFriendlyURLPublic(String pathFriendlyURLPublic) {
936                    _pathFriendlyURLPublic = pathFriendlyURLPublic;
937            }
938    
939            public void setPathImage(String pathImage) {
940                    if (isFacebook() &&
941                            !pathImage.startsWith(Http.HTTP_WITH_SLASH) &&
942                            !pathImage.startsWith(Http.HTTPS_WITH_SLASH)) {
943    
944                            pathImage = getPortalURL() + pathImage;
945                    }
946    
947                    _pathImage = pathImage;
948            }
949    
950            public void setPathJavaScript(String pathJavaScript) {
951                    _pathJavaScript = pathJavaScript;
952            }
953    
954            public void setPathMain(String pathMain) {
955                    _pathMain = pathMain;
956            }
957    
958            public void setPathSound(String pathSound) {
959                    _pathSound = pathSound;
960            }
961    
962            public void setPathThemeCss(String pathThemeCss) {
963                    _pathThemeCss = pathThemeCss;
964            }
965    
966            public void setPathThemeImages(String pathThemeImages) {
967                    _pathThemeImages = pathThemeImages;
968            }
969    
970            public void setPathThemeJavaScript(String pathThemeJavaScript) {
971                    _pathThemeJavaScript = pathThemeJavaScript;
972            }
973    
974            public void setPathThemeRoot(String pathThemeRoot) {
975                    _pathThemeRoot = pathThemeRoot;
976            }
977    
978            public void setPathThemeTemplates(String pathThemeTemplates) {
979                    _pathThemeTemplates = pathThemeTemplates;
980            }
981    
982            public void setPermissionChecker(PermissionChecker permissionChecker) {
983                    _permissionChecker = permissionChecker;
984            }
985    
986            public void setPlid(long plid) {
987                    _plid = plid;
988            }
989    
990            public void setPortalURL(String portalURL) {
991                    _portalURL = portalURL;
992            }
993    
994            public void setRealCompanyLogo(String realCompanyLogo) {
995                    _realCompanyLogo = realCompanyLogo;
996            }
997    
998            public void setRealCompanyLogoHeight(int realCompanyLogoHeight) {
999                    _realCompanyLogoHeight = realCompanyLogoHeight;
1000            }
1001    
1002            public void setRealCompanyLogoWidth(int realCompanyLogoWidth) {
1003                    _realCompanyLogoWidth = realCompanyLogoWidth;
1004            }
1005    
1006            public void setRealUser(User realUser) {
1007                    _realUser = realUser;
1008            }
1009    
1010            public void setRefererPlid(long refererPlid) {
1011                    _refererPlid = refererPlid;
1012            }
1013    
1014            public void setScopeGroupId(long scopeGroupId) {
1015                    _scopeGroupId = scopeGroupId;
1016    
1017                    if (_scopeGroupId > 0) {
1018                            try {
1019                                    _scopeGroup = GroupLocalServiceUtil.getGroup(_scopeGroupId);
1020                            }
1021                            catch (Exception e) {
1022                                    _log.error(e, e);
1023                            }
1024                    }
1025            }
1026    
1027            public void setSecure(boolean secure) {
1028                    _secure = secure;
1029            }
1030    
1031            public void setServerName(String serverName) {
1032                    _serverName = serverName;
1033            }
1034    
1035            public void setServerPort(int serverPort) {
1036                    _serverPort = serverPort;
1037            }
1038    
1039            public void setSessionId(String sessionId) {
1040                    _sessionId = sessionId;
1041            }
1042    
1043            public void setShowAddContentIcon(boolean showAddContentIcon) {
1044                    _showAddContentIcon = showAddContentIcon;
1045            }
1046    
1047            public void setShowAddContentIconPermission(
1048                    boolean showAddContentIconPermission) {
1049    
1050                    _showAddContentIconPermission = showAddContentIconPermission;
1051            }
1052    
1053            public void setShowControlPanelIcon(boolean showControlPanelIcon) {
1054                    _showControlPanelIcon = showControlPanelIcon;
1055            }
1056    
1057            public void setShowHomeIcon(boolean showHomeIcon) {
1058                    _showHomeIcon = showHomeIcon;
1059            }
1060    
1061            public void setShowLayoutTemplatesIcon(boolean showLayoutTemplatesIcon) {
1062                    _showLayoutTemplatesIcon = showLayoutTemplatesIcon;
1063            }
1064    
1065            public void setShowManageSiteMembershipsIcon(
1066                    boolean showManageSiteMembershipsIcon) {
1067    
1068                    _showManageSiteMembershipsIcon = showManageSiteMembershipsIcon;
1069            }
1070    
1071            public void setShowMyAccountIcon(boolean showMyAccountIcon) {
1072                    _showMyAccountIcon = showMyAccountIcon;
1073            }
1074    
1075            public void setShowPageCustomizationIcon(
1076                    boolean showPageCustomizationIcon) {
1077    
1078                    _showPageCustomizationIcon = showPageCustomizationIcon;
1079            }
1080    
1081            public void setShowPageSettingsIcon(boolean showPageSettingsIcon) {
1082                    _showPageSettingsIcon = showPageSettingsIcon;
1083            }
1084    
1085            public void setShowPortalIcon(boolean showPortalIcon) {
1086                    _showPortalIcon = showPortalIcon;
1087            }
1088    
1089            public void setShowSignInIcon(boolean showSignInIcon) {
1090                    _showSignInIcon = showSignInIcon;
1091            }
1092    
1093            public void setShowSignOutIcon(boolean showSignOutIcon) {
1094                    _showSignOutIcon = showSignOutIcon;
1095            }
1096    
1097            public void setShowSiteContentIcon(boolean showSiteContentIcon) {
1098                    _showSiteContentIcon = showSiteContentIcon;
1099            }
1100    
1101            public void setShowSiteMapSettingsIcon(boolean showSiteMapSettingsIcon) {
1102                    _showSiteMapSettingsIcon = showSiteMapSettingsIcon;
1103            }
1104    
1105            public void setShowSiteSettingsIcon(boolean showSiteSettingsIcon) {
1106                    _showSiteSettingsIcon = showSiteSettingsIcon;
1107            }
1108    
1109            public void setShowStagingIcon(boolean showStagingIcon) {
1110                    _showStagingIcon = showStagingIcon;
1111            }
1112    
1113            public void setSignedIn(boolean signedIn) {
1114                    _signedIn = signedIn;
1115            }
1116    
1117            public void setStateExclusive(boolean stateExclusive) {
1118                    _stateExclusive = stateExclusive;
1119            }
1120    
1121            public void setStateMaximized(boolean stateMaximized) {
1122                    _stateMaximized = stateMaximized;
1123            }
1124    
1125            public void setStatePopUp(boolean statePopUp) {
1126                    _statePopUp = statePopUp;
1127            }
1128    
1129            public void setThemeCssFastLoad(boolean themeCssFastLoad) {
1130                    _themeCssFastLoad = themeCssFastLoad;
1131            }
1132    
1133            public void setThemeImagesFastLoad(boolean themeImagesFastLoad) {
1134                    _themeImagesFastLoad = themeImagesFastLoad;
1135            }
1136    
1137            public void setThemeJsBarebone(boolean themeJsBarebone) {
1138                    _themeJsBarebone = themeJsBarebone;
1139            }
1140    
1141            public void setThemeJsFastLoad(boolean themeJsFastLoad) {
1142                    _themeJsFastLoad = themeJsFastLoad;
1143            }
1144    
1145            public void setTilesContent(String tilesContent) {
1146                    _tilesContent = tilesContent;
1147            }
1148    
1149            public void setTilesSelectable(boolean tilesSelectable) {
1150                    _tilesSelectable = tilesSelectable;
1151            }
1152    
1153            public void setTilesTitle(String tilesTitle) {
1154                    _tilesTitle = tilesTitle;
1155            }
1156    
1157            public void setTimeZone(TimeZone timeZone) {
1158                    _timeZone = timeZone;
1159    
1160                    TimeZoneThreadLocal.setThemeDisplayTimeZone(timeZone);
1161            }
1162    
1163            public void setUnfilteredLayouts(List<Layout> unfilteredLayouts) {
1164                    _unfilteredLayouts = unfilteredLayouts;
1165            }
1166    
1167            public void setURLAddContent(String urlAddContent) {
1168                    _urlAddContent = urlAddContent;
1169            }
1170    
1171            public void setURLControlPanel(String urlControlPanel) {
1172                    _urlControlPanel = urlControlPanel;
1173            }
1174    
1175            public void setURLCurrent(String urlCurrent) {
1176                    _urlCurrent = urlCurrent;
1177            }
1178    
1179            public void setURLHome(String urlHome) {
1180                    _urlHome = urlHome;
1181            }
1182    
1183            public void setURLLayoutTemplates(String urlLayoutTemplates) {
1184                    _urlLayoutTemplates = urlLayoutTemplates;
1185            }
1186    
1187            public void setURLManageSiteMemberships(
1188                    PortletURL urlManageSiteMemberships) {
1189    
1190                    _urlManageSiteMemberships = urlManageSiteMemberships;
1191            }
1192    
1193            public void setURLMyAccount(PortletURL urlMyAccount) {
1194                    _urlMyAccount = urlMyAccount;
1195            }
1196    
1197            public void setURLPageSettings(PortletURL urlPageSettings) {
1198                    _urlPageSettings = urlPageSettings;
1199            }
1200    
1201            public void setURLPortal(String urlPortal) {
1202                    _urlPortal = urlPortal;
1203            }
1204    
1205            public void setURLPublishToLive(PortletURL urlPublishToLive) {
1206                    _urlPublishToLive = urlPublishToLive;
1207            }
1208    
1209            public void setURLSignIn(String urlSignIn) {
1210                    _urlSignIn = urlSignIn;
1211            }
1212    
1213            public void setURLSignOut(String urlSignOut) {
1214                    _urlSignOut = urlSignOut;
1215            }
1216    
1217            public void setURLSiteContent(String urlSiteContent) {
1218                    _urlSiteContent = urlSiteContent;
1219            }
1220    
1221            public void setURLSiteMapSettings(PortletURL urlSiteMapSettings) {
1222                    _urlSiteMapSettings = urlSiteMapSettings;
1223            }
1224    
1225            public void setURLSiteSettings(PortletURL urlSiteSettings) {
1226                    _urlSiteSettings = urlSiteSettings;
1227            }
1228    
1229            public void setURLUpdateManager(PortletURL urlUpdateManager) {
1230                    _urlUpdateManager = urlUpdateManager;
1231            }
1232    
1233            public void setUser(User user) throws PortalException, SystemException {
1234                    _user = user;
1235    
1236                    setContact(user.getContact());
1237            }
1238    
1239            public void setWidget(boolean widget) {
1240                    _widget = widget;
1241            }
1242    
1243            public String translate(String key) {
1244                    return LanguageUtil.get(getLocale(), key);
1245            }
1246    
1247            public String translate(String pattern, Object argument) {
1248                    return LanguageUtil.format(getLocale(), pattern, argument);
1249            }
1250    
1251            public String translate(String pattern, Object[] arguments) {
1252                    return LanguageUtil.format(getLocale(), pattern, arguments);
1253            }
1254    
1255            private static Log _log = LogFactoryUtil.getLog(ThemeDisplay.class);
1256    
1257            private Account _account;
1258            private boolean _addSessionIdToURL;
1259            private String _cdnHost = StringPool.BLANK;
1260            private ColorScheme _colorScheme;
1261            private Company _company;
1262            private long _companyGroupId;
1263            private String _companyLogo = StringPool.BLANK;
1264            private int _companyLogoHeight;
1265            private int _companyLogoWidth;
1266            private Contact _contact;
1267            private String _controlPanelCategory = StringPool.BLANK;
1268            private User _defaultUser;
1269            private Device _device;
1270            private long _doAsGroupId = 0;
1271            private String _doAsUserId = StringPool.BLANK;
1272            private String _doAsUserLanguageId = StringPool.BLANK;
1273            private boolean _facebook;
1274            private String _facebookCanvasPageURL;
1275            private boolean _freeformLayout;
1276            private boolean _i18n;
1277            private String _i18nLanguageId;
1278            private String _i18nPath;
1279            private boolean _includePortletCssJs;
1280            private boolean _includeServiceJs;
1281            private boolean _isolated;
1282            private String _languageId;
1283            private Layout _layout;
1284            private List<Layout> _layouts;
1285            private String _layoutSetLogo = StringPool.BLANK;
1286            private LayoutSet _layoutSet;
1287            private LayoutTypePortlet _layoutTypePortlet;
1288            private String _lifecycle;
1289            private boolean _lifecycleAction;
1290            private boolean _lifecycleRender;
1291            private boolean _lifecycleResource;
1292            private Locale _locale;
1293            private MDRRuleGroupInstance _mdrRuleGroupInstance;
1294            private Group _parentGroup;
1295            private long _parentGroupId;
1296            private String _pathApplet = StringPool.BLANK;
1297            private String _pathCms = StringPool.BLANK;
1298            private String _pathColorSchemeImages = StringPool.BLANK;
1299            private String _pathContext = StringPool.BLANK;
1300            private String _pathFlash = StringPool.BLANK;
1301            private String _pathFriendlyURLPrivateGroup = StringPool.BLANK;
1302            private String _pathFriendlyURLPrivateUser = StringPool.BLANK;
1303            private String _pathFriendlyURLPublic = StringPool.BLANK;
1304            private String _pathImage = StringPool.BLANK;
1305            private String _pathJavaScript = StringPool.BLANK;
1306            private String _pathMain = StringPool.BLANK;
1307            private String _pathSound = StringPool.BLANK;
1308            private String _pathThemeCss = StringPool.BLANK;
1309            private String _pathThemeImages = StringPool.BLANK;
1310            private String _pathThemeJavaScript = StringPool.BLANK;
1311            private String _pathThemeRoot = StringPool.BLANK;
1312            private String _pathThemeTemplates = StringPool.BLANK;
1313            private transient PermissionChecker _permissionChecker;
1314            private long _plid;
1315            private String _portalURL = StringPool.BLANK;
1316            private PortletDisplay _portletDisplay = new PortletDisplay();
1317            private String _realCompanyLogo = StringPool.BLANK;
1318            private int _realCompanyLogoHeight;
1319            private int _realCompanyLogoWidth;
1320            private User _realUser;
1321            private long _refererPlid;
1322            private Group _scopeGroup;
1323            private long _scopeGroupId;
1324            private boolean _secure;
1325            private String _serverName;
1326            private int _serverPort;
1327            private String _sessionId = StringPool.BLANK;
1328            private boolean _showAddContentIcon;
1329            private boolean _showAddContentIconPermission;
1330            private boolean _showControlPanelIcon;
1331            private boolean _showHomeIcon;
1332            private boolean _showLayoutTemplatesIcon;
1333            private boolean _showManageSiteMembershipsIcon;
1334            private boolean _showMyAccountIcon;
1335            private boolean _showPageCustomizationIcon;
1336            private boolean _showPageSettingsIcon;
1337            private boolean _showPortalIcon;
1338            private boolean _showSignInIcon;
1339            private boolean _showSignOutIcon;
1340            private boolean _showSiteContentIcon;
1341            private boolean _showSiteMapSettingsIcon;
1342            private boolean _showSiteSettingsIcon;
1343            private boolean _showStagingIcon;
1344            private boolean _signedIn;
1345            private boolean _stateExclusive;
1346            private boolean _stateMaximized;
1347            private boolean _statePopUp;
1348            private Theme _theme;
1349            private boolean _themeCssFastLoad;
1350            private boolean _themeImagesFastLoad;
1351            private boolean _themeJsBarebone;
1352            private boolean _themeJsFastLoad;
1353            private String _tilesContent = StringPool.BLANK;
1354            private boolean _tilesSelectable;
1355            private String _tilesTitle = StringPool.BLANK;
1356            private TimeZone _timeZone;
1357            private List<Layout> _unfilteredLayouts;
1358            private String _urlAddContent = StringPool.BLANK;
1359            private String _urlControlPanel = StringPool.BLANK;
1360            private String _urlCurrent = StringPool.BLANK;
1361            private String _urlHome = StringPool.BLANK;
1362            private String _urlLayoutTemplates = StringPool.BLANK;
1363            private transient PortletURL _urlManageSiteMemberships = null;
1364            private transient PortletURL _urlMyAccount = null;
1365            private transient PortletURL _urlPageSettings = null;
1366            private String _urlPortal = StringPool.BLANK;
1367            private transient PortletURL _urlPublishToLive = null;
1368            private String _urlSignIn = StringPool.BLANK;
1369            private String _urlSignOut = StringPool.BLANK;
1370            private String _urlSiteContent = StringPool.BLANK;
1371            private transient PortletURL _urlSiteMapSettings = null;
1372            private transient PortletURL _urlSiteSettings = null;
1373            private transient PortletURL _urlUpdateManager = null;
1374            private User _user;
1375            private boolean _widget;
1376    
1377    }