Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Re-directing to Login page when connecting to the server while sessio…
…n is closed
  • Loading branch information
k-joseph committed Jul 8, 2015
1 parent 4598730 commit 2043918
Show file tree
Hide file tree
Showing 8 changed files with 602 additions and 493 deletions.
10 changes: 7 additions & 3 deletions omod/src/main/resources/config.xml
Expand Up @@ -37,15 +37,19 @@
<require_module version="${emrapiVersion}">
org.openmrs.module.emrapi
</require_module>

<require_module version="${allergyapiVersion}">
org.openmrs.module.allergyapi
</require_module>

<require_module version="${appointmentschedulingVersion}">
org.openmrs.module.appointmentscheduling
</require_module>

<require_module version="${htmlformentryuiVersion}">
org.openmrs.module.htmlformentryui
</require_module>

</require_modules>

<!-- Module Activator -->
Expand Down Expand Up @@ -140,7 +144,7 @@
ChartSearchCategories.hbm.xml

</mappingFiles>

<packagesWithMappedClasses>
org.openmrs.module.chartsearch.cache
</packagesWithMappedClasses>
Expand Down
227 changes: 124 additions & 103 deletions omod/src/main/webapp/fragments/manageBookmarks.gsp
Expand Up @@ -84,37 +84,43 @@
}
});
});
function invokeBookmarkDetailsDialog(bookmarkUuid) {
jq('#dialog-bookmark-categories').html("");
if(bookmarkUuid) {
jq.ajax({
type: "POST",
url: "${ ui.actionLink('fetchBookmarkDetails') }",
data: {"uuid":bookmarkUuid},
dataType: "json",
success: function(bookmarks) {
var phrase = bookmarks.searchPhrase;
var cats = bookmarks.categories;
var bkName = bookmarks.bookmarkName;
//TODO set dialog element values
jq("#dialog-bookmark-uuid").val(bookmarkUuid);
jq("#dialog-bookmark-name").val(bkName);
jq("#dialog-bookmark-phrase").val(phrase);
jq.each(cats, function(key, value) {
jq('#dialog-bookmark-categories').append(jq("<option></option>").attr("value",key).text(value));
});
if(jq('#dialog-bookmark-categories option').text() !== "") {
jq('#dialog-bookmark-categories option').prop('selected', true);
if(isLoggedInSynchronousCheck()) {
jq('#dialog-bookmark-categories').html("");
if(bookmarkUuid) {
jq.ajax({
type: "POST",
url: "${ ui.actionLink('fetchBookmarkDetails') }",
data: {"uuid":bookmarkUuid},
dataType: "json",
success: function(bookmarks) {
var phrase = bookmarks.searchPhrase;
var cats = bookmarks.categories;
var bkName = bookmarks.bookmarkName;
//TODO set dialog element values
jq("#dialog-bookmark-uuid").val(bookmarkUuid);
jq("#dialog-bookmark-name").val(bkName);
jq("#dialog-bookmark-phrase").val(phrase);
jq.each(cats, function(key, value) {
jq('#dialog-bookmark-categories').append(jq("<option></option>").attr("value",key).text(value));
});
if(jq('#dialog-bookmark-categories option').text() !== "") {
jq('#dialog-bookmark-categories option').prop('selected', true);
}
invokeDialog("#selected-bookmark-dialog-content", "Editing '" + bkName + "' Bookmark", "450px");
},
error: function(e) {
}
invokeDialog("#selected-bookmark-dialog-content", "Editing '" + bkName + "' Bookmark", "450px");
},
error: function(e) {
}
});
}
});
}
} else {
location.reload();
}
}
function displayExistingBookmarks() {
Expand Down Expand Up @@ -145,53 +151,61 @@
}
function deleteAllSelectedBookmarks() {
var selectedUuids = returnUuidsOfSeletedBookmarks();
var deleteConfirmMsg = "Are you sure you want to delete " + selectedUuids.length + " Item(s)!";
if(selectedUuids.length !== 0) {
if(confirm(deleteConfirmMsg)) {
jq.ajax({
type: "POST",
url: "${ ui.actionLink('deleteSelectedBookmarks') }",
data: {"selectedUuids":selectedUuids},
dataType: "json",
success: function(remainingBookmarks) {
bookmarksAfterparse = remainingBookmarks.reverse();
displayExistingBookmarks();
},
error: function(e) {
}
});
if(isLoggedInSynchronousCheck()) {
var selectedUuids = returnUuidsOfSeletedBookmarks();
var deleteConfirmMsg = "Are you sure you want to delete " + selectedUuids.length + " Item(s)!";
if(selectedUuids.length !== 0) {
if(confirm(deleteConfirmMsg)) {
jq.ajax({
type: "POST",
url: "${ ui.actionLink('deleteSelectedBookmarks') }",
data: {"selectedUuids":selectedUuids},
dataType: "json",
success: function(remainingBookmarks) {
bookmarksAfterparse = remainingBookmarks.reverse();
displayExistingBookmarks();
},
error: function(e) {
}
});
} else {
//alert("DELETE Cancelled");
}
} else {
//alert("DELETE Cancelled");
alert("Select at-least one Bookmark to be deleted!");
}
} else {
alert("Select at-least one Bookmark to be deleted!");
}
location.reload();
}
}
function setSelectedBookmarkAsDefaultSearch() {
var selectedDefaultBkuuid = returnUuidOfSelectedDefaultBookmark();
if(selectedDefaultBkuuid) {
jq.ajax({
type: "POST",
url: "${ ui.actionLink('setBookmarkAsDefaultSearch') }",
data: {"selectedUuid":selectedDefaultBkuuid},
dataType: "json",
success: function(bookmarks) {
bookmarksAfterparse = bookmarks.reverse();
displayExistingBookmarks();
alert("Successfully saved default search :-)");
},
error: function(e) {
}
});
} else {
alert("Please select a bookmark to set as a default search and try again!");
}
if(isLoggedInSynchronousCheck()) {
var selectedDefaultBkuuid = returnUuidOfSelectedDefaultBookmark();
if(selectedDefaultBkuuid) {
jq.ajax({
type: "POST",
url: "${ ui.actionLink('setBookmarkAsDefaultSearch') }",
data: {"selectedUuid":selectedDefaultBkuuid},
dataType: "json",
success: function(bookmarks) {
bookmarksAfterparse = bookmarks.reverse();
displayExistingBookmarks();
alert("Successfully saved default search :-)");
},
error: function(e) {
}
});
} else {
alert("Please select a bookmark to set as a default search and try again!");
}
} else {
location.reload();
}
}
function returnUuidsOfSeletedBookmarks() {
Expand Down Expand Up @@ -221,44 +235,51 @@
}
function saveBookmarkProperties(bookmarkUuid, bkName, phrase, categories) {
jq('#selected-bookmark-dialog-content').dialog('close');
if(bookmarkUuid !== "" && bkName !== "" && phrase !== "") {
jq.ajax({
type: "POST",
url: "${ ui.actionLink('saveBookmarkProperties') }",
data: { "bookmarkUuid":bookmarkUuid, "bookmarkName":bkName, "searchPhrase":phrase, "selectedCategories":categories },
dataType: "json",
success: function(remainingBookmarks) {
bookmarksAfterparse = remainingBookmarks.reverse();
displayExistingBookmarks();
},
error: function(e) {
}
});
}
if(isLoggedInSynchronousCheck()) {
jq('#selected-bookmark-dialog-content').dialog('close');
if(bookmarkUuid !== "" && bkName !== "" && phrase !== "") {
jq.ajax({
type: "POST",
url: "${ ui.actionLink('saveBookmarkProperties') }",
data: { "bookmarkUuid":bookmarkUuid, "bookmarkName":bkName, "searchPhrase":phrase, "selectedCategories":categories },
dataType: "json",
success: function(remainingBookmarks) {
bookmarksAfterparse = remainingBookmarks.reverse();
displayExistingBookmarks();
},
error: function(e) {
}
});
}
} else {
location.reload();
}
}
function deleteBookmarkInTheDialog(bookmarkUuid) {
jq('#selected-bookmark-dialog-content').dialog('close');
if(bookmarkUuid !== "") {
jq.ajax({
type: "POST",
url: "${ ui.actionLink('deleteBookmarkInTheDialog') }",
data: { "bookmarkUuid":bookmarkUuid },
dataType: "json",
success: function(remainingBookmarks) {
bookmarksAfterparse = remainingBookmarks.reverse();
displayExistingBookmarks();
},
error: function(e) {
}
});
}
if(isLoggedInSynchronousCheck()) {
jq('#selected-bookmark-dialog-content').dialog('close');
if(bookmarkUuid !== "") {
jq.ajax({
type: "POST",
url: "${ ui.actionLink('deleteBookmarkInTheDialog') }",
data: { "bookmarkUuid":bookmarkUuid },
dataType: "json",
success: function(remainingBookmarks) {
bookmarksAfterparse = remainingBookmarks.reverse();
displayExistingBookmarks();
},
error: function(e) {
}
});
}
} else {
location.reload();
}
}
});
</script>


