list_zones.php
author rejo
Mon, 25 Jun 2007 21:32:29 +0000
changeset 26 5d63f1e71d6e
parent 20 76e20b9d45e6
child 29 e1c60f72d494
permissions -rw-r--r--
[feladat @ 73] All owners (not sub-owners though) of the zone are now shown when listing a zone. Added a new function to retrieve owners of zone by id without fetching all other zone details, which should improve perfomance. Both fixes by Peter Beernink.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
13
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
     1
<?php
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
     2
require_once("inc/i18n.inc.php");
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
     3
require_once("inc/toolkit.inc.php");
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
     4
include_once("inc/header.inc.php");
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
     5
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
     6
$all_doms = get_domains(0);
15
305cee3b388d [feladat @ 62]
rejo
parents: 13
diff changeset
     7
$num_all_domains = ($all_doms == -1) ? 0 : count($all_doms);
13
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
     8
$doms = get_domains(0,LETTERSTART);
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
     9
?>
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
    10
   <h2><? echo _('List zones'); ?></h2>
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
    11
<?
20
76e20b9d45e6 [feladat @ 67]
rejo
parents: 15
diff changeset
    12
	echo "<div class=\"showmax\">";
76e20b9d45e6 [feladat @ 67]
rejo
parents: 15
diff changeset
    13
	show_pages(count($doms),ROWAMOUNT);
76e20b9d45e6 [feladat @ 67]
rejo
parents: 15
diff changeset
    14
	echo "</div>";
76e20b9d45e6 [feladat @ 67]
rejo
parents: 15
diff changeset
    15
13
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
    16
if ($num_all_domains > ROWAMOUNT) 
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
    17
{
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
    18
	echo "<div class=\"showmax\">";
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
    19
	show_letters(LETTERSTART,$all_doms);
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
    20
	echo "</div>";
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
    21
}
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
    22
?>
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
    23
   <table>
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
    24
    <tr>
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
    25
     <th>&nbsp;</th>
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
    26
     <th><? echo _('Name'); ?></th>
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
    27
     <th><? echo _('Type'); ?></th>
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
    28
     <th><? echo _('Records'); ?></th>
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
    29
     <th><? echo _('Owner'); ?></th>
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
    30
    </tr>
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
    31
    <tr>
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
    32
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
    33
<?
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
    34
if ($num_all_domains < ROWAMOUNT) {
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
    35
   $doms = get_domains(0,"all",ROWSTART,ROWAMOUNT);
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
    36
} else {
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
    37
   $doms = get_domains(0,LETTERSTART,ROWSTART,ROWAMOUNT);
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
    38
   $num_show_domains = count($doms);
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
    39
}
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
    40
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
    41
// If the user doesnt have any domains print a message saying so
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
    42
if ($doms < 0)
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
    43
{
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
    44
	?>
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
    45
    <tr>
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
    46
     <td>&nbsp;</td>
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
    47
     <td colspan="4"><? echo _('There are no zones.'); ?></td>
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
    48
    </tr>
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
    49
<?
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
    50
}
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
    51
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
    52
// If he has domains, dump them (duh)
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
    53
else
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
    54
{
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
    55
	foreach ($doms as $c)
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
    56
	{
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
    57
		?>
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
    58
		
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
    59
    <tr>
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
    60
<?
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
    61
if (level(5))
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
    62
{
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
    63
?>
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
    64
     <td>
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
    65
      <a href="edit.php?id=<? echo $c["id"] ?>"><img src="images/edit.gif" title="<? echo _('Edit zone') . " " . $c['name']; ?>" alt="[ <? echo _('Edit zone') . " " . $c['name']; ?> ]"></a>
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
    66
      <a href="delete_domain.php?id=<? echo $c["id"] ?>"><img src="images/delete.gif" title="<? print _('Delete zone') . " " . $c['name']; ?>" alt="[<? echo _('Delete zone') . " " . $c['name']; ?>]"></a>
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
    67
     </td>
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
    68
<?
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
    69
}
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
    70
else
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
    71
{
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
    72
?>
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
    73
     <td class="n">
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
    74
      &nbsp;
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
    75
     </td>
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
    76
<?
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
    77
}
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
    78
?>
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
    79
     <td class="y"><? echo $c["name"] ?></td>
26
5d63f1e71d6e [feladat @ 73]
rejo
parents: 20
diff changeset
    80
     <td class="y"><? echo strtolower(get_domain_type($c["id"])) ?></td>
13
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
    81
     <td class="y"><? echo $c["numrec"] ?></td>
26
5d63f1e71d6e [feladat @ 73]
rejo
parents: 20
diff changeset
    82
     <td class="y"><? echo get_owners_from_domainid($c["id"]) ?></td>
13
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
    83
    </tr><?
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
    84
		print "\n";
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
    85
	}
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
    86
}
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
    87
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
    88
?>
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
    89
   </table>
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
    90
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
    91
<?
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
    92
if ($num_all_domains < ROWAMOUNT) {
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
    93
?>
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
    94
   <p><? printf(_('This lists shows all %s zones(s) you have access to.'), $num_all_domains); ?></p>
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
    95
<?
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
    96
}
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
    97
else
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
    98
{
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
    99
?>
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
   100
   <p><? printf(_('This lists shows %s out of %s zones you have access to.'), $num_show_domains, $num_all_domains); ?></p>
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
   101
<?
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
   102
}
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
   103
?>
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
   104
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
   105
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
   106
<? // RZ TODO Check next, does it work? 
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
   107
//  <small> echo _('You only administer some records of domains marked with an (*).'); </small>
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
   108
?>
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
   109
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
   110
<?
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
   111
include_once("inc/footer.inc.php");
2ff220cfde13 [feladat @ 60]
rejo
parents:
diff changeset
   112
?>