login/edit: hide empty tags column (empty groups)
authorMischa POSLAWSKY <perl@shiar.org>
Tue, 17 Jul 2018 20:08:43 +0000 (22:08 +0200)
committerMischa POSLAWSKY <perl@shiar.org>
Fri, 10 Aug 2018 23:24:25 +0000 (01:24 +0200)
login/edit.php

index ad9dbda68faa8f378081dfcbf2bee041bb74190a..49b8ed8c43e821092694b4c9953cbb154f507595 100644 (file)
@@ -17,14 +17,16 @@ and !empty($Place['user']) and $Place['user'] !== $User['name']) {
 require_once('edit.inc.php');
 
 foreach ($cols as $col => &$colconf) {
+       $colconf['visible'] = TRUE;
+
        if (!isset($colconf['filename'])) {
                continue;  # exceptional storage
        }
 
        if (isset($colconf['values'])) {
                if (!file_exists($colconf['filename'])) {
+                       $colconf['visible'] = FALSE;
                        continue;
-                       #TODO: drop key
                }
                $tags = [];
                foreach (glob($colconf['filename'] . '/*') as $tag) {
@@ -158,6 +160,10 @@ if ($_POST) {
        <ul class="grid">
 <?php
 foreach ($cols as $col => &$colconf) {
+       if (!$colconf['visible']) {
+               continue;
+       }
+
        print "\t";
        printf('<li><label for="%s">%s:</label>', $col, ucfirst($colconf['label']));
        if (@$colconf['type'] == 'file' and isset($colconf['value'])) {