Changeset 723 for trunk/dns.cgi


Ignore:
Timestamp:
06/17/16 18:01:13 (9 years ago)
Author:
Kris Deugau
Message:

/trunk

Record search is substantially complete, including scope limits for users
in subgroups, sorting, and various links into zones or direct record
editing (records attached to both a forward and reverse zone.
See #57.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/dns.cgi

    r722 r723  
    18611861} elsif ($webvar{page} eq 'recsearch') {
    18621862
    1863 ##FIXME
    1864 ##FIXME  Limit scope of search!!
    1865 ##FIXME
    1866 
    1867 #  my $count = $dnsdb->recSearchCount(searchfor => $webvar{searchfor});
    1868 
    1869   $page->param(searchfor => $webvar{searchfor});
    1870   my $recset = $dnsdb->recSearch(searchfor => $webvar{searchfor}, group => $logingroup);
     1863  # we do this for the domain and record list filter/search - it should be extremely rare to
     1864  # need to search on characters outside this set until we get into IDNs
     1865  $webvar{searchfor} =~ s/[^a-zA-Z0-9_.:\@-]//g if $webvar{searchfor};
     1866
     1867  # save the search in the session, same as the "filter" in various other lists...
     1868  if (defined($webvar{searchfor})) {
     1869    if ($session->param('recsearch') && $webvar{searchfor} ne $session->param('recsearch')) {
     1870      $uri_self =~ s/\&offset=[^&]//;
     1871      $offset = 0;
     1872    }
     1873    $session->param(recsearch => $webvar{searchfor});
     1874  }
     1875  my $searchfor = $session->param('recsearch');
     1876
     1877  $sortby = 'host';
     1878  $session->param($webvar{page}.'sortby', $webvar{sortby}) if $webvar{sortby};
     1879  $session->param($webvar{page}.'order', $webvar{order}) if $webvar{order};
     1880  $sortby = $session->param($webvar{page}.'sortby') if $session->param($webvar{page}.'sortby');
     1881  $sortorder = $session->param($webvar{page}.'order') if $session->param($webvar{page}.'order');
     1882
     1883  # some magic to label and linkify the column headers for sorting
     1884  my @cols = ('domain','revzone','host','type','val','location');
     1885  my %colheads = (domain => "Domain (Group)", revzone => "Reverse zone (Group)", host => "Host",
     1886        type => "Type", val => "IP/value", location => "Location");
     1887  fill_colheads($sortby, $sortorder, \@cols, \%colheads);
     1888
     1889  # pgcount.tmpl
     1890  my $count = $dnsdb->recSearchCount(searchfor => $searchfor, group => $logingroup);
     1891  fill_pgcount($count, "records");
     1892  fill_fpnla($count);
     1893
     1894  # and a bit for fpnla.tmpl
     1895  $page->param(curpage => $webvar{page});
     1896
     1897  $page->param(searchfor => $searchfor);
     1898  my $recset = $dnsdb->recSearch(searchfor => $searchfor, group => $logingroup, offset => $webvar{offset},
     1899    sortby => $sortby, sortorder => $sortorder);
    18711900  $page->param(searchresults => $recset);
    18721901
Note: See TracChangeset for help on using the changeset viewer.