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