Versions Compared

Key

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

...

Tags inserted into the config.xml file:

Code Block

<extension>
   <point>org.openmrs.admin.list</point>
   <class>org.openmrs.module.htmlformentry.extension.html.AdminList</class>
</extension>

...

The FormEntryAdminExt class is similar to:

Code Block

package org.openmrs.module.formentry.extension.html;

import java.util.Map;
import java.util.TreeMap;

import org.openmrs.module.Extension;
import org.openmrs.module.web.extension.AdministrationSectionExt;
import org.openmrs.util.InsertedOrderComparator;

public class FormEntryAdminExt extends AdministrationSectionExt {

   public Extension.MEDIA_TYPE getMediaType()  { return Extension.MEDIA_TYPE.html;	}

   public String getTitle() {	 return "formentry.title";	}

   public Map getLinks() {

      Map map = new TreeMap(new InsertedOrderComparator()); map.put("module/formentry/xsnUpload.form", "formentry.xsn.title");	 map.put("module/formentry/formEntryQueue.list", "formentry.FormEntryQueue.manage");	 map.put("module/formentry/formEntryInfo.htm", "formentry.info"); return map;

   }

}

...

A more complicated Extension Point might want more than one method implemented for complicated information:

Code Block

<openmrs:extensionPoint pointId="org.openmrs.admin.users.localHeader" type="html">
  <c:forEach items="${extension.links}" var="link">
    <li <c:if test="${fn:endsWith(pageContext.request.requestURI, link.key)}">class="active"</c:if> >
      <a href="${pageContext.request.contextPath}/${link.key}"><spring:message code="${link.value}"/></a>
    </li>
  </c:forEach>
</openmrs:extensionPoint>

...

If the page you want to add something to does not have an extensionPoint on it, the process is simple:

  1. Create a new ticket specifying the page the extPoint will be on
  2. Add the point to your local copy and test it out
  3. Create a patch and attach that patch diff to the ticket
  4. Wait for a developer to review your patch for consistency checks
  5. Apply the patch to trunk and the latest branches/1.x.x if desired
  6. Close the ticket and reference the changeset

Example: ticket:1979

Where are there extension points currently?

...

Page

Extension Point Id

Parameters

Works With

Req Class

Description

/patientDashboard

org.openmrs.patientDashboard.afterLastEncounter

patientId

1.3+

 

Located in patient header after the "last encounter" text

/WEB-INF/template/gutter (menu bar)

org.openmrs.gutter.tools

 

1.3+

 

Uses getRequiredPrivilege/getUrl/getLabel methods

encounters/encounterDisplay

org.openmrs.encounters.encounterListTop

encounterId

1.6.2+

 

At top of page. Uses getTitle and getPortletUrl

admin/observations/obsForm

org.openmrs.admin.observations.obsFormBottom

obsId

1.6.2+

 

At very bottom of page before footer. Uses getTitle and getPortletUrl

admin/encounters/encounterForm

org.openmrs.admin.encounters.encounterFormBeforeObs

encounterId

1.6.2+

 

Between encounter metadata and obs list. Uses getTitle and getPortletUrl

admin/encounters/encounterForm

org.openmrs.admin.encounters.encounterFormAddObsMenu

 

1.3+

LinkProviderExtension

 

admin/index

org.openmrs.admin.list

 

1.1+

 

Optionally extend: AdministrationSectionExt. Uses getRequiredPrivilege, getTitle, getLinks

admin/index --> Maintenance section

org.openmrs.admin.maintenance.localHeader

 

1.3+

 

Uses getRequiredPrivilege, getLinks. Optionally extend: AdministrationSectionExt (and ignore getTitle)

/WEB-INF/template/footerFull

org.openmrs.footerFullBeforeStatusBar

 

1.6.6+, 1.7.4+, 1.8.4+, 1.9.1+, 1.10.0+

 

Located at footerFull.jsp page right before the "status bar" (locale options strip, buildDate information, etc)

/errorhandler

org.openmrs.errorHandler

 

1.7.4+, 1.8.4+, 1.9.1+, 1.10.0+

 

Located at errorhandler.jsp page after the "(The full error stack trace.." text

(Add more here as you create/find them)

 

 

 

 

 

What kinds of abstract classes for extensions are there and what are they for?

...

Try changing your module's processing order in moduleApplicationContext.xml (lower number means earlier processing, default is 99):

Code Block

<bean id="basicmoduleUrlMapping">

   <property name="order"><value>2</value></property>
   ...
</bean>
How to add a Gutter extension point ?

https://openmrs.atlassian.net/wiki/display/docs/Adding+a+Gutter+extension+point