Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement menu validation based on a string expression #23

Closed
end2endzone opened this issue May 31, 2019 · 4 comments
Closed

Implement menu validation based on a string expression #23

end2endzone opened this issue May 31, 2019 · 4 comments
Labels
enhancement New feature or request
Milestone

Comments

@end2endzone
Copy link
Owner

The system should implement a way to define a a menu validation based on an expression that contains a property, an operator and a expected value.

For instance, ${myproperty}=="true" would validate a <visibility> or <visibility> node only if the value of property myproperty is set to the value true.

The attribute sugested for specifying an expression would be propertyexpression.
For instance:

<visibility propertyexpression="&quot;%{myproperty}&quot; == &quot;&quot;" />

This kind of validation would allow the application to support "exclusive menus". For instance, in a 2 menu scenario, the application would be able to only show one of the two menus at a time.
For instance, the following could be implemented:

  <menu name="A">
    <visibility propertyexpression="&quot;%{next_menu}&quot; == &quot;&quot; || &quot;%{next_menu}&quot; == &quot;A&quot;" />
    <actions>
      <!--Do something meaningful-->
      
      <!--Change the property to only show B.-->
      <property name="next_menu" value="B" />
    </actions>
  </menu>
  <menu name="B">
    <visibility propertyexpression="&quot;%{next_menu}&quot; == &quot;B&quot;" />
    <actions>
      <!--Do something meaningful-->

      <!--Change the property to only show C.-->
      <property name="next_menu" value="C" />
    </actions>
  </menu>
  <menu name="C">
    <visibility propertyexpression="&quot;%{next_menu}&quot; == &quot;C&quot;" />
    <actions>
      <!--Do something meaningful-->

      <!--Change the property to only show A.-->
      <property name="next_menu" value="A" />
    </actions>
  </menu>
@end2endzone end2endzone added the enhancement New feature or request label May 31, 2019
@end2endzone
Copy link
Owner Author

end2endzone commented Jun 12, 2019

An external library may be required for evaluating the string expressions.
Possible candidates are the following:

@end2endzone end2endzone added this to the 0.6.0 milestone Aug 26, 2020
@end2endzone
Copy link
Owner Author

end2endzone commented Sep 10, 2020

More candidate:

or code my own parser as described here.

@end2endzone
Copy link
Owner Author

end2endzone commented Sep 11, 2020

Some use case scenarios:

<visibility expression="${selection.count} == 3" />
<visibility expression="&quot;${my_software.active}&quot; == &quot;true&quot;" />
<visibility expression="&quot;%{level}&quot; == &quot;unknown&quot; || &quot;%{level}&quot; == &quot;top&quot;" />
<visibility expression="length(${selection.path}) >= 10" />
<visibility expression="'${myapp.state}' == 'PAUSED'" />

end2endzone added a commit that referenced this issue Sep 15, 2020
…matically. The project `libeval` was created to wrap exprtk library for easier usage.

Implemented Validator::SetExprtk() and Validator::GetExprtk() with tests.
Created the following new properties: `selection.count`, `selection.files.count` and `selection.directories.count`.
For issue #23.
@end2endzone
Copy link
Owner Author

Add a dependency to INSTALL.md:

[exprtk d312ba9](https://github.com/ArashPartow/exprtk) (downloaded automatically)

Add the missing license file to /licenses directory.
example available at https://raw.githubusercontent.com/ArashPartow/exprtk/master/exprtk.hpp

end2endzone added a commit that referenced this issue Nov 14, 2020
* feature-issue23:
  Updated CHANGES for this issue.
  Merged 'master' into 'feature-issue23' branch.
  Added a small contribution.
  Small correction in exprtk attribute documentation.
  Added documentation for exprtk attribute on <property> elements.
  Small corrections.
  Fixed libEval::evaluate() to prevent buffer overflows.
  Implemented exprtk attribute support for ActionProperty. Created unit tests for ActionProperty.
  Implemented exprtk error logging when validating for visibility or validity. Errors are added to the logs.
  Implemented error support in libEval (with unit tests).
  Updated INSTALL.md document for exprtk dependency. Updated UserManual.md for exprtk attribute
  Added exprtk license file: exprtk LICENSE.txt
  Implemented logging for Validator class when an invalid value for class or exprtk attributes. Implemented more testing for exprtk attribute. Added exprtk license file: exprtk LICENSE.txt
  Implemented inversed exprtk support and tests.
  Implemented parsing of attribute `exprtk`. For issue #23.
  Partially reverted code that was commented in error.
  Added a dependency to Exprtk. The library is downloaded and used automatically. The project `libeval` was created to wrap exprtk library for easier usage. Implemented Validator::SetExprtk() and Validator::GetExprtk() with tests. Created the following new properties: `selection.count`, `selection.files.count` and `selection.directories.count`. For issue #23.
  Enabled building of branch `feature-issue23`.
end2endzone added a commit that referenced this issue Nov 21, 2020
Squashed commit of the following:

commit 5969148
Merge: b0ebc99 da19eaf
Author: Antoine <[email protected]>
Date:   Sat Nov 14 12:29:28 2020 -0500

    Merge branch 'feature-issue23' #23

    * feature-issue23:
      Updated CHANGES for this issue.
      Merged 'master' into 'feature-issue23' branch.
      Added a small contribution.
      Small correction in exprtk attribute documentation.
      Added documentation for exprtk attribute on <property> elements.
      Small corrections.
      Fixed libEval::evaluate() to prevent buffer overflows.
      Implemented exprtk attribute support for ActionProperty. Created unit tests for ActionProperty.
      Implemented exprtk error logging when validating for visibility or validity. Errors are added to the logs.
      Implemented error support in libEval (with unit tests).
      Updated INSTALL.md document for exprtk dependency. Updated UserManual.md for exprtk attribute
      Added exprtk license file: exprtk LICENSE.txt
      Implemented logging for Validator class when an invalid value for class or exprtk attributes. Implemented more testing for exprtk attribute. Added exprtk license file: exprtk LICENSE.txt
      Implemented inversed exprtk support and tests.
      Implemented parsing of attribute `exprtk`. For issue #23.
      Partially reverted code that was commented in error.
      Added a dependency to Exprtk. The library is downloaded and used automatically. The project `libeval` was created to wrap exprtk library for easier usage. Implemented Validator::SetExprtk() and Validator::GetExprtk() with tests. Created the following new properties: `selection.count`, `selection.files.count` and `selection.directories.count`. For issue #23.
      Enabled building of branch `feature-issue23`.

commit da19eaf
Author: Antoine <[email protected]>
Date:   Sat Nov 14 12:21:04 2020 -0500

    Updated CHANGES for this issue.

commit 249dc78
Author: Antoine <[email protected]>
Date:   Sat Nov 14 12:07:11 2020 -0500

    Merged 'master' into 'feature-issue23' branch.

    Squashed commit of the following:

    commit b0ebc99
    Author: Antoine <[email protected]>
    Date:   Sat Nov 14 11:40:54 2020 -0500

        Increased product version to 0.6.0.

    commit 0aa7e75
    Author: Antoine <[email protected]>
    Date:   Sat Nov 14 10:10:06 2020 -0500

        Updated CHANGES for v0.5.1.

    commit 7bbc45d
    Author: Antoine <[email protected]>
    Date:   Sat Nov 14 09:27:16 2020 -0500

        Moved the generated html files (from markdown) to the build directory.

    commit 2e83c44
    Author: Antoine <[email protected]>
    Date:   Sat Nov 14 08:44:03 2020 -0500

        Modified Wix installer:
        - Application how installs in directory `C:\Program Files\ShellAnything 0.5.1`.
        - Start menu entry is now named `ShellAnything 0.5.1` instead of `ShellAnything`.

        For issue #75

    commit 8185779
    Author: Antoine <[email protected]>
    Date:   Fri Nov 13 20:16:51 2020 -0500

        Added AUTHORS, CHANGES, LICENSE and CONTRIBUTING.md files to installer package. Text files without extensions are packaged with 'txt' file extension.
        For issue #75

    commit 270c48e
    Author: Antoine <[email protected]>
    Date:   Fri Nov 13 20:16:12 2020 -0500

        Increased product to 0.5.1.

    commit 1af4c0c
    Merge: c2e7699 2a14529
    Author: Mindaugas <[email protected]>
    Date:   Sun Nov 8 09:40:29 2020 +0200

        Merge pull request #74 from end2endzone/feature-issue56

        Reintegrating issue #56 into master branch.

    commit 2a14529
    Author: Antoine <[email protected]>
    Date:   Sat Nov 7 10:58:28 2020 -0500

        Modified TestActionExecute.testVerb() to use shellanything_unittest.exe for debugging instead of cmd.exe which does not well with 'runas' verb.

    commit 740af0f
    Author: Antoine <[email protected]>
    Date:   Sat Nov 7 10:57:20 2020 -0500

        Modified ArgumentsHandler::PrintProcessSettings() to also print command line arguments and also print the settings to an output file.

    commit 7412ab8
    Author: Antoine <[email protected]>
    Date:   Sat Nov 7 09:22:08 2020 -0500

        Implemented custom command line arguments in unit tests.

    commit bff3894
    Author: Antoine <[email protected]>
    Date:   Tue Nov 3 17:35:52 2020 -0500

        Modified ActionExecute::Execute() to delegate to ExecuteVerb() or ExecuteProcess(). Created unit tests.

    commit 23e3df9
    Author: Antoine <[email protected]>
    Date:   Sun Nov 1 07:54:18 2020 -0500

        Updated CHANGES file.
        Moved `ActionExecute::StartProcess()` private.
        Fixed a bad copy paste for `ActionExecute::SetVerb()` and `ActionExecute::GetVerb()`.
        Updated documentation for verb attribute of <exec> element.
        Fixed missing closing quotes in logs of ActionExecute::Execute().
        Created TestObjectFactory.testParseActionExecute() unit tests to validate parsing.
        For issue #56.

    commit d0de816
    Author: Mindaugas <[email protected]>
    Date:   Wed Oct 7 21:21:16 2020 +0300

        Migrating from CreateProcess to ShellExecuteEx

    commit c2e7699
    Author: Antoine <[email protected]>
    Date:   Sat Oct 3 08:26:27 2020 -0400

        Updated CHANGES for issue #54.

    commit 8659617
    Author: Mindaugas <[email protected]>
    Date:   Wed Sep 30 21:56:56 2020 +0300

        Bitmap device-independent (DIP) transparency corrections

    commit aa627ad
    Author: Mindaugas <[email protected]>
    Date:   Sun Sep 27 21:26:45 2020 +0300

        Bitmap device-independent (DIP) transparency

commit 0be9aac
Author: Antoine <[email protected]>
Date:   Sat Nov 14 12:05:47 2020 -0500

    Added a small contribution.

commit b0ebc99
Author: Antoine <[email protected]>
Date:   Sat Nov 14 11:40:54 2020 -0500

    Increased product version to 0.6.0.

commit 0aa7e75
Author: Antoine <[email protected]>
Date:   Sat Nov 14 10:10:06 2020 -0500

    Updated CHANGES for v0.5.1.

commit 7bbc45d
Author: Antoine <[email protected]>
Date:   Sat Nov 14 09:27:16 2020 -0500

    Moved the generated html files (from markdown) to the build directory.

commit 2e83c44
Author: Antoine <[email protected]>
Date:   Sat Nov 14 08:44:03 2020 -0500

    Modified Wix installer:
    - Application how installs in directory `C:\Program Files\ShellAnything 0.5.1`.
    - Start menu entry is now named `ShellAnything 0.5.1` instead of `ShellAnything`.

    For issue #75

commit 8185779
Author: Antoine <[email protected]>
Date:   Fri Nov 13 20:16:51 2020 -0500

    Added AUTHORS, CHANGES, LICENSE and CONTRIBUTING.md files to installer package. Text files without extensions are packaged with 'txt' file extension.
    For issue #75

commit 270c48e
Author: Antoine <[email protected]>
Date:   Fri Nov 13 20:16:12 2020 -0500

    Increased product to 0.5.1.

commit 1af4c0c
Merge: c2e7699 2a14529
Author: Mindaugas <[email protected]>
Date:   Sun Nov 8 09:40:29 2020 +0200

    Merge pull request #74 from end2endzone/feature-issue56

    Reintegrating issue #56 into master branch.

commit 2a14529
Author: Antoine <[email protected]>
Date:   Sat Nov 7 10:58:28 2020 -0500

    Modified TestActionExecute.testVerb() to use shellanything_unittest.exe for debugging instead of cmd.exe which does not well with 'runas' verb.

commit 740af0f
Author: Antoine <[email protected]>
Date:   Sat Nov 7 10:57:20 2020 -0500

    Modified ArgumentsHandler::PrintProcessSettings() to also print command line arguments and also print the settings to an output file.

commit 7412ab8
Author: Antoine <[email protected]>
Date:   Sat Nov 7 09:22:08 2020 -0500

    Implemented custom command line arguments in unit tests.

commit bff3894
Author: Antoine <[email protected]>
Date:   Tue Nov 3 17:35:52 2020 -0500

    Modified ActionExecute::Execute() to delegate to ExecuteVerb() or ExecuteProcess(). Created unit tests.

commit 23e3df9
Author: Antoine <[email protected]>
Date:   Sun Nov 1 07:54:18 2020 -0500

    Updated CHANGES file.
    Moved `ActionExecute::StartProcess()` private.
    Fixed a bad copy paste for `ActionExecute::SetVerb()` and `ActionExecute::GetVerb()`.
    Updated documentation for verb attribute of <exec> element.
    Fixed missing closing quotes in logs of ActionExecute::Execute().
    Created TestObjectFactory.testParseActionExecute() unit tests to validate parsing.
    For issue #56.

commit adc1a2d
Author: Antoine <[email protected]>
Date:   Sat Oct 31 09:41:26 2020 -0400

    Small correction in exprtk attribute documentation.

commit 7bfe79d
Author: Antoine <[email protected]>
Date:   Sat Oct 31 09:33:54 2020 -0400

    Added documentation for exprtk attribute on <property> elements.

commit dc3c459
Author: Antoine <[email protected]>
Date:   Sat Oct 31 09:27:09 2020 -0400

    Small corrections.

commit 22879cb
Author: Antoine <[email protected]>
Date:   Sat Oct 24 12:00:03 2020 -0400

    Fixed libEval::evaluate() to prevent buffer overflows.

commit 98fea11
Author: Antoine <[email protected]>
Date:   Fri Oct 23 19:00:02 2020 -0400

    Implemented exprtk attribute support for ActionProperty.
    Created unit tests for ActionProperty.

commit 74447c0
Author: Antoine <[email protected]>
Date:   Thu Oct 22 18:57:57 2020 -0400

    Implemented exprtk error logging when validating for visibility or validity. Errors are added to the logs.

commit 2990f9d
Author: Antoine <[email protected]>
Date:   Wed Oct 21 18:55:48 2020 -0400

    Implemented error support in libEval (with unit tests).

commit 0aef7da
Author: Antoine <[email protected]>
Date:   Fri Oct 16 20:51:46 2020 -0400

    Updated INSTALL.md document for exprtk dependency.
    Updated UserManual.md for exprtk attribute

commit f70cd8d
Author: Antoine <[email protected]>
Date:   Fri Oct 16 20:48:55 2020 -0400

    Added exprtk license file: exprtk LICENSE.txt

commit c91c033
Author: Antoine <[email protected]>
Date:   Fri Oct 16 20:48:34 2020 -0400

    Implemented logging for Validator class when an invalid value for class or exprtk attributes.
    Implemented more testing for exprtk attribute.
    Added exprtk license file: exprtk LICENSE.txt

commit d0de816
Author: Mindaugas <[email protected]>
Date:   Wed Oct 7 21:21:16 2020 +0300

    Migrating from CreateProcess to ShellExecuteEx

commit 504f74e
Author: Antoine <[email protected]>
Date:   Sun Oct 4 09:13:01 2020 -0400

    Implemented inversed exprtk support and tests.

commit c2e7699
Author: Antoine <[email protected]>
Date:   Sat Oct 3 08:26:27 2020 -0400

    Updated CHANGES for issue #54.

commit 8659617
Author: Mindaugas <[email protected]>
Date:   Wed Sep 30 21:56:56 2020 +0300

    Bitmap device-independent (DIP) transparency corrections

commit aa627ad
Author: Mindaugas <[email protected]>
Date:   Sun Sep 27 21:26:45 2020 +0300

    Bitmap device-independent (DIP) transparency

commit f7ecf2c
Author: Antoine <[email protected]>
Date:   Tue Sep 15 19:12:45 2020 -0400

    Implemented parsing of attribute `exprtk`. For issue #23.

commit cb6b893
Author: Antoine <[email protected]>
Date:   Mon Sep 14 20:21:42 2020 -0400

    Partially reverted code that was commented in error.

commit 08f21fb
Author: Antoine <[email protected]>
Date:   Mon Sep 14 20:20:50 2020 -0400

    Added a dependency to Exprtk. The library is downloaded and used automatically. The project `libeval` was created to wrap exprtk library for easier usage.
    Implemented Validator::SetExprtk() and Validator::GetExprtk() with tests.
    Created the following new properties: `selection.count`, `selection.files.count` and `selection.directories.count`.
    For issue #23.

commit ab055c9
Author: Antoine <[email protected]>
Date:   Sun Sep 13 08:46:48 2020 -0400

    Enabled building of branch `feature-issue23`.

commit 02fcca0
Author: Antoine <[email protected]>
Date:   Mon Sep 7 10:22:05 2020 -0400

    Fixed a small issue with pattern attribute documentation.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant