Mercurial Hosting > nabble
comparison src/nabble/view/web/forum/UploadImage.jtp @ 0:7ecd1a4ef557
add content
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Thu, 21 Mar 2019 19:15:52 -0600 |
parents | |
children | 18cf4872fd7f |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:7ecd1a4ef557 |
---|---|
1 <% | |
2 package nabble.view.web.forum; | |
3 | |
4 import nabble.model.Message; | |
5 import nabble.model.ModelHome; | |
6 import nabble.model.Site; | |
7 import nabble.model.User; | |
8 import nabble.view.lib.Jtp; | |
9 import nabble.view.lib.Shared; | |
10 | |
11 import javax.servlet.ServletException; | |
12 import javax.servlet.http.HttpServlet; | |
13 import javax.servlet.http.HttpServletRequest; | |
14 import javax.servlet.http.HttpServletResponse; | |
15 import java.io.IOException; | |
16 import java.io.PrintWriter; | |
17 | |
18 | |
19 public final class UploadImage extends HttpServlet { | |
20 | |
21 protected void service(HttpServletRequest request,HttpServletResponse response) | |
22 throws ServletException, IOException | |
23 { | |
24 User user = Jtp.getUser(request,response); | |
25 if( user==null ) { | |
26 Jtp.login("You must login to upload a file.",request,response); | |
27 return; | |
28 } | |
29 PrintWriter out = response.getWriter(); | |
30 | |
31 String nodeId = request.getParameter("node"); | |
32 Site site = user.getSite(); | |
33 Message.Source src = nodeId == null || nodeId.length() == 0? new Message.TempSource(user) : site.getNode(Long.valueOf(nodeId)); | |
34 %> | |
35 <html> | |
36 <head> | |
37 <script type="text/javascript"> | |
38 // Fixes the parent variable to consider the nested frames. | |
39 var customParent = function() { | |
40 return parent.parent; | |
41 }; | |
42 </script> | |
43 <% Shared.title(request,response,"Upload Image"); %> | |
44 <script type="text/javascript"> | |
45 // Can only be called after the Shared.title() because of jquery | |
46 $(document).ready(function() { | |
47 var $table = $('table', document.body); | |
48 var h = $table.outerHeight() + 15; | |
49 var w = $table.outerWidth() + 15; | |
50 var f = parent.Nabble.get('imageuploader'); | |
51 $(f).height(h).width(w); | |
52 $(document.body).css('background-color', $('form').parent().css('background-color')); | |
53 }); | |
54 </script> | |
55 </head> | |
56 <body style="background:transparent;margin:0"> | |
57 <% Shared.noHeader(request,response); %> | |
58 <div class="shaded-bg-color" style="padding:.5em"> | |
59 <form id="image-upload-form" action="/forum/UploadImage2.jtp" method="POST" enctype="multipart/form-data"> | |
60 <input type="hidden" name="srcType" value="<%=src.getMessageSourceType().getCode()%>" /> | |
61 <input type="hidden" name="srcId" value="<%=src.getSourceId()%>" /> | |
62 <table> | |
63 <tr> | |
64 <td colspan=2> | |
65 <span class="form-label" style="display:block;margin-bottom:.3em;text-align:left">Upload image from my computer:</span> | |
66 <input name="image" id="nabble.image" type="file" size="35" /> | |
67 </td> | |
68 </tr> | |
69 <tr> | |
70 <td colspan=2> | |
71 <span class="form-label" style="display:block;margin-bottom:.3em;text-align:left">Or copy an image from the Internet:</span> | |
72 <input name="imageUrl" id="nabble.imageUrl" type="text" size="40" value="http://" /> | |
73 </td> | |
74 </tr> | |
75 <tr> | |
76 <td style="padding:.5em 0 0" nowrap> | |
77 <table style="float:left;margin-right:2em"> | |
78 <tr> | |
79 <td colspan=2><span class="form-label" style="display:block;text-align:left">Float</span></td> | |
80 </tr> | |
81 <tr> | |
82 <td><input id="float-none" type="radio" name="float-position" value="none" checked="y"/></td> | |
83 <td><label for="float-none">None</label></td> | |
84 </tr> | |
85 <tr> | |
86 <td><input id="float-left" type="radio" name="float-position" value="left"/></td> | |
87 <td><label for="float-left">Left</label></td> | |
88 </tr> | |
89 <tr> | |
90 <td><input id="float-center" type="radio" name="float-position" value="center"/></td> | |
91 <td><label for="float-center">Center</label></td> | |
92 </tr> | |
93 <tr> | |
94 <td><input id="float-right" type="radio" name="float-position" value="right"/></td> | |
95 <td><label for="float-right">Right</label></td> | |
96 </tr> | |
97 </table> | |
98 <table style="float:left"> | |
99 <tr> | |
100 <td colspan=2><span class="form-label" style="display:block;text-align:left">Resize</span></td> | |
101 </tr> | |
102 <tr> | |
103 <td><input id="resize-none" type="radio" name="resize-size" value="none" checked="y"/></td> | |
104 <td><label for="resize-none">None</label></td> | |
105 </tr> | |
106 <tr> | |
107 <td><input id="resize-small" type="radio" name="resize-size" value="250"/></td> | |
108 <td><label for="resize-small">Small Size (250 x 250px)</label></td> | |
109 </tr> | |
110 <tr> | |
111 <td><input id="resize-medium" type="radio" name="resize-size" value="500"/></td> | |
112 <td><label for="resize-medium">Medium Size (500 x 500px)</label></td> | |
113 </tr> | |
114 <tr> | |
115 <td><input id="resize-big" type="radio" name="resize-size" value="750"/></td> | |
116 <td><label for="resize-big">Big Size (750 x 750px)</label></td> | |
117 </tr> | |
118 </table> | |
119 </td> | |
120 </tr> | |
121 <tr> | |
122 <td style="padding:.7em 0 0" colspan=2> | |
123 <div class="form-label" style="display:block;text-align:left">Description</div> | |
124 <input type="text" name="description" size=40/> | |
125 </td> | |
126 </tr> | |
127 <tr> | |
128 <td style="padding:.5em 0 0" colspan=2> | |
129 <input type="submit" value="Insert Image"> | |
130 <input type="button" value="Close" onclick="parent.Nabble.closeWindows()"> | |
131 </td> | |
132 </tr> | |
133 </table> | |
134 </form> | |
135 </div> | |
136 <% Shared.noFooter(request,response); %> | |
137 </body> | |
138 </html> | |
139 <% | |
140 } | |
141 } | |
142 %> |