Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,17 @@
*/
package org.openmrs.module.teammodule.web.controller;

import java.util.List;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.openmrs.Location;
import org.openmrs.api.context.Context;
import org.openmrs.module.teammodule.Team;
import org.openmrs.module.webservices.rest.web.v1_0.search.openmrs1_8.LocationSearchHandler;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.validation.BindingResult;
Expand Down Expand Up @@ -40,7 +44,11 @@ public class TeamController {
@RequestMapping(method = RequestMethod.GET)
public String showForm(Model model, HttpServletRequest request) {
try {
model.addAttribute("allLocations", Context.getLocationService().getAllLocations());
List<Location> locations = Context.getLocationService().getAllLocations();
for(Location location:locations) {
location.setName(location.getName().replace("\"", "'"));
}
model.addAttribute("allLocations", locations);
}
catch(Exception e) { e.printStackTrace(); throw new RuntimeException(e); }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,12 @@

package org.openmrs.module.teammodule.web.controller;

import java.util.List;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;

import org.openmrs.Location;
import org.openmrs.api.context.Context;
import org.openmrs.module.teammodule.api.TeamRoleService;
import org.openmrs.module.teammodule.api.TeamMemberService;
Expand Down Expand Up @@ -50,10 +53,14 @@ public class TeamMemberViewForm {
@RequestMapping(method = RequestMethod.GET)
public String showForm(Model model, HttpServletRequest request) {
try {
List<Location> locations = Context.getLocationService().getAllLocations();
for(Location location:locations) {
location.setName(location.getName().replace("\"", "'"));
}
model.addAttribute("allTeams", Context.getService(TeamService.class).getAllTeams(false, 0, 1000));
model.addAttribute("allSupervisors", Context.getService(TeamMemberService.class).searchTeamMember(null, null, null, null, null, 0, 1000));
model.addAttribute("allTeamRoles", Context.getService(TeamRoleService.class).getAllTeamRole(true, false, null, null));
model.addAttribute("allLocations", Context.getLocationService().getAllLocations());
model.addAttribute("allLocations", locations);
model.addAttribute("allTeamMembers", Context.getService(TeamMemberService.class).getAllTeamMember(null, true, null, null));
}
catch(Exception e) { e.printStackTrace(); throw new RuntimeException(e); }
Expand Down
4 changes: 2 additions & 2 deletions omod/src/main/webapp/teamMemberAddForm.jsp
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@
var selectedValue = gender.options[gender.selectedIndex].value;
var selectedMemberRoleValue = teamRoleOption.options[teamRoleOption.selectedIndex].value;
var selectedMemberValue = teamOption.options[teamOption.selectedIndex].value;
var regexp = /^[a-z/i][a-z.\- ]*[a-z/i]{2,}$/i;
var regexp = /^[a-zA-Z0-9]{3,20}$/i;
var idRegExp = /^[a-z|0-9]+[a-z.\-_]*[a-z|0-9]{2,}$/i;
var mustSelectMessage = "";
var dataTypeMessage = "";
Expand All @@ -158,7 +158,7 @@
//if (selectedMemberValue == 0) { mustSelectMessage += "<br>Please select a Member Team."; }
if(document.getElementById("loginChoice").checked) {
if (user == null || user == "") { mustSelectMessage += "<br>UserName can't be empty."; }
if (!regexp.test(user)) { dataTypeMessage += "<br>In UserName Min 3, max 20 All data types and either [- . Or _ ] are allowed for text field."; }
if (!regexp.test(user)) { dataTypeMessage += user+"<br>In ---- UserName Min 3, max 20 All data types and either [- . Or _ ] are allowed for text field."; }
}
if(mustSelectMessage != ""){ alertify.alert(mustSelectMessage); }
else if(dataTypeMessage != ""){ alertify.alert(dataTypeMessage); }
Expand Down