- Timestamp:
- 03/04/16 14:10:53 (9 years ago)
- Location:
- trunk
- Files:
-
- 1 added
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/DNSDB.pm
r703 r704 2316 2316 # Add a domain 2317 2317 # Takes a database handle, domain name, numeric group, boolean(ish) state (active/inactive), 2318 # and user info hash (for logging).2318 # and a default location indicator 2319 2319 # Returns a status code and message 2320 2320 sub addDomain { … … 2341 2341 return ('FAIL', "Invalid characters in domain") if $domain !~ /^[a-zA-Z0-9_.-]+$/; 2342 2342 2343 my $sth = $dbh->prepare("SELECT domain_id FROM domains WHERE lower(domain) = lower(?) ");2343 my $sth = $dbh->prepare("SELECT domain_id FROM domains WHERE lower(domain) = lower(?) AND location = ?"); 2344 2344 my $dom_id; 2345 2345 2346 2346 # quick check to start to see if we've already got one 2347 $sth->execute($domain );2347 $sth->execute($domain, $defloc); 2348 2348 ($dom_id) = $sth->fetchrow_array; 2349 2349 … … 2362 2362 2363 2363 # get the ID... 2364 ($dom_id) = $dbh->selectrow_array("SELECT domain_id FROM domains WHERE lower(domain) = lower(?) ",2365 undef, ($domain ));2364 ($dom_id) = $dbh->selectrow_array("SELECT domain_id FROM domains WHERE lower(domain) = lower(?) AND location = ?", 2365 undef, ($domain, $defloc)); 2366 2366 2367 2367 $self->_log(domain_id => $dom_id, group_id => $group, … … 2602 2602 2603 2603 # quick check to start to see if we've already got one 2604 my ($rdns_id) = $dbh->selectrow_array("SELECT rdns_id FROM revzones WHERE revnet=?", undef, ("$zone")); 2604 my ($rdns_id) = $dbh->selectrow_array("SELECT rdns_id FROM revzones WHERE revnet = ? AND default_location = ?", 2605 undef, ("$zone", $defloc)); 2605 2606 2606 2607 return ('FAIL', "Zone already exists") if $rdns_id; … … 2843 2844 if ($args{revrec} eq 'n') { 2844 2845 $args{sortby} = 'domain' if !$args{sortby} || !grep /^$args{sortby}$/, ('domain','group','status'); 2845 $sql = "SELECT domain_id AS zoneid,domain AS zone,status,groups.group_name AS group FROM domains". 2846 " INNER JOIN groups ON domains.group_id=groups.group_id". 2847 " WHERE domains.group_id IN ($args{curgroup}".($args{childlist} ? ",$args{childlist}" : '').")". 2846 $sql = q(SELECT 2847 domain_id AS zoneid, 2848 domain AS zone, 2849 status, 2850 groups.group_name AS group, 2851 l.description AS location 2852 FROM domains 2853 LEFT JOIN locations l ON domains.default_location=l.location 2854 INNER JOIN groups ON domains.group_id=groups.group_id ). 2855 "WHERE domains.group_id IN ($args{curgroup}".($args{childlist} ? ",$args{childlist}" : '').")". 2848 2856 ($args{startwith} ? " AND domain ~* ?" : ''). 2849 2857 ($args{filter} ? " AND domain ~* ?" : ''); … … 2851 2859 ##fixme: arguably startwith here is irrelevant. depends on the UI though. 2852 2860 $args{sortby} = 'revnet' if !$args{sortby} || !grep /^$args{sortby}$/, ('revnet','group','status'); 2853 $sql = "SELECT rdns_id AS zoneid,revnet AS zone,status,groups.group_name AS group FROM revzones". 2854 " INNER JOIN groups ON revzones.group_id=groups.group_id". 2861 $sql = q(SELECT 2862 rdns_id AS zoneid, 2863 revnet AS zone, 2864 status, 2865 groups.group_name AS group, 2866 l.description AS location 2867 FROM revzones 2868 LEFT JOIN locations l ON revzones.default_location=l.location 2869 INNER JOIN groups ON revzones.group_id=groups.group_id ). 2855 2870 " WHERE revzones.group_id IN ($args{curgroup}".($args{childlist} ? ",$args{childlist}" : '').")". 2856 2871 ($args{startwith} ? " AND CAST(revnet AS VARCHAR) ~* ?" : ''); -
trunk/dns.cgi
r702 r704 528 528 529 529 fill_grouplist("grouplist"); 530 my $loclist = $dnsdb->getLocDropdown($curgroup); 531 $page->param(loclist => $loclist); 530 fill_loclist($curgroup, $webvar{defloc} ? $webvar{defloc} : ''); 532 531 533 532 # prepopulate revpatt with the matching default record -
trunk/templates/domlist.tmpl
r589 r704 42 42 <TMPL_LOOP name=domtable> 43 43 <tr class="row<TMPL_IF __odd__>0<TMPL_ELSE>1</TMPL_IF>"> 44 <td align="left"><a href="<TMPL_VAR NAME=script_self>&page=reclist&id=<TMPL_VAR NAME=zoneid>&defrec=n<TMPL_UNLESS domlist>&revrec=y</TMPL_UNLESS>"><TMPL_VAR NAME=zone></a>< /td>44 <td align="left"><a href="<TMPL_VAR NAME=script_self>&page=reclist&id=<TMPL_VAR NAME=zoneid>&defrec=n<TMPL_UNLESS domlist>&revrec=y</TMPL_UNLESS>"><TMPL_VAR NAME=zone></a><TMPL_IF location> (<TMPL_VAR NAME=location>)</TMPL_IF></td> 45 45 <td><TMPL_IF status>Active<TMPL_ELSE>Inactive</TMPL_IF></td> 46 46 <td><TMPL_VAR name=group></td>
Note:
See TracChangeset
for help on using the changeset viewer.