]> git.plutz.net Git - serve0/blobdiff - templates/tagger.html.sh
styling for pagination links
[serve0] / templates / tagger.html.sh
index 28fb1b8424273ab16faa24a6ff9d27690a0b4060..4b1d0fe698f83e47b74366d6f328ebca38f94095 100755 (executable)
@@ -1,47 +1,54 @@
-#!/bin/zsh    
+# Copyright 2014, 2015, 2016 Paul Hänsch
+#
+# This file is part of Serve0
+# 
+# Serve0 is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+# 
+# Serve0 is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU Affero General Public License for more details.
+# 
+# You should have received a copy of the GNU Affero General Public License
+# along with Serve0  If not, see <http://www.gnu.org/licenses/>. 
 
-cat <<LOCATIONend
-  <div class="footer" id="foot">
-    <a class="panel" href="#foot" onclick="javascript:hide_block('foot');show_block('tagger');">Add Tags</a>
-    <span style="float:right;">
-      <b>Page:</b>
-      <a href="?o=$order&i=$info&p=$([ "$page" != 0 ] && echo $(($page - 1)) || echo 0)&f=$filter&s=$search#$anchor">&lt;&lt;</a>
-      <a href="?o=$order&i=&p=$page&f=$filter&s=$search#$anchor">$(($page + 1))</a>
-      <a href="?o=$order&i=$info&p=$(($page + 1))&f=$filter&s=$search#$anchor">&gt;&gt;</a>
-    </span>
-  </div>
+category_options(){
+  cat="${1}:"
+  [ "$cat" = "none:" ] && cat=''
+
+  printf %s "$taglist_set" \
+  | sed -rn 's;^('"$cat"')([^:]+)$;<option value="\1\2">\2</option>;p'
+}
 
+category_box(){
+  for cat in "$@"; do
+  cat <<EOF
+  <fieldset class="newtag">
+    <label class="category">${cat}:</label>
+    <input type="hidden" name="category" value="$cat">
+    <select name="ctag" size="12" multiple>
+      $(category_options "$cat")
+    </select>
+  </fieldset>
+EOF
+  done
+}
 
-  <div class="footer" id="tagger" style="display: none;">
-    <a class="panel" href="#foot" onclick="javascript:hide_block('tagger');$(for n in $(seq 1 4); do echo "hide_inline('filter$n');"; done)show_block('foot')">Hide</a>
-    <hr>
-    <div>Add selectetd tags to selected videos.<br>
-      <!-- select name="category" size="12" onchange="${hideall}show_inline('${n}_'+this.options[this.options.selectedIndex].value)">
-        <option>none</option>
-        $(sed -rn 's;^([^:]+):.*$;<option>\1</option>;p' <<<"$taglist" |sort -u)
-      </select -->
-      <!-- input type="hidden" name="category" value="" -->
-      <div>None:<br>
-        <select name="ctag" size="12" multiple id="${n}_none">
-         $(sed -rn 's;^([^:]+)$;<option value="\1">\1</option>;p' <<<"$taglist")
-        </select>
-      </div>
-      $(sed -rn 's;^([^:]+):.*$;\1;p' <<<"$taglist" |sort -u |while read cat; do echo "
-      <div>${cat}:</br>
-        <input type=\"hidden\" name=\"category\" value=\"$cat\">
-        <select name=\"ctag\" size=\"12\" multiple id=\"${n}_$cat\" style=\"display:inline;\">
-         $(sed -rn "s;^${cat}:(.*)$;<option value=\"${cat}:\\1\">\\1</option>;p" <<<"$taglist")
-        </select>
-      </div>"
-      done)
-    </div>
-    <div>Additional Tags (one per line):<br>
+cat <<EOF
+  <div class="panel switchable bottom" id="tagger">
+    <p class="help">Add selectetd tags to selected videos.</p>
+    $(category_box $(list_categories))
+    <fieldset class="newtag additional">
+      <label class="additional">Additional Tags (one per line):</label>
       <textarea name="tags" rows="2"></textarea>
-    </div>
-    <div><input type="submit" value="Add Tags!"></div>
+    </fieldset>
+    <input type="submit" value="Add Tags!">
+
+    <a class="panel toggle" href="#foot">Hide</a>
   </div>
-  <a name="foot"></a>
-LOCATIONend
+EOF
 
 # vi:set filetype=html:
-