aboutsummaryrefslogtreecommitdiffstats
path: root/web/api/read/template-list
diff options
context:
space:
mode:
authorOle Mathias Heggem <olemathias.aa.heggem@gmail.com>2018-03-22 13:52:39 +0100
committerOle Mathias Heggem <olemathias.aa.heggem@gmail.com>2018-03-22 13:52:39 +0100
commit22d72afb561091aeaee6a62fb2afbf61dc8bcd7a (patch)
treee893b364bef744dd02415cd2d5b9834d1619bab7 /web/api/read/template-list
parent17abab7dd56006af43b35a916553efa06e28e173 (diff)
Added new API point for list of templates
Diffstat (limited to 'web/api/read/template-list')
-rwxr-xr-xweb/api/read/template-list21
1 files changed, 21 insertions, 0 deletions
diff --git a/web/api/read/template-list b/web/api/read/template-list
new file mode 100755
index 0000000..d1c8773
--- /dev/null
+++ b/web/api/read/template-list
@@ -0,0 +1,21 @@
+#! /usr/bin/perl
+# vim:ts=8:sw=8
+
+use lib '/opt/gondul/include';
+use nms::web;
+use strict;
+use warnings;
+
+my $template_dir = "/opt/gondul/web/templates";
+
+opendir (DIR, $template_dir) or die $!;
+
+while (my $file = readdir(DIR)) {
+ next if ($file =~ m/^\./);
+ my %meh;
+ $meh{'file'} = $file;
+
+ push @{$nms::web::json{'templates'}},\%meh;
+}
+
+nms::web::finalize_output();