1 40 package org.dspace.app.webui.jsptag; 41 42 import java.io.IOException ; 43 44 import javax.servlet.http.HttpServletRequest ; 45 import javax.servlet.jsp.JspException ; 46 import javax.servlet.jsp.tagext.BodyContent ; 47 import javax.servlet.jsp.tagext.BodyTagSupport ; 48 49 64 public class PopupTag extends BodyTagSupport 65 { 66 67 private String page; 68 69 public PopupTag() 70 { 71 super(); 72 } 73 74 79 public String getPage() 80 { 81 return page; 82 } 83 84 90 public void setPage(String s) 91 { 92 page = s; 93 } 94 95 public int doAfterBody() throws JspException 96 { 97 112 BodyContent bc = getBodyContent(); 113 String linkText = bc.getString(); 114 bc.clearBody(); 115 116 HttpServletRequest hrq = (HttpServletRequest ) pageContext.getRequest(); 117 String actualPage = hrq.getContextPath() + page; 118 119 String html = "<script type=\"text/javascript\">\n" 120 + "<!-- Javascript starts here\n" 121 + "document.write('<a HREF=\"#\" onClick=\"var popupwin = window.open(\\'" 122 + actualPage 123 + "\\',\\'dspacepopup\\',\\'height=600,width=550,resizable,scrollbars\\');popupwin.focus();return false;\">" 124 + linkText + "<\\/a>');\n" + "// -->\n" 125 + "</script><noscript><a HREF=\"" + actualPage 126 + "\" target=\"dspacepopup\">" + linkText + "</a></noscript>"; 127 128 try 129 { 130 getPreviousOut().print(html); 131 } 132 catch (IOException ie) 133 { 134 throw new JspException (ie); 135 } 136 137 return SKIP_BODY; 138 } 139 } 140 | Popular Tags |