summaryrefslogtreecommitdiff
path: root/httemplate/pref/pref.html
blob: abd1ea57f807298f312bc84fa801590928edcec5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
<& /elements/header.html, mt('Preferences for [_1]', $FS::CurrentUser::CurrentUser->username) &>

<FORM METHOD="POST" NAME="pref_form" ACTION="pref-process.html">

<& /elements/error.html &>

% if ( FS::Auth->auth_class->can('change_password') ) {

    <FONT CLASS="fsinnerbox-title"><% emt('Change password (leave blank for no change)') %></FONT>
    <TABLE CLASS="fsinnerbox">

      <TR>
        <TH ALIGN="right"><% emt("Current password:") %> </TH>
        <TD><INPUT TYPE="password" NAME="_password"></TD>
      </TR>

      <TR>
        <TH ALIGN="right"><% emt("New password:") %> </TH>
        <TD><INPUT TYPE="password" NAME="new_password"></TD>
      </TR>

      <TR>
       <TH ALIGN="right"><% emt("Re-enter new password:") %> </TH>
       <TD><INPUT TYPE="password" NAME="new_password2"></TD>
      </TR>

    </TABLE>
    <BR>

% }

<FONT CLASS="fsinnerbox-title"><% emt("Interface") %></FONT>
<TABLE CLASS="fsinnerbox">

  <TR>
    <TH ALIGN="right"><% emt("Locale:") %> </TH>
    <TD COLSPAN=2>
      <SELECT NAME="locale">
%       foreach my $locale ( @locales ) {
%         my %info = FS::Locales->locale_info($locale);
%         my $selected = ($locale eq $curuser->option('locale'))
%                          ? 'SELECTED' : '';
          <OPTION VALUE="<% $locale %>" <%$selected%>><% $info{name} %> (<% $info{country} %>)
%       }
      </SELECT>
    </TD>
  </TR>

  <TR>
    <TH ALIGN="right" STYLE="vertical-align:top"><% emt("Menu location:") %> </TH>
    <TD>
      <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>
      <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>
    </TD>
    <TD><IMG NAME="menu_example" SRC="../images/menu-<% $menu_position %>-example.png"></TD>
  </TR>

  <TR>
    <TH ALIGN="right"><% emt("Enable mobile-friendly menu:") %> </TH>
    <TD COLSPAN=2>
      <INPUT TYPE="checkbox" NAME="mobile_menu" VALUE="Y"
<% $curuser->option('mobile_menu') ? 'CHECKED' : '' %>>
    </TD>
  </TR>
 
  <TR>
    <TH ALIGN="right"><% emt("Default customer view:") %> </TH>
    <TD COLSPAN=2>
      <SELECT NAME="default_customer_view">
%       foreach my $view ( keys %customer_views ) {
%         my $selected =
%           $customer_views{$view} eq $curuser->option('default_customer_view')
%             ? 'SELECTED'
%             : '';
          <OPTION VALUE="<%$customer_views{$view}%>" <%$selected%>><% emt($view) %></OPTION>
%       }
      </SELECT>
    </TD>
  </TR>

% my $history_order = $curuser->option('history_order') || 'oldest';
  <TR>
    <TH ALIGN="right"><% emt("Customer history sort order:") %> </TH>
    <TD COLSPAN=2>
      <& /elements/select.html,
        field       => 'history_order',
        curr_value  => $history_order,
        options     => [ 'oldest', 'newest' ],
        labels      => { 'oldest' => mt('Oldest first'),
                         'newest' => mt('Newest first'),
                       },
      &>
    </TD>
  </TR>
  
  <TR>
    <TH ALIGN="right"><% emt("Spreadsheet download format:") %> </TH>
    <TD COLSPAN=2>
      <SELECT NAME="spreadsheet_format">
