diff options
author | ivan <ivan> | 2010-08-07 07:39:06 +0000 |
---|---|---|
committer | ivan <ivan> | 2010-08-07 07:39:06 +0000 |
commit | b3205ddf480401284a5fc4ccbcb45d9c42b0bcf9 (patch) | |
tree | 050841c8f10d32f58c7009890c0777ce78c017fb /httemplate | |
parent | 82970ec1511c7bbb892eb296f3c0358480b77ba6 (diff) |
communigate phase 3: RPOP/acct_snarf, RT#7515
Diffstat (limited to 'httemplate')
-rw-r--r-- | httemplate/browse/acct_snarf.html | 78 | ||||
-rw-r--r-- | httemplate/edit/acct_snarf.html | 50 | ||||
-rw-r--r-- | httemplate/edit/process/acct_snarf.html | 20 | ||||
-rw-r--r-- | httemplate/view/svc_acct/communigate.html | 14 |
4 files changed, 160 insertions, 2 deletions
diff --git a/httemplate/browse/acct_snarf.html b/httemplate/browse/acct_snarf.html new file mode 100644 index 000000000..f6109944f --- /dev/null +++ b/httemplate/browse/acct_snarf.html @@ -0,0 +1,78 @@ +<% include('elements/browse.html', + 'title' => "Remote POP accounts for $svc_label: $svc_value", + 'name_singular' => 'Remote POP account', + 'html_init' => $html_init, + 'query' => { 'table' => 'acct_snarf', + 'hashref' => { 'svcnum' => $svcnum }, + #'order_by' => 'ORDER BY priority DESC', + }, + 'count_query' => $count_query, + 'header' => [ 'Name', + 'Mail server', + 'Username', + #'Password', + 'Poll every', + #'Options', + 'Leave', + 'APOP', + 'TLS', + 'Mailbox', + '', #delete + ], + 'fields' => [ 'snarfname', + 'machine', + 'username', + sub { FS::acct_snarf->check_freq_labels->{shift->check_freq} }, + 'leave', + 'apop', + 'tls', + 'mailbox', + ], + #'align' + 'links' => [ $edit_sub, $edit_sub, $edit_sub, '', + '', '', '', '', $del_sub ], + ) +%> +<%init> + +$cgi->param('svcnum') =~ /^(\d+)$/ or die 'no svcnum'; +my $svcnum = $1; + +#agent virt so you can't do cross-agent snarfing +my $cust_svc = qsearchs('cust_svc', { 'svcnum' => $svcnum }) + or die 'unknown svcnum'; +my $part_svc = $cust_svc->part_svc; + +my $count_query = "SELECT COUNT(*) FROM acct_snarf WHERE svcnum = $svcnum"; + +my($svc_label, $svc_value, $svcdb) = $cust_svc->label; + +my $view = FS::UI::Web::svc_url( 'm' => $m, + 'action' => 'view', + 'part_svc' => $part_svc, + 'svc' => $cust_svc, + ); + +my $html_init = + qq(<A HREF="$view">View this $svc_label</A><BR><BR>). + qq!<A HREF="${p}edit/acct_snarf.html?svcnum=$svcnum">Add new remote POP account</A><BR>!. + '<BR>'. + qq! + <SCRIPT> + function areyousure_delete(href) { + areyousure(href,"Are you sure you want to delete this remote POP account?"); + } + function areyousure(href,message) { + if (confirm(message) == true) + window.location.href = href; + } + </SCRIPT> +!; + +my $edit_sub = [ $p.'edit/acct_snarf.html?', 'snarfnum' ]; +my $del_sub = sub { + my $snarfnum = shift->snarfnum; + [ "javascript:areyousure_delete('${p}misc/delete-acct_snarf.html?$snarfnum')", '' ]; +}; + +</%init> diff --git a/httemplate/edit/acct_snarf.html b/httemplate/edit/acct_snarf.html new file mode 100644 index 000000000..5fd3f83fb --- /dev/null +++ b/httemplate/edit/acct_snarf.html @@ -0,0 +1,50 @@ +<% include('elements/edit.html', + 'name_singular' => 'remote email address', + 'table' => 'acct_snarf', + 'labels' => { 'snarfnum' => 'Remote email address', + #'svcnum' => 'Local account', + 'snarfname' => 'Name', + 'machine' => 'Mail server', + 'protocol' => 'Protocol', + 'username' => 'Username', + '_password' => 'Password', + 'check_freq' => 'Poll every', + 'leave' => 'Leave', + 'apop' => 'Use APOP', + 'tls' => 'TLS', + 'mailbox' => 'Mailbox', + }, + 'fields' => [ + { field=>'svcnum', type=>'hidden', }, + { field=>'protocol', type=>'hidden', }, + 'snarfname', + 'machine', + 'username', + { 'field'=>'_password', type=>'password', }, + { 'field' => 'check_freq', + 'type' => 'select', + 'options' => [ keys %$cf_labels ], + 'labels' => $cf_labels, + }, + { field=>'leave', type=>'checkbox', value=>'Y', }, + { field=>'apop', type=>'checkbox', value=>'Y', }, + { field=>'tls', type=>'checkbox', value=>'Y', }, + 'mailbox', + ], + 'new_callback' => sub { my( $cgi, $acct_snarf ) = @_; + $acct_snarf->svcnum($cgi->param('svcnum')); + $acct_snarf->protocol('POP'); + }, + #'viewall_url' => $viewall_url, + 'menubar' => [], + ) +%> +<%init> + +my %opt = @_; + +#my $viewall_url = $p. "browse/$table.html?svcnum=$svcnum"; + +my $cf_labels = FS::acct_snarf->check_freq_labels; + +</%init> diff --git a/httemplate/edit/process/acct_snarf.html b/httemplate/edit/process/acct_snarf.html new file mode 100644 index 000000000..332ac5228 --- /dev/null +++ b/httemplate/edit/process/acct_snarf.html @@ -0,0 +1,20 @@ +<% include( 'elements/process.html', + 'table' => 'acct_snarf', + 'redirect' => $redirect, + 'noerror_callback' => sub { + my( $cgi, $object ) = @_; + my $error = $object->svc_export; + #shit, not a good place for error handling :/ + die $error if $error; + }, + ) +%> +<%init> + +my $redirect = sub { + my($cgi, $new) = @_; + my $svcnum = $new->svcnum; + popurl(3)."browse/acct_snarf.html?svcnum=$svcnum;snarfnum="; +}; + +</%init> diff --git a/httemplate/view/svc_acct/communigate.html b/httemplate/view/svc_acct/communigate.html index ece1724be..179facfa0 100644 --- a/httemplate/view/svc_acct/communigate.html +++ b/httemplate/view/svc_acct/communigate.html @@ -107,6 +107,13 @@ ) %> +%# RPOP + + <% include('/view/elements/tr.html', label=>'Remote POP accounts', + value=>$rpop_link, + ) + %> + <%init> my %opt = @_; @@ -116,8 +123,11 @@ my %opt = @_; my $svc_acct = $opt{'svc_acct'}; #my $part_svc = $opt{'part_svc'}; -my $rule_link = qq(<A HREF="${p}browse/cgp_rule.html?svcnum=). - $svc_acct->svcnum. '">View/edit mail rules</A>'; #'dum vim +my $rule_link = qq(<A HREF="${p}browse/cgp_rule.html?svcnum=). #"dum vim + $svc_acct->svcnum. '">View/edit mail rules</A>'; + +my $rpop_link = qq(<A HREF="${p}browse/acct_snarf.html?svcnum=). #"dee vim + $svc_acct->svcnum. '">View/edit remote POP accounts</A>'; my $vacation_rule = qsearchs('cgp_rule', { 'svcnum' => $svc_acct->svcnum, 'name' => '#Vacation' |