diff options
author | ivan <ivan> | 2004-02-13 11:28:07 +0000 |
---|---|---|
committer | ivan <ivan> | 2004-02-13 11:28:07 +0000 |
commit | ecf57b84d7a29c9bebac62eb5ebf178332163fd9 (patch) | |
tree | 4480de42aefa82c228d5ccff15b8682e64c8e0a1 /httemplate | |
parent | 1e2a5c920840e046e4e28ca35681cb0912322666 (diff) |
add mail alias browse to main menu and fix mail alias view to recognize new schema also
Diffstat (limited to 'httemplate')
-rw-r--r-- | httemplate/index.html | 3 | ||||
-rwxr-xr-x | httemplate/search/svc_forward.cgi | 79 | ||||
-rwxr-xr-x | httemplate/view/svc_forward.cgi | 17 |
3 files changed, 94 insertions, 5 deletions
diff --git a/httemplate/index.html b/httemplate/index.html index 7d90efc71..d39f8b04d 100644 --- a/httemplate/index.html +++ b/httemplate/index.html @@ -34,7 +34,8 @@ <FORM ACTION="search/cust_main.cgi" METHOD="POST"><INPUT TYPE="hidden" NAME="phone_on" VALUE="1">Phone # <INPUT TYPE="text" NAME="phone_text"><INPUT TYPE="submit" VALUE="Search"></FORM> <BR><FORM ACTION="search/svc_acct.cgi" METHOD="POST">Username <INPUT TYPE="text" NAME="username"><SELECT NAME="username_type"><OPTION VALUE="All">(all)</OPTION><OPTION>Fuzzy</OPTION><OPTION>Substring</OPTION><OPTION SELECTED>Exact</OPTION></SELECT><INPUT TYPE="submit" VALUE="Search"> or <A HREF="search/svc_acct.cgi?username">all accounts by username</A> or <A HREF="search/svc_acct.cgi?uid">uid</A></FORM> <BR><FORM ACTION="search/svc_domain.cgi" METHOD="POST">Domain <INPUT TYPE="text" NAME="domain"><INPUT TYPE="submit" VALUE="Search"> or <A HREF="search/svc_domain.cgi?domain">all domains</A></FORM> -<!-- <LI><A HREF="search/svc_forward.html">mail forwards (by ?)</A>--> + <BR><A HREF="search/svc_forward.cgi?svcnum">all mail forwards by svcnum</A><BR> + <BR> </TD></TR> </TABLE> diff --git a/httemplate/search/svc_forward.cgi b/httemplate/search/svc_forward.cgi new file mode 100755 index 000000000..10094bc99 --- /dev/null +++ b/httemplate/search/svc_forward.cgi @@ -0,0 +1,79 @@ +<% + +my $conf = new FS::Conf; + +my($query)=$cgi->keywords; +$query ||= ''; #to avoid use of unitialized value errors +my(@svc_forward,$sortby); +if ( $query eq 'svcnum' ) { + $sortby=\*svcnum_sort; + @svc_forward=qsearch('svc_forward',{}); +} else { + eidiot('unimplemented'); +} + +if ( scalar(@svc_forward) == 1 ) { + print $cgi->redirect(popurl(2). "view/svc_forward.cgi?". $svc_forward[0]->svcnum); + #exit; +} elsif ( scalar(@svc_forward) == 0 ) { +%> +<!-- mason kludge --> +<% + eidiot "No matching forwards found!\n"; +} else { +%> +<!-- mason kludge --> +<% + my $total = scalar(@svc_forward); + print header("Mail forward Search Results",''), <<END; + + $total matching mail forwards found + <TABLE BORDER=4 CELLSPACING=0 CELLPADDING=0> + <TR> + <TH>Service #<BR><FONT SIZE=-1>(click to view forward)</FONT></TH> + <TH>Mail to<BR><FONT SIZE=-1>(click to view account)</FONT></TH> + <TH>Forwards to<BR><FONT SIZE=-1>(click to view account)</FONT></TH> + </TR> +END + + foreach my $svc_forward ( + sort $sortby (@svc_forward) + ) { + my $svcnum = $svc_forward->svcnum; + + my $src = $svc_forward->src; + $src = "<I>(anything)</I>$src" if $src =~ /^@/; + if ( $svc_forward->srcsvc_acct ) { + $src = qq!<A HREF="${p}view/svc_acct.cgi?!. $svc_forward->srcsvc. '">'. + $svc_forward->srcsvc_acct->email. '</A>'; + } + + my $dst = $svc_forward->dst; + if ( $svc_forward->dstsvc_acct ) { + $dst = qq!<A HREF="${p}view/svc_acct.cgi?!. $svc_forward->dstsvc. '">'. + $svc_forward->dstsvc_acct->email. '</A>'; + } + + print <<END; + <TR> + <TD><A HREF="${p}view/svc_forward.cgi?$svcnum">$svcnum</A></TD> + <TD>$src</TD> + <TD>$dst</TD> + </TR> +END + + } + + print <<END; + </TABLE> + </BODY> +</HTML> +END + +} + +sub svcnum_sort { + $a->getfield('svcnum') <=> $b->getfield('svcnum'); +} + +%> diff --git a/httemplate/view/svc_forward.cgi b/httemplate/view/svc_forward.cgi index 5d619de54..c2ce164d1 100755 --- a/httemplate/view/svc_forward.cgi +++ b/httemplate/view/svc_forward.cgi @@ -39,16 +39,25 @@ my($srcsvc,$dstsvc,$dst) = ( $svc_forward->dstsvc, $svc_forward->dst, ); +my $src = $svc_forward->dbdef_table->column('src') ? $svc_forward->src : ''; + my $svc = $part_svc->svc; -my $svc_acct = qsearchs('svc_acct',{'svcnum'=>$srcsvc}) - or die "Corrupted database: no svc_acct.svcnum matching srcsvc $srcsvc"; -my $source = $svc_acct->email; + +my $source; +if ($srcsvc) { + my $svc_acct = qsearchs('svc_acct',{'svcnum'=>$srcsvc}) + or die "Corrupted database: no svc_acct.svcnum matching srcsvc $srcsvc"; + $source = $svc_acct->email; +} else { + $source = $src; +} + my $destination; if ($dstsvc) { my $svc_acct = qsearchs('svc_acct',{'svcnum'=>$dstsvc}) or die "Corrupted database: no svc_acct.svcnum matching dstsvc $dstsvc"; $destination = $svc_acct->email; -}else{ +} else { $destination = $dst; } |