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