ispman/ispman-web/cgi-bin/tmpl/dns edit_TXTrecords.tmpl, NONE, 1.1
Joerg Delker <[email protected]>
| Newsgroups | gmane.comp.isp.ispman.cvs |
|---|---|
| Message-ID | <[email protected]> |
Update of /cvsroot/ispman/ispman/ispman-web/cgi-bin/tmpl/dns
In directory sc8-pr-cvs2.sourceforge.net:/tmp/cvs-serv31553/ispman-web/cgi-bin/tmpl/dns
Added Files:
edit_TXTrecords.tmpl
Log Message:
added template for TXT record page
--- NEW FILE: edit_TXTrecords.tmpl ---
<script type="text/javascript">
var domain="<perl>$r->param("ispmanDomain")</perl>";
var cgiurl=window.location.pathname;
var hrefurl=window.location.href;
function sortBy(column){
location=cgiurl+"?mode=editDNStXTRecords&ispmanDomain="+domain+"&sortby="+column;
}
function submitForm(f,action){
switch(action){
case 'add': f.mode.value="addDNStXTRecord"; break;
case 'update': f.mode.value="modifyDNStXTRecord"; break;
case 'delete': f.mode.value="deleteDNStXTRecord"; break;
}
f.ispmanDomain.value=domain;
f.action=cgiurl;
f.submit();
}
</script>
<perl>
my $text="";
my $c=1;
my $thisDomain=$r->param("ispmanDomain");
$text.=qq|
<P>
@{[_("Editing TXT Records for domain:")]} $thisDomain
<table class=dns>
<tr>
<th><a href='javascript:sortBy("host")'>@{[_("Host")]}</a></th>
<th><a href='javascript:sortBy("txt")'>@{[_("Text")]}</a></th>
<th> </th>
</tr>
<tr>
<form method=POST>
<input type=hidden name='ispmanDomain'>
<input type=hidden name='mode'>
<td><input type=text name=host></td>
<td><input type=text name=txt></td>
<td><input type=button onClick='submitForm(this.form,"add")' value='@{[_("Add")]}'></td>
</form>
</tr>
|;
my $sortby=$r->param("sortby") || "origin";
my @sorted=();
if ($ispman->{'domain'}{'dns'}){
if ($sortby eq 'host') {
@sorted=sort {
$a->{'host'} cmp $b->{'host'} || $a->{'txt'} cmp $b->{'txt'}
} @{$ispman->{'domain'}{'dns'}};
} else {
@sorted=sort {
$a->{'txt'} cmp $b->{'txt'} || $a->{'host'} <=> $b->{'host'}
} @{$ispman->{'domain'}{'dns'}};
}
}
for (@sorted){
$text.="<tr>";
$text.="<form method=POST>";
$text.="<input type=hidden name='dn' value='@{[$ispman->getnSRecordDn($thisDomain, $_->{'origion'}, $_->{'host'})]}'>";
$text.="<input type=hidden name='ispmanDomain'>";
$text.="<input type=hidden name='mode'>";
$text.="<td><input type=text name='host' value='$_->{'host'}'></td>";
$text.="<td><input type=text name='txt' value='$_->{'txt'}'></td>";
$text.="<td>\n";
$text.="<input type=image onClick='submitForm(this.form,\"update\")' src='".$ispman->getConfig("ispmanUrlPrefix")."/gfx/apply.gif'>\n";
$text.="<input type=image onClick='submitForm(this.form,\"delete\")' src='".$ispman->getConfig("ispmanUrlPrefix")."/gfx/delete.gif'>\n";
$text.="</td>\n";
$text.="</form>";
$text.="</tr>";
$c++;
}
$text
</perl>
</table>