Browse Source

etherpad configuration menu style

Bob Mottram 7 years ago
parent
commit
7f027206e6
1 changed files with 11 additions and 18 deletions
  1. 11
    18
      src/freedombone-app-etherpad

+ 11
- 18
src/freedombone-app-etherpad View File

269
 }
269
 }
270
 
270
 
271
 function configure_interactive_etherpad {
271
 function configure_interactive_etherpad {
272
+    W=(1 $"Set Title"
273
+       2 $"Set a welcome message")
274
+
272
     while true
275
     while true
273
     do
276
     do
274
-        data=$(mktemp 2>/dev/null)
275
-        dialog --backtitle $"Freedombone Control Panel" \
276
-               --title $"Etherpad Settings" \
277
-               --radiolist $"Choose an operation:" 12 70 3 \
278
-               1 $"Set Title" off \
279
-               2 $"Set a welcome message" off \
280
-               3 $"Exit" on 2> "$data"
281
-        sel=$?
282
-        case $sel in
283
-            1) rm -f "$data"
284
-               return;;
285
-            255) rm -f "$data"
286
-                 return;;
287
-        esac
288
-        case $(cat "$data") in
277
+        # shellcheck disable=SC2068
278
+        selection=$(dialog --backtitle $"Freedombone Administrator Control Panel" --title $"Etherpad" --menu $"Choose an operation, or ESC to exit:" 10 60 2 "${W[@]}" 3>&2 2>&1 1>&3)
279
+
280
+        if [ ! "$selection" ]; then
281
+            break
282
+        fi
283
+
284
+        case $selection in
289
             1) etherpad_set_title;;
285
             1) etherpad_set_title;;
290
             2) etherpad_set_welcome_message;;
286
             2) etherpad_set_welcome_message;;
291
-            3) rm -f "$data"
292
-               break;;
293
         esac
287
         esac
294
-        rm -f "$data"
295
     done
288
     done
296
 }
289
 }
297
 
290