Skip to content

Commit

Permalink
initial
Browse files Browse the repository at this point in the history
  • Loading branch information
StiftungAusNachlass committed Apr 29, 2024
0 parents commit 4a0666e
Show file tree
Hide file tree
Showing 10 changed files with 316 additions and 0 deletions.
17 changes: 17 additions & 0 deletions .github/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
changelog:
exclude:
labels:
- ignore-for-release
categories:
- title: Bug Fixes 🛠
labels:
- bug fix
- title: Enhancements 🛠
labels:
- enhancement
- title: New Features 🎉
labels:
- new feature
- title: Other Changes
labels:
- "*"
47 changes: 47 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: Release

on:
push:
tags:
- "v*.*.*"

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Install coffeescript-compiler
run: sudo apt-get install coffeescript

- name: Checkout
uses: actions/checkout@v2
with:
submodules: recursive

- name: Checkout submodules
run: git submodule update --init --recursive

- name: Get the version
id: get_version
run: echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\//}
shell: bash

- name: Extract repository name
run: echo "REPOSITORY_NAME=$(echo '${{ github.repository }}' | awk -F '/' '{print $2}')" >> $GITHUB_ENV
shell: bash

- name: Set zip file name
run: echo "ZIP_NAME=trayLinkManager.zip" >> $GITHUB_ENV

- name: Build and Package
shell: bash
run: make zip

- name: Release
uses: softprops/action-gh-release@v1
with:
name: Release ${{ steps.get_version.outputs.VERSION }}
draft: true
generate_release_notes: true
files: |
build/${{ env.ZIP_NAME }}
README.md
24 changes: 24 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
This is free and unencumbered software released into the public domain.

Anyone is free to copy, modify, publish, use, compile, sell, or
distribute this software, either in source code form or as a compiled
binary, for any purpose, commercial or non-commercial, and by any
means.

In jurisdictions that recognize copyright laws, the author or authors
of this software dedicate any and all copyright interest in the
software to the public domain. We make this dedication for the benefit
of the public at large and to the detriment of our heirs and
successors. We intend this dedication to be an overt act of
relinquishment in perpetuity of all present and future rights to this
software under copyright law.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.

For more information, please refer to <http://unlicense.org>
37 changes: 37 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
ZIP_NAME ?= "TrayLinkManager.zip"
PLUGIN_NAME = "tray-link-manager"

# coffescript-files to compile
COFFEE_FILES = tray-link-manager.coffee


help:
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'

all: build ## build all

build: clean ## clean, compile, copy files to build folder

mkdir -p build
mkdir -p build/$(PLUGIN_NAME)
mkdir -p build/$(PLUGIN_NAME)/webfrontend
mkdir -p build/$(PLUGIN_NAME)/l10n

mkdir -p src/tmp # build code from coffee
cp src/webfrontend/*.coffee src/tmp

cd src/tmp && coffee -b --compile ${COFFEE_FILES} # bare-parameter is obligatory!
cat src/tmp/*.js > build/$(PLUGIN_NAME)/webfrontend/TrayLinkManager.js

rm -rf src/tmp # clean tmp

cp l10n/tray-link-manager.csv build/$(PLUGIN_NAME)/l10n/TrayLinkManager.csv # copy l10n

cp src/webfrontend/css/main.css build/$(PLUGIN_NAME)/webfrontend/TrayLinkManager.css # copy css
cp manifest.master.yml build/$(PLUGIN_NAME)/manifest.yml # copy manifest

clean: ## clean
rm -rf build

zip: build ## build zip file
cd build && zip ${ZIP_NAME} -r $(PLUGIN_NAME)/
30 changes: 30 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
> This Plugin / Repo is being maintained by a community of developers.
There is no warranty given or bug fixing guarantee; especially not by
Programmfabrik GmbH. Please use the github issue tracking to report bugs
and self organize bug fixing. Feel free to directly contact the committing
developers.

# fylr-plugin-tray-link-manager
Create and manage tray-links for app-header

The plugin makes it possible to create tray entries in baseconfig and to provide them with text, a link and an icon, and to assign group permissions there.

## installation

The latest version of this plugin can be found [here](https://github.com/programmfabrik/fylr-plugin-tray-link-manager/releases/latest/download/trayLinkManager.zip).

The ZIP can be downloaded and installed using the plugin manager, or used directly (recommended).

Github has an overview page to get a list of [all release](https://github.com/programmfabrik/fylr-plugin-tray-link-manager/releases/).

## configuration

* baseconfig
* name
* url (e.g. "/lists/objecttype1")
* icon (e.g. "fa-superpowers")
* groups (choose from select)

## sources

The source code of this plugin is managed in a git repository at <https://github.com/programmfabrik/fylr-plugin-tray-link-manager>.
8 changes: 8 additions & 0 deletions l10n/tray-link-manager.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
key,de-DE,en-US
server.config.name.system.Tray-Link-Manager,Tray-Link-Manager,Tray-Link-Manager
server.config.parameter.system.Tray-Link-Manager.templates.label,Einstellungen,Einstellungen
server.config.parameter.system.Tray-Link-Manager.templates.name.label,Label,Label
server.config.parameter.system.Tray-Link-Manager.templates.url.label,URL (ohne Domain),URL (without domain)
server.config.parameter.system.Tray-Link-Manager.templates.groups.label,Erlaubte Gruppen, Allowed groups
server.config.parameter.system.Tray-Link-Manager.templates.groups.group.label,Gruppe,Group
server.config.parameter.system.Tray-Link-Manager.templates.icon.label,Icon (https://fontawesome.com/v4/icons/),Icon (https://fontawesome.com/v4/icons/)
45 changes: 45 additions & 0 deletions manifest.master.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
plugin:
name: tray-link-manager
version: 1.0
l10n: l10n/TrayLinkManager.csv
displayname:
de-DE: Tray-Links-Verwalter
en-US: Tray-Link-Manager
info:
de-DE: Tray-Links für die Kopfzeile erstellen und verwalten
en-US: Create and manage tray-links for app-header
server:
api-version:
require: 1
webfrontend:
url: TrayLinkManager.js
css: TrayLinkManager.css


base_url_prefix: "webfrontend"


base_config:
- name: Tray-Link-Manager
group: tray_link_manager
parameters:
templates:
type: table
fields:
- name: name
type: text-l10n
position: 0
- name: url
type: text
position: 1
- name: icon
type: text
position: 2
- name: groups
type: table
fields:
- name: group
type: int
plugin_type: group_easydb_select
position: 0
position: 3
Empty file added src/webfrontend/css/main.css
Empty file.
53 changes: 53 additions & 0 deletions src/webfrontend/tray-link-manager-base-config.coffee
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
class TrayLinkManagerBaseConfig extends BaseConfigPlugin
getFieldDefFromParm: (baseConfig, pname, def, parent_def) ->

if def.plugin_type != "tray-link-manager"
return

# TODO: GENERIEREN NACH FRONDENDSPRACHEN
# TODO: GENERIEREN NACH FRONDENDSPRACHEN
# TODO: GENERIEREN NACH FRONDENDSPRACHEN
# TODO: GENERIEREN NACH FRONDENDSPRACHEN

multi_input_control = new CUI.MultiInputControl
user_control: true
preferred_key: "de-DE"
keys: [
name: "de-DE"
tag: "DE"
enabled: true
tooltip: text: "de-DE"
,
name: "en-US"
tag: "EN"
tooltip: text: "en-US"
,
name: "fr-FR"
tag: "FR"
tooltip: text: "fr-FR"
]

field =
type: CUI.Form
name: "tray_link_manager"
fields: [
type: CUI.DataTable
name: "data_table"
fields: [
form:
label: $$("baseconfig.validation.selector.objecttype.label")
type: CUI.MultiInput
name: "objecttype"
control: multi_input_control
,
form:
label: $$("baseconfig.validation.selector.validierung.label")
type: CUI.Checkbox
text: $$("baseconfig.validation.selector.validierung.activate.label")
name: "activate"
]
]
field

CUI.ready =>
BaseConfig.registerPlugin(new TrayLinkManagerBaseConfig())
55 changes: 55 additions & 0 deletions src/webfrontend/tray-link-manager.coffee
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
class TOBIExampleTrayApp extends TrayApp
is_allowed: =>
true

getDisplay: =>
super()

# get all usergroups
userGroups = ez5.session.user.getGroups().map((group) => group.id);

# get frontendlanguage
frontend_language = ez5.session.frontend_language
baseConfigTemplates = ez5.session.config.base?.plugin['tray-link-manager']?.config['Tray-Link-Manager']?.templates

# concordance of all pathes and appnames
appPathNamesConcordance = {}
for app in ez5.rootMenu.__apps
if app.getPathname() != ''
appPathNamesConcordance[app.getPathname().replace('/','')] = app.name
if baseConfigTemplates
for template, templateKey in baseConfigTemplates
# label (l10n)
loca_label = template?.name[frontend_language] ? ''
# icon
icon = template?.icon ? ''
# check if first part of template.url is a valid path
path = template.url
if path[0] != '/'
path = '/' + path
pathParts = path.split('/')
pathFirstPart = pathParts[1];
if appPathNamesConcordance[pathFirstPart]
# get allowed groups from template
templateGroups = template.groups.map((group) => group.group);
groupMatches = userGroups.some((value) ->
templateGroups.includes(value)
)
# if groups match
if groupMatches || templateGroups.length == 0
button = new LocaButton
text: loca_label # FROM CONFIG
icon_left: new CUI.Icon(class: icon)
onClick: ((template, pathFirstPart, appPathNamesConcordance) =>
() =>
full_path = window.easydb_base_prefix + template.url
window.history["pushState"]({}, null, full_path)
selectedApp = ez5.rootMenu.__apps.find (app) ->
app.name is appPathNamesConcordance[pathFirstPart]
ez5.rootMenu.loadApp(selectedApp, false)
)(template, pathFirstPart, appPathNamesConcordance)

CUI.dom.append(@display, button)

ez5.session_ready ->
ez5.tray.registerApp(new TOBIExampleTrayApp())

0 comments on commit 4a0666e

Please sign in to comment.