Expand Down
52 changes: 28 additions & 24 deletions omod/src/main/webapp/fragments/manageHistory.gsp
Expand Up @@ -63,6 +63,8 @@
deleteAllSelectedHistory();
});
});
function displayHistoryExistingHistory() {
var thHistoryToday = "";
var thHistoryWeek = "";
Expand Down Expand Up @@ -181,33 +183,35 @@
}
function deleteAllSelectedHistory() {
var selectedUuids = returnuuidsOfSeletedHistory();
var deleteConfirmMsg = "Are you sure you want to delete " + selectedUuids.length + " Item(s)!";
if(selectedUuids.length !== 0) {
if(confirm(deleteConfirmMsg)) {
jq.ajax({
type: "POST",
url: "${ ui.actionLink('deleteSelectedHistory') }",
data: {"selectedUuids":selectedUuids},
dataType: "json",
success: function(remainingHistory) {
historyAfterparse = remainingHistory.reverse();
displayHistoryExistingHistory();
},
error: function(e) {
}
});
if(isLoggedInSynchronousCheck()) {
var selectedUuids = returnuuidsOfSeletedHistory();
var deleteConfirmMsg = "Are you sure you want to delete " + selectedUuids.length + " Item(s)!";
if(selectedUuids.length !== 0) {
if(confirm(deleteConfirmMsg)) {
jq.ajax({
type: "POST",
url: "${ ui.actionLink('deleteSelectedHistory') }",
data: {"selectedUuids":selectedUuids},
dataType: "json",
success: function(remainingHistory) {
historyAfterparse = remainingHistory.reverse();
displayHistoryExistingHistory();
},
error: function(e) {
}
});
} else {
//alert("DELETE Cancelled");
}
} else {
//alert("DELETE Cancelled");
alert("Select at-least one history to be deleted!");
}
} else {
alert("Select at-least one history to be deleted!");
}
} else {
location.reload();
}
}
});
</script>

<h1>Manage History</h1>
Expand Down

0 comments on commit 2043918

Please sign in to comment.