civicrm-core.git
4 years agoFixes #4 - html encode injected properties and enable test
Coleman Watts [Sat, 2 Nov 2019 00:57:27 +0000 (20:57 -0400)]
Fixes #4 - html encode injected properties and enable test

4 years agoFields drag n drop
Coleman Watts [Fri, 1 Nov 2019 19:15:59 +0000 (15:15 -0400)]
Fields drag n drop

4 years agoWIP canvas
Coleman Watts [Thu, 31 Oct 2019 00:08:47 +0000 (20:08 -0400)]
WIP canvas

4 years agoRemove convertTextNodes
Coleman Watts [Wed, 30 Oct 2019 22:18:31 +0000 (18:18 -0400)]
Remove convertTextNodes

The api now returns them as an array so we don't need to worry about this on the client side.

4 years agoWIP fields
Coleman Watts [Tue, 29 Oct 2019 21:30:23 +0000 (17:30 -0400)]
WIP fields

4 years agoConfig forms - values section
Coleman Watts [Mon, 28 Oct 2019 01:52:14 +0000 (21:52 -0400)]
Config forms - values section

4 years agoHorizontal tabs
Coleman Watts [Fri, 25 Oct 2019 16:01:48 +0000 (12:01 -0400)]
Horizontal tabs

4 years agoAdd some metadata
Coleman Watts [Fri, 25 Oct 2019 14:32:24 +0000 (10:32 -0400)]
Add some metadata

4 years agoWIP beginning work on GUI
Coleman Watts [Thu, 24 Oct 2019 17:05:19 +0000 (13:05 -0400)]
WIP beginning work on GUI

4 years ago(REF) AHQ::makeRoot() - Extract helper from FormDataModel
Tim Otten [Fri, 1 Nov 2019 20:27:46 +0000 (13:27 -0700)]
(REF) AHQ::makeRoot() - Extract helper from FormDataModel

4 years agoFilterTest - Add basic unit test for the 'defn="..."` injection
Tim Otten [Fri, 1 Nov 2019 20:14:33 +0000 (13:14 -0700)]
FilterTest - Add basic unit test for the 'defn="..."` injection

4 years ago(REF) _afform_html_filter() - Extract method for unit-testing
Tim Otten [Fri, 1 Nov 2019 19:45:15 +0000 (12:45 -0700)]
(REF) _afform_html_filter() - Extract method for unit-testing

4 years ago(NFC) Small cleanup
Tim Otten [Fri, 1 Nov 2019 19:41:35 +0000 (12:41 -0700)]
(NFC) Small cleanup

4 years ago(REF) AfformScanner::getLayout() - Extract new method
Tim Otten [Fri, 1 Nov 2019 19:40:56 +0000 (12:40 -0700)]
(REF) AfformScanner::getLayout() - Extract new method

4 years agoFix parser to work with nested fields
Coleman Watts [Fri, 1 Nov 2019 13:57:25 +0000 (09:57 -0400)]
Fix parser to work with nested fields

Fields should be allowed to be inside other tags as long as they're
contained in an af-fieldset.

4 years agoAdd bin/test-all.sh
Tim Otten [Fri, 1 Nov 2019 05:20:26 +0000 (22:20 -0700)]
Add bin/test-all.sh

4 years agoFix warnings for `#text` format
Tim Otten [Fri, 1 Nov 2019 04:53:44 +0000 (21:53 -0700)]
Fix warnings for `#text` format

4 years agoaf-fieldset - More updates for switching E=>A
Tim Otten [Fri, 1 Nov 2019 04:53:24 +0000 (21:53 -0700)]
af-fieldset - More updates for switching E=>A

4 years agoRestrict af-fieldset directive to A not E
Coleman Watts [Thu, 31 Oct 2019 00:33:26 +0000 (20:33 -0400)]
Restrict af-fieldset directive to A not E

The af-fieldset directive was ambiguiously set to restrict: "AE"
but only "E" was supported. I want to pick one and stick with it, and
I prefer "A" because the fieldset is also a container, so div or fieldset
seem like the appropriate tag names.

4 years agoArrayHtml - Change text node format from string to array
Coleman Watts [Wed, 30 Oct 2019 20:53:19 +0000 (16:53 -0400)]
ArrayHtml - Change text node format from string to array

Everything in the arrayHtml is associative exept text nodes were just strings.
That made it difficult to loop through the whole thing in javascript, so
this updates the format to be consistent with everything else.

4 years agoArrayHtml - Treat `<af-entity/>` and `<af-field/>` as self-closing tags
Tim Otten [Tue, 29 Oct 2019 23:11:10 +0000 (16:11 -0700)]
ArrayHtml - Treat `<af-entity/>` and `<af-field/>` as self-closing tags

4 years agoArrayHtml - Encode self-closing HTML tags (`<img />`, `<br />`) normally
Tim Otten [Tue, 29 Oct 2019 23:07:12 +0000 (16:07 -0700)]
ArrayHtml - Encode self-closing HTML tags (`<img />`, `<br />`) normally

4 years agoArrayHtml - Support comments
Tim Otten [Tue, 29 Oct 2019 22:31:06 +0000 (15:31 -0700)]
ArrayHtml - Support comments

Before
------

HTML comments appear in the array as NULL values

After
-----

HTML comments appear in the array as `['#comment' => '...']`

Technical Notes
---------------

* Considered using `['#tag' => 'comment', '#children' => '...'], but this is ambiguous when you
  have a node/tag named '<comment>'
* Considered using `['#tag' => 'comment', '#children' => '...'], but it's needlessly difficult to
  extract the comment text from under `'#children'`.

4 years agoFix forms autofill with new dataModel
Coleman Watts [Mon, 28 Oct 2019 17:38:22 +0000 (13:38 -0400)]
Fix forms autofill with new dataModel

The formDataModel is now an object rather than an array.
This also changes the array key to match what's used in testAfform.aff.html:
url-autofill instead of af-url-autofill

4 years ago(BC Break) Change shallow+deep formats to begin with an array of elements
Tim Otten [Sat, 26 Oct 2019 00:14:30 +0000 (17:14 -0700)]
(BC Break) Change shallow+deep formats to begin with an array of elements

Before: In the shallow+deep representations of `layout`, the root array
has a `#tag` and `#children`.

After: The root array is just list a list of children.

Comment: This is a more accufrate representation of how HTML partials are
often written.

4 years agoFormDataModel::parseFields() - Rename param for clarity
Tim Otten [Sat, 26 Oct 2019 01:51:07 +0000 (18:51 -0700)]
FormDataModel::parseFields() - Rename param for clarity

This function uses a recursive algorithm to scan subtrees.  Each call to the
algorithm is a particular HTML element.

4 years agoFormDataModel - Define behavior for more edgy HTML documents
Tim Otten [Sat, 26 Oct 2019 01:31:22 +0000 (18:31 -0700)]
FormDataModel - Define behavior for more edgy HTML documents

4 years agoSplit "Utils" into "AHQ" and "FormDataModel"
Tim Otten [Sat, 26 Oct 2019 01:21:40 +0000 (18:21 -0700)]
Split "Utils" into "AHQ" and "FormDataModel"

4 years ago(NFC) Civi/Afform/Symbols.php - Docblock
Tim Otten [Sat, 26 Oct 2019 00:45:40 +0000 (17:45 -0700)]
(NFC) Civi/Afform/Symbols.php - Docblock

4 years agoCivi/Afform/Utils - Small cleanups
Tim Otten [Sat, 26 Oct 2019 00:40:08 +0000 (17:40 -0700)]
Civi/Afform/Utils - Small cleanups

4 years agoUnit tests - Fix test-run on 5.19.beta
Tim Otten [Thu, 24 Oct 2019 20:15:03 +0000 (13:15 -0700)]
Unit tests - Fix test-run on 5.19.beta

The conditional incorrectly tries to activate `api4` when running on 5.19.beta.

4 years agoUse helper for checking items to get by name
Coleman Watts [Thu, 24 Oct 2019 12:15:27 +0000 (08:15 -0400)]
Use helper for checking items to get by name

4 years agoafform/mock - Update extension boilerplate
Tim Otten [Thu, 24 Oct 2019 00:35:24 +0000 (17:35 -0700)]
afform/mock - Update extension boilerplate

