Changeset 239
Legend:
- Unmodified
- Added
- Removed
-
trunk/DNSDB.pm
r237 r239 1202 1202 1203 1203 my @filterargs; 1204 $args{filter} =~ s/\./\[\.\]/g if $args{filter}; 1205 push @filterargs, $args{startwith} if $args{startwith}; 1204 $args{startwith} = undef if $args{startwith} && $args{startwith} !~ /^(?:[a-z]|0-9)$/; 1205 push @filterargs, "^$args{startwith}" if $args{startwith}; 1206 $args{filter} =~ s/\./\[\.\]/g if $args{filter}; # only match literal dots, usually in reverse zones 1206 1207 push @filterargs, $args{filter} if $args{filter}; 1207 1208 … … 1236 1237 1237 1238 $args{sortorder} = 'ASC' if !grep $args{sortorder}, ('ASC','DESC'); 1238 $args{offset} = 0 if !$args{offset} ;1239 $args{offset} = 0 if !$args{offset} || $args{offset} !~ /^(?:all|\d+)$/; 1239 1240 1240 1241 my @filterargs; 1241 $args{filter} =~ s/\./\[\.\]/g if $args{filter}; 1242 push @filterargs, $args{startwith} if $args{startwith}; 1242 $args{startwith} = undef if $args{startwith} && $args{startwith} !~ /^(?:[a-z]|0-9)$/; 1243 push @filterargs, "^$args{startwith}" if $args{startwith}; 1244 $args{filter} =~ s/\./\[\.\]/g if $args{filter}; # only match literal dots, usually in reverse zones 1243 1245 push @filterargs, $args{filter} if $args{filter}; 1244 1246 … … 1253 1255 ($args{filter} ? " AND domain ~* ?" : ''); 1254 1256 } else { 1257 ##fixme: arguably startwith here is irrelevant. depends on the UI though. 1255 1258 $args{sortby} = 'revnet' if !grep $args{sortby}, ('domain','group','status'); 1256 1259 $sql = "SELECT rdns_id,revnet,status,groups.group_name AS group FROM revzones". … … 1261 1264 } 1262 1265 # A common tail. 1263 $sql .= " ORDER BY ".($args{sortby} eq 'group' ? 'groups.group_name' : $args{sortby}). 1264 " $args{sortorder} ".($args{offset} eq 'all' ? '' : " LIMIT $config{perpage}".1266 $sql .= " ORDER BY ".($args{sortby} eq 'group' ? 'groups.group_name' : $args{sortby})." $args{sortorder} ". 1267 ($args{offset} eq 'all' ? '' : " LIMIT $config{perpage}". 1265 1268 " OFFSET ".$args{offset}*$config{perpage}); 1266 1269 my $sth = $dbh->prepare($sql); … … 1272 1275 $row{domainid} = $data[0]; 1273 1276 $row{domain} = $data[1]; 1274 $row{status} = ($data[2] ? 'Active' : 'Inactive');1277 $row{status} = $data[2]; 1275 1278 $row{group} = $data[3]; 1276 $row{bg} = ($rownum++)%2;1277 $row{mkactive} = !$data[2];1278 # $row{sid} = $args{sid};1279 $row{offset} = $args{offset};1280 # ACLs1281 # $row{domain_edit} = ($permissions{admin} || $permissions{domain_edit});1282 # $row{domain_delete} = ($permissions{admin} || $permissions{domain_delete});1283 1279 push @zonelist, \%row; 1284 1280 } -
trunk/dns.cgi
r238 r239 300 300 301 301 } elsif ($webvar{page} eq 'domlist' or $webvar{page} eq 'index') { 302 303 $page->param(domlist => 1); 302 304 303 305 # hmm. seeing problems in some possibly-not-so-corner cases. … … 1960 1962 offset => $webvar{offset}, sortby => $sortby, sortorder => $sortorder 1961 1963 ) ); 1962 foreach (@$zonelist) { 1963 $_->{sid} = $sid; 1964 $_->{domain_edit} = ($permissions{admin} || $permissions{domain_edit}); 1965 $_->{domain_delete} = ($permissions{admin} || $permissions{domain_delete}); 1966 } 1964 # probably don't need this, keeping for reference for now 1965 # foreach (@$zonelist) { 1966 # } 1967 1967 $page->param(domtable => $zonelist); 1968 1968 } # end listdomains() -
trunk/templates/domlist.tmpl
r147 r239 9 9 </TMPL_IF> 10 10 <TMPL_IF errmsg> 11 <div class= 'errmsg'><TMPL_VAR NAME=errmsg></div>11 <div class="errmsg"><TMPL_VAR NAME=errmsg></div> 12 12 </TMPL_IF> 13 13 14 14 <table width="98%"> 15 <tr><th colspan="3"><div class="center maintitle"> Domainlist</div></th></tr>15 <tr><th colspan="3"><div class="center maintitle"><TMPL_IF domlist>Domain<TMPL_ELSE>Reverse zone</TMPL_IF> list</div></th></tr> 16 16 <tr> 17 17 <td class="leftthird"><TMPL_INCLUDE NAME="pgcount.tmpl"></td> … … 19 19 <td class="rightthird"><TMPL_INCLUDE NAME="sbox.tmpl"></td> 20 20 </tr> 21 <tr><td colspan="3" align="center"><TMPL_INCLUDE NAME="lettsearch.tmpl"></td></tr> 22 <tr><td colspan="3" align="right"><TMPL_IF domain_create><a href="dns.cgi?sid=<TMPL_VAR NAME=sid>&page=newdomain">New Domain</a></TMPL_IF></td></tr> 21 <TMPL_IF domlist><tr><td colspan="3" align="center"><TMPL_INCLUDE NAME="lettsearch.tmpl"></td></tr></TMPL_IF> 22 <tr><td colspan="3" align="right"> 23 <TMPL_IF domain_create> 24 <TMPL_IF domlist> 25 <a href="dns.cgi?sid=<TMPL_VAR NAME=sid>&page=newdomain">New Domain</a> 26 <TMPL_ELSE> 27 <a href="dns.cgi?sid=<TMPL_VAR NAME=sid>&page=newrevzone">New Reverse Zone</a> 28 </TMPL_IF> 29 </TMPL_IF> 30 </td></tr> 23 31 </table> 24 32 … … 37 45 <TMPL_IF name=domtable> 38 46 <TMPL_LOOP name=domtable> 39 <tr class="row<TMPL_ VAR name=bg>">40 <td align="left"><a href="dns.cgi?sid=<TMPL_VAR NAME=sid>&page=reclist&id=<TMPL_VAR NAME=domainid>&defrec=n "><TMPL_VAR NAME=domain></a></td>41 <td><TMPL_ VAR name=status></td>47 <tr class="row<TMPL_IF __odd__>1<TMPL_ELSE>0</TMPL_IF>"> 48 <td align="left"><a href="dns.cgi?sid=<TMPL_VAR NAME=sid>&page=reclist&id=<TMPL_VAR NAME=domainid>&defrec=n<TMPL_UNLESS domlist>&revrec=y</TMPL_UNLESS>"><TMPL_VAR NAME=domain></a></td> 49 <td><TMPL_IF status>Active<TMPL_ELSE>Inactive</TMPL_IF></td> 42 50 <td><TMPL_VAR name=group></td> 43 <TMPL_IF domain_edit> <td align="center"><a href="dns.cgi?sid=<TMPL_VAR NAME=sid>&page= domlist<TMPL_IF NAME=offset>&offset=<TMPL_VAR NAME=offset></TMPL_IF>&id=<TMPL_VAR NAME=domainid>&domstatus=<TMPL_IF NAME=mkactive>domon<TMPL_ELSE>domoff</TMPL_IF>"><TMPL_IF NAME=mkactive>activate<TMPL_ELSE>deactivate</TMPL_IF></a></td></TMPL_IF>44 <TMPL_IF domain_delete> <td align="center"><a href="dns.cgi?sid=<TMPL_VAR NAME=sid>&page= deldom&id=<TMPL_VAR NAME=domainid>"><img src="images/trash2.png" alt="[ Delete ]" /></a></td></TMPL_IF>51 <TMPL_IF domain_edit> <td align="center"><a href="dns.cgi?sid=<TMPL_VAR NAME=sid>&page=<TMPL_VAR NAME=curpage><TMPL_IF NAME=offset>&offset=<TMPL_VAR NAME=offset></TMPL_IF>&id=<TMPL_VAR NAME=domainid>&domstatus=<TMPL_IF status>domoff<TMPL_ELSE>domon</TMPL_IF>"><TMPL_IF status>deactivate<TMPL_ELSE>activate</TMPL_IF></a></td></TMPL_IF> 52 <TMPL_IF domain_delete> <td align="center"><a href="dns.cgi?sid=<TMPL_VAR NAME=sid>&page=<TMPL_IF domlist>deldom<TMPL_ELSE>delrevzone</TMPL_IF>&id=<TMPL_VAR NAME=domainid>"><img src="images/trash2.png" alt="[ Delete ]" /></a></td></TMPL_IF> 45 53 </tr> 46 54 </TMPL_LOOP> 47 55 <TMPL_ELSE> 48 <tr><td colspan="5" align="center">No domainsfound</td></tr>56 <tr><td colspan="5" align="center">No <TMPL_IF domlist>domains<TMPL_ELSE>reverse zones</TMPL_IF> found</td></tr> 49 57 </TMPL_IF> 50 58 </table>
Note:
See TracChangeset
for help on using the changeset viewer.