Mercurial > hg > orthanc
diff OrthancExplorer/explorer.js @ 1232:f1c01451a8ee
Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Thu, 04 Dec 2014 17:04:40 +0100 |
parents | 2e11c3353356 |
children | 72d1c2fc0edb |
line wrap: on
line diff
--- a/OrthancExplorer/explorer.js Fri Nov 28 12:39:22 2014 +0100 +++ b/OrthancExplorer/explorer.js Thu Dec 04 17:04:40 2014 +0100 @@ -1023,3 +1023,46 @@ OpenAnonymizeResourceDialog('../patients/' + $.mobile.pageData.uuid, 'Anonymize this patient?'); }); + + +$('#plugins').live('pagebeforeshow', function() { + $.ajax({ + url: '../plugins', + dataType: 'json', + async: false, + cache: false, + success: function(plugins) { + var target = $('#all-plugins'); + $('li', target).remove(); + + plugins.map(function(id) { + return $.ajax({ + url: '../plugins/' + id, + dataType: 'json', + async: false, + cache: false, + success: function(plugin) { + var li = $('<li>'); + var item = li; + + if ('RootUri' in plugin) + { + item = $('<a>'); + li.append(item); + item.click(function() { + window.open(plugin.RootUri); + }); + } + + item.append($('<h1>').text(plugin.ID)); + item.append($('<p>').text(plugin.Description)); + item.append($('<span>').addClass('ui-li-count').text(plugin.Version)); + target.append(li); + } + }); + }); + + target.listview('refresh'); + } + }); +});