4 years agoafform/gui - Update extension boilerplate
Tim Otten [Thu, 24 Oct 2019 00:35:18 +0000 (17:35 -0700)]
afform/gui - Update extension boilerplate

4 years agoafform/html - Update extension boilerplate
Tim Otten [Thu, 24 Oct 2019 00:35:12 +0000 (17:35 -0700)]
afform/html - Update extension boilerplate

4 years agoafform/core - Update extension boilerplate
Tim Otten [Thu, 24 Oct 2019 00:34:54 +0000 (17:34 -0700)]
afform/core - Update extension boilerplate

4 years agoDelete unused files
Coleman Watts [Wed, 23 Oct 2019 13:47:04 +0000 (09:47 -0400)]
Delete unused files

4 years agoafform_html - Fix typo in module name ("afMoncao"/"afMonaco")
Tim Otten [Sat, 19 Oct 2019 03:49:28 +0000 (20:49 -0700)]
afform_html - Fix typo in module name ("afMoncao"/"afMonaco")

4 years ago'exports' - Specify symbols in notation more like Angular directives ("A", "AE",...
Tim Otten [Sat, 19 Oct 2019 03:46:17 +0000 (20:46 -0700)]
'exports' - Specify symbols in notation more like Angular directives ("A", "AE", etc)

4 years agoafform_mock - Add test-coverage for auto-requires functionality
Tim Otten [Sat, 19 Oct 2019 03:16:14 +0000 (20:16 -0700)]
afform_mock - Add test-coverage for auto-requires functionality

4 years agoafform_mock - Simplify; use auto-requires
Tim Otten [Fri, 18 Oct 2019 23:09:07 +0000 (16:09 -0700)]
afform_mock - Simplify; use auto-requires

4 years agoafform_html - Simplify; use auto-requires
Tim Otten [Fri, 18 Oct 2019 22:58:24 +0000 (15:58 -0700)]
afform_html - Simplify; use auto-requires

4 years agoafform_core: Declare exports for 'af-form', 'af-field', etc
Tim Otten [Fri, 18 Oct 2019 23:05:36 +0000 (16:05 -0700)]
afform_core: Declare exports for 'af-form', 'af-field', etc

4 years agoCivi\Afform\Symbols - Add unit test. Define behavior for Angular exprs.
Tim Otten [Sat, 19 Oct 2019 01:30:14 +0000 (18:30 -0700)]
Civi\Afform\Symbols - Add unit test. Define behavior for Angular exprs.

4 years agoAutomatically detect requirements in *.aff.html
Tim Otten [Fri, 18 Oct 2019 22:05:22 +0000 (15:05 -0700)]
Automatically detect requirements in *.aff.html

PART A: EXPORT LIST

Suppose you create a form `downstreamForm.aff.html`.

The metadata for `downstreamForm` will indicate that it exports an element `<downstream-form/>`:

```php
$angularModules['downstreamForm']['exports']['el'] = ['downstream-form'];
```

PART B: AUTO-REQUIRES

Suppose that:

1. he form `downstreamForm.aff.html` uses element `<upstream-el/>`.
2. The `$angularModules['upsteamMod']['exports']['el']` defines an exported element `upstream-el`.

Then the `downstreamForm` module will automatically requires the `upstreamMod`, as in

```php
$angularModules['downstreamForm']['requires'][] = 'upstreamMod';
```

4 years agoafform_mock - Tweak example names/text
Tim Otten [Tue, 15 Oct 2019 14:35:23 +0000 (07:35 -0700)]
afform_mock - Tweak example names/text

4 years agoUnit tests - Update for api4 in core
Tim Otten [Sat, 19 Oct 2019 02:29:44 +0000 (19:29 -0700)]
Unit tests - Update for api4 in core

4 years agotestAfform.aff.html - Tweak example
Tim Otten [Tue, 15 Oct 2019 14:02:27 +0000 (07:02 -0700)]
testAfform.aff.html - Tweak example

4 years agoafHtmlList - Tweak layout
Tim Otten [Tue, 15 Oct 2019 14:02:05 +0000 (07:02 -0700)]
afHtmlList - Tweak layout

4 years agoDo not fatal on missing extensions
eileen [Sat, 5 Oct 2019 09:11:54 +0000 (11:11 +0200)]
Do not fatal on missing extensions

Currently a missing extension will lead to a complete fatal on afforms. We can ignore these in the
extensions, missing extensions are otherwise notified in corre

4 years agoRename `<af-model>` to `<af-entity>` to better match API terminology
Tim Otten [Sat, 14 Sep 2019 02:09:21 +0000 (22:09 -0400)]
Rename `<af-model>` to `<af-entity>` to better match API terminology

4 years ago<af-form> - By default, show an indicator of submission status
Tim Otten [Sat, 14 Sep 2019 02:02:27 +0000 (22:02 -0400)]
<af-form> - By default, show an indicator of submission status

4 years agoAfform.submit - Use an event to allow the mix of prioritized special-case save methods
Tim Otten [Sat, 14 Sep 2019 01:59:06 +0000 (21:59 -0400)]
Afform.submit - Use an event to allow the mix of prioritized special-case save methods

4 years agoaf/Form.js - Get the form name implicitly (without a global)
Tim Otten [Sat, 14 Sep 2019 00:57:39 +0000 (20:57 -0400)]
af/Form.js - Get the form name implicitly (without a global)

4 years agoafex.aff.html - Slightly more contemporary markup
Tim Otten [Sat, 14 Sep 2019 00:43:49 +0000 (20:43 -0400)]
afex.aff.html - Slightly more contemporary markup

4 years agoaf/Form.js - Use the canonical name for API calls
Tim Otten [Sat, 14 Sep 2019 00:36:21 +0000 (20:36 -0400)]
af/Form.js - Use the canonical name for API calls

4 years agoFix login error due to stale constant in afform_html_civicrm_check()
Tim Otten [Sat, 14 Sep 2019 00:23:16 +0000 (20:23 -0400)]
Fix login error due to stale constant in afform_html_civicrm_check()

4 years agoAdd mock testAfform
Coleman Watts [Sat, 14 Sep 2019 00:03:35 +0000 (20:03 -0400)]
Add mock testAfform

4 years ago(CRM_Afform_ArrayHtml) Fix errant reference
Tim Otten [Fri, 13 Sep 2019 17:14:54 +0000 (13:14 -0400)]
(CRM_Afform_ArrayHtml) Fix errant reference

4 years agoRename `[af-name]` to `af-model[name]` and `af-fieldset[model]`
Tim Otten [Fri, 13 Sep 2019 17:13:44 +0000 (13:13 -0400)]
Rename `[af-name]` to `af-model[name]` and `af-fieldset[model]`

4 years ago(af-field) Rename "field-name" to "name"
Tim Otten [Fri, 13 Sep 2019 16:55:26 +0000 (12:55 -0400)]
(af-field) Rename "field-name" to "name"

4 years ago(af-field) Rename "field-defn" to "defn"
Tim Otten [Fri, 13 Sep 2019 16:43:09 +0000 (12:43 -0400)]
(af-field) Rename "field-defn" to "defn"

4 years agoRename speculative attributes af-api4-params and af-contact-relationship
Tim Otten [Fri, 13 Sep 2019 16:40:30 +0000 (12:40 -0400)]
Rename speculative attributes af-api4-params and af-contact-relationship

4 years ago(af-model) Rename "af-data" to "data"
Tim Otten [Fri, 13 Sep 2019 16:38:38 +0000 (12:38 -0400)]
(af-model) Rename "af-data" to "data"

4 years ago(af-model) Rename "af-autofill" to "autofill"
Tim Otten [Fri, 13 Sep 2019 16:36:06 +0000 (12:36 -0400)]
(af-model) Rename "af-autofill" to "autofill"

4 years ago(af-model) Rename af-label to label
Tim Otten [Fri, 13 Sep 2019 16:35:01 +0000 (12:35 -0400)]
(af-model) Rename af-label to label

4 years ago(docs) Finish renaming "af-type" to "type"
Tim Otten [Fri, 13 Sep 2019 16:33:31 +0000 (12:33 -0400)]
(docs) Finish renaming "af-type" to "type"

4 years agoRename `<af-will-be-model>` to its real name, `<af-model>`
Tim Otten [Fri, 13 Sep 2019 16:27:00 +0000 (12:27 -0400)]
Rename `<af-will-be-model>` to its real name, `<af-model>`

4 years agoRename <af-model> to <af-fieldset>
Tim Otten [Fri, 13 Sep 2019 16:21:26 +0000 (12:21 -0400)]
Rename <af-model> to <af-fieldset>

4 years agoTemporarily rename <af-model-prop> to <af-will-be-model> (so we can rename existing...
Tim Otten [Fri, 13 Sep 2019 16:18:01 +0000 (12:18 -0400)]
Temporarily rename <af-model-prop> to <af-will-be-model> (so we can rename existing <af-model> easily)

4 years agoRename `<af-model-list>` to `<af-form>`
Tim Otten [Fri, 13 Sep 2019 16:14:21 +0000 (12:14 -0400)]
Rename `<af-model-list>` to `<af-form>`

4 years agoRename af-type to type
Tim Otten [Fri, 13 Sep 2019 02:07:56 +0000 (22:07 -0400)]
Rename af-type to type

4 years agoWIP Submit api
Coleman Watts [Thu, 12 Sep 2019 01:02:59 +0000 (21:02 -0400)]
WIP Submit api

4 years agoAdd afData property for predetermined data like contact_id
Coleman Watts [Tue, 27 Aug 2019 02:33:37 +0000 (22:33 -0400)]
Add afData property for predetermined data like contact_id

4 years agoMove modelProps to whitelist
Coleman Watts [Tue, 27 Aug 2019 02:10:45 +0000 (22:10 -0400)]
Move modelProps to whitelist

4 years agoAdd api for afform prefill
Coleman Watts [Sun, 25 Aug 2019 23:44:55 +0000 (19:44 -0400)]
Add api for afform prefill

4 years ago(NFC) Normalize trailing newlines
Tim Otten [Thu, 12 Sep 2019 23:36:40 +0000 (19:36 -0400)]
(NFC) Normalize trailing newlines

4 years agoaf-api4-action - Rename 'msg-' and 'on-' options
Tim Otten [Thu, 12 Sep 2019 23:07:59 +0000 (19:07 -0400)]
af-api4-action - Rename 'msg-' and 'on-' options

Here's the bash script...

```
for REGEX in \
        s/msg-start/af-api4-start-msg/g \
        s/msgStart/afApi4StartMsg/g \
        s/msg-error/af-api4-error-msg/g \
        s/msgError/afApi4ErrorMsg/g \
        s/msg-success/af-api4-success-msg/g \
        s/msgSuccess/afApi4SuccessMsg/g \
        s/on-success/af-api4-success/g \
        s/onSuccess/afApi4Success/g \
        s/on-error/af-api4-error/g \
        s/on-error/afApi4Error/g
do
  DIRS="core docs gui html mock auditor"
  echo "Processing regex [$REGEX] in [$DIRS]"
  find $DIRS -name '*.js' -o -name '*.html' -o -name '*.json' -o -name '*.md' \
    | grep -v /node_modules/ \
    | xargs -L1 sed -i.bak "$REGEX"
  find $DIRS -name '*.bak' -delete
done
```

4 years agoRename afformCore to afCore
Tim Otten [Thu, 12 Sep 2019 22:31:22 +0000 (18:31 -0400)]
Rename afformCore to afCore

4 years agodocs/embed.md - Use example prefix that doesn't conflict with built-ins
Tim Otten [Thu, 12 Sep 2019 22:26:19 +0000 (18:26 -0400)]
docs/embed.md - Use example prefix that doesn't conflict with built-ins

4 years agoRename `afformExamplepage` to `afExamplePage`
Tim Otten [Thu, 12 Sep 2019 22:21:03 +0000 (18:21 -0400)]
Rename `afformExamplepage` to `afExamplePage`

4 years agoRename afformApi3* to afApi3*
Tim Otten [Thu, 12 Sep 2019 22:13:07 +0000 (18:13 -0400)]
Rename afformApi3* to afApi3*

4 years agoinfo.xml - Align version numbers
Tim Otten [Thu, 12 Sep 2019 22:19:16 +0000 (18:19 -0400)]
info.xml - Align version numbers

4 years agoRename affApi4* to afApi4*
Tim Otten [Thu, 12 Sep 2019 22:10:36 +0000 (18:10 -0400)]
Rename affApi4* to afApi4*

4 years agoRename `afformHtml*` to `afHtml*`
Tim Otten [Thu, 12 Sep 2019 22:07:02 +0000 (18:07 -0400)]
Rename `afformHtml*` to `afHtml*`

4 years agoAdd docs/style.md
Tim Otten [Thu, 12 Sep 2019 21:57:16 +0000 (17:57 -0400)]
Add docs/style.md

4 years agolayoutFormat - Flip default from shallow to deep
Tim Otten [Wed, 11 Sep 2019 22:39:09 +0000 (18:39 -0400)]
layoutFormat - Flip default from shallow to deep

4 years agoAfformTest - Test two example documents thoroughly for consistent conversions
Tim Otten [Wed, 11 Sep 2019 22:27:38 +0000 (18:27 -0400)]
AfformTest - Test two example documents thoroughly for consistent conversions

4 years agoWIP ArrayHtml
Tim Otten [Wed, 11 Sep 2019 21:16:24 +0000 (17:16 -0400)]
WIP ArrayHtml

4 years agoWIP deep array format
Coleman Watts [Wed, 11 Sep 2019 20:32:28 +0000 (16:32 -0400)]
WIP deep array format

4 years agoLet's stop advertising 5.6 since we might break it at any moment
Eileen McNaughton [Wed, 28 Aug 2019 21:44:53 +0000 (09:44 +1200)]
Let's stop advertising 5.6 since we might break it at any moment

4 years agoAdd note as to what this does
Eileen McNaughton [Wed, 28 Aug 2019 21:43:40 +0000 (09:43 +1200)]
Add note as to what this does

Limited but  in the right direction

4 years agoinfo.xml - Normalize titles/descriptions
Tim Otten [Sat, 24 Aug 2019 02:55:23 +0000 (19:55 -0700)]
info.xml - Normalize titles/descriptions

4 years agoafformHtmlEditor - Expose 'title' property
Tim Otten [Sat, 24 Aug 2019 02:50:27 +0000 (19:50 -0700)]
afformHtmlEditor - Expose 'title' property

4 years agoRemove dependence on crmApp & add page title
Coleman Watts [Wed, 14 Aug 2019 03:59:51 +0000 (23:59 -0400)]
Remove dependence on crmApp & add page title

4 years agoSuppress warnings about nonstandard tag names
Coleman Watts [Tue, 13 Aug 2019 21:46:14 +0000 (17:46 -0400)]
Suppress warnings about nonstandard tag names

4 years agoCode cleanup
Coleman Watts [Tue, 13 Aug 2019 21:17:08 +0000 (17:17 -0400)]
Code cleanup

4 years agoSimplify variable assignment
Coleman Watts [Tue, 13 Aug 2019 21:10:29 +0000 (17:10 -0400)]
Simplify variable assignment

4 years agoafformHtmlEditor - Fix saving of server_route and description
Tim Otten [Wed, 7 Aug 2019 22:48:11 +0000 (15:48 -0700)]
afformHtmlEditor - Fix saving of server_route and description

4 years agoApi4Ctrl - Fix infinite reloads
Tim Otten [Wed, 7 Aug 2019 22:00:26 +0000 (15:00 -0700)]
Api4Ctrl - Fix infinite reloads

I noticed that the `afform-html` GUI is sending an infinite number requests to
reload its data.  After bisecting, I found that e7ebc633a had expanded the
scope the `watch()` so that it reloads on *any* change to `affApi4Ctrl` (not
just a change in params).  But the `affApi4Ctrl` includes the `.result` data
- as soon as the result data is returned, it re-triggers the watch and sends
the request again.  This becomes an infinite loop.

I don't think this was necessary for the goal of indexing - although maybe
the idea was that a change to `.index` should cause a reload, which seems
reasonable.  So I've whitelisted fields which deal with APIv4 inputs.