Skip to content
28 changes: 28 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,31 @@ until they are able to migrate away from it, since most of the implementations o

- It is compulsory to run openmrs-module-legacyui against legacyui branch of openmrs-core
that I have created to eventually remove legacyui.
X
# openmrs-module-legacyui
[![Build Status](https://travis-ci.org/openmrs/openmrs-module-legacyui.svg?branch=master)](https://travis-ci.org/openmrs/openmrs-module-legacyui) [![Coverage Status](https://coveralls.io/repos/github/openmrs/openmrs-module-legacyui/badge.svg?branch=master)](https://coveralls.io/github/openmrs/openmrs-module-legacyui?branch=master)

- The legacy user interface for OpenMRS Platform 2.x is chiefly comprised of administrative functions and the patient dashboard.
- A new and more contemporary UI has been introduced via a UI framework and the legacy UI is kept around for
administrative functions that are not yet implemented in the new UI.
- To retire the Legacy UI as planned, it is required to move the implementations and modules that still rely on it in order to
maintain backwards compatibility.
- The main idea behind this project is to move legacy UI functions into an OpenMRS module that these implementations can install
until they are able to migrate away from it, since most of the implementations of OpenMRS around the world are running OpenMRS 1.9.

- It is compulsory to run openmrs-module-legacyui against legacyui branch of openmrs-core
that I have created to eventually remove legacyui.
X
# openmrs-module-legacyui
[![Build Status](https://travis-ci.org/openmrs/openmrs-module-legacyui.svg?branch=master)](https://travis-ci.org/openmrs/openmrs-module-legacyui) [![Coverage Status](https://coveralls.io/repos/github/openmrs/openmrs-module-legacyui/badge.svg?branch=master)](https://coveralls.io/github/openmrs/openmrs-module-legacyui?branch=master)

- The legacy user interface for OpenMRS Platform 2.x is chiefly comprised of administrative functions and the patient dashboard.
- A new and more contemporary UI has been introduced via a UI framework and the legacy UI is kept around for
administrative functions that are not yet implemented in the new UI.
- To retire the Legacy UI as planned, it is required to move the implementations and modules that still rely on it in order to
maintain backwards compatibility.
- The main idea behind this project is to move legacy UI functions into an OpenMRS module that these implementations can install
until they are able to migrate away from it, since most of the implementations of OpenMRS around the world are running OpenMRS 1.9.

- It is compulsory to run openmrs-module-legacyui against legacyui branch of openmrs-core
that I have created to eventually remove legacyui.
13 changes: 11 additions & 2 deletions omod/src/main/java/org/openmrs/web/WebComponentRegistrar.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,16 @@
import org.springframework.stereotype.Component;
import org.springframework.web.context.ServletContextAware;

//Added
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

@Component
public class WebComponentRegistrar implements ServletContextAware {


//Added
private static final Logger log = LoggerFactory.getLogger(WebComponentRegistrar.class);

@Override
public void setServletContext(ServletContext servletContext) {

Expand Down Expand Up @@ -61,7 +68,9 @@ public void setServletContext(ServletContext servletContext) {
//This happens on running openmrs after InitializationFilter or UpdateFilter
//hence requiring a restart to see any page other than index.htm
//After a restart, all mappings will then happen within Listener.contextInitialized()
ex.printStackTrace();

//Replaced
log.error("Error registering web component", ex);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.openmrs.ConceptDatatype;
import org.openmrs.api.APIException;
import org.openmrs.api.ConceptService;
import org.openmrs.api.context.Context;
import org.openmrs.web.WebConstants;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,9 @@
import org.apache.commons.logging.LogFactory;
import org.openmrs.ConceptSource;
import org.openmrs.ImplementationId;
import org.openmrs.api.APIException;
import org.openmrs.api.ConceptService;
import org.openmrs.api.context.Context;
import org.springframework.beans.propertyeditors.CustomNumberEditor;
import org.springframework.validation.BindException;
import org.springframework.validation.Errors;
import org.springframework.web.bind.ServletRequestDataBinder;
import org.springframework.web.servlet.mvc.SimpleFormController;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@
*/
package org.openmrs.web.controller.maintenance;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import org.openmrs.api.context.Context;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
Expand All @@ -20,7 +23,8 @@
*/
@Controller
public class SystemInformationController {

private static final Logger log =
LoggerFactory.getLogger(SystemInformationController.class);
/**
* Default constructor used by spring MVC
*/
Expand All @@ -39,7 +43,10 @@ public SystemInformationController() {
*/
@RequestMapping(method = RequestMethod.GET, value = "admin/maintenance/systemInfo.htm")
public String showPage(ModelMap model) {
model.addAttribute("systemInfo", Context.getAdministrationService().getSystemInformation());

log.debug("Loading system information page");

model.addAttribute("systemInfo", Context.getAdministrationService().getSystemInformation());
return "/module/legacyui/admin/maintenance/systemInfo";
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,8 @@
import static org.junit.Assert.assertThat;
import static org.junit.Assert.assertTrue;

import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.Collection;
import java.util.Locale;
import java.util.Set;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
Expand All @@ -35,9 +32,7 @@
import org.openmrs.ConceptAnswer;
import org.openmrs.ConceptAttribute;
import org.openmrs.ConceptAttributeType;
import org.openmrs.ConceptClass;
import org.openmrs.ConceptComplex;
import org.openmrs.ConceptDatatype;
import org.openmrs.ConceptDescription;
import org.openmrs.ConceptMap;
import org.openmrs.ConceptMapType;
Expand All @@ -54,8 +49,6 @@
import org.openmrs.util.LocaleUtility;
import org.openmrs.util.OpenmrsConstants;
import org.openmrs.web.controller.ConceptFormController.ConceptFormBackingObject;
import org.openmrs.web.controller.concept.ConceptReferenceRange;
import org.openmrs.web.controller.mappper.ConceptFormMapper;
import org.openmrs.web.test.BaseModuleWebContextSensitiveTest;
import org.openmrs.web.test.WebTestHelper;
import org.openmrs.web.test.WebTestHelper.Response;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@
*/
package org.openmrs.web.controller.maintenance;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.util.Map;

import junit.framework.Assert;
Expand All @@ -25,7 +28,9 @@
public class SystemInformationControllerTest extends BaseModuleWebContextSensitiveTest {

private ModelMap model = null;


private static final Logger log = LoggerFactory.getLogger(SystemInformationControllerTest.class);

@Before
public void before() throws Exception {
createController();
Expand All @@ -36,9 +41,17 @@ public void before() throws Exception {
*/
private void createController() {
model = new ModelMap();
SystemInformationController controller = new SystemInformationController();

// Safe null check
if (model == null) {
log.warn("Model was null, creating new ModelMap");
model = new ModelMap();
}

SystemInformationController controller = new SystemInformationController();
controller.showPage(model);
//System.out.println("SystemInformationControllerTest.createController() "+model.toString());

log.debug("createController() model: {}", model);
}

/**
Expand Down