OrthancExplorer extension - mbarnig/RadioLogic GitHub Wiki
The Javascript code to add to the Orthanc Explorer Javascript is located in the folder /RadioLogicCreator/Resources/. The script adds new elements into the jQuery Framework used by Orthanc.
The following example shows how to add a button in the Orthanc Patient webpage.
$('#patient').live('pagebeforecreate', function() {
var b = $('<a>')
.attr('data-role', 'button')
.attr('href', '#')
.attr('data-icon', 'action')
.attr('data-theme', 'e')
.text('Create clinical case from this patient');
b.insertBefore($('#patient-delete').parent().parent());
b.click(function() {
if ($.mobile.pageData) {
var myURL = myFunction("Patient");
window.open(myURL, '_self');
}
});
});

The required attributes of the button are specified > role, icon, theme, link. The location is indicated > before the patient-delete button. The button text is inserted > Create clinical case from this patient. The most important is the function called when the button is clicked > myFunction("Patient").
This functions returns the variable myURL which is used by the command to open a new browser window pointing the the returned URL. Here is the code of the Javascript function myFunction().
function myFunction(myOrigin) {
var myLocation = window.location;
log("Location : " + myLocation);
var myProtocol = myLocation.protocol;
var myHost = myLocation.host; // hostname + port number
console.log("Host : " + myHost);
var myQuery = myLocation.query;
console.log("Query : " + myQuery);
var myHash = myLocation.hash;
console.log("Hash : " + myHash);
var myURL = myProtocol + "//" + myHost + "/radiologic/radiologiccreator.html?origin=" + myOrigin + "&dicomsource=" + myHash;
return myURL;
}
Similar code snippets are used to insert buttons in the studies, series and instances websites. Buttons labelled RadioLogicCreator are added to the Orthanc lookup and plugins interface webpages.
The HTML code of the RadioLogicCreator webpage opened with the buttons is shown in the next chapter.