Changeset 383 for trunk/DNSDB.pm
- Timestamp:
- 08/13/12 17:26:35 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/DNSDB.pm
r382 r383 42 42 &loadConfig &connectDB &finish 43 43 &addDomain &delZone &domainName &revName &domainID &revID &addRDNS 44 &getZoneCount &getZoneList 44 &getZoneCount &getZoneList &getZoneLocation 45 45 &addGroup &delGroup &getChildren &groupName 46 46 &getGroupCount &getGroupList … … 69 69 &loadConfig &connectDB &finish 70 70 &addDomain &delZone &domainName &revName &domainID &revID &addRDNS 71 &getZoneCount &getZoneList 71 &getZoneCount &getZoneList &getZoneLocation 72 72 &addGroup &delGroup &getChildren &groupName 73 73 &getGroupCount &getGroupList … … 2182 2182 2183 2183 2184 ## DNSDB::getZoneLocation() 2185 # Retrieve the default locatino for a zone. 2186 # Takes a database handle, forward/reverse flag, and zone ID 2187 sub getZoneLocation { 2188 my $dbh = shift; 2189 my $revrec = shift; 2190 my $zoneid = shift; 2191 2192 my ($loc) = $dbh->selectrow_array("SELECT default_location FROM ". 2193 ($revrec eq 'n' ? 'domains WHERE domain_id = ?' : 'revzones WHERE rdns_id = ?'), 2194 undef, ($zoneid)); 2195 return $loc; 2196 } # end getZoneLocation() 2197 2198 2184 2199 ## DNSDB::addGroup() 2185 2200 # Add a group … … 3101 3116 3102 3117 ## DNSDB::getLocDropdown() 3118 # Get a list of location names for use in a dropdown menu. 3119 # Takes a database handle, current group, and optional "tag this as selected" flag. 3120 # Returns a reference to a list of hashrefs suitable to feeding to HTML::Template 3121 sub getLocDropdown { 3122 my $dbh = shift; 3123 my $grp = shift; 3124 my $sel = shift || ''; 3125 3126 my $sth = $dbh->prepare(qq( 3127 SELECT description,location FROM locations 3128 WHERE group_id=? 3129 ORDER BY description 3130 ) ); 3131 $sth->execute($grp); 3132 3133 my @loclist; 3134 push @loclist, { locname => "(None/public)", loc => '', selected => ($sel ? 0 : ($sel eq '' ? 1 : 0)) }; 3135 while (my ($locname, $loc) = $sth->fetchrow_array) { 3136 my %row = ( 3137 locname => $locname, 3138 loc => $loc, 3139 selected => ($sel eq $loc ? 1 : 0) 3140 ); 3141 push @loclist, \%row; 3142 } 3143 return \@loclist; 3144 } # end getLocDropdown() 3103 3145 3104 3146
Note:
See TracChangeset
for help on using the changeset viewer.