RT# 82949 - changes section name from fees to pricing, better opiton
[freeside.git] / httemplate / elements / pbx_extension.html
1 % unless ( $opt{'js_only'} ) {
2
3   <INPUT TYPE="hidden" NAME="<%$name%>" ID="<%$id%>" VALUE="<% $curr_value %>">
4
5   <TABLE STYLE="display:inline">
6     <TR>
7
8 %     ###
9 %     # extension
10 %     ###
11       <TD>
12         <INPUT
13               TYPE  = "text"
14               NAME  = "<%$name%>_extension"
15               ID    = "<%$id%>_extension"
16               VALUE = "<% scalar($cgi->param($name.'_extension'))
17                             || $pbx_extension->extension
18                        %>"
19               SIZE  = 5
20               MAXLENGTH = 6
21               <% $onchange %>
22             >
23         <BR>
24         <FONT SIZE="-1">Extension</FONT>
25       </TD>
26
27 %     ###
28 %     # pin
29 %     ###
30       <TD>
31         <INPUT
32               TYPE  = "text"
33               NAME  = "<%$name%>_pin"
34               ID    = "<%$id%>_pin"
35               VALUE = "<% scalar($cgi->param($name.'_pin'))
36                             || $pbx_extension->pin
37                        %>"
38               SIZE  = 7
39               MAXLENGTH = 6
40               <% $onchange %>
41             >
42         <BR>
43         <FONT SIZE="-1">PIN</FONT>
44       </TD>
45
46 %     ###
47 %     # sip_password
48 %     ###
49       <TD>
50         <INPUT
51               TYPE  = "text"
52               NAME  = "<%$name%>_sip_password"
53               ID    = "<%$id%>_sip_password"
54               VALUE = "<% scalar($cgi->param($name.'_sip_password'))
55                             || $pbx_extension->sip_password
56                        %>"
57               SIZE      = <% $passwordmax == 80 ? 20 : $passwordmax + 2 %>
58               MAXLENGTH = <% $passwordmax + 2 %>
59               <% $onchange %>
60             >
61         <BR>
62         <FONT SIZE="-1">SIP Password</FONT>
63       </TD>
64
65 %     ###
66 %     # phone_name
67 %     ###
68       <TD>
69         <INPUT
70               TYPE  = "text"
71               NAME  = "<%$name%>_phone_name"
72               ID    = "<%$id%>_phone_name"
73               VALUE = "<% scalar($cgi->param($name.'_phone_name'))
74                             || $pbx_extension->phone_name
75                        %>"
76               SIZE      = 20
77               MAXLENGTH = 80
78               <% $onchange %>
79             >
80         <BR>
81         <FONT SIZE="-1">Name</FONT>
82       </TD>
83
84     </TR>
85   </TABLE>
86
87 % }
88 <%init>
89
90 my( %opt ) = @_;
91
92 my $conf = new FS::Conf;
93 my $passwordmax = $conf->config('sip_passwordmax') || 80;
94
95 my $name = $opt{'element_name'} || $opt{'field'} || 'extensionnum';
96 my $id = $opt{'id'} || 'extensionnum';
97
98 my $curr_value = $opt{'curr_value'} || $opt{'value'};
99
100 my $onchange = '';
101 if ( $opt{'onchange'} ) {
102   $onchange = $opt{'onchange'};
103   $onchange .= '(this)' unless $onchange =~ /\(\w*\);?$/;
104   $onchange =~ s/\(what\);/\(this\);/g; #ugh, terrible hack.  all onchange
105                                         #callbacks should act the same
106   $onchange = 'onChange="'. $onchange. '"';
107 }
108
109 my $pbx_extension = $curr_value
110   ? qsearchs('pbx_extension', { 'extensionnum' => $curr_value } )
111   : new FS::pbx_extension {};
112
113 </%init>