RT# 78617 - fixed preference field customer_view_emails to only except whole numbers...
[freeside.git] / httemplate / pref / pref.html
1 <& /elements/header.html, mt('Preferences for [_1]', $FS::CurrentUser::CurrentUser->username) &>
2
3 % my $js_form_validate = { 'pref_form' => { 'name' => 'pref_form' } };
4
5 <FORM METHOD="POST" NAME="pref_form" ACTION="pref-process.html">
6
7 <& /elements/error.html &>
8
9 <& /elements/alert.html &>
10
11 % if ( FS::Auth->auth_class->can('change_password') ) {
12
13     <FONT CLASS="fsinnerbox-title"><% emt('Change password (leave blank for no change)') %></FONT>
14     <TABLE CLASS="fsinnerbox">
15
16       <TR>
17         <TH ALIGN="right"><% emt("Current password:") %> </TH>
18         <TD><INPUT TYPE="password" NAME="_password"></TD>
19       </TR>
20
21       <TR>
22         <TH ALIGN="right"><% emt("New password:") %> </TH>
23         <TD><INPUT TYPE="password" NAME="new_password"></TD>
24       </TR>
25
26       <TR>
27        <TH ALIGN="right"><% emt("Re-enter new password:") %> </TH>
28        <TD><INPUT TYPE="password" NAME="new_password2"></TD>
29       </TR>
30
31     </TABLE>
32     <BR>
33
34 % }
35
36 <FONT CLASS="fsinnerbox-title"><% emt("Interface") %></FONT>
37 <TABLE CLASS="fsinnerbox">
38
39   <TR>
40     <TH ALIGN="right"><% emt("Locale:") %> </TH>
41     <TD COLSPAN=2>
42       <SELECT NAME="locale">
43 %       foreach my $locale ( @locales ) {
44 %         my %info = FS::Locales->locale_info($locale);
45 %         my $selected = ($locale eq $curuser->option('locale'))
46 %                          ? 'SELECTED' : '';
47           <OPTION VALUE="<% $locale %>" <%$selected%>><% $info{name} %> (<% $info{country} %>)
48 %       }
49       </SELECT>
50     </TD>
51   </TR>
52
53   <TR>
54     <TH ALIGN="right" STYLE="vertical-align:top"><% emt("Menu location:") %> </TH>
55     <TD>
56       <INPUT TYPE="radio" NAME="menu_position" VALUE="left" onClick="document.images['menu_example'].src='../images/menu-left-example.png';" <% $menu_position eq 'left' ? ' CHECKED' : ''%>> <% emt("Left") %><BR>
57       <INPUT TYPE="radio" NAME="menu_position" VALUE="top" onClick="document.images['menu_example'].src='../images/menu-top-example.png';" <% $menu_position eq 'top' ? ' CHECKED' : ''%>> <% emt("Top") %> <BR>
58     </TD>
59     <TD><IMG NAME="menu_example" SRC="../images/menu-<% $menu_position %>-example.png"></TD>
60   </TR>
61
62   <TR>
63     <TH ALIGN="right"><% emt("Enable mobile-friendly menu:") %> </TH>
64     <TD COLSPAN=2>
65       <INPUT TYPE="checkbox" NAME="mobile_menu" VALUE="Y"
66 <% $curuser->option('mobile_menu') ? 'CHECKED' : '' %>>
67     </TD>
68   </TR>
69  
70   <TR>
71     <TH ALIGN="right"><% emt("Default customer view:") %> </TH>
72     <TD COLSPAN=2>
73       <SELECT NAME="default_customer_view">
74 %       foreach my $view ( keys %customer_views ) {
75 %         my $selected =
76 %           $customer_views{$view} eq $curuser->option('default_customer_view')
77 %             ? 'SELECTED'
78 %             : '';
79           <OPTION VALUE="<%$customer_views{$view}%>" <%$selected%>><% emt($view) %></OPTION>
80 %       }
81       </SELECT>
82     </TD>
83   </TR>
84
85 % my $history_order = $curuser->option('history_order') || 'oldest';
86   <TR>
87     <TH ALIGN="right"><% emt("Customer history sort order:") %> </TH>
88     <TD COLSPAN=2>
89       <& /elements/select.html,
90         field       => 'history_order',
91         curr_value  => $history_order,
92         options     => [ 'oldest', 'newest' ],
93         labels      => { 'oldest' => mt('Oldest first'),
94                          'newest' => mt('Newest first'),
95                        },
96       &>
97     </TD>
98   </TR>
99   
100   <TR>
101     <TH ALIGN="right"><% emt("Spreadsheet download format:") %> </TH>
102     <TD COLSPAN=2>
103       <SELECT NAME="spreadsheet_format">
104 %       my $xls =  $curuser->option('spreadsheet_format') eq 'XLS';
105 %       my $xlsx = $curuser->option('spreadsheet_format') eq 'XLSX';
106         <OPTION VALUE=""></OPTION>
107         <OPTION VALUE="XLS"<%  $xls ? 'SELECTED' : '' %>>XLS (Excel 97/2000/XP)
108         </OPTION>
109         <OPTION VALUE="XLSX"<% $xlsx ? 'SELECTED' : ''%>>XLSX (Excel 2007+)
110         </OPTION>
111       </SELECT>
112     </TD>
113   </TR>
114
115   <TR>
116     <TH ALIGN="right" COLSPAN=1><% emt("Disable HTML editor for customer notes:") %> </TH>
117     <TD ALIGN="left" COLSPAN=2>
118       <INPUT TYPE="checkbox" NAME="disable_html_editor" VALUE="1" <% $curuser->option('disable_html_editor') ? 'CHECKED' : '' %>>
119     </TD>
120   </TR>
121
122   <TR>
123     <TH ALIGN="right" COLSPAN=1><% emt("Disable submission on Enter key - one-time charges:") %> </TH>
124     <TD ALIGN="left" COLSPAN=2>
125       <INPUT TYPE="checkbox" NAME="disable_enter_submit_onetimecharge" VALUE="1" <% $curuser->option('disable_enter_submit_onetimecharge') ? 'CHECKED' : '' %>>
126     </TD>
127   </TR>
128
129   <TR>
130     <TH ALIGN="right"><% emt("Don't copy MAC address delimiters to clipboard") %></TH>
131     <TD ALIGN="left" COLSPAN=2>
132       <INPUT TYPE="checkbox" NAME="enable_mask_clipboard_hack" VALUE="1" <% $curuser->option('enable_mask_clipboard_hack') ? 'CHECKED' : '' %>>
133     </TD>
134   </TR>
135
136   <TR>
137     <TH ALIGN="right"><% emt("When printing, scale HTML documents to fit on a letter-size page") %></TH>
138     <TD ALIGN="left">
139       <INPUT TYPE="checkbox" NAME="printtofit" VALUE="Y" <% $curuser->option('printtofit') ? 'CHECKED' : '' %>>
140     </TD>
141   </TR>
142
143   <TR>
144     <TH ALIGN="right"><% emt("How many recently-modified customers displayed on dashboard") %></TH>
145     <TD ALIGN="left" COLSPAN=2>
146       <INPUT TYPE="text" NAME="dashboard_customers" VALUE="<% $curuser->option('dashboard_customers') %>"></TD>
147     </TD>
148   </TR>
149
150 % my $validate_field_cve = 'customer_view_emails';
151 % $js_form_validate->{pref_form}->{validate_fields}{$validate_field_cve} = 'digits: true';
152 % $js_form_validate->{pref_form}->{error_message}{$validate_field_cve} = 'Please only enter numbers here.';
153
154   <TR>
155     <TH ALIGN="right"><% emt("How many recent outbound emails to show in customer view") %></TH>
156     <TD ALIGN="left" COLSPAN=2>
157       <INPUT TYPE="text" ID="<% $validate_field_cve %>" NAME="<% $validate_field_cve %>" VALUE="<% $curuser->option('customer_view_emails') %>"></TD>
158     </TD>
159   </TR>
160
161 </TABLE>
162 <BR>
163
164
165 <FONT CLASS="fsinnerbox-title"><% emt("Email Address") %></FONT>
166 <TABLE CLASS="fsinnerbox">
167
168   <TR>
169     <TH><% emt("Email Address(es) (comma separated) ") %></TH>
170     <TD>
171    <TD><INPUT TYPE="text" NAME="email_address" VALUE="<% $email_address %>">
172     </TD>
173   </TR>
174
175 </TABLE>
176 <BR>
177
178
179 <FONT CLASS="fsinnerbox-title"><% emt("Development") %></FONT>
180 <TABLE CLASS="fsinnerbox">
181
182   <TR>
183     <TH><% emt("Show customer package timestamps:") %> </TH>
184     <TD><INPUT TYPE="checkbox" NAME="cust_pkg-display_times" VALUE="1" <% $curuser->option('cust_pkg-display_times') ? 'CHECKED' : '' %>></TD>
185   </TR>
186   <TR>
187     <TH><% emt("Show internal package numbers:") %> </TH>
188     <TD><INPUT TYPE="checkbox" NAME="show_pkgnum" VALUE="1" <% $curuser->option('show_pkgnum') ? 'CHECKED' : '' %>></TD>
189   </TR>
190   <TR>
191     <TH><% emt("Show config item counts:") %> </TH>
192     <TD><INPUT TYPE="checkbox" NAME="show_confitem_counts" VALUE="1" <% $curuser->option('show_confitem_counts') ? 'CHECKED' : '' %>></TD>
193   </TR>
194   <TR>
195     <TH><% emt("Show export data on service view (when available):") %> </TH>
196     <TD><INPUT TYPE="checkbox" NAME="export_getsettings" VALUE="1" <% $curuser->option('export_getsettings') ? 'CHECKED' : '' %>></TD>
197   </TR>
198   <TR>
199     <TH><% emt("Show database profiling (when available):") %> </TH>
200     <TD><INPUT TYPE="checkbox" NAME="show_db_profile" VALUE="1" <% $curuser->option('show_db_profile') ? 'CHECKED' : '' %>></TD>
201   </TR>
202   <TR>
203     <TH><% emt("Save database profiling logs (when available):") %> </TH>
204     <TD><INPUT TYPE="checkbox" NAME="save_db_profile" VALUE="1" <% $curuser->option('save_db_profile') ? 'CHECKED' : '' %>></TD>
205   </TR>
206   <TR>
207     <TH><% emt("Save temporary invoice typesetting files:") %> </TH>
208     <TD><INPUT TYPE="checkbox" NAME="save_tmp_typesetting" VALUE="1" <% $curuser->option('save_tmp_typesetting') ? 'CHECKED' : '' %>></TD>
209   </TR>
210
211 </TABLE>
212 <BR>
213
214 % if ( $curuser->access_right('Employee preference telephony integration') ) {
215
216 <% emt("SNOM integration") %>
217 <% ntable("#cccccc",2) %>
218
219   <TR>
220     <TH ALIGN="right"><% emt("SNOM IP address") %></TH>
221     <TD><INPUT TYPE="text" NAME="snom-ip" VALUE="<% $curuser->option('snom-ip') %>"></TD>
222   </TR>
223
224   <TR>
225     <TH ALIGN="right"><% emt("SNOM HTTP username (if necessary)") %></TH>
226     <TD><INPUT TYPE="text" NAME="snom-username" VALUE="<% $curuser->option('snom-username') %>"></TD>
227   </TR>
228
229   <TR>
230     <TH ALIGN="right"><% emt("SNOM HTTP password (if necessary)") %></TH>
231     <TD><INPUT TYPE="password" NAME="snom-password" VALUE="<% $curuser->option('snom-password') %>"></TD>
232   </TR>
233
234 </TABLE>
235 <BR>
236
237 <% emt("OR")%><BR><BR>
238
239 <% emt("Vonage integration (see") %> <a href="https://secure.click2callu.com/"><% emt("Click2Call") %></a>)
240 <% ntable("#cccccc",2) %>
241
242   <TR>
243     <TH ALIGN="right"><% emt("Vonage phone number") %></TH>
244     <TD><INPUT TYPE="text" NAME="vonage-fromnumber" VALUE="<% $curuser->option('vonage-fromnumber') %>"></TD>
245   </TR>
246
247   <TR>
248     <TH ALIGN="right"><% emt("Vonage username") %></TH>
249     <TD><INPUT TYPE="text" NAME="vonage-username" VALUE="<% $curuser->option('vonage-username') %>"></TD>
250   </TR>
251
252   <TR>
253     <TH ALIGN="right"><% emt("Vonage password") %></TH>
254     <TD><INPUT TYPE="password" NAME="vonage-password" VALUE="<% $curuser->option('vonage-password') %>"></TD>
255   </TR>
256
257 </TABLE>
258 <BR>
259
260 % }
261
262 % foreach my $prop (qw( height width availHeight availWidth colorDepth )) {
263   <INPUT TYPE="hidden" NAME="<% $prop %>" VALUE="">
264   <SCRIPT TYPE="text/javascript">
265   document.pref_form.<% $prop %>.value = screen.<% $prop %>;
266   </script>
267 % }
268
269 <INPUT TYPE="submit" VALUE="<% emt("Update preferences") %>">
270
271 % my %footerdata = (
272 %   'formvalidation' => $js_form_validate,
273 % );
274 <% include("/elements/footer.html", %footerdata) %>
275
276 %#<&/elements/footer.html &>
277
278 <%init>
279
280 my $curuser = $FS::CurrentUser::CurrentUser;
281
282 #false laziness w/view/cust_main.cgi and Conf.pm (cust_main-default_view)
283
284 tie my %customer_views, 'Tie::IxHash',
285   'Basics'          => 'basics',
286   'Notes'           => 'notes', #notes and files?
287   'Tickets'         => 'tickets',
288   'Appointments'    => 'appointments',
289   'Quotations'      => 'quotations',
290   'Packages'        => 'packages',
291   'Payment History' => 'payment_history',
292 ;
293 $customer_views{'Change History'} = 'change_history'
294   if $curuser->access_right('View customer history');
295
296 # XSS via your own preferences?  seems unlikely, but nice try anyway...
297 ( $curuser->option('menu_position') || 'top' )
298   =~ /^(\w+)$/ or die "illegal menu_position";
299 my $menu_position = $1;
300 ( $curuser->option('email_address') )
301   =~ /^([,\w\@.\-]*)$/ or die "illegal email_address";  #too late
302 my $email_address = $1;
303
304 my $conf = new FS::Conf;
305
306 my @locales = $conf->config('available-locales');
307
308 if ( ! @locales ) {
309
310         @locales = FS::Locales->locales ;
311
312 }
313
314 </%init>