1 5 6 package com.raptus.owxv3.libtags; 7 8 import java.io.IOException ; 9 10 import javax.servlet.jsp.*; 11 import javax.servlet.jsp.tagext.TagSupport ; 12 13 import org.apache.struts.Globals; 14 import org.apache.struts.action.Action; 15 import org.apache.struts.util.RequestUtils; 16 17 import com.raptus.owxv3.LoggingManager; 18 19 41 public class PopupConfirmTag extends TagSupport { 42 43 44 46 49 protected String okurl = null; 50 51 public String getOkurl() { return (this.okurl); } 52 public void setOkurl(String url) { this.okurl = url; } 53 54 57 protected String cancelurl = null; 58 59 public String getCancelurl() { return (this.cancelurl); } 60 public void setCancelurl(String url) { this.cancelurl = url; } 61 62 65 protected String displaytag = null; 66 67 public String getDisplaytag() { return (this.displaytag); } 68 public void setDisplaytag(String tag) { this.displaytag = tag; } 69 70 73 protected String hreftext = null; 74 75 public String getHreftext() { return (this.hreftext); } 76 public void setHreftext(String text) { this.hreftext = text; } 77 78 81 protected String statustext = null; 82 83 public String getStatustext() { return (this.statustext); } 84 public void setStatustext(String text) { this.statustext = text; } 85 86 89 protected String confirmtext = null; 90 91 public String getConfirmtext() { return (this.confirmtext); } 92 public void setConfirmtext(String text) { this.confirmtext = text; } 93 94 97 protected String target = null; 98 99 public String getTarget() { return (this.target); } 100 public void setTarget(String target) { this.target = target; } 101 102 105 protected String resources = Action.MESSAGES_KEY;; 106 107 public String getResources() { return (this.resources); } 108 public void setResources(String res) { this.resources = res; } 109 110 112 113 118 public int doStartTag() throws JspException 119 { 120 if(cancelurl != null && cancelurl.length() > 0) 121 cancelurl = "else { location=\\'" + cancelurl + "\\'; } "; 122 else 123 cancelurl = ""; 124 125 if(resources != null) 126 { 127 if(confirmtext != null) confirmtext = RequestUtils.message(pageContext, resources, Globals.LOCALE_KEY, confirmtext); 128 if(hreftext != null) hreftext = RequestUtils.message(pageContext, resources, Globals.LOCALE_KEY, hreftext); 129 if(statustext != null) statustext = RequestUtils.message(pageContext, resources, Globals.LOCALE_KEY, statustext); 130 } 131 132 try 133 { 134 JspWriter out = pageContext.getOut(); 135 out.println("<script language=\"javascript\">"); 136 out.println("// <!--"); 137 out.println(" document.write('<a HREF=\"javascript:if(confirm(\\'" + confirmtext + "\\')) { location=\\'" + okurl + "\\'; } " + cancelurl + "\" '); "); 138 out.println(" document.write('title=\"" + hreftext + "\" onmouseover=\"window.status=\\'" + statustext + "\\'; return true\" ');"); 139 out.println(" document.write('" + (target != null ? target : "") + ">" + displaytag + "</a>');"); 140 out.println("// -->"); 141 out.println("</script>"); 142 out.println("<noscript>"); 143 out.println(" <a HREF=\"" + okurl + "\" title=\"" + hreftext + "\">" + displaytag + "</a>"); 144 out.println("</noscript>"); 145 } 146 catch(IOException e) { 147 LoggingManager.log("Somenthing really screwed up", this); 148 } 149 150 return (SKIP_BODY); 152 153 } 154 155 156 159 public void release() 160 { 161 okurl = null; 162 cancelurl = null; 163 displaytag = null; 164 hreftext = null; 165 statustext = null; 166 confirmtext = null; 167 target = null; 168 } 169 170 } 171 172 | Popular Tags |