yadamz
(Yani Adamz)
January 7, 2017, 7:29pm
1
Hello all @dkayiwa ,
How can code openmrs to select default location. Should I write it like this:
Default= “location.id:2”
Obviously that didn’t work
Thanks for you help
yadamz
(Yani Adamz)
January 7, 2017, 7:37pm
3
nop @dkayiwa
reference app : login page
dkayiwa
(Daniel Kayiwa)
January 7, 2017, 7:44pm
4
By the way, when you say “should i do this or that”? Have you actually tried out these options and seen what happens?
yadamz
(Yani Adamz)
January 7, 2017, 7:46pm
5
I have not noticed any changes. the login page is the same
dkayiwa
(Daniel Kayiwa)
January 7, 2017, 8:43pm
6
Can i look at your changes on somewhere like github?
yadamz
(Yani Adamz)
January 9, 2017, 1:43am
7
Hello @dkayiwa ,
I am trying to find the source code for reference app 2.3 and 2.4 but I could not. Where are these kept? I need them so I can show you the changes
dkayiwa
(Daniel Kayiwa)
January 9, 2017, 8:44am
8
I mean the changes that you have made locally.
yadamz
(Yani Adamz)
January 15, 2017, 5:46am
9
@dkayiwa This is the changes on the reference application login file. I added default=“location.name:pharmacy” it didn’t work. Not sure how to write it correctley
http://pastebin.com/LGcRv8vZ
The original full code can be found here https://github.com/openmrs/openmrs-module-referenceapplication/blob/master/omod/src/main/webapp/pages/login.gsp
yadamz
(Yani Adamz)
January 18, 2017, 6:57pm
10
Anybody can help me in this regards …
I appreciate your support
dkayiwa
(Daniel Kayiwa)
January 18, 2017, 8:05pm
11
@yadamz the reference application automatically selects a location basing on what one had selected for the last login session. If that is not enough for you, you can put your default location as the lastSessionLocation
The links below will help you see what is going on:
${ ui.includeFragment("referenceapplication", "infoAndErrorMessages") }
<script type="text/javascript">
jQuery(function() {
updateSelectedOption = function() {
jQuery('#sessionLocation li').removeClass('selected');
var sessionLocationVal = jQuery('#sessionLocationInput').val();
if(sessionLocationVal != null && sessionLocationVal != "" && sessionLocationVal != 0){
jQuery('#sessionLocation li[value|=' + sessionLocationVal + ']').addClass('selected');
}
};
updateSelectedOption();
jQuery('#sessionLocation li').click( function() {
jQuery('#sessionLocationInput').val(jQuery(this).attr("value"));
updateSelectedOption();
});
lastSessionLocation = locationService.getLocation(Integer.valueOf(lastSessionLocationId));
}
catch (NumberFormatException ex) {
// pass
}
finally {
Context.removeProxyPrivilege(VIEW_LOCATIONS);
Context.removeProxyPrivilege(GET_LOCATIONS);
}
model.addAttribute("lastSessionLocation", lastSessionLocation);
return null;
}
private String getRedirectUrlFromReferer(PageRequest pageRequest) {
String referer = pageRequest.getRequest().getHeader("Referer");
String redirectUrl = "";
if (referer != null) {
if (referer.contains("http://") || referer.contains("https://")) {
try {