summaryrefslogtreecommitdiff
path: root/httemplate/elements
diff options
context:
space:
mode:
authorIvan Kohler <ivan@freeside.biz>2014-01-18 19:13:14 -0800
committerIvan Kohler <ivan@freeside.biz>2014-01-18 19:13:14 -0800
commit6ac45d15e85b10e3d63645c26a0a2acbad103df1 (patch)
tree79ffb548e9018b9512fe31740e6ab8911e08ff2a /httemplate/elements
parent5fbd483ef56737fad894f18ec311a817c40054f0 (diff)
FS/FS/pbx_extension.pm
Diffstat (limited to 'httemplate/elements')
-rw-r--r--httemplate/elements/pbx_extension.html113
-rw-r--r--httemplate/elements/tr-pbx_extension.html24
2 files changed, 137 insertions, 0 deletions
diff --git a/httemplate/elements/pbx_extension.html b/httemplate/elements/pbx_extension.html
new file mode 100644
index 000000000..62a1f5172
--- /dev/null
+++ b/httemplate/elements/pbx_extension.html
@@ -0,0 +1,113 @@
+% unless ( $opt{'js_only'} ) {
+
+ <INPUT TYPE="hidden" NAME="<%$name%>" ID="<%$id%>" VALUE="<% $curr_value %>">
+
+ <TABLE STYLE="display:inline">
+ <TR>
+
+% ###
+% # extension
+% ###
+ <TD>
+ <INPUT
+ TYPE = "text"
+ NAME = "<%$name%>_extension"
+ ID = "<%$id%>_extension"
+ VALUE = "<% scalar($cgi->param($name.'_extension'))
+ || $pbx_extension->extension
+ %>"
+ SIZE = 5
+ MAXLENGTH = 6
+ <% $onchange %>
+ >
+ <BR>
+ <FONT SIZE="-1">Extension</FONT>
+ </TD>
+
+% ###
+% # pin
+% ###
+ <TD>
+ <INPUT
+ TYPE = "text"
+ NAME = "<%$name%>_pin"
+ ID = "<%$id%>_pin"
+ VALUE = "<% scalar($cgi->param($name.'_pin'))
+ || $pbx_extension->pin
+ %>"
+ SIZE = 7
+ MAXLENGTH = 6
+ <% $onchange %>
+ >
+ <BR>
+ <FONT SIZE="-1">PIN</FONT>
+ </TD>
+
+% ###
+% # sip_password
+% ###
+ <TD>
+ <INPUT
+ TYPE = "text"
+ NAME = "<%$name%>_sip_password"
+ ID = "<%$id%>_sip_password"
+ VALUE = "<% scalar($cgi->param($name.'_sip_password'))
+ || $pbx_extension->sip_password
+ %>"
+ SIZE = <% $passwordmax == 80 ? 20 : $passwordmax + 2 %>
+ MAXLENGTH = <% $passwordmax + 2 %>
+ <% $onchange %>
+ >
+ <BR>
+ <FONT SIZE="-1">SIP Password</FONT>
+ </TD>
+
+% ###
+% # phone_name
+% ###
+ <TD>
+ <INPUT
+ TYPE = "text"
+ NAME = "<%$name%>_phone_name"
+ ID = "<%$id%>_phone_name"
+ VALUE = "<% scalar($cgi->param($name.'_phone_name'))
+ || $pbx_extension->phone_name
+ %>"
+ SIZE = 20
+ MAXLENGTH = 80
+ <% $onchange %>
+ >
+ <BR>
+ <FONT SIZE="-1">Name</FONT>
+ </TD>
+
+ </TR>
+ </TABLE>
+
+% }
+<%init>
+
+my( %opt ) = @_;
+
+my $conf = new FS::Conf;
+my $passwordmax = $conf->config('sip_passwordmax') || 80;
+
+my $name = $opt{'element_name'} || $opt{'field'} || 'extensionnum';
+my $id = $opt{'id'} || 'extensionnum';
+
+my $curr_value = $opt{'curr_value'} || $opt{'value'};
+
+my $onchange = '';
+if ( $opt{'onchange'} ) {
+ $onchange = $opt{'onchange'};
+ $onchange .= '(this)' unless $onchange =~ /\(\w*\);?$/;
+ $onchange =~ s/\(what\);/\(this\);/g; #ugh, terrible hack. all onchange
+ #callbacks should act the same
+ $onchange = 'onChange="'. $onchange. '"';
+}
+
+my $pbx_extension = $curr_value
+ ? qsearchs('pbx_extension', { 'extensionnum' => $curr_value } )
+ : new FS::pbx_extension {};
+
+</%init>
diff --git a/httemplate/elements/tr-pbx_extension.html b/httemplate/elements/tr-pbx_extension.html
new file mode 100644
index 000000000..a9d640d51
--- /dev/null
+++ b/httemplate/elements/tr-pbx_extension.html
@@ -0,0 +1,24 @@
+% unless ( $opt{'js_only'} ) {
+
+ <% include('tr-td-label.html', %opt) %>
+ <TD <% $cell_style %>>
+
+% }
+%
+ <% include( '/elements/pbx_extension.html', %opt ) %>
+%
+% unless ( $opt{'js_only'} ) {
+
+ </TD>
+ </TR>
+
+% }
+<%init>
+
+my( %opt ) = @_;
+
+my $cell_style = $opt{'cell_style'} ? 'STYLE="'. $opt{'cell_style'}. '"' : '';
+
+$opt{'label'} ||= 'Extension';
+
+</%init>