Model Examples
No edit summary
No edit summary
Line 1: Line 1:
=== Introduction to Examples and merge ===
=== Introduction to Examples and Merge ===
This page describe merge in models - if you rather would use model+data="a complete system" to apply to a existing turnkey site look here [[Example_Gist]].
This page describes merge in models. If you would rather use model+data - "a complete system" - to apply to an existing turnkey site look here: [[Example_Gist]].


Examples that you can merge into your empty or not complete model in order to get some functionality
Examples you can merge into your empty or incomplete model to gain some functionality:
[[File:2020-05-30 19h00 48.png|none|thumb]]
[[File:2020-05-30 19h00 48.png|none|thumb]]
or/and :
or/and :
Line 8: Line 8:


==== What happens when you merge another modlr file? ====
==== What happens when you merge another modlr file? ====
# If the merged file use some class name that you already use - the content of the classes is copied from the merged file to the class you already had - the incoming class is discarded to avoid doublet
# If the merged file uses an existing class name, the content of the classes is copied from the merged file to the class you already had; the incoming class is discarded to avoid doublet.
# If the merged file use the same package name as you already have in your model - the content from the merged file is moved into your package
# If the merged file uses the same package name as you already have in your model, the content from the merged file is moved into your package.
# If you the merged file use some viewmodel-names you already have - they are skipped - if new viewmodels are found they are added
# If the merged file uses some viewmodel names you already have, these names are skipped. If new viewmodels are found, they are added.
# If you have the same diagram name - the diagrams are merged to avoid doublets.
# If you have the same diagram name, the diagrams are merged to avoid doublets.
# If the merged had some AssetsTK - it is merged to your AssetsTK increasing it or updating it
# If the merged file had some AssetsTK, it is merged into your AssetsTK, increasing or updating it.


=== Packages primarily used by importing into an existing model ===
=== Packages Primarily Used By Importing Into an Existing Model ===


==== Important patterns ====
==== Important Patterns ====


===== SysUserAuthentication - important architectural pattern =====
===== SysUserAuthentication - important architectural pattern =====
This example adds the SysSingleton and SysUser classes needed to enable login and authentication in Turnkey systems
This example adds the SysSingleton and SysUser classes needed to enable login and authentication in Turnkey systems.
[[File:2020-05-30 19h31 20.png|none|thumb]][[Special:Redirect/file/SysUserAuthentication.modlr|Download SysUserAuthentication]] - once downloaded do "open merge add" from the model you want to extend.
[[File:2020-05-30 19h31 20.png|none|thumb]][[Special:Redirect/file/SysUserAuthentication.modlr|Download SysUserAuthentication]] - once downloaded, click "open merge add" from the model you want to extend.


===== Password reset sample - architectural pattern =====
===== Password Reset Sample - architectural pattern =====
There's no build in password reset functionality in Turnkey. This is because if we had one, it would probably not fit you anyway.
There's no built-in password reset functionality in Turnkey. If we had one, it would probably not fit you anyway.


Instead, you add this functionality to your model and are then free to integrate and adapt it as you feel needed.
Instead, add this functionality to your model, and this frees you to integrate and adapt it as needed.


If you use the default package for login, the ASPNETIdentity package, this package will just extend you model with the following;
If you use the default package for login, the ASPNETIdentity package, this package will extend your model with the following;
# A reset password page that you can create an action to go to. This page should be without any access groups.
# A reset password page that you can create an action to go to. This page should not have any access groups.
# A server side viewmodel that runs every 20 seconds and sends emails with reset instructions to your users. Remember to set the Turnkey/MDrivenServer's email server settings.
# A server-side viewmodel that runs every 20 seconds and sends emails with reset instructions to your users. Remember to set the Turnkey/MDrivenServer's email server settings.
# A page for the user to set the password. This page also has information to the user about expired reset tickets and sending a new ticket in those circumstances.
# A page for the user to set the password. This page also has information for the user about expired reset tickets and sending new tickets in those circumstances.
You import this template and then you;
You import this template and then you;
# Set the PasswordReset package's "Default superclass" if you want that.
# Set the PasswordReset package's "Default superclass" if you want that.
# Make sure you have email server set up.
# Make sure you have an email server set up.
# Create an action that opens the "RestetPasswordPage" viewmodel.
# Create an action that opens the "RestetPasswordPage" viewmodel.
Download the model file here: [[Special:Redirect/file/PasswordResetTemplate.modlr|PasswordResetTemplate.modlr]]  
Download the model file here: [[Special:Redirect/file/PasswordResetTemplate.modlr|PasswordResetTemplate.modlr]]  
Line 39: Line 39:


===== SysAsyncTicket - important architectural pattern =====
===== SysAsyncTicket - important architectural pattern =====
SysAsyncTicket is a model pattern described here [[AsyncTicket]], it is recognized by the MDrivenServer and helps you easily do stuff in the background
SysAsyncTicket is a model pattern described here [[AsyncTicket]]. It is recognized by the MDrivenServer and helps you easily do stuff in the background.


Goto [[SysAsync package]] to download this package
Goto [[SysAsync package]] to download this package.


===== Localization and Translation - architectural pattern =====
===== Localization and Translation - architectural pattern =====
MDriven systems can adhere to a model pattern and use that to store translations to all texts in actions and ViewModels. There is also ocl operators (Translate) that work on data according to this pattern. [[Localization|Read more here]]
MDriven systems can adhere to a model pattern and use that to store translations to all texts in actions and ViewModels. There are also OCL operators (Translate) that work on data according to this pattern. [[Localization|Read more here.]]
[[File:2020-06-17 15h43 02.png|none|thumb]]
[[File:2020-06-17 15h43 02.png|none|thumb]]
[[Special:Redirect/file/Translations.modlr|Translations.modlr]]
[[Special:Redirect/file/Translations.modlr|Translations.modlr]]


===== SysTurnkeyTraceLog =====
===== SysTurnkeyTraceLog =====
If you have the need to track what users are up to in your Turnkey-app you can add class following this pattern:
If you need to track what users are up to in your Turnkey app, you can add a class following this pattern:
[[File:2022-07-19 13h48 16.png|none|thumb|265x265px]]
[[File:2022-07-19 13h48 16.png|none|thumb|265x265px]]
For every navigation (change of view) or action (action language execution resulting in potential data change) information will be snapshot and every 30 seconds MDrivenTurnkey will spool out objects of the above class.
For every navigation (change of view) or action (action language execution resulting in potential data change), information will be snapshotted, and every 30 seconds, MDrivenTurnkey will spool out objects of the above class.


This is how it was used in one customer case:
This is how it was used in one customer case:
[[File:2022-07-19 13h52 14.png|alt=x|none|thumb|851x851px]]
[[File:2022-07-19 13h52 14.png|alt=x|none|thumb|851x851px]]


==== Extensions ====
==== EXTENSIONS ====
===== Consume and Purchase GetPaid#1 =====
===== Consume and Purchase GetPaid#1 =====
This model extends your system with an ability to [[Charge end user|charge the end-user]] for services you provide. The user will be treated as a SysConsumer in portal - and you can charge the SysConsumer with a Credit card and you can let the SysConsumer consume your services with a simple call in your local model.[[Special:Redirect/file/ChargeEndUserViaMDrivenPortalService.modlr|Download ChargeEndUserViaMDrivenPortalService.modlr]] :
This model extends your system with the ability to [[Charge end user|charge the end-user]] for services you provide. The user will be treated as a SysConsumer in the portal. You can charge the SysConsumer with a Credit card and let the SysConsumer consume your services with a simple call in your local model. [[Special:Redirect/file/ChargeEndUserViaMDrivenPortalService.modlr|Download ChargeEndUserViaMDrivenPortalService.modlr]] :
[[File:2020-05-31 12h01 07.png|none|thumb|578x578px]]
[[File:2020-05-31 12h01 07.png|none|thumb|578x578px]]


===== PayPal-Checkout GetPaid#2 =====
===== PayPal - Checkout GetPaid#2 =====
As an alternative method to get paid from a user you can integrate PayPal. You will need a PayPal account and register as a developer. Once there you register your app and get a ClientID - you paste this ClientID into this viewmodel and you are all set.
As an alternative method to get paid by users, you can integrate PayPal. You will need a PayPal account and register as a developer. Once this is done, register your app and get a ClientID. Paste this ClientID into this viewmodel and you are all set.
[[Special:Redirect/file/PayPalCheckout.modlr|PayPalCheckout.modlr]]
[[Special:Redirect/file/PayPalCheckout.modlr|PayPalCheckout.modlr]]
[[File:2020-07-20 12h48 44.png|none|thumb|288x288px]]
[[File:2020-07-20 12h48 44.png|none|thumb|288x288px]]
[[File:2020-07-20 12h50 01.png|none|thumb]]
[[File:2020-07-20 12h50 01.png|none|thumb]]


===== Theme builder - build theme in runtime =====
===== Theme Builder - build themes in runtime =====
You can easily set CSS variables to influence colors and sizes of the UI. To try different settings out in runtime you can merge this model section:
You can easily set CSS variables to influence the colors and sizes of the UI. To try different settings out in runtime, you can merge this model section:
[[File:2020-06-22 18h49 08.png|none|thumb|531x531px]]
[[File:2020-06-22 18h49 08.png|none|thumb|531x531px]]
[[File:2020-06-22 18h49 22.png|none|thumb|499x499px]]
[[File:2020-06-22 18h49 22.png|none|thumb|499x499px]]


[[Special:Redirect/file/ThemeBuilder.modlr|ThemeBuilder.modlr]] , also see [[Theme as data]]
[[Special:Redirect/file/ThemeBuilder.modlr|ThemeBuilder.modlr]], also see [[Theme as data|Theme as data.]]


===== Outgoing Email Queue =====
===== Outgoing Email Queue =====
Model pattern that adds a outgoing email queue to the standard base model.
This is a model pattern that adds an outgoing email queue to the standard base model.


A seeker view enables you to search for queued or sent emails and an email detail view for changing the queued emails.
A seeker view enables you to search for queued or sent emails and an email detail view for changing the queued emails.
[[File:OutgoingEmailQueue-model.png|none|thumb|459x459px]]
[[File:OutgoingEmailQueue-model.png|none|thumb|459x459px]]
Includes two serverside viewmodels, one that sends the emails and one that cleans up sent emails.
It includes two serverside viewmodels, one that sends the emails and one that cleans up the sent emails.


It can attach files to the outgoing emails.
It can attach files to outgoing emails.


It has exception handling, error viewing and retying failed send attempts.
It has exception handling, error viewing, and retying failed send attempts.


[[Special:Redirect/file/OutgoingEmailQueue.modlr|OutgoingEmailQueue.modlr]]
[[Special:Redirect/file/OutgoingEmailQueue.modlr|OutgoingEmailQueue.modlr]]


===== Calendar model for linking things to dates, weeks, months and years =====
===== Calendar Model for Linking Things to Dates, Weeks, Months, and Years =====
This model implements classes that makes aggregation (for statistics for example) easy.
This model implements classes that make aggregation (for statistics, for example) easy.


It follows a common pattern with dimensions from data analysis. By prepopulating the database with days, months, years, weeks etc, you can easily (and efficiently) find data to present in a diagram or table.[[File:Calender model diagram.png|none|thumb|481x481px]][[Special:Redirect/file/CalendarPackage.modlr|CalendarPackage.modlr]]
It follows a common pattern with dimensions from data analysis. By prepopulating the database with days, months, years, weeks, etc, you can easily (and efficiently) find data to present in a diagram or table.[[File:Calender model diagram.png|none|thumb|481x481px]][[Special:Redirect/file/CalendarPackage.modlr|CalendarPackage.modlr]]


Read more here: [[Calendar package]]
Read more here: [[Calendar package]]


=== [[Complete model examples]] ===
=== [[Complete model examples]] ===
Click header or [[Complete model examples]] to go the descriptions.
Click the header or [[Complete model examples]] to go the descriptions.


==== SVG - Move boxes around ====
==== SVG - Move boxes around ====
==== Google map to show and update positions ====
==== Google maps to show and update positions ====
==== A Trello like board with cards you move between lists ====
==== A Trello-like board with cards you move between lists ====


==== Markup editor TinyMCE ====
==== Markup editor TinyMCE ====
Line 106: Line 106:


== Notes to admin ==
== Notes to admin ==
The files uploaded here are maintained here '''SVN\source\Ideas\WikiPublishedModelExamples ,''' read NOTESTOADMIN.txt in that location
The files uploaded here are maintained here: '''SVN\source\Ideas\WikiPublishedModelExamples''' Read NOTESTOADMIN.txt in that location.


In order to create a direct download link use syntax like this:[[Special:Redirect/file/Företag.modlr]]
To create a direct download link, use syntax like this:[[Special:Redirect/file/Företag.modlr]]


This is how the link should be formed: https://www.mediawiki.org/wiki/Help:Linking_to_files
This is how the link should be formed: https://www.mediawiki.org/wiki/Help:Linking_to_files
[[Category:Example]]
[[Category:Example]]

Revision as of 06:56, 16 January 2023

Introduction to Examples and Merge

This page describes merge in models. If you would rather use model+data - "a complete system" - to apply to an existing turnkey site look here: Example_Gist.

Examples you can merge into your empty or incomplete model to gain some functionality:

2020-05-30 19h00 48.png

or/and :

2020-05-30 19h02 13.png

What happens when you merge another modlr file?

  1. If the merged file uses an existing class name, the content of the classes is copied from the merged file to the class you already had; the incoming class is discarded to avoid doublet.
  2. If the merged file uses the same package name as you already have in your model, the content from the merged file is moved into your package.
  3. If the merged file uses some viewmodel names you already have, these names are skipped. If new viewmodels are found, they are added.
  4. If you have the same diagram name, the diagrams are merged to avoid doublets.
  5. If the merged file had some AssetsTK, it is merged into your AssetsTK, increasing or updating it.

Packages Primarily Used By Importing Into an Existing Model

Important Patterns

SysUserAuthentication - important architectural pattern

This example adds the SysSingleton and SysUser classes needed to enable login and authentication in Turnkey systems.

2020-05-30 19h31 20.png

Download SysUserAuthentication - once downloaded, click "open merge add" from the model you want to extend.

Password Reset Sample - architectural pattern

There's no built-in password reset functionality in Turnkey. If we had one, it would probably not fit you anyway.

Instead, add this functionality to your model, and this frees you to integrate and adapt it as needed.

If you use the default package for login, the ASPNETIdentity package, this package will extend your model with the following;

  1. A reset password page that you can create an action to go to. This page should not have any access groups.
  2. A server-side viewmodel that runs every 20 seconds and sends emails with reset instructions to your users. Remember to set the Turnkey/MDrivenServer's email server settings.
  3. A page for the user to set the password. This page also has information for the user about expired reset tickets and sending new tickets in those circumstances.

You import this template and then you;

  1. Set the PasswordReset package's "Default superclass" if you want that.
  2. Make sure you have an email server set up.
  3. Create an action that opens the "RestetPasswordPage" viewmodel.

Download the model file here: PasswordResetTemplate.modlr

Password reset model sample.png
SysAsyncTicket - important architectural pattern

SysAsyncTicket is a model pattern described here AsyncTicket. It is recognized by the MDrivenServer and helps you easily do stuff in the background.

Goto SysAsync package to download this package.

Localization and Translation - architectural pattern

MDriven systems can adhere to a model pattern and use that to store translations to all texts in actions and ViewModels. There are also OCL operators (Translate) that work on data according to this pattern. Read more here.

2020-06-17 15h43 02.png

Translations.modlr

SysTurnkeyTraceLog

If you need to track what users are up to in your Turnkey app, you can add a class following this pattern:

2022-07-19 13h48 16.png

For every navigation (change of view) or action (action language execution resulting in potential data change), information will be snapshotted, and every 30 seconds, MDrivenTurnkey will spool out objects of the above class.

This is how it was used in one customer case:

x

EXTENSIONS

Consume and Purchase GetPaid#1

This model extends your system with the ability to charge the end-user for services you provide. The user will be treated as a SysConsumer in the portal. You can charge the SysConsumer with a Credit card and let the SysConsumer consume your services with a simple call in your local model. Download ChargeEndUserViaMDrivenPortalService.modlr :

2020-05-31 12h01 07.png
PayPal - Checkout GetPaid#2

As an alternative method to get paid by users, you can integrate PayPal. You will need a PayPal account and register as a developer. Once this is done, register your app and get a ClientID. Paste this ClientID into this viewmodel and you are all set. PayPalCheckout.modlr

2020-07-20 12h48 44.png
2020-07-20 12h50 01.png
Theme Builder - build themes in runtime

You can easily set CSS variables to influence the colors and sizes of the UI. To try different settings out in runtime, you can merge this model section:

2020-06-22 18h49 08.png
2020-06-22 18h49 22.png

ThemeBuilder.modlr, also see Theme as data.

Outgoing Email Queue

This is a model pattern that adds an outgoing email queue to the standard base model.

A seeker view enables you to search for queued or sent emails and an email detail view for changing the queued emails.

OutgoingEmailQueue-model.png

It includes two serverside viewmodels, one that sends the emails and one that cleans up the sent emails.

It can attach files to outgoing emails.

It has exception handling, error viewing, and retying failed send attempts.

OutgoingEmailQueue.modlr

Calendar Model for Linking Things to Dates, Weeks, Months, and Years

This model implements classes that make aggregation (for statistics, for example) easy.

It follows a common pattern with dimensions from data analysis. By prepopulating the database with days, months, years, weeks, etc, you can easily (and efficiently) find data to present in a diagram or table.

Calender model diagram.png

CalendarPackage.modlr

Read more here: Calendar package

Complete model examples

Click the header or Complete model examples to go the descriptions.

SVG - Move boxes around

Google maps to show and update positions

A Trello-like board with cards you move between lists

Markup editor TinyMCE

Gantt chart interactive

Notes to admin

The files uploaded here are maintained here: SVN\source\Ideas\WikiPublishedModelExamples Read NOTESTOADMIN.txt in that location.

To create a direct download link, use syntax like this:Special:Redirect/file/Företag.modlr

This is how the link should be formed: https://www.mediawiki.org/wiki/Help:Linking_to_files

This page was edited 179 days ago on 11/09/2023. What links here