Bladeren bron

postactiv configuration menu style

Bob Mottram 7 jaren geleden
bovenliggende
commit
e47bf36beb
1 gewijzigde bestanden met toevoegingen van 15 en 22 verwijderingen
  1. 15
    22
      src/freedombone-app-postactiv

+ 15
- 22
src/freedombone-app-postactiv Bestand weergeven

@@ -317,38 +317,31 @@ function postactiv_set_expire_months {
317 317
 }
318 318
 
319 319
 function configure_interactive_postactiv {
320
+    W=(1 $"Set a background image"
321
+       2 $"Set the title"
322
+       3 $"Set post expiry period (currently $POSTACTIV_EXPIRE_MONTHS months)"
323
+       4 $"Select Qvitter user interface"
324
+       5 $"Select Pleroma user interface"
325
+       6 $"Select Classic user interface")
326
+
320 327
     read_config_param "POSTACTIV_EXPIRE_MONTHS"
321 328
     while true
322 329
     do
323
-        data=$(mktemp 2>/dev/null)
324
-        dialog --backtitle $"Freedombone Control Panel" \
325
-               --title $"PostActiv" \
326
-               --radiolist $"Choose an operation:" 16 70 7 \
327
-               1 $"Set a background image" off \
328
-               2 $"Set the title" off \
329
-               3 $"Set post expiry period (currently $POSTACTIV_EXPIRE_MONTHS months)" off \
330
-               4 $"Select Qvitter user interface" off \
331
-               5 $"Select Pleroma user interface" off \
332
-               6 $"Select Classic user interface" off \
333
-               7 $"Exit" on 2> "$data"
334
-        sel=$?
335
-        case $sel in
336
-            1) rm -f "$data"
337
-               return;;
338
-            255) rm -f "$data"
339
-                 return;;
340
-        esac
341
-        case $(cat "$data") in
330
+        # shellcheck disable=SC2068
331
+        selection=$(dialog --backtitle $"Freedombone Administrator Control Panel" --title $"PostActiv" --menu $"Choose an operation, or ESC to exit:" 15 60 6 "${W[@]}" 3>&2 2>&1 1>&3)
332
+
333
+        if [ ! "$selection" ]; then
334
+            break
335
+        fi
336
+
337
+        case $selection in
342 338
             1) postactiv_set_background_image;;
343 339
             2) postactiv_set_title;;
344 340
             3) postactiv_set_expire_months;;
345 341
             4) gnusocial_use_qvitter postactiv;;
346 342
             5) gnusocial_use_pleroma postactiv;;
347 343
             6) gnusocial_use_classic postactiv;;
348
-            7) rm -f "$data"
349
-               break;;
350 344
         esac
351
-        rm -f "$data"
352 345
     done
353 346
 }
354 347