OpenMRS Module

(Inserting a Link to the module to Adminpage)
 
Line 12: Line 12:
  <!-- /Extensions -->
  <!-- /Extensions -->
-
*Be sure to that your replace all references to basicmodule with the new name of your project which you may select.
+
*Be sure to that your replace all references to basicmodule with the new name of your module.
-
*Switch into Java perspective which is located in the upper right hand corner of eclispe below the eixt botton.
+
*Switch into Java perspective, which is located in the upper right hand corner of eclispe below the exit button.
*Edit your AdminList.java file in extention html to insert this line of code in to the function <b><i>public Map<String, String> getLinks() </i></b> before your return the map but after you declare it.
*Edit your AdminList.java file in extention html to insert this line of code in to the function <b><i>public Map<String, String> getLinks() </i></b> before your return the map but after you declare it.
Line 22: Line 22:
*Each page must be saved as a <b>.jsp</b> file but the OpenMRS controller translates request suffixes so you must refer to them in client side code as <b>.htm</b> .
*Each page must be saved as a <b>.jsp</b> file but the OpenMRS controller translates request suffixes so you must refer to them in client side code as <b>.htm</b> .
 +
 +
To build your module, right-click on <tt>build.xml</tt> and click on Run As... Ant Build. This will create a jar file in <tt>dist</tt> called <tt>yourmodulename.omod</tt>. This can be uploaded to the openmrs installation under Admin.. Manage Modules.

Current revision as of 14:39, 10 July 2007

The OpenMRS system supports a module system. Modules are compiled into jar files with an .omod suffix and stored in the modules directory.

Creating a simple module

To first setup and create a simple module follow OpenMRS's guide.

Inserting a Link to the module to Adminpage

  • In your config.xml file under metadata folder uncomment the section titled <!-- Extensions -->,
<!-- Extensions -->

<extension>
<point>org.openmrs.admin.list</point>
<class>@MODULE_PACKAGE@.extension.html.AdminList</class>
</extension>
<!-- /Extensions -->
  • Be sure to that your replace all references to basicmodule with the new name of your module.
  • Switch into Java perspective, which is located in the upper right hand corner of eclispe below the exit button.
  • Edit your AdminList.java file in extention html to insert this line of code in to the function public Map<String, String> getLinks() before your return the map but after you declare it.
map.put("module/yourmodulename/somepage.htm", "some link text");
  • To make this link display text or functions, under your web folder → module create a somepage.jsp file
  • Each page must be saved as a .jsp file but the OpenMRS controller translates request suffixes so you must refer to them in client side code as .htm .

To build your module, right-click on build.xml and click on Run As... Ant Build. This will create a jar file in dist called yourmodulename.omod. This can be uploaded to the openmrs installation under Admin.. Manage Modules.