001
014
015 package com.liferay.taglib.util;
016
017 import com.liferay.portal.kernel.language.LanguageUtil;
018 import com.liferay.portal.kernel.portlet.PortletProvider;
019 import com.liferay.portal.kernel.servlet.DirectRequestDispatcherFactoryUtil;
020 import com.liferay.portal.kernel.servlet.JSPSupportServlet;
021 import com.liferay.portal.kernel.template.TemplateConstants;
022 import com.liferay.portal.kernel.util.HttpUtil;
023 import com.liferay.portal.kernel.util.StringPool;
024 import com.liferay.portal.kernel.util.WebKeys;
025 import com.liferay.portal.model.Layout;
026 import com.liferay.portal.model.LayoutConstants;
027 import com.liferay.portal.model.Portlet;
028 import com.liferay.portal.theme.ThemeDisplay;
029 import com.liferay.taglib.TagSupport;
030 import com.liferay.taglib.aui.ColumnTag;
031 import com.liferay.taglib.aui.LayoutTag;
032 import com.liferay.taglib.portlet.ActionURLTag;
033 import com.liferay.taglib.portletext.IconBackTag;
034 import com.liferay.taglib.portletext.IconOptionsTag;
035 import com.liferay.taglib.portletext.IconPortletTag;
036 import com.liferay.taglib.portletext.RuntimeTag;
037 import com.liferay.taglib.security.DoAsURLTag;
038 import com.liferay.taglib.security.PermissionsURLTag;
039 import com.liferay.taglib.servlet.PipingPageContext;
040 import com.liferay.taglib.theme.LayoutIconTag;
041 import com.liferay.taglib.theme.MetaTagsTag;
042 import com.liferay.taglib.theme.WrapPortletTag;
043 import com.liferay.taglib.ui.AssetCategoriesSummaryTag;
044 import com.liferay.taglib.ui.AssetLinksTag;
045 import com.liferay.taglib.ui.AssetTagsSummaryTag;
046 import com.liferay.taglib.ui.BreadcrumbTag;
047 import com.liferay.taglib.ui.DiscussionTag;
048 import com.liferay.taglib.ui.FlagsTag;
049 import com.liferay.taglib.ui.IconTag;
050 import com.liferay.taglib.ui.JournalArticleTag;
051 import com.liferay.taglib.ui.JournalContentSearchTag;
052 import com.liferay.taglib.ui.LanguageTag;
053 import com.liferay.taglib.ui.MySitesTag;
054 import com.liferay.taglib.ui.PngImageTag;
055 import com.liferay.taglib.ui.RatingsTag;
056 import com.liferay.taglib.ui.SearchTag;
057 import com.liferay.taglib.ui.SitesDirectoryTag;
058 import com.liferay.taglib.ui.SocialBookmarksTag;
059 import com.liferay.taglib.ui.ToggleTag;
060
061 import java.io.Writer;
062
063 import java.util.Map;
064 import java.util.Set;
065
066 import javax.portlet.PortletMode;
067 import javax.portlet.PortletRequest;
068 import javax.portlet.PortletURL;
069 import javax.portlet.WindowState;
070
071 import javax.servlet.RequestDispatcher;
072 import javax.servlet.ServletContext;
073 import javax.servlet.http.HttpServletRequest;
074 import javax.servlet.http.HttpServletResponse;
075 import javax.servlet.jsp.JspFactory;
076 import javax.servlet.jsp.PageContext;
077
078
082 public class VelocityTaglibImpl implements VelocityTaglib {
083
084 public VelocityTaglibImpl(
085 ServletContext servletContext, HttpServletRequest request,
086 HttpServletResponse response, Map<String, Object> contextObjects) {
087
088 _servletContext = servletContext;
089 _request = request;
090 _response = response;
091 _contextObjects = contextObjects;
092
093 JspFactory jspFactory = JspFactory.getDefaultFactory();
094
095 _pageContext = jspFactory.getPageContext(
096 new JSPSupportServlet(_servletContext), _request, _response, null,
097 false, 0, false);
098 }
099
100 @Override
101 public String actionURL(long plid, String portletName, String queryString)
102 throws Exception {
103
104 String windowState = WindowState.NORMAL.toString();
105 String portletMode = PortletMode.VIEW.toString();
106
107 return actionURL(
108 windowState, portletMode, plid, portletName, queryString);
109 }
110
111 @Override
112 public String actionURL(String portletName, String queryString)
113 throws Exception {
114
115 return actionURL(
116 LayoutConstants.DEFAULT_PLID, portletName, queryString);
117 }
118
119
124 @Deprecated
125 @Override
126 public String actionURL(
127 String windowState, String portletMode, Boolean secure,
128 Boolean copyCurrentRenderParameters, Boolean escapeXml, String name,
129 long plid, long refererPlid, String portletName, Boolean anchor,
130 Boolean encrypt, long doAsUserId, Boolean portletConfiguration,
131 String queryString)
132 throws Exception {
133
134 return actionURL(
135 windowState, portletMode, secure, copyCurrentRenderParameters,
136 escapeXml, name, plid, refererPlid, portletName, anchor, encrypt, 0,
137 doAsUserId, portletConfiguration, queryString);
138 }
139
140 @Override
141 public String actionURL(
142 String windowState, String portletMode, Boolean secure,
143 Boolean copyCurrentRenderParameters, Boolean escapeXml, String name,
144 long plid, long refererPlid, String portletName, Boolean anchor,
145 Boolean encrypt, long doAsGroupId, long doAsUserId,
146 Boolean portletConfiguration, String queryString)
147 throws Exception {
148
149 String resourceID = null;
150 String cacheability = null;
151 Map<String, String[]> parameterMap = HttpUtil.parameterMapFromString(
152 queryString);
153 Set<String> removedParameterNames = null;
154
155 PortletURL portletURL = ActionURLTag.doTag(
156 PortletRequest.ACTION_PHASE, windowState, portletMode, secure,
157 copyCurrentRenderParameters, escapeXml, name, resourceID,
158 cacheability, plid, refererPlid, portletName, anchor, encrypt,
159 doAsGroupId, doAsUserId, portletConfiguration, parameterMap,
160 removedParameterNames, _request);
161
162 return portletURL.toString();
163 }
164
165 @Override
166 public String actionURL(
167 String windowState, String portletMode, long plid,
168 String portletName, String queryString)
169 throws Exception {
170
171 Boolean secure = null;
172 Boolean copyCurrentRenderParameters = null;
173 Boolean escapeXml = null;
174 long refererPlid = LayoutConstants.DEFAULT_PLID;
175 String name = null;
176 Boolean anchor = null;
177 Boolean encrypt = null;
178 long doAsGroupId = 0;
179 long doAsUserId = 0;
180 Boolean portletConfiguration = null;
181
182 return actionURL(
183 windowState, portletMode, secure, copyCurrentRenderParameters,
184 escapeXml, name, plid, refererPlid, portletName, anchor, encrypt,
185 doAsGroupId, doAsUserId, portletConfiguration, queryString);
186 }
187
188 @Override
189 public String actionURL(
190 String windowState, String portletMode, String portletName,
191 String queryString)
192 throws Exception {
193
194 return actionURL(
195 windowState, portletMode, LayoutConstants.DEFAULT_PLID, portletName,
196 queryString);
197 }
198
199 @Override
200 public void assetCategoriesSummary(
201 String className, long classPK, String message,
202 PortletURL portletURL)
203 throws Exception {
204
205 AssetCategoriesSummaryTag<?> assetCategorySummaryTag =
206 new AssetCategoriesSummaryTag<>();
207
208 setUp(assetCategorySummaryTag);
209
210 assetCategorySummaryTag.setClassName(className);
211 assetCategorySummaryTag.setClassPK(classPK);
212 assetCategorySummaryTag.setMessage(message);
213 assetCategorySummaryTag.setPortletURL(portletURL);
214
215 assetCategorySummaryTag.runTag();
216 }
217
218 @Override
219 public void assetLinks(long assetEntryId, String className, long classPK)
220 throws Exception {
221
222 AssetLinksTag assetLinksTag = new AssetLinksTag();
223
224 setUp(assetLinksTag);
225
226 assetLinksTag.setAssetEntryId(assetEntryId);
227 assetLinksTag.setClassName(className);
228 assetLinksTag.setClassPK(classPK);
229
230 assetLinksTag.runTag();
231 }
232
233 @Override
234 public void assetTagsSummary(
235 String className, long classPK, String message,
236 String assetTagNames, PortletURL portletURL)
237 throws Exception {
238
239 AssetTagsSummaryTag<?> assetTagsSummaryTag =
240 new AssetTagsSummaryTag<>();
241
242 setUp(assetTagsSummaryTag);
243
244 assetTagsSummaryTag.setClassName(className);
245 assetTagsSummaryTag.setClassPK(classPK);
246 assetTagsSummaryTag.setMessage(message);
247 assetTagsSummaryTag.setPortletURL(portletURL);
248 assetTagsSummaryTag.setAssetTagNames(assetTagNames);
249
250 assetTagsSummaryTag.runTag();
251 }
252
253 @Override
254 public void breadcrumb() throws Exception {
255 BreadcrumbTag breadcrumbTag = new BreadcrumbTag();
256
257 setUp(breadcrumbTag);
258
259 breadcrumbTag.runTag();
260 }
261
262 @Override
263 public void breadcrumb(
264 long ddmTemplateGroupId, String ddmTemplateKey,
265 boolean showGuestGroup, boolean showParentGroups,
266 boolean showLayout, boolean showPortletBreadcrumb)
267 throws Exception {
268
269 BreadcrumbTag breadcrumbTag = new BreadcrumbTag();
270
271 setUp(breadcrumbTag);
272
273 breadcrumbTag.setDdmTemplateGroupId(ddmTemplateGroupId);
274 breadcrumbTag.setDdmTemplateKey(ddmTemplateKey);
275 breadcrumbTag.setShowGuestGroup(showGuestGroup);
276 breadcrumbTag.setShowLayout(showLayout);
277 breadcrumbTag.setShowParentGroups(showParentGroups);
278 breadcrumbTag.setShowPortletBreadcrumb(showPortletBreadcrumb);
279
280 breadcrumbTag.runTag();
281 }
282
283 @Override
284 public void discussion(
285 String className, long classPK, String formAction, String formName,
286 boolean hideControls, boolean ratingsEnabled, String redirect,
287 long userId)
288 throws Exception {
289
290 DiscussionTag discussionTag = new DiscussionTag();
291
292 setUp(discussionTag);
293
294 discussionTag.setClassName(className);
295 discussionTag.setClassPK(classPK);
296 discussionTag.setFormAction(formAction);
297 discussionTag.setFormName(formName);
298 discussionTag.setHideControls(hideControls);
299 discussionTag.setRatingsEnabled(ratingsEnabled);
300 discussionTag.setRedirect(redirect);
301 discussionTag.setUserId(userId);
302
303 discussionTag.runTag();
304 }
305
306
310 @Deprecated
311 @Override
312 public void discussion(
313 String className, long classPK, String formAction, String formName,
314 boolean hideControls, boolean ratingsEnabled, String redirect,
315 String subject, long userId)
316 throws Exception {
317
318 discussion(
319 className, classPK, formAction, formName, hideControls,
320 ratingsEnabled, redirect, userId);
321 }
322
323 @Override
324 public void doAsURL(long doAsUserId) throws Exception {
325 DoAsURLTag.doTag(doAsUserId, _request);
326 }
327
328 @Override
329 public void flags(
330 String className, long classPK, String contentTitle, boolean label,
331 String message, long reportedUserId)
332 throws Exception {
333
334 FlagsTag flagsTag = new FlagsTag();
335
336 setUp(flagsTag);
337
338 flagsTag.setClassName(className);
339 flagsTag.setClassPK(classPK);
340 flagsTag.setContentTitle(contentTitle);
341 flagsTag.setLabel(label);
342 flagsTag.setMessage(message);
343 flagsTag.setReportedUserId(reportedUserId);
344
345 flagsTag.runTag();
346 }
347
348 @Override
349 public AssetCategoriesSummaryTag<?> getAssetCategoriesSummaryTag()
350 throws Exception {
351
352 AssetCategoriesSummaryTag<?> assetCategoriesSummaryTag =
353 new AssetCategoriesSummaryTag<>();
354
355 setUp(assetCategoriesSummaryTag);
356
357 return assetCategoriesSummaryTag;
358 }
359
360 @Override
361 public AssetLinksTag getAssetLinksTag() throws Exception {
362 AssetLinksTag assetLinksTag = new AssetLinksTag();
363
364 setUp(assetLinksTag);
365
366 return assetLinksTag;
367 }
368
369 @Override
370 public AssetTagsSummaryTag<?> getAssetTagsSummaryTag() throws Exception {
371 AssetTagsSummaryTag<?> assetTagsSummaryTag =
372 new AssetTagsSummaryTag<>();
373
374 setUp(assetTagsSummaryTag);
375
376 return assetTagsSummaryTag;
377 }
378
379 @Override
380 public BreadcrumbTag getBreadcrumbTag() throws Exception {
381 BreadcrumbTag breadcrumbTag = new BreadcrumbTag();
382
383 setUp(breadcrumbTag);
384
385 return breadcrumbTag;
386 }
387
388 @Override
389 public ColumnTag getColumnTag() throws Exception {
390 ColumnTag columnTag = new ColumnTag();
391
392 setUp(columnTag);
393
394 return columnTag;
395 }
396
397 @Override
398 public DiscussionTag getDiscussionTag() throws Exception {
399 DiscussionTag discussionTag = new DiscussionTag();
400
401 setUp(discussionTag);
402
403 return discussionTag;
404 }
405
406 @Override
407 public FlagsTag getFlagsTag() throws Exception {
408 FlagsTag flagsTag = new FlagsTag();
409
410 setUp(flagsTag);
411
412 return flagsTag;
413 }
414
415 @Override
416 public IconTag getIconTag() throws Exception {
417 IconTag iconTag = new IconTag();
418
419 setUp(iconTag);
420
421 return iconTag;
422 }
423
424 @Override
425 public JournalArticleTag getJournalArticleTag() throws Exception {
426 JournalArticleTag journalArticleTag = new JournalArticleTag();
427
428 setUp(journalArticleTag);
429
430 return journalArticleTag;
431 }
432
433 @Override
434 public LayoutTag getLayoutTag() throws Exception {
435 LayoutTag layoutTag = new LayoutTag();
436
437 setUp(layoutTag);
438
439 return layoutTag;
440 }
441
442 @Override
443 public MySitesTag getMySitesTag() throws Exception {
444 MySitesTag mySitesTag = new MySitesTag();
445
446 setUp(mySitesTag);
447
448 return mySitesTag;
449 }
450
451 @Override
452 public PageContext getPageContext() {
453 return _pageContext;
454 }
455
456 @Override
457 public PngImageTag getPngImageTag() throws Exception {
458 PngImageTag pngImageTag = new PngImageTag();
459
460 setUp(pngImageTag);
461
462 return pngImageTag;
463 }
464
465 @Override
466 public RatingsTag getRatingsTag() throws Exception {
467 RatingsTag ratingsTag = new RatingsTag();
468
469 setUp(ratingsTag);
470
471 return ratingsTag;
472 }
473
474 @Override
475 public String getSetting(String name) {
476 ThemeDisplay themeDisplay = (ThemeDisplay)_request.getAttribute(
477 WebKeys.THEME_DISPLAY);
478
479 return themeDisplay.getThemeSetting(name);
480 }
481
482 @Override
483 public WindowState getWindowState(String windowState) {
484 return new WindowState(windowState);
485 }
486
487 @Override
488 public void icon(String image, boolean label, String message, String url)
489 throws Exception {
490
491 IconTag iconTag = new IconTag();
492
493 setUp(iconTag);
494
495 iconTag.setImage(image);
496 iconTag.setLabel(label);
497 iconTag.setMessage(message);
498 iconTag.setUrl(url);
499
500 iconTag.runTag();
501 }
502
503
506 @Deprecated
507 @Override
508 public void iconBack() throws Exception {
509 portletIconBack();
510 }
511
512 @Override
513 public void iconHelp(String message) throws Exception {
514 com.liferay.taglib.ui.IconHelpTag iconHelpTag =
515 new com.liferay.taglib.ui.IconHelpTag();
516
517 setUp(iconHelpTag);
518
519 iconHelpTag.setMessage(message);
520
521 iconHelpTag.runTag();
522 }
523
524
527 @Deprecated
528 @Override
529 public void iconOptions() throws Exception {
530 portletIconOptions();
531 }
532
533
536 @Deprecated
537 @Override
538 public void iconPortlet() throws Exception {
539 portletIconPortlet();
540 }
541
542
545 @Deprecated
546 @Override
547 public void iconPortlet(Portlet portlet) throws Exception {
548 portletIconPortlet();
549 }
550
551 @Override
552 public void include(ServletContext servletContext, String page)
553 throws Exception {
554
555 RequestDispatcher requestDispatcher =
556 servletContext.getRequestDispatcher(page);
557
558 requestDispatcher.include(_request, _response);
559 }
560
561 @Override
562 public void include(String page) throws Exception {
563 RequestDispatcher requestDispatcher =
564 DirectRequestDispatcherFactoryUtil.getRequestDispatcher(
565 _servletContext, page);
566
567 requestDispatcher.include(_request, _response);
568 }
569
570 @Override
571 public void journalArticle(
572 String articleId, long groupId, String ddmTemplateKey)
573 throws Exception {
574
575 JournalArticleTag journalArticleTag = new JournalArticleTag();
576
577 setUp(journalArticleTag);
578
579 journalArticleTag.setArticleId(articleId);
580 journalArticleTag.setGroupId(groupId);
581 journalArticleTag.setLanguageId(LanguageUtil.getLanguageId(_request));
582 journalArticleTag.setDDMTemplateKey(ddmTemplateKey);
583
584 journalArticleTag.runTag();
585 }
586
587 @Override
588 public void journalContentSearch() throws Exception {
589 journalContentSearch(true, null);
590 }
591
592 @Override
593 public void journalContentSearch(boolean showListed, String targetPortletId)
594 throws Exception {
595
596 JournalContentSearchTag journalContentSearchTag =
597 new JournalContentSearchTag();
598
599 setUp(journalContentSearchTag);
600
601 journalContentSearchTag.setShowListed(showListed);
602 journalContentSearchTag.setTargetPortletId(targetPortletId);
603
604 journalContentSearchTag.runTag();
605 }
606
607 @Override
608 public void language() throws Exception {
609 LanguageTag languageTag = new LanguageTag();
610
611 setUp(languageTag);
612
613 languageTag.runTag();
614 }
615
616 @Override
617 public void language(
618 String formName, String formAction, String name,
619 String ddmTemplateKey)
620 throws Exception {
621
622 LanguageTag languageTag = new LanguageTag();
623
624 setUp(languageTag);
625
626 languageTag.setDdmTemplateKey(ddmTemplateKey);
627 languageTag.setFormAction(formAction);
628 languageTag.setFormName(formName);
629 languageTag.setName(name);
630
631 languageTag.runTag();
632 }
633
634 @Override
635 public void language(
636 String formName, String formAction, String name,
637 String[] languageIds, String ddmTemplateKey)
638 throws Exception {
639
640 LanguageTag languageTag = new LanguageTag();
641
642 setUp(languageTag);
643
644 languageTag.setDdmTemplateKey(ddmTemplateKey);
645 languageTag.setFormAction(formAction);
646 languageTag.setFormName(formName);
647 languageTag.setLanguageIds(languageIds);
648 languageTag.setName(name);
649
650 languageTag.runTag();
651 }
652
653 @Override
654 public void layoutIcon(Layout layout) throws Exception {
655 LayoutIconTag.doTag(layout, _servletContext, _request, _response);
656 }
657
658 @Override
659 public void metaTags() throws Exception {
660 MetaTagsTag.doTag(_servletContext, _request, _response);
661 }
662
663
666 @Deprecated
667 @Override
668 public void myPlaces() throws Exception {
669 mySites();
670 }
671
672
675 @Deprecated
676 @Override
677 public void myPlaces(int max) throws Exception {
678 mySites(max);
679 }
680
681 @Override
682 public void mySites() throws Exception {
683 MySitesTag mySitesTag = new MySitesTag();
684
685 setUp(mySitesTag);
686
687 mySitesTag.runTag();
688 }
689
690 @Override
691 public void mySites(int max) throws Exception {
692 MySitesTag mySitesTag = new MySitesTag();
693
694 setUp(mySitesTag);
695
696 mySitesTag.setMax(max);
697
698 mySitesTag.runTag();
699 }
700
701 @Override
702 public String permissionsURL(
703 String redirect, String modelResource,
704 String modelResourceDescription, Object resourceGroupId,
705 String resourcePrimKey, String windowState, int[] roleTypes)
706 throws Exception {
707
708 return PermissionsURLTag.doTag(
709 redirect, modelResource, modelResourceDescription, resourceGroupId,
710 resourcePrimKey, windowState, roleTypes, _request);
711 }
712
713
717 @Deprecated
718 @Override
719 public String permissionsURL(
720 String redirect, String modelResource,
721 String modelResourceDescription, String resourcePrimKey,
722 String windowState, int[] roleTypes)
723 throws Exception {
724
725 return permissionsURL(
726 redirect, modelResourceDescription, modelResourceDescription, null,
727 resourcePrimKey, windowState, roleTypes);
728 }
729
730 @Override
731 public void portletIconBack() throws Exception {
732 IconBackTag iconBackTag = new IconBackTag();
733
734 setUp(iconBackTag);
735
736 iconBackTag.runTag();
737 }
738
739 @Override
740 public void portletIconOptions() throws Exception {
741 IconOptionsTag iconOptionsTag = new IconOptionsTag();
742
743 setUp(iconOptionsTag);
744
745 iconOptionsTag.runTag();
746 }
747
748 @Override
749 public void portletIconOptions(String direction, String markupView)
750 throws Exception {
751
752 IconOptionsTag iconOptionsTag = new IconOptionsTag();
753
754 setUp(iconOptionsTag);
755
756 iconOptionsTag.setDirection(direction);
757 iconOptionsTag.setMarkupView(markupView);
758
759 iconOptionsTag.runTag();
760 }
761
762 @Override
763 public void portletIconPortlet() throws Exception {
764 IconPortletTag iconPortletTag = new IconPortletTag();
765
766 setUp(iconPortletTag);
767
768 iconPortletTag.runTag();
769 }
770
771 @Override
772 public void portletIconPortlet(Portlet portlet) throws Exception {
773 IconPortletTag iconPortletTag = new IconPortletTag();
774
775 setUp(iconPortletTag);
776
777 iconPortletTag.setPortlet(portlet);
778
779 iconPortletTag.runTag();
780 }
781
782 @Override
783 public void ratings(
784 String className, long classPK, int numberOfStars, String type,
785 String url)
786 throws Exception {
787
788 RatingsTag ratingsTag = new RatingsTag();
789
790 setUp(ratingsTag);
791
792 ratingsTag.setClassName(className);
793 ratingsTag.setClassPK(classPK);
794 ratingsTag.setNumberOfStars(numberOfStars);
795 ratingsTag.setType(type);
796 ratingsTag.setUrl(url);
797
798 ratingsTag.runTag();
799 }
800
801 @Override
802 public String renderURL(long plid, String portletName, String queryString)
803 throws Exception {
804
805 String windowState = WindowState.NORMAL.toString();
806 String portletMode = PortletMode.VIEW.toString();
807
808 return renderURL(
809 windowState, portletMode, plid, portletName, queryString);
810 }
811
812 @Override
813 public String renderURL(String portletName, String queryString)
814 throws Exception {
815
816 return renderURL(
817 LayoutConstants.DEFAULT_PLID, portletName, queryString);
818 }
819
820 @Override
821 public String renderURL(
822 String windowState, String portletMode, Boolean secure,
823 Boolean copyCurrentRenderParameters, Boolean escapeXml, long plid,
824 long refererPlid, String portletName, Boolean anchor,
825 Boolean encrypt, long doAsGroupId, long doAsUserId,
826 Boolean portletConfiguration, String queryString)
827 throws Exception {
828
829 String name = null;
830 String resourceID = null;
831 String cacheability = null;
832 Map<String, String[]> parameterMap = HttpUtil.parameterMapFromString(
833 queryString);
834 Set<String> removedParameterNames = null;
835
836 PortletURL portletURL = ActionURLTag.doTag(
837 PortletRequest.RENDER_PHASE, windowState, portletMode, secure,
838 copyCurrentRenderParameters, escapeXml, name, resourceID,
839 cacheability, plid, refererPlid, portletName, anchor, encrypt,
840 doAsGroupId, doAsUserId, portletConfiguration, parameterMap,
841 removedParameterNames, _request);
842
843 return portletURL.toString();
844 }
845
846
851 @Deprecated
852 @Override
853 public String renderURL(
854 String windowState, String portletMode, Boolean secure,
855 Boolean copyCurrentRenderParameters, Boolean escapeXml, long plid,
856 String portletName, Boolean anchor, Boolean encrypt,
857 long doAsUserId, Boolean portletConfiguration, String queryString)
858 throws Exception {
859
860 long refererPlid = LayoutConstants.DEFAULT_PLID;
861
862 return renderURL(
863 windowState, portletMode, secure, copyCurrentRenderParameters,
864 escapeXml, plid, refererPlid, portletName, anchor, encrypt, 0,
865 doAsUserId, portletConfiguration, queryString);
866 }
867
868 @Override
869 public String renderURL(
870 String windowState, String portletMode, long plid,
871 String portletName, String queryString)
872 throws Exception {
873
874 Boolean secure = null;
875 Boolean copyCurrentRenderParameters = null;
876 Boolean escapeXml = null;
877 long referPlid = LayoutConstants.DEFAULT_PLID;
878 Boolean anchor = null;
879 Boolean encrypt = null;
880 long doAsGroupId = 0;
881 long doAsUserId = 0;
882 Boolean portletConfiguration = null;
883
884 return renderURL(
885 windowState, portletMode, secure, copyCurrentRenderParameters,
886 escapeXml, plid, referPlid, portletName, anchor, encrypt,
887 doAsGroupId, doAsUserId, portletConfiguration, queryString);
888 }
889
890 @Override
891 public String renderURL(
892 String windowState, String portletMode, String portletName,
893 String queryString)
894 throws Exception {
895
896 return renderURL(
897 windowState, portletMode, LayoutConstants.DEFAULT_PLID, portletName,
898 queryString);
899 }
900
901 @Override
902 public void runtime(String portletName) throws Exception {
903 runtime(portletName, (String)null);
904 }
905
906 @Override
907 public void runtime(
908 String portletProviderClassName,
909 PortletProvider.Action portletProviderAction)
910 throws Exception {
911
912 RuntimeTag.doTag(
913 portletProviderClassName, portletProviderAction, StringPool.BLANK,
914 null, null, _pageContext, _request, _response);
915 }
916
917 @Override
918 public void runtime(
919 String portletProviderClassName,
920 PortletProvider.Action portletProviderAction, String instanceId)
921 throws Exception {
922
923 RuntimeTag.doTag(
924 portletProviderClassName, portletProviderAction, instanceId, null,
925 null, _pageContext, _request, _response);
926 }
927
928 @Override
929 public void runtime(
930 String portletProviderClassName,
931 PortletProvider.Action portletProviderAction, String instanceId,
932 String defaultPreferences)
933 throws Exception {
934
935 RuntimeTag.doTag(
936 portletProviderClassName, portletProviderAction, instanceId, null,
937 defaultPreferences, _pageContext, _request, _response);
938 }
939
940 @Override
941 public void runtime(String portletName, String queryString)
942 throws Exception {
943
944 RuntimeTag.doTag(
945 portletName, queryString, _pageContext, _request, _response);
946 }
947
948 @Override
949 public void runtime(
950 String portletName, String queryString, String defaultPreferences)
951 throws Exception {
952
953 RuntimeTag.doTag(
954 portletName, queryString, defaultPreferences, _pageContext,
955 _request, _response);
956 }
957
958 @Override
959 public void runtime(
960 String portletName, String instanceId, String queryString,
961 String defaultPreferences)
962 throws Exception {
963
964 RuntimeTag.doTag(
965 portletName, instanceId, queryString, defaultPreferences,
966 _pageContext, _request, _response);
967 }
968
969 @Override
970 public void search() throws Exception {
971 SearchTag searchTag = new SearchTag();
972
973 setUp(searchTag);
974
975 searchTag.runTag();
976 }
977
978 @Override
979 public void sitesDirectory() throws Exception {
980 SitesDirectoryTag sitesDirectoryTag = new SitesDirectoryTag();
981
982 setUp(sitesDirectoryTag);
983
984 sitesDirectoryTag.runTag();
985 }
986
987 @Override
988 public void sitesDirectory(String displayStyle, String sites)
989 throws Exception {
990
991 SitesDirectoryTag sitesDirectoryTag = new SitesDirectoryTag();
992
993 setUp(sitesDirectoryTag);
994
995 sitesDirectoryTag.setDisplayStyle(displayStyle);
996 sitesDirectoryTag.setSites(sites);
997
998 sitesDirectoryTag.runTag();
999 }
1000
1001 @Override
1002 public void socialBookmarks(
1003 String displayStyle, String target, String types, String title,
1004 String url)
1005 throws Exception {
1006
1007 SocialBookmarksTag socialBookmarksTag = new SocialBookmarksTag();
1008
1009 setUp(socialBookmarksTag);
1010
1011 socialBookmarksTag.setDisplayStyle(displayStyle);
1012 socialBookmarksTag.setTarget(target);
1013 socialBookmarksTag.setTypes(types);
1014 socialBookmarksTag.setTitle(title);
1015 socialBookmarksTag.setUrl(url);
1016
1017 socialBookmarksTag.runTag();
1018 }
1019
1020
1023 @Deprecated
1024 @Override
1025 public void staging() throws Exception {
1026 }
1027
1028 @Override
1029 public void toggle(
1030 String id, String showImage, String hideImage, String showMessage,
1031 String hideMessage, boolean defaultShowContent)
1032 throws Exception {
1033
1034 ToggleTag.doTag(
1035 id, showImage, hideImage, showMessage, hideMessage,
1036 defaultShowContent, null, _servletContext, _request, _response);
1037 }
1038
1039 @Override
1040 public String wrapPortlet(String wrapPage, String portletPage)
1041 throws Exception {
1042
1043 return WrapPortletTag.doTag(
1044 wrapPage, portletPage, _servletContext, _request, _response);
1045 }
1046
1047 protected void setUp(TagSupport tagSupport) throws Exception {
1048 Writer writer = null;
1049
1050 if (_contextObjects != null) {
1051 writer = (Writer)_contextObjects.get(TemplateConstants.WRITER);
1052 }
1053
1054 if (writer == null) {
1055 writer = _response.getWriter();
1056 }
1057
1058 tagSupport.setPageContext(new PipingPageContext(_pageContext, writer));
1059 }
1060
1061 private final Map<String, Object> _contextObjects;
1062 private final PageContext _pageContext;
1063 private final HttpServletRequest _request;
1064 private final HttpServletResponse _response;
1065 private final ServletContext _servletContext;
1066
1067 }