Commit graph

81 commits

Author SHA1 Message Date
Martin Hebnes Pedersen
063c15f38f Require Go 1.24 (and update deps) 2025-09-04 11:47:20 +02:00
Martin Hebnes Pedersen
6760cbcf63 Pass automatic locator updates to forms manager 2025-08-31 18:55:35 +02:00
Martin Hebnes Pedersen
36eb6ade59 Fix parsing of ReplyTemplate template command 2025-07-05 13:32:30 +02:00
Martin Hebnes Pedersen
713d20a491 Call app.Close from main 2025-06-20 12:58:25 +02:00
Martin Hebnes Pedersen
6ae942e13b Refactor to prepare for hot reloading of config
* Remove singletons
* Split into app, cli and api packages

Ref #6
2025-06-14 07:50:42 +02:00
Martin Hebnes Pedersen
361973623e Search --template path in forms dir if not found 2025-06-12 21:21:52 +02:00
Martin Hebnes Pedersen
8a3159e8f2 Improve template parsing/detection 2025-05-30 07:07:43 +02:00
Martin Hebnes Pedersen
d840b17101 Add endpoints for text-template editor in web gui 2025-05-29 16:47:10 +02:00
Martin Hebnes Pedersen
d6701547f0 Fix duplicate subfolders in form catalog listing 2025-05-29 08:36:33 +02:00
Martin Hebnes Pedersen
922b4ba43f templates: Add support for {FormFolder} tag
Resolves #458
2025-05-26 11:37:58 +02:00
Martin Hebnes Pedersen
4dc5577eb0 Fix panic on empty attached_text form values
Resolves #470
2025-01-21 19:40:56 +01:00
Martin Hebnes Pedersen
32448b138b Strip whitespace from Standard Forms version str
Version 1.1.6.0 was released as `1.1.6\t.0`.
2025-01-12 21:32:10 +01:00
Martin Hebnes Pedersen
34f38822b5 Add CLI command templates
With subcommands `update` and `seqset`.

Deprecates command `updateforms`.
2024-12-27 14:43:14 +01:00
Martin Hebnes Pedersen
3a2c12b6b3 Add support for template sequence numbers 2024-12-27 13:55:28 +01:00
Martin Hebnes Pedersen
4d1615fbf8 Enhance support for reply templates
* Add insertion tags MsgOriginal*
* Insert original body as citation at the end of the message.
2024-12-19 23:53:46 +01:00
Martin Hebnes Pedersen
47b15734e8 Properly close response body on internet check 2024-12-19 23:53:14 +01:00
Martin Hebnes Pedersen
fc36ba5626 Add support for <InternetAvailable> insertion tag 2024-12-19 23:29:56 +01:00
Martin Hebnes Pedersen
42856f11d7 Handle UTF-8 BOM when reading templates files 2024-12-13 18:34:04 +01:00
Martin Hebnes Pedersen
855c8678b4 Implement multi-line prompt for text templates
Resolves #444
2024-12-13 13:00:00 +01:00
Martin Hebnes Pedersen
839b147853 Remove use of deprecated ioutil package 2024-12-13 12:13:56 +01:00
Martin Hebnes Pedersen
917592942b Fix formatting of dates in test
Gofmt did not agree with my zero-padded numeric constants.
2024-04-13 07:33:20 +02:00
Martin Hebnes Pedersen
51e115fd17 Trim whitespace from form vars in XML attachment
I found this difference when comparing against Winlink Express's output
using the same Form template. Winlink Express trims trailing whitespace
before writing the form variables as XML.
2024-04-13 07:33:20 +02:00
Martin Hebnes Pedersen
12def2e3b7 Remove trailing space in GPSValid insertion tag
Winlink Express does include this, and neither should we.
2024-04-13 07:33:20 +02:00
Martin Hebnes Pedersen
94a3caf749 Fix <Ask ...,UP> (uppercase prompt) 2024-04-13 07:33:20 +02:00
Martin Hebnes Pedersen
504d905153 Support attached_textN/attached_fileN
Issue #437
2024-04-13 07:33:20 +02:00
Martin Hebnes Pedersen
0a497087b9 Build forms folder using fs.WalkDir 2024-04-13 07:33:20 +02:00
Martin Hebnes Pedersen
4d7ab34e65 Cleanup 2024-04-13 07:33:20 +02:00
Martin Hebnes Pedersen
64dd3cd29d Resolve Form files by referencing the template
By referencing the template instead of the "initial_uri" (Forms
composer), the backend is able to more precisely identify the correct
HTML file for any given template. It also makes handling of reply
templates much easier.

