@Override public void doView( HttpServletRequest request, HttpServletResponse response, SWBParamRequest paramsRequest) throws SWBResourceException { try { VelocityContext context = new VelocityContext(); Resource base = paramsRequest.getResourceBase(); String idPage = base.getAttribute("sitePage", base.getWebSite().getHomePage().getId()); WebPage selPage = base.getWebSite().getWebPage(idPage); Iterator<WebPage> childs = selPage.listChilds("es", true, false, false, true, true); List<WebPage> ochilds = new ArrayList<WebPage>(); while (childs.hasNext()) { WebPage child = childs.next(); ochilds.add(child); } context.put("childs", ochilds); context.put("urlPage", selPage.getUrl()); context.put("pageItems", base.getAttribute("pageItems", "0")); context.put("newWindow", base.getAttribute("newWindow", "0")); SWBEmbedTemplates.buildTemplate(response, context, "SWBEmbedWidget", base); } catch (Exception e) { log.error("Ocurrió un error en la construcción de la vista del recurso:\n " + e.getMessage()); log.error(SWBEmbed.getStack(e)); e.printStackTrace(); } }
@Override public void doAdmin( HttpServletRequest request, HttpServletResponse response, SWBParamRequest paramReq) { SWBResourceURL url = paramReq.getActionUrl(); Resource base = getResourceBase(); try { VelocityContext context = new VelocityContext(); WebPage hp = base.getWebSite().getHomePage(); LinkedHashMap<String, String> pages = SWBEmbedPages.getPages(hp, "-"); context.put("pages", pages); context.put("actionURL", url); context.put("msg", request.getParameter("msg")); context.put("sitePage", base.getAttribute("sitePage", "0")); context.put("pageItems", base.getAttribute("pageItems", "0")); context.put("newWindow", base.getAttribute("newWindow", "0")); SWBEmbedTemplates.buildTemplate(response, context, "SWBEmbedWidgetAdmin", base); } catch (Exception e) { log.error( "Ocurrió un error durante la construcción de la vista de administración. " + e.getMessage()); e.printStackTrace(); } }