X-Git-Url: https://git.adam-barratt.org.uk/?a=blobdiff_plain;f=machines.cgi;h=4108fff7d932d1d43768140c1a12c99f2472dcf0;hb=beb9b1f7d58f809f6d27acb98ea5a218164e43a3;hp=34d622a9536db5860e2f313aef53d5181e50a0a9;hpb=43878ea9452342f57b453ae2098100de2089517d;p=mirror%2Fuserdir-ldap-cgi.git
diff --git a/machines.cgi b/machines.cgi
index 34d622a..4108fff 100755
--- a/machines.cgi
+++ b/machines.cgi
@@ -17,7 +17,7 @@ use POSIX;
use MIME::Base64;
use Digest::MD5 qw(md5_hex);
-my (%attrs, @attrorder, %summaryattrs, @summaryorder);
+my (%attrs, @attrorder, %summaryattrs, @summaryorder, %summarylistitems);
# This defines the description of the fields, and which fields are retrieved
%attrs = ('hostname' => 'Host name',
@@ -50,13 +50,14 @@ my (%attrs, @attrorder, %summaryattrs, @summaryorder);
# ditto for summary
%summaryattrs = ('hostname' => 'Host name',
- 'host' => 'just for a link',
- 'architecture' => 'Architecture',
- 'distribution' => 'Distribution',
+ 'host' => 'just for a link',
+ 'architecture' => 'Architecture',
'status' => 'Status',
- 'access' => 'Access');
-
-@summaryorder = ('hostname', 'architecture', 'distribution', 'status', 'access');
+ 'access' => 'Access',
+ 'sponsor' => 'Sponsor',
+ 'purpose' => 'Purpose');
+@summaryorder = qw{hostname architecture sponsor purpose status access};
+%summarylistitems = map {$_=>1} qw{purpose sponsor};
# Global settings...
my %config = &Util::ReadConfigFile;
@@ -83,6 +84,41 @@ sub sshfingerprint {
return $hrfpr;
}
+sub wiki_link($) {
+ my ($in) = @_;
+ # [[hostname|text]] makes a link
+ # [[hostname]] makes a link too
+ # if you add a * after [[ it's still the same, only not used for ssh_known_hosts in ud-generate
+ # [[-hostname]] are not links, but get added to known_hosts. we should drop the [[- ]] tho
+ $in =~ s#\[\[-(.*?)\]\]#$1#g;
+ $in =~ s#\[\[\*?(.*?)\|(.*?)\]\]#$2#g;
+ $in =~ s#\[\[\*?(.*?)\]\]#$1#g;
+ return $in;
+}
+
+# in the purpose field [[host|some other text]] (where some other text is optional)
+# makes a hyperlink on the web thing. we now also add these hosts to the ssh known_hosts
+# file. But so that we don't have to add everything we link we can add an asterisk
+# and say [[*... to ignore it. In order to be able to add stuff to ssh without
+# http linking it we also support [[-hostname]] entries.
+#
+# sponsors are also wikified like purpose. maybe others as well
+sub item_uplist($) {
+ my ($items) = @_;
+ my $out = undef;
+ my(@tmp) = @$items;
+
+ if (scalar @tmp>= 1) {
+ $out = "