Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migrated to Confluence 5.3

...

Tutorials and Further Documentation

App Framework Step by Step Tutorial

Terminology

App

App Template

...

Code Block
languagejavascript
// comments provided for tutorial purposes, but they are NOT LEGAL in this file (per the JSON spec)
[
    {
        "id": "coreapps.patientDashboard",        // unique id for this app, unique across all apps, typically starts with your module id
        "description": "Basic page summarizing patient's visits and demographics",        // plain text or a message code (not displayed to end-users)
        "extensionPoints": [        // defines where other apps can plug functionality into this app
            {
                "id": "coreapps.patientDashboard.visitActions",        // unique id for this extension point, must be unique across all loaded apps
                "description": "coreapps.patientDashboard.extension.visits.description"        // plain text or message code (not displayed to end-users)
            },
            {
                "id": "coreapps.patientDashboard.overallActions",
                "description" : "coreapps.patientDashboard.extension.actions.description"
            }
        ],
        "contextModel": [        // extensions may count on the app providing these values (dev documentation, not enforced by the framework)
            "patientId",
            "activeVisitId"
        ]
    }
]

...

Code Block
languagejavascript
// comments provided for tutorial purposes, but they are NOT LEGAL in this file (per the JSON spec)
[
    {
        "id": "coreapps.template.findPatient",        // unique across all app templates, typically starts with your module id
        "description": "Simple patient search by name and/or id",        // plain text or message code
        "contextModel": [        // extensions may count on apps with this template providing these values (dev documentation, not enforced by the framework)
            "patientId"
        ]
        "configOptions": [        // apps that inherit from this template may override these or inherit the default values
            {
                "name": "onSelectUrl",
                "description": "What url to go to after choosing a patient. Supports {{patientId}}",
                "defaultValue": "/coreapps/patientDashboard.page?patientId={{patientId}}"
            }
        ]
    }
]

Another module would instantiate this template in one of its *app.json files like this:

Code Block
languagejavascript
// comments provided for tutorial purposes, but they are NOT LEGAL in this file (per the JSON spec)
[
    {
        "id": "referenceapplication.quickSummary",        // unique app id, (independent of the template)
        "instanceOf": "coreapps.template.findPatient",        // unique id of the template to inherit
        "label": "Quick Patient Summary",        // text or message code
        "description": "Search for a patient by name and/or ID and see a patient summary",        // text or message code
        "extensions": [        // extensions that attach to extension points of _other_ apps
            {
                "id": "referenceapplication.quickSummary.homepageLink",        // id for this extension, must be unique across all apps
                "extensionPointId": "org.openmrs.referenceapplication.homepageLink",
                "type": "link",
                "label": "referenceapplication.app.quickSummary.label",
                "url": "coreapps/findPatient.page?app=referenceapplication.quickSummary",
                "icon": "icon-search",
                "order": 1,
                "requiredPrivilege": "App: referenceapplication.quickSummary"
            }
        ],
        "config": {        // in this example we override this setting
            "onSelectUrl": "/somemodule/patientSummary.page?patientId={{patientId}}"
        }
    }
] 

...