...
Installation and Configuration
- Download from the module repository
- Grant any required privileges
- Manage Homepages: Users with this privilege will be able to configure what homepages are assigned to what roles
- Configure global properties settings:
- rolebasedhomepage.defaultHomePage: If specified, this will be the default homepage for all users. If unspecified, it will default to a standard OpenMRS homepage
Administration:
...
Manage Homepages Dashboard
All administration of Role-Based Homepages can be done via the "Manage Homepages" page, accessible from the Administration section
...
Manage Homepages:
Manage Homepages link helps in creating a new homepage, View the existing homepage or Edit the existing homepage for each role.
Create Using Portlets:
- Create Using Portlets is used to create homepage using portlets.
- In this process one can add the portlets from the existing portlets list.
- Show preview enables to see the preview how the homepage appears.
- Generate Homepage creates and saves the homepage.
Once the JSP homepage for that role is created the Create Using Portlets button will be disabled, and the Create Using HTML, Add URL, View & Edit buttons in Manage Homepages will be enabled.
Create Using HTML:
- Create Using HTML is used to create homepage using HTML code.
- In this process one can write the HTML/JSP code and portlet tags can also be used.
- Show preview enables to see the preview how the homepage appears.
- Generate Homepage creates and saves the homepage.
Once the HTML homepage for that role is created the Create Using HTML button will be disabled, and the Create Using Portlets, Add URL, View & Edit buttons in Manage Homepages will be enabled.
Add URL:
- Add URL is used to point the homepage to an existing URL.
- In this the home page points to the URL entered in the Redirection URL field.
- Assign URL sets the url as the homepage
Once the URL is set as homepage for a role then the Add Url button will be disabled, and the Create Using Portlets, Create Using HTML, View & Edit buttons in Manage Homepages will be enabled.
View:
- The View button will be enabled only once the role has a (any of the 3 types- using portlets, using html, url).
- The view button enables the user to see the existing homepage for the selected role.
Edit:
- The Edit button will be enabled once the role has a homepage (any of the 3 types- using portlets, using html, url).
- If the homepage is created using portlets then the edit page will display all the portlets present in the existing homepage and the user to delete the existing portlets or add new portlets.
- If the homepage is created using Html then the edit page will be the html edit in which the existing Html code for that homepage will be display.
- If the homepage is using redirection url then the edit page will be url edit in which the existing url will be displayed.
Delete Homepages
- Delete Homepages page displays the list of the roles and the type of existing homepage of that role.
- To deleted the homepages select the homepages to be deleted and click Delete Homepage button.
Add from other modules during the creation of the module
- The homepage for a role can be added from modules other than rolebasedhomepage by using the uploadHomepage() method present in RoleBasedHomePageService.
- If the homepage is added using this method from other module and it is started, all the options (Create Using Portlets, Create Using HTML, Add URL, View, Edit) for that role under the Manage Homepages link are disabled.
- Once this module is stopped or undeployed the Create Using Portlets, CreateHTML & Add URL buttons under the Manage Homepages link are enabled.
- Method Syntax : uploadHomepage(String role,String htmlCode,String jspName,String url,String moduleId)
Set Homepage:
To set a homepage by using the JSP page, the parameters role, jspName, moduleId must be set with appropriate values and the parameters htmlCode, url must be null.
Example Method call:
Code Block |
---|
uploadHomepage(“Clinician”,null,”jsp_name”,nul,”module_id”);
|
To set a homepage by using the HTML code, the parameters role, htmlCode, moduleId must be set with appropriate values and the parameters jspName, url must be null.
Example Method call:
Code Block |
---|
uploadHomepage(“Clinician”,”html_code”,null,nul,”module_id”);
|
To set a homepage by using the JSP page, the parameters role, jspName, moduleId must be set with appropriate values and the parameters htmlCode, jspName must be null.
Example Method call:
...
. Within this page, you can view all of the current home pages by role. You can preview the home page for a particular role by clicking the "Preview" link next to a Role. You can also preview the home page that will appear for a particular user by entering a username in the supplied box and clicking the "Preview" button. You can edit the home page for a role by clicking on the Role name. You can also directly configure the default homepage global property from this page.
URL-based Homepages
The first manner in which a Home Page can be defined is by referencing a URL within the system you wish to use. This can be any page supplied by core or by a module. To determine the valid configuration setting, you should first navigate to the page you are interested in within your system, and find the URL of this page in the browser. The page you navigate to will have a URL in the form of:
http://localhost:8080/openmrs/admin/index.htm
In such as case, the home page configuration for this page should be "admin/index.htm" (i.e. you would omit the
http://localhost:8080/openmrs/
part of the URL from the specification). An example of this is shown below.
Custom HTML/JSP-based Homepages
The second manner in which you can configure a home page is via custom HTML and/or JSP. This can contain standard HTML and Javascript. It can also contain any valid JSTL expression, JSP Scriplet, or custom tag that is exposed within the standard OpenMRS header and Portlet Controller. This is very powerful, as it allows developers to create a library of portlets that might be added to user dashboards, and for system administrators to configure which of these portlets appear on which role-based homepage, and with what layout. An example of this is shown below:
Basic HTML | Addition of JSTL | Addition of JSP Tags |
---|---|---|
Usage
Once configured, users will see their custom homepage any time they initially log into the system, navigate to
http://server_name_here/index.htm
or click the "Home" link within the OpenMRS Navigation Header. If a particular user belongs only to a single Role that has a custom homepage configured for them, they will always be taken into the homepage for that Role. If, however, a user belongs to multiple Roles, more than one of which has a custom homepage assigned to it, then upon first access each time they log in, the user will need to choose which Role they wish to assume for the course of that session. The system will "remember" this decision for each subsequent access to the home page during the course of the user's session. To reset this, the user can log out and log back in, and they will be prompted to answer this question once again. See below:
Release Notes
- 2.0: Initial release (NOTE: THIS IS NOT BACKWARDS COMPATIBLE WITH THE 1.0 RELEASE)
- 1.0: Initial alpha (never released)
Contacts
Project Lead: | |
Contributers: | Former user (Deleted) (Google Summer of Code 2009) |