Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
freedombone
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Context Sensitive Group
freedombone
Commits
3eb9b0b7
Commit
3eb9b0b7
authored
6 years ago
by
Bob Mottram
Browse files
Options
Downloads
Patches
Plain Diff
Categories for apps to be added
parent
1af181e2
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/freedombone-utils-webadmin
+86
-46
86 additions, 46 deletions
src/freedombone-utils-webadmin
webadmin/EN/apps_add_template.html
+13
-0
13 additions, 0 deletions
webadmin/EN/apps_add_template.html
with
99 additions
and
46 deletions
src/freedombone-utils-webadmin
+
86
−
46
View file @
3eb9b0b7
...
...
@@ -393,45 +393,31 @@ function web_admin_create_users {
chown www-data:www-data "$users_file"
}
function web_admin_create_add_apps {
web_admin_get_hostname
function get_app_categories {
APP_CATEGORY=()
APP_CATEGORY+=("chat")
APP_CATEGORY+=("media")
APP_CATEGORY+=("office")
APP_CATEGORY+=("social")
APP_CATEGORY+=("sync")
APP_CATEGORY+=("publishing")
APP_CATEGORY+=("other")
}
appslist_add_filename="$webadmin_install_dir/apps_add.html"
if [ -f "$webadmin_install_dir/.setupscreenactive" ]; then
if [ ! -f "$webadmin_install_dir/.running_install_command" ]; then
if [ -f "$appslist_add_filename" ]; then
rm "$appslist_add_filename"
fi
if [ ! -d "$INSTALL_DIR/tempwebadmin" ]; then
mkdir -p "$INSTALL_DIR/tempwebadmin"
fi
mv "$webadmin_install_dir/app_add_"*.html "$INSTALL_DIR/tempwebadmin"
return
fi
fi
function web_admin_create_add_apps_category {
# This counter is used to enforce 4 icon rows
available_apps_ctr=0
read_config_param DDNS_PROVIDER
read_config_param ONION_ONLY
apps_add_template_filename="$webadmin_install_dir/apps_add_template.html"
pending_installs="$webadmin_install_dir/pending_installs.txt"
icons_dir="$webadmin_install_dir/icons"
app_add_template_filename="$webadmin_install_dir/app_add_template.html"
FILES="/usr/share/${PROJECT_NAME}/apps/${PROJECT_NAME}-app-*"
# Index within the array of all apps
app_index=0
if [ ! -d "$icons_dir" ]; then
mkdir -p "$icons_dir
"
fi
# shellcheck disable=SC2086
category_str="$(tr '[:lower:]' '[:upper:]'
<
<<
${
category:0:1
})${
category:1
}
"
translated_category=
$(web_admin_translate_text
"$
category_str
")
if [ ! -f "$apps_add_template_filename" ]; then
return
fi
cp "$apps_add_template_filename" "$appslist_add_filename"
sed -i '/
<
\/
div
>
/d' "$appslist_add_filename"
sed -i '/
<
\/
body
>
/d' "$appslist_add_filename"
sed -i '/
<
\/
html
>
/d' "$appslist_add_filename"
apps_header_str=
"<fieldset class=\"
field_set
\"
><legend
class=
\"category\"
>
$translated_category
</legend>
"
echo " $apps_header_str" >> "$appslist_filename"
available_apps_ctr=0
app_index=0
for filename in $FILES
do
app_name=$(echo "${filename}" | awk -F '-app-' '{print $2}')
...
...
@@ -467,6 +453,21 @@ function web_admin_create_add_apps {
if [ ! $app_is_installed ]; then
app_filename="/usr/share/${PROJECT_NAME}/apps/${PROJECT_NAME}-app-${app_name}"
if [ -f "$app_filename" ]; then
# does this app have a category?
if ! grep -q 'APP_CATEGORY=' "$app_filename"; then
if [[ "$category" != 'other' ]]; then
app_index=$((app_index+1))
continue
fi
fi
# Does this app belong in the current category?
if ! grep -q "APP_CATEGORY=$category" "$app_filename"; then
app_index=$((app_index+1))
continue
fi
if grep -q "VARIANTS=''" "$app_filename"; then
continue
fi
...
...
@@ -598,9 +599,59 @@ function web_admin_create_add_apps {
echo '
</div>
';
echo '
</div>
'; } >> "$appslist_add_filename"
done
echo '
</div>
' >> "$appslist_add_filename"
{ echo '
</div>
';
echo '
</fieldset>
'; } >> "$appslist_add_filename"
else
# remove the header for this category
sed -i "/$apps_header_str/d" "$appslist_add_filename"
fi
}
function web_admin_create_add_apps {
web_admin_get_hostname
appslist_add_filename="$webadmin_install_dir/apps_add.html"
if [ -f "$webadmin_install_dir/.setupscreenactive" ]; then
if [ ! -f "$webadmin_install_dir/.running_install_command" ]; then
if [ -f "$appslist_add_filename" ]; then
rm "$appslist_add_filename"
fi
if [ ! -d "$INSTALL_DIR/tempwebadmin" ]; then
mkdir -p "$INSTALL_DIR/tempwebadmin"
fi
mv "$webadmin_install_dir/app_add_"*.html "$INSTALL_DIR/tempwebadmin"
return
fi
fi
read_config_param DDNS_PROVIDER
read_config_param ONION_ONLY
apps_add_template_filename="$webadmin_install_dir/apps_add_template.html"
pending_installs="$webadmin_install_dir/pending_installs.txt"
icons_dir="$webadmin_install_dir/icons"
app_add_template_filename="$webadmin_install_dir/app_add_template.html"
FILES="/usr/share/${PROJECT_NAME}/apps/${PROJECT_NAME}-app-*"
if [ ! -d "$icons_dir" ]; then
mkdir -p "$icons_dir"
fi
if [ ! -f "$apps_add_template_filename" ]; then
return
fi
cp "$apps_add_template_filename" "$appslist_add_filename"
sed -i '/
<
\/
div
>
/d' "$appslist_add_filename"
sed -i '/
<
\/
body
>
/d' "$appslist_add_filename"
sed -i '/
<
\/
html
>
/d' "$appslist_add_filename"
get_app_categories
# shellcheck disable=SC2068,SC2034
for category in ${APP_CATEGORY[@]}
do
web_admin_create_add_apps_category
done
{ echo '
</div>
';
echo '
<br><br>
';
echo '
</body>
';
...
...
@@ -609,17 +660,6 @@ function web_admin_create_add_apps {
chown -R www-data:www-data "$webadmin_install_dir"
}
function get_app_categories {
APP_CATEGORY=()
APP_CATEGORY+=("chat")
APP_CATEGORY+=("media")
APP_CATEGORY+=("office")
APP_CATEGORY+=("social")
APP_CATEGORY+=("sync")
APP_CATEGORY+=("publishing")
APP_CATEGORY+=("other")
}
function web_admin_create_installed_apps_category {
# This counter is used to enforce 4 icon rows
installed_apps_ctr=0
...
...
This diff is collapsed.
Click to expand it.
webadmin/EN/apps_add_template.html
+
13
−
0
View file @
3eb9b0b7
...
...
@@ -34,6 +34,19 @@
min-width
:
220px
;
}
.category
{
text-align
:
left
;
color
:
#72a7cf
;
font-size
:
130%
;
padding-top
:
2%
;
padding-bottom
:
2%
;
}
.field_set
{
border-color
:
#cfdde7
;
border-style
:
solid
;
}
.header
{
text-align
:
center
;
padding
:
32px
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment