Mercurial Hosting > nabble
comparison src/nabble/view/web/user/ChangeAvatar.java @ 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.user; | |
3 | |
4 import nabble.model.User; | |
5 import nabble.view.lib.Jtp; | |
6 import nabble.view.lib.Shared; | |
7 | |
8 import javax.servlet.ServletException; | |
9 import javax.servlet.http.HttpServlet; | |
10 import javax.servlet.http.HttpServletRequest; | |
11 import javax.servlet.http.HttpServletResponse; | |
12 import java.io.IOException; | |
13 import java.io.PrintWriter; | |
14 | |
15 | |
16 public final class ChangeAvatar extends HttpServlet { | |
17 | |
18 protected void service(HttpServletRequest request,HttpServletResponse response) | |
19 throws ServletException, IOException | |
20 { | |
21 PrintWriter out = response.getWriter(); | |
22 User user = Jtp.getUser(request,response); | |
23 if (user==null) { | |
24 Jtp.login("You must login to change your email.",request,response); | |
25 return; | |
26 } | |
27 | |
28 | |
29 out.print( "\r\n<html>\r\n<head>\r\n " ); | |
30 Shared.title(request,response,"Change Avatar"); | |
31 out.print( "\r\n <script type=\"text/javascript\">\r\n function deleteAvatar() {\r\n if (!confirm('Do you really want to reset your avatar?'))\r\n return;\r\n var newLocation = \"/user/ChangeAvatar2.jtp?action=delete\";\r\n Nabble.setTop(newLocation);\r\n };\r\n </script>\r\n</head>\r\n<body>\r\n " ); | |
32 | |
33 Shared.minHeaderGlobal(request,response); | |
34 Shared.profileHeading(request,out,user,"Change Your Picture"); | |
35 | |
36 out.print( "\r\n<br/>\r\n<form action=\"/user/ChangeAvatar2.jtp\" method=\"POST\" enctype=\"multipart/form-data\">\r\n <table cellspacing=\"3\">\r\n <tr valign=\"top\">\r\n <td>\r\n <img class=\"avatar light-border-color\" src=\"" ); | |
37 out.print( (Shared.getAvatarImageURL(user, false)) ); | |
38 out.print( "\"/><br/>\r\n <div style=\"text-align:center\"><a href=\"javascript: deleteAvatar();\">Reset Picture</a></div>\r\n </td>\r\n <td>\r\n <span class=\"form-label\">Choose a file to upload:</span><br/>\r\n <input name=\"image\" id=\"image\" type=\"file\" size=\"35\" /><br/>\r\n <span style=\"font-size:80%\"><strong>Important:</strong> The file size cannot exceed 4 Mb and the image must be at least 100 x 100 px.</span><br/><br/>\r\n <input type=\"submit\" value=\"Upload Image\">\r\n or <a href=\"/template/NamlServlet.jtp?macro=user_profile\">Cancel</a>\r\n </td>\r\n </tr>\r\n </table>\r\n</form>\r\n\r\n" ); | |
39 Shared.footer(request,response); | |
40 out.print( "\r\n" ); | |
41 Shared.analytics(request,response); | |
42 out.print( "\r\n</body>\r\n</html>\r\n" ); | |
43 | |
44 } | |
45 } | |
46 |