%       my $xls =  $curuser->option('spreadsheet_format') eq 'XLS';
%       my $xlsx = $curuser->option('spreadsheet_format') eq 'XLSX';
        <OPTION VALUE=""></OPTION>
        <OPTION VALUE="XLS"<%  $xls ? 'SELECTED' : '' %>>XLS (Excel 97/2000/XP)
        </OPTION>
        <OPTION VALUE="XLSX"<% $xlsx ? 'SELECTED' : ''%>>XLSX (Excel 2007+)
        </OPTION>
      </SELECT>
    </TD>
  </TR>

  <TR>
    <TH ALIGN="right" COLSPAN=1><% emt("Disable HTML editor for customer notes:") %> </TH>
    <TD ALIGN="left" COLSPAN=2>
      <INPUT TYPE="checkbox" NAME="disable_html_editor" VALUE="1" <% $curuser->option('disable_html_editor') ? 'CHECKED' : '' %>>
    </TD>
  </TR>

  <TR>
    <TH ALIGN="right" COLSPAN=1><% emt("Disable submission on Enter key - one-time charges:") %> </TH>
    <TD ALIGN="left" COLSPAN=2>
      <INPUT TYPE="checkbox" NAME="disable_enter_submit_onetimecharge" VALUE="1" <% $curuser->option('disable_enter_submit_onetimecharge') ? 'CHECKED' : '' %>>
    </TD>
  </TR>

  <TR>
    <TH ALIGN="right"><% emt("Don't copy MAC address delimiters to clipboard") %></TH>
    <TD ALIGN="left" COLSPAN=2>
      <INPUT TYPE="checkbox" NAME="enable_mask_clipboard_hack" VALUE="1" <% $curuser->option('enable_mask_clipboard_hack') ? 'CHECKED' : '' %>>
    </TD>
  </TR>

  <TR>
    <TH ALIGN="right"><% emt("When printing, scale HTML documents to fit on a letter-size page") %></TH>
    <TD ALIGN="left">
      <INPUT TYPE="checkbox" NAME="printtofit" VALUE="Y" <% $curuser->option('printtofit') ? 'CHECKED' : '' %>>
    </TD>
  </TR>

  <TR>
    <TH ALIGN="right"><% emt("How many recently-modified customers displayed on dashboard") %></TH>
    <TD ALIGN="left" COLSPAN=2>
      <INPUT TYPE="text" NAME="dashboard_customers" VALUE="<% $curuser->option('dashboard_customers') %>"></TD>
    </TD>
  </TR>

  <TR>
    <TH ALIGN="right"><% emt("How many recent outbound emails to show in customer view") %></TH>
    <TD ALIGN="left" COLSPAN=2>
      <INPUT TYPE="text" NAME="customer_view_emails" VALUE="<% $curuser->option('customer_view_emails') %>"></TD>
    </TD>
  </TR>

</TABLE>
<BR>


<FONT CLASS="fsinnerbox-title"><% emt("Email Address") %></FONT>
<TABLE CLASS="fsinnerbox">

  <TR>
    <TH><% emt("Email Address(es) (comma separated) ") %></TH>
    <TD>
   <TD><INPUT TYPE="text" NAME="email_address" VALUE="<% $email_address %>">
    </TD>
  </TR>

</TABLE>
<BR>


<FONT CLASS="fsinnerbox-title"><% emt("Development") %></FONT>
<TABLE CLASS="fsinnerbox">

  <TR>
    <TH><% emt("Show customer package timestamps:") %> </TH>
    <TD><INPUT TYPE="checkbox" NAME="cust_pkg-display_times" VALUE="1" <% $curuser->option('cust_pkg-display_times') ? 'CHECKED' : '' %>></TD>
  </TR>
  <TR>
    <TH><% emt("Show internal package numbers:") %> </TH>
    <TD><INPUT TYPE="checkbox" NAME="show_pkgnum" VALUE="1" <% $curuser->option('show_pkgnum') ? 'CHECKED' : '' %>></TD>
  </TR>
  <TR>
    <TH><% emt("Show config item counts:") %> </TH>
    <TD><INPUT TYPE="checkbox" NAME="show_confitem_counts" VALUE="1" <% $curuser->option('show_confitem_counts') ? 'CHECKED' : '' %>></TD>
  </TR>
  <TR>
    <TH><% emt("Show export data on service view (when available):") %> </TH>
    <TD><INPUT TYPE="checkbox" NAME="export_getsettings" VALUE="1" <% $curuser->option('export_getsettings') ? 'CHECKED' : '' %>></TD>
  </TR>
  <TR>
    <TH><% emt("Show database profiling (when available):") %> </TH>
    <TD><INPUT TYPE="checkbox" NAME="show_db_profile" VALUE="1" <% $curuser->option('show_db_profile') ? 'CHECKED' : '' %>></TD>
  </TR>
  <TR>
    <TH><% emt("Save database profiling logs (when available):") %> </TH>
    <TD><INPUT TYPE="checkbox" NAME="save_db_profile" VALUE="1" <% $curuser->option('save_db_profile') ? 'CHECKED' : '' %>></TD>
  </TR>
  <TR>
    <TH><% emt("Save temporary invoice typesetting files:") %> </TH>
    <TD><INPUT TYPE="checkbox" NAME="save_tmp_typesetting" VALUE="1" <% $curuser->option('save_tmp_typesetting') ? 'CHECKED' : '' %>></TD>
  </TR>

</TABLE>
<BR>

% if ( $curuser->access_right('Employee preference telephony integration') ) {

<% emt("SNOM integration") %>
<% ntable("#cccccc",2) %>

  <TR>
    <TH ALIGN="right"><% emt("SNOM IP address") %></TH>
    <TD><INPUT TYPE="text" NAME="snom-ip" VALUE="<% $curuser->option('snom-ip') %>"></TD>
  </TR>

  <TR>
    <TH ALIGN="right"><% emt("SNOM HTTP username (if necessary)") %></TH>
    <TD><INPUT TYPE="text" NAME="snom-username" VALUE="<% $curuser->option('snom-username') %>"></TD>
  </TR>

  <TR>
    <TH ALIGN="right"><% emt("SNOM HTTP password (if necessary)") %></TH>
    <TD><INPUT TYPE="password" NAME="snom-password" VALUE="<% $curuser->option('snom-password') %>"></TD>
  </TR>

</TABLE>
<BR>

<% emt("OR")%><BR><BR>

<% emt("Vonage integration (see") %> <a href="https://secure.click2callu.com/"><% emt("Click2Call") %></a>)
<% ntable("#cccccc",2) %>

  <TR>
    <TH ALIGN="right"><% emt("Vonage phone number") %></TH>
    <TD><INPUT TYPE="text" NAME="vonage-fromnumber" VALUE="<% $curuser->option('vonage-fromnumber') %>"></TD>
  </TR>

  <TR>
    <TH ALIGN="right"><% emt("Vonage username") %></TH>
    <TD><INPUT TYPE="text" NAME="vonage-username" VALUE="<% $curuser->option('vonage-username') %>"></TD>
  </TR>

  <TR>
    <TH ALIGN="right"><% emt("Vonage password") %></TH>
    <TD><INPUT TYPE="password" NAME="vonage-password" VALUE="<% $curuser->option('vonage-password') %>"></TD>
  </TR>

</TABLE>
<BR>

% }

% foreach my $prop (qw( height width availHeight availWidth colorDepth )) {
  <INPUT TYPE="hidden" NAME="<% $prop %>" VALUE="">
  <SCRIPT TYPE="text/javascript">
  document.pref_form.<% $prop %>.value = screen.<% $prop %>;
  </script>
% }

<INPUT TYPE="submit" VALUE="<% emt("Update preferences") %>">

<&/elements/footer.html &>
<%init>

my $curuser = $FS::CurrentUser::CurrentUser;

#false laziness w/view/cust_main.cgi and Conf.pm (cust_main-default_view)

tie my %customer_views, 'Tie::IxHash',
  'Basics'          => 'basics',
  'Notes'           => 'notes', #notes and files?
  'Tickets'         => 'tickets',
  'Appointments'    => 'appointments',
  'Quotations'      => 'quotations',
  'Packages'        => 'packages',
  'Payment History' => 'payment_history',
;
$customer_views{'Change History'} = 'change_history'
  if $curuser->access_right('View customer history');

# XSS via your own preferences?  seems unlikely, but nice try anyway...
( $curuser->option('menu_position') || 'top' )
  =~ /^(\w+)$/ or die "illegal menu_position";
my $menu_position = $1;
( $curuser->option('email_address') )
  =~ /^([,\w\@.\-]*)$/ or die "illegal email_address";  #too late
my $email_address = $1;

my $conf = new FS::Conf;

my @locales = $conf->config('available-locales');

if ( ! @locales ) {

	@locales = FS::Locales->locales ;

}

</%init>