Introduction to Examples and Merge
This page describes how to 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 include:
or/and :
What happens when you merge another modlr file?
- 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 uses 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 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 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.
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:
- 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 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:
- Set the PasswordReset package's "Default superclass" if you want that.
- Make sure you have an email server set up.
- Create an action that opens the "RestetPasswordPage" ViewModel.
Download the model file here: PasswordResetTemplate.modlr
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.
SysTurnkeyTraceLog
If you need to track what users are up to in your Turnkey app, add a class following this pattern:
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 example is available at: https://github.com/supportMDriven/MDrivenComponents.git
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:
PayPal - Checkout GetPaid#2
As an alternative method to get paid by users, 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
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:
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.
- 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.
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.
Read more here: Calendar package
Complete Model Examples
Click the header or visit Complete model examples to find 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