fix username@domain search
authorivan <ivan>
Tue, 26 Sep 2006 18:55:59 +0000 (18:55 +0000)
committerivan <ivan>
Tue, 26 Sep 2006 18:55:59 +0000 (18:55 +0000)
httemplate/search/svc_Smart.html
httemplate/search/svc_acct.cgi

index 4d8f3e2..706471b 100644 (file)
@@ -1,29 +1,28 @@
+% if (    $cgi->param('search_svc') =~ /\.[a-z]{2,8}$/i
+%      && $cgi->param('search_svc') !~ /\@/
+%    )
+% {
+
+% # looks (enough) like a domain
+  <% $cgi->redirect('svc_domain.cgi?domain='. uri_escape( $cgi->param('search_svc') ) ) %>
+
+% } elsif ( $cgi->param('search_svc') =~ /\w/ ) {
 %
-%
-%if ( $cgi->param('search_svc') =~ /\.[a-z]{2,8}$/i ) {
-%
-%  # looks (enough) like a domain
-%
-%  
-<% $cgi->redirect('svc_domain.cgi?domain='. uri_escape( $cgi->param('search_svc') ) ) %>
-%
-%
-%} elsif ( $cgi->param('search_svc') =~ /\w/ ) {
-%
-%  #looks (enough) like a username
-%
-%  
-<% $cgi->redirect('svc_acct.cgi?username_type=Exact;username='. uri_escape( $cgi->param('search_svc') ) ) %>
-%
-%
-%} else {
-%
-%
-<% include('/elements/header.html', 'Unrecognized service string') %>
+%   if ( $cgi->param('search_svc') =~ /^(.+)\@(.+)$/ ) {
+
+%     #looks (enough) like a username@domain
+      <% $cgi->redirect('svc_acct.cgi?username_type=Exact;username='. uri_escape($1). ';domain='. uri_escape($2) ) %>
+
+%   } else {
+
+%     #looks (enough) like a username
+      <% $cgi->redirect('svc_acct.cgi?username_type=Exact;username='. uri_escape( $cgi->param('search_svc') ) ) %>
+
+%   }
+
+% } else {
+
+  <% include('/elements/header.html', 'Unrecognized service string') %>
   <% include('/elements/footer.html') %>
-%
-%
-%} 
-%
-%
 
+% } 
index d293e24..2a1414b 100755 (executable)
 %  push @extra_sql, 'pkgnum IS NULL';
 %}
 %
+% if ( $cgi->param('domain') ) { 
+%   my $svc_domain =
+%     qsearchs('svc_domain', { 'domain' => $cgi->param('domain') } );
+%   unless ( $svc_domain ) {
+%     #it would be nice if this looked more like the other "not found"
+%     #errors, but this will do for now.
+%     eidiot "Domain ". $cgi->param('domain'). " not found at all";
+%   } else {
+%     push @extra_sql, 'domsvc = '. $svc_domain->svcnum;
+%   }
+% }
+%
 %if ( $query eq 'svcnum' ) {
 %  #$orderby = "ORDER BY svcnum";
 %} elsif ( $query eq 'username' ) {