Skip to content

Commit

Permalink
cops: Use mustache to generate wizards
Browse files Browse the repository at this point in the history
  • Loading branch information
smaarn committed Aug 6, 2023
1 parent ef666be commit 7221158
Show file tree
Hide file tree
Showing 7 changed files with 65 additions and 110 deletions.
20 changes: 1 addition & 19 deletions spk/cops/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,7 @@ REQUIRED_MIN_DSM = 7.0

DSM_UI_CONFIG = src/app/config

WIZARDS_DIR = $(WORK_DIR)/generated-wizards
WIZARDS = install_uifile
WIZARDS_TEMPLATES_DIR = src/wizard_templates
CONF_DIR = src/conf/

SERVICE_SETUP = src/service-setup.sh
Expand All @@ -40,30 +39,13 @@ POST_STRIP_TARGET = cops_extra_install

SUPPORTED_LANGUAGES = fre

wizards: generated-wizards

# Pure PHP package, make sure ARCH is not defined
override ARCH=

ICON_DIR = $(STAGING_DIR)/$(DSM_UI_DIR)/images

include ../../mk/spksrc.spk.mk

.PHONY: generated-wizards
generated-wizards:
@mkdir -p $(WIZARDS_DIR)
@for template in $(WIZARDS); do \
for suffix in '' $(patsubst %,_%,$(SUPPORTED_LANGUAGES)) ; do \
{\
echo "#!/bin/sh";\
echo "";\
cat src/wizard_templates/uifile_vars$${suffix} | sed -e 's/\\/\\\\/g' -e 's/\"/\\\"/g' -e 's/^\([^=]*\)=\\"\(.*\)\\"$$/\1="\2"/g';\
echo "";\
cat src/wizard_templates/$${template}.sh;\
}>$(WIZARDS_DIR)/$${template}$${suffix}.sh;\
done;\
done

.PHONY: cops_extra_install
cops_extra_install:
install -m 755 -d $(STAGING_DIR)/app
Expand Down
38 changes: 38 additions & 0 deletions spk/cops/src/wizard_templates/install_uifile
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
[{
"step_title": "{{{COPS_CONFIGURATION_FIRST_STEP_TITLE}}}",
"items": [{
"type": "textfield",
"desc": "{{{EXISTING_CALIBRE_DIRECTORY_DESCRIPTION}}}",
"subitems": [{
"key": "wizard_calibre_dir",
"defaultValue": "/volume1/calibre/",
"desc": "{{{EXISTING_CALIBRE_DIRECTORY_LABEL}}}"
}]
}, {
"type": "textfield",
"desc": "{{{COPS_CATALOG_TITLE_DESCRIPTION}}}",
"subitems": [{
"key": "wizard_cops_title",
"defaultValue": "COPS",
"desc": "{{{COPS_CATALOG_TITLE_LABEL}}}"
}]
}]
},{
"step_title": "{{{COPS_CONFIGURATION_SECOND_STEP_TITLE}}}",
"items": [{
"type": "multiselect",
"desc": "{{{DO_YOU_WANT_TO_USE_COPS_WITH_A_KOBO_DESCRIPTION}}}",
"subitems": [{
"key": "wizard_use_url_rewriting",
"desc": "{{{DO_YOU_WANT_TO_USE_COPS_WITH_A_KOBO_LABEL}}}"
}]
}]
},{
"step_title": "{{{DSM_PERMISSIONS_TITLE}}}",
"items": [
{
"desc": "{{{DSM_PERMISSIONS_TEXT}}}"
}
]
}
]
65 changes: 0 additions & 65 deletions spk/cops/src/wizard_templates/install_uifile.sh

This file was deleted.

13 changes: 13 additions & 0 deletions spk/cops/src/wizard_templates/install_uifile.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
COPS_CONFIGURATION_FIRST_STEP_TITLE: "COPS configuration"

EXISTING_CALIBRE_DIRECTORY_DESCRIPTION: "Existing Calibre library directory. WARNING: has to end with a / and never use your web directory"
EXISTING_CALIBRE_DIRECTORY_LABEL: "Calibre directory"
COPS_CATALOG_TITLE_DESCRIPTION: "Catalog title."
COPS_CATALOG_TITLE_LABEL: "Catalog title"

COPS_CONFIGURATION_SECOND_STEP_TITLE: "COPS configuration (next)"
DO_YOU_WANT_TO_USE_COPS_WITH_A_KOBO_DESCRIPTION: "Do you want to use COPS with a Kobo eReader?"
DO_YOU_WANT_TO_USE_COPS_WITH_A_KOBO_LABEL: "Kobo"

DSM_PERMISSIONS_TITLE: "Attention! DSM Permissions"
DSM_PERMISSIONS_TEXT: "Permissions are managed with the group <b>http</b> in DSM.<br>The group 'users' is no longer used as of DSM 6.<br>Package user (= sc-cops) will not appear on most UI settings.<br>Including the following:<br>- Application privilege's permission viewer<br>- FPT's chroot user selector<br>- File Stations's<br>- Change owner<br>- Shared Links Manager -> Enable secure sharing<br><br>The only exceptions are:<br>- Control Panel > Shared Folder > Edit > Permission > System internal user<br>- ACL editor<br>"
13 changes: 13 additions & 0 deletions spk/cops/src/wizard_templates/install_uifile_fre.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
COPS_CONFIGURATION_FIRST_STEP_TITLE: "Configuration de COPS"

EXISTING_CALIBRE_DIRECTORY_DESCRIPTION: "Répertoire existant contenant une bibliothèque Calibre. Attention : doit se terminer par un / et ne jamais utiliser le répertoire web."
EXISTING_CALIBRE_DIRECTORY_LABEL: "Répertoire contenant Calibre"
COPS_CATALOG_TITLE_DESCRIPTION: "Titre du catalogue."
COPS_CATALOG_TITLE_LABEL: "Titre du catalogue"

COPS_CONFIGURATION_SECOND_STEP_TITLE: "Configuration de COPS (suite)"
DO_YOU_WANT_TO_USE_COPS_WITH_A_KOBO_DESCRIPTION: "Voulez vous utiliser COPS avec votre liseuse Kobo ?"
DO_YOU_WANT_TO_USE_COPS_WITH_A_KOBO_LABEL: "Kobo"

DSM_PERMISSIONS_TITLE: "Attention! DSM Permissions"
DSM_PERMISSIONS_TEXT: "Les autorisations sont gérées avec le groupe <b>http</b> dans DSM.<br>Le groupe 'utilisateurs' n'est plus utilisé à partir de DSM 6.<br>L'utilisateur du paquet (= sc-cops) n'apparaîtra pas sur la plupart des paramètres d'interface utilisateur. Y compris ce qui suit: <br>- Afficheur d'autorisation de privilège d'application <br>- Sélecteur d'utilisateur chroot FPT <br>- File Stations's- Changer de propriétaire <br>- Shared Links Manager -> Activer le partage sécurisé <br><br>Les seules exceptions sont: <br>- Panneau de configuration> Dossier partagé> Edition> Autorisation> Utilisateur interne du système <br>- Éditeur ACL"
13 changes: 0 additions & 13 deletions spk/cops/src/wizard_templates/uifile_vars

This file was deleted.

13 changes: 0 additions & 13 deletions spk/cops/src/wizard_templates/uifile_vars_fre

This file was deleted.

0 comments on commit 7221158

Please sign in to comment.