machines.cgi: only generate sponsor-admin links if there is one
[mirror/userdir-ldap-cgi.git] / machines.cgi
index e867098..a812e78 100755 (executable)
@@ -36,7 +36,7 @@ my (%attrs, @attrorder, %summaryattrs, @summaryorder, %summarylistitems);
          'notes' => 'Notes',
          'sshrsahostkey' => 'SSH host key',
          'description' => 'Description',
-         'purpose' => 'purposes of this server',
+         'purpose' => 'Purposes of this server',
 #        'createtimestamp' => 'Entry created',
 #        'modifytimestamp' => 'Entry modified'
         );
@@ -95,7 +95,7 @@ sub item_uplist($) {
                $out = "<ul>".
                        join("", map { 
                                "<li>".wiki_link($_)."</li>\n";
-                         } sort {my $A=$a; my $B=$b; $A =~ s/[\[\]\*]//g; $B =~ s/[\[\]\*]//g; $A cmp $B} @tmp
+                         } sort {my $A=$a; my $B=$b; $A =~ s/\[\[[-*]?(.*?)\]\]/\1/g; $B =~ s/\[\[[-*]?(.*?)\]\]/\1/g; $A cmp $B} @tmp
                        ).
                        "</ul>";
        }
@@ -144,7 +144,8 @@ foreach $dn (sort {$entries->{$a}->{host}->[0] cmp $entries->{$b}->{host}->[0]}
     
     # Format email addresses
     $output{admin} = sprintf("<a href=\"mailto:%s\">%s</a>", $output{admin}, $output{admin});
-    $output{'sponsor-admin'} = sprintf("<a href=\"mailto:%s\">%s</a>", $output{'sponsor-admin'}, $output{'sponsor-admin'});
+    $output{'sponsor-admin'} = sprintf("<a href=\"mailto:%s\">%s</a>", $output{'sponsor-admin'}, $output{'sponsor-admin'})
+      if defined $output{'sponsor-admin'};
 
     $output{sshrsahostkey} = undef;
     foreach $key (@{$data->{sshrsahostkey}}) {
@@ -190,7 +191,7 @@ if ($output{havehostdata}) {
 } else {
   # display summary info
   $hostdetails = "<h1>Summary</h1>\n";
-  $hostdetails .= "<table id=\"machines\" class=\"tablesorter\" border=\"1\" cellpadding=\"0\" cellspacing=\"1\">\n<thead>\n<tr>";
+  $hostdetails .= "<table id=\"machines\" class=\"display compact cell-border\" border=\"1\" cellpadding=\"0\" cellspacing=\"1\">\n<thead>\n<tr>";
   foreach $key (@summaryorder) {
     if ($sortby ne $key) {
       $hostdetails .= "<th><a class=\"sort\" href=\"machines.cgi?sortby=$key&sortorder=asc\">$summaryattrs{$key}</a></th>";