1 25 26 package net.killingar.forum.actions.area.customizer; 27 28 import net.killingar.forum.actions.area.EditMessage; 29 import net.killingar.forum.internal.FieldData; 30 31 public class Links extends AbstractParameterizedCustomizer 32 { 33 String description, url, title; 35 36 protected void updateParams(FieldData f) 38 { 39 updateParam("url", f); 40 updateParam("description", f); 41 updateParam("title", f); 42 } 43 44 public void previewMessage(EditMessage in) 45 { 46 FieldData f = new FieldData(in.body); 47 url = (String )f.getFields().get("url"); 48 description = (String )f.getFields().get("description"); 49 title = (String )f.getFields().get("title"); 50 51 preview(in, f); 52 } 53 54 public boolean editMessagePreProccess(EditMessage in) 55 { 56 if (in.replyMessageID != -1) 57 return true; 58 59 super.editMessagePreProccess(in); 60 if (!url.startsWith("http://") && !url.startsWith("https://") && !url.startsWith("ftp://")) 61 { 62 in.addErrorMessage("URLs must start with http://"); 63 return false; 64 } 65 66 return true; 67 } 68 69 71 public void setUrl(String in) { url = in; } 73 public void setDescription(String in) { description = in; } 74 public void setTitle(String in) { title = in; } 75 76 public String getWriteView() { return "link-write.jsp"; } 78 public String getMessageView() { return "link-message.jsp"; } 79 80 public String getUrl() { return url; } 81 public String getDescription() { return description; } 82 public String getTitle() { return title; } 83 } | Popular Tags |