Mercurial Hosting > nabble
comparison src/nabble/view/web/user/Advanced.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.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 Advanced 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 settings.",request,response); | |
25 return; | |
26 } | |
27 %> | |
28 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> | |
29 <html> | |
30 <head> | |
31 <% Shared.title(request,response,"Advanced Settings"); %> | |
32 <script type="text/javascript"> | |
33 Nabble.currentStyle = function(t) { | |
34 return t.currentStyle ? t.currentStyle : getComputedStyle(t,null); | |
35 }; | |
36 | |
37 Nabble.init = function() { | |
38 var dateFmt = Nabble.getCookie("date_fmt"); | |
39 if( dateFmt==null ) | |
40 dateFmt = "default"; | |
41 Nabble.get("nabble.date_fmt."+dateFmt).checked = true; | |
42 var maxWidth = Nabble.getCookie("max_width"); | |
43 if( maxWidth!=null ) | |
44 Nabble.get("nabble.max_width").value = maxWidth; | |
45 var fontSize = Nabble.getCookie("font_size"); | |
46 if( fontSize==null ) { | |
47 var t = Nabble.get('nabble'); | |
48 fontSize = Nabble.currentStyle(t).fontSize; | |
49 Nabble.get("nabble.font_size_comment").innerHTML = '(default value)'; | |
50 } else { | |
51 Nabble.get("nabble.font_size_comment").innerHTML = '(leave blank to reset to default)'; | |
52 } | |
53 Nabble.get("nabble.font_size").value = fontSize; | |
54 Nabble.get("nabble-online").checked = Nabble.getCookie('visible') != null; | |
55 }; | |
56 | |
57 Nabble.submit = function() { | |
58 var dateFmts = ["default","euro","tech"]; | |
59 for( var i=0; i<dateFmts.length; i++ ) { | |
60 if( Nabble.get("nabble.date_fmt."+dateFmts[i]).checked ) { | |
61 var dateFmt = dateFmts[i]; | |
62 break; | |
63 } | |
64 } | |
65 if( dateFmt=="default" ) { | |
66 Nabble.deleteCookie("date_fmt"); | |
67 } else { | |
68 Nabble.setPersistentCookie("date_fmt",dateFmt); | |
69 } | |
70 var maxWidth = Nabble.get("nabble.max_width").value.replace(/ /,""); | |
71 if( maxWidth=="" ) { | |
72 Nabble.deleteCookie("max_width"); | |
73 } else { | |
74 Nabble.setPersistentCookie("max_width",maxWidth); | |
75 } | |
76 var t = Nabble.get('nabble'); | |
77 var defaultFontSize = Nabble.currentStyle(t).fontSize; | |
78 var fontSize = Nabble.get("nabble.font_size").value.replace(/ /,""); | |
79 if( fontSize=="" || fontSize==defaultFontSize ) { | |
80 Nabble.deleteCookie("font_size"); | |
81 } else { | |
82 Nabble.setPersistentCookie("font_size",fontSize); | |
83 } | |
84 var invisible = Nabble.get("nabble-online").checked; | |
85 if (invisible) | |
86 Nabble.setPersistentCookie('visible', 'off'); | |
87 else | |
88 Nabble.deleteCookie('visible'); | |
89 | |
90 location = "Advanced2.jtp"; | |
91 }; | |
92 </script> | |
93 <style type="text/css"> | |
94 .nabble .advanced-table td { | |
95 padding: 0.5em; | |
96 } | |
97 .field-title { | |
98 text-align: right; | |
99 } | |
100 </style> | |
101 </head> | |
102 <body> | |
103 <% | |
104 Shared.minHeaderGlobal(request,response); | |
105 Shared.profileHeading(request,out,user,"Advanced Settings"); | |
106 %> | |
107 | |
108 <div> | |
109 Configurations on this screen are saved on this computer only. | |
110 </div> | |
111 | |
112 <form action="/user/Advanced.jtp" style="display:inline;"> | |
113 <table class="advanced-table" style="margin: 1em;border-collapse: collapse;"> | |
114 <tr valign="top"> | |
115 <td class="second-font field-title weak-color" style="padding-top:.8em">Use Date Format<br /></td> | |
116 <td> | |
117 <input type="radio" name="nabble.date_fmt" id="nabble.date_fmt.default" /><label for="nabble.date_fmt.default">Aug 11, 2006; 09:06pm</label><br /> | |
118 <input type="radio" name="nabble.date_fmt" id="nabble.date_fmt.euro" /><label for="nabble.date_fmt.euro">21:06, 11.Aug.2006</label><br /> | |
119 <input type="radio" name="nabble.date_fmt" id="nabble.date_fmt.tech" /><label for="nabble.date_fmt.tech">2006-08-11 21:06</label><br /> | |
120 </td> | |
121 </tr> | |
122 <tr> | |
123 <td class="second-font field-title weak-color">Maximum width of messages<br /></td> | |
124 <td> | |
125 <input id="nabble.max_width" size="10" /> | |
126 (like 600px or 50em or leave blank for variable width) | |
127 </td> | |
128 </tr> | |
129 <tr> | |
130 <td class="second-font field-title weak-color">Font Size<br /></td> | |
131 <td> | |
132 <input id="nabble.font_size" size="10" /> | |
133 <span id="nabble.font_size_comment"></span> | |
134 </td> | |
135 </tr> | |
136 <tr> | |
137 <td class="second-font field-title weak-color">Online Status</td> | |
138 <td> | |
139 <input type="checkbox" id="nabble-online" value="y" /> | |
140 <label for="nabble-online">Hide my online indicator (invisible mode)</label> | |
141 </td> | |
142 </tr> | |
143 </table> | |
144 | |
145 <input type="submit" value="Update Settings" onclick="Nabble.submit(); return false;" /> | |
146 or <a href="/template/NamlServlet.jtp?macro=user_profile">Cancel</a> | |
147 </form> | |
148 <script type="text/javascript"> | |
149 Nabble.init(); | |
150 </script> | |
151 | |
152 <% Shared.footer(request,response); %> | |
153 <% Shared.analytics(request,response); %> | |
154 </body> | |
155 </html> | |
156 <% | |
157 } | |
158 } | |
159 %> |