In addition to a less complex implementation, this simplifies the API as
we no longer need to supply the frontend with URIs for all HTML
variants. We also get increased performance because of the simplified
file search, and by not having to parse reply templates upfront.

This also opens up the possibility of serving a specialized HTML-based
composer for text-only templates in the future, without having to change
the existing frontend.
2024-04-13 07:33:20 +02:00
Martin Hebnes Pedersen
6129ee5302 Fallback to global file reference search
Some templates references HTML Forms and reply templates located in
adjecent folders, without specifying a relative path. Examples of this
can be found in `MAPPING-GIS FORMS`.
2024-04-13 07:33:20 +02:00
Martin Hebnes Pedersen
c4984fcf77 Ignore invalid file references
This fixes an issue where, when searching for a html viewer, we ended up
using a non-existent HTML file.
2024-04-13 07:33:20 +02:00
Martin Hebnes Pedersen
f0c78674e5 Fix missing appname for tag <ProgramVersion> 2024-04-13 07:33:20 +02:00
Martin Hebnes Pedersen
9f99d104f9 Avoid "." as reply template value if path is empty 2024-04-13 07:33:20 +02:00
Martin Hebnes Pedersen
60474bde9e Marshal XML attachment using the xml package 2024-04-13 07:33:20 +02:00
Martin Hebnes Pedersen
a0076fd6a9 Refactor XML marshalling and add tests
Also fixed issue of inconsistent output due to unstable ordering of form
variables.
2024-04-13 07:33:20 +02:00
Martin Hebnes Pedersen
bc9512e159 Add a couple of missing insertion Tags + docs
<Day>, <UDay>, <GPSLatitude> and <GPSLongitude>
2024-04-13 07:33:20 +02:00
Martin Hebnes Pedersen
35988914fb Add more insertion tags tests 2024-04-13 07:33:20 +02:00
Martin Hebnes Pedersen
c98746ed2a Customizable time.Now and location for testing 2024-04-13 07:33:20 +02:00
Martin Hebnes Pedersen
bda13dc25e Refactor gridSquare position formatting 2024-04-13 07:33:20 +02:00
Martin Hebnes Pedersen
f72a5ad888 Handle <Ask ...,UP> (uppercase prompt) 2024-04-13 07:33:20 +02:00
Martin Hebnes Pedersen
ebcaa4bc71 Fix resolve of Def: bug introduced in refactoring 2024-04-13 07:33:20 +02:00
Martin Hebnes Pedersen
a3191fb802 Refactor message builder 2024-04-13 07:33:20 +02:00
Martin Hebnes Pedersen
9db0706843 More refactoring (split source files) 2024-04-13 07:33:20 +02:00
Martin Hebnes Pedersen
55e58e460a Improve form variable prompting in CLI composer
Forms-enabled templates is not written with a CLI user in mind. By
echoing the template line before prompting for a <Var ...>, it will
hopefully be possible to understand the meaning of the variable (by
context).

Also apply a hack to refresh the regular expressions used by
varReplacer, to avoid prompting for the same variable multiple times.
2024-04-13 07:33:20 +02:00
Martin Hebnes Pedersen
780891c19c Distinguish Template from Form
(HTML) Forms is an extension of the Templates feature in RMS Express.
Templates are the .txt files. Some templates support HTML forms,
indicated by the Template Control Field `Form`.
2024-04-13 07:33:20 +02:00
Martin Hebnes Pedersen
87e02d5481 More refactoring (split source files) 2024-04-13 07:33:20 +02:00
Martin Hebnes Pedersen
72238a3038 Cleanup (read form file) 2024-04-13 07:33:20 +02:00
Martin Hebnes Pedersen
d626aedeaf Refactor variable substitution
Variable substitution is essentially the same as tag insertion, so the
two features can share the same underlying implementation.
2024-04-13 07:33:20 +02:00
Martin Hebnes Pedersen
5ff709abe2 Refactor insertion tags and use for all templates
Also make the search case-insentitive since caseness is not strictly
handled in HTML forms. Unsupported insertion tags are logged (debug).
2024-01-20 18:38:09 +00:00
Martin Hebnes Pedersen
c409d48804 Support <Ask> and <Select> prompts in templates
Ref #375
2024-01-20 18:38:09 +00:00
Martin Hebnes Pedersen
b58e0fa78b Support attached_text (formData.txt)
Resolves #437
2023-12-29 11:11:12 +01:00