Changeset 15
Legend:
- Unmodified
- Added
- Removed
-
trunk/DNSDB.pm
r13 r15 68 68 sub connectDB { 69 69 $errstr = ''; 70 my ($dbname,$user,$pass) = @_; 70 my $dbname = shift; 71 my $user = shift; 72 my $pass = shift; 71 73 my $dbh; 72 74 my $DSN = "DBI:Pg:dbname=$dbname"; … … 385 387 } 386 388 $sql .= " and not type=$reverse_typemap{SOA} order by $order"; 389 ##fixme: need to set nstart properly (offset is not internally multiplied with limit) 387 390 $sql .= " limit $nrecs offset $nstart" if $nstart ne 'all'; 388 391 … … 440 443 my $sql = "insert into ".($defrec eq 'y' ? 'default_' : '')."records ($fields) values ($vallist)"; 441 444 # something is bugging me about this... 442 print "DEBUG: $sql<br>\n";445 #warn "DEBUG: $sql"; 443 446 my $sth = $dbh->prepare($sql); 444 447 $sth->execute; -
trunk/dns.cgi
r13 r15 61 61 # default 62 62 #my $perpage = 15; 63 my $perpage = 4;63 my $perpage = 3; 64 64 my $offset = ($webvar{offset} ? $webvar{offset} : 0); 65 65 … … 78 78 initGlobals($dbh); 79 79 80 # Default page is a login page81 my $page; # to be initialized as an HTML::Template entity sooner or later80 ## Default page is a login page 81 #my $page; # to be initialized as an HTML::Template entity sooner or later 82 82 83 83 84 84 85 85 # decide which page to spit out... 86 if (!$webvar{page}) { 87 $page = HTML::Template->new(filename => "$templatedir/login.tmpl"); 88 } else { 89 $page = HTML::Template->new(filename => "$templatedir/$webvar{page}.tmpl"); 90 } 86 $webvar{page} = 'login' if !$webvar{page}; 87 #if (!$webvar{page}) { 88 # $page = HTML::Template->new(filename => "$templatedir/login.tmpl"); 89 #} else { 90 #} 91 92 my $page = HTML::Template->new(filename => "$templatedir/$webvar{page}.tmpl"); 91 93 92 94 $page->param(sid => $sid); … … 176 178 } elsif ($webvar{page} eq 'record') { 177 179 if ($webvar{recact} eq 'new') { 178 $page->param(recact => "Add record to"); 180 $page->param(todo => "Add record to"); 181 $page->param(recact => "add"); 179 182 stdrecs(); 183 } elsif ($webvar{recact} eq 'add') { 184 185 my @recargs = ($dbh,$webvar{defrec},$webvar{parentid},$webvar{name},$webvar{type},$webvar{address},$webvar{ttl}); 186 if ($webvar{type} == $reverse_typemap{MX} or $webvar{type} == $reverse_typemap{SRV}) { 187 push @recargs, $webvar{distance}; 188 if ($webvar{type} == $reverse_typemap{SRV}) { 189 push @recargs, $webvar{weight}; 190 push @recargs, $webvar{port}; 191 } 192 } 193 # wtf? 194 # push @recargs, 195 my ($code,$msg) = addRec(@recargs); 196 197 if ($code eq 'OK') { 198 changepage(page => "reclist", id => $webvar{parentid}, defrec => $webvar{defrec}); 199 # showdomain($webvar{defrec},$webvar{parentid}); 200 # NB: should **really** redirect here, in case of reload. >_< eyowch. 201 } else { 202 $page->param(add_failed => 1); 203 $page->param(errmsg => $msg); 204 stdrecs($webvar{type}); # populate the form... er, mostly. 205 $page->param(name => $webvar{name}); 206 $page->param(address => $webvar{address}); 207 $page->param(distance => $webvar{distance}) 208 if ($webvar{type} == $reverse_typemap{MX} or $webvar{type} == $reverse_typemap{SRV}); 209 $page->param(weight => $webvar{weight}) if $webvar{type} == $reverse_typemap{SRV}; 210 $page->param(port => $webvar{port}) if $webvar{type} == $reverse_typemap{SRV}; 211 } 212 213 $page->param(defrec => $webvar{defrec}); 214 180 215 } elsif ($webvar{recact} eq 'edit') { 181 $page->param(recact => "Edit record in"); 216 217 $page->param(todo => "Edit record in"); 182 218 my $sth = $dbh->prepare("SELECT host,type,val,distance,weight,port,ttl FROM ". 183 219 ($webvar{defrec} eq 'y' ? 'default_' : '')."records WHERE record_id=?"); … … 322 358 foreach (@debugbits) { print; } 323 359 324 $page->param(grp => $group) ;360 $page->param(grp => $group) if $webvar{page} ne 'login'; 325 361 326 362 # spit it out -
trunk/templates/record.tmpl
r14 r15 6 6 7 7 <TMPL_IF edit_failed><span class="errmsg">Error <TMPL VAR NAME=recact> record: <TMPL_VARNAME=errmsg></span></TMPL_IF> 8 <form action="dns.cgi" >8 <form action="dns.cgi" method="POST"> 9 9 <input type="hidden" name="page" value="record"> 10 10 <input type="hidden" name="defrec" value="<TMPL_VAR NAME=defrec>"> 11 11 <input type="hidden" name="sid" value="<TMPL_VAR NAME=sid>"> 12 12 <input type="hidden" name="parentid" value="<TMPL_VAR NAME=parentid>"> 13 13 <input type="hidden" name="recact" value="<TMPL_VAR NAME=recact>"> 14 14 <table border=0 bgcolor="white"> 15 15 … … 17 17 18 18 <table border=0 width="100%"> 19 <tr class="tableheader"><td align="center" colspan=2><TMPL_VAR NAME= recact> <TMPL_VAR NAME=domain></td></tr>19 <tr class="tableheader"><td align="center" colspan=2><TMPL_VAR NAME=todo> <TMPL_VAR NAME=domain></td></tr> 20 20 <tr class="datalinelight"> 21 21 <td>Hostname</td>
Note:
See TracChangeset
for help on using the changeset viewer.