Hello Everyone,
I have a question regarding the customization of a plugin UI in general, for example if I would like to modify the UI to have a new tool in the tool box and extend the orthanc-webviewer plugin. Is this easily possible? I can see the webapplication and also seen the respective javasript file responsible for this
https://hg.orthanc-server.com/orthanc-webviewer/file/tip/WebApplication/viewer.js
But how do one adapt this JS file and deploy it in Orthanc server? Is this possible at all?
I see that the cpp part of the plugin has been documented here in this link
https://book.orthanc-server.com/developers/creating-plugins.html#creating-plugins. But have not seen any mention about the UI part anywhere in the documentation, do we have this part documented somewhere else, in general the interaction between the native ccp plugin side and WebApplication?
I tried to build the cpp files using the build setup here and can also deploy the generated libOrthancWebViewer.so file at the plugins location (/usr/local/share/orthanc/plugins/) inside orthanc server. But could not find the means to modify the WebApplication and deploy it successfully in Orthanc server, I am not sure if this is possible at all or not meant to be done. Please let me know, thanks
Regards
Jithu
Hi Jithu,
The JS code is actually embedded in the C++ code. If you modify the JS code and rebuild the C++ code, it should contain your new version of JS code.
However, this is not very comfortable to develop so an other alternative is, e.g, to use the ServeFolders plugin and serve the WebApplication folder directly but you’ll have to download all the “external files” that are expected on the /libs endpoint and copy them in a separate folder:
Sample config file:
“Plugins” : [
“/home/alain/o/build/orthanc-webviewer/libOrthancWebViewer.so”,
“/home/alain/o/build/orthanc/libServeFolders.so”
],
“ServeFolders” : {
“/web-viewer-dev/app” : “/home/alain/o/orthanc-webviewer/WebApplication”,
“/web-viewer-dev/libs” : “/home/alain/o/orthanc-webviewer/WebApplication/downloaded-libs”
},
Then, you may open the viewer at web-viewer**-dev**/app/viewer.html?series=96b3b9d1-47b91bd6-c173d4e6-68a196e8-7102e07a
HTH
Alain.
Dear Alain,
Thank you so much for the detailed response, I tried compiling both the release version & debug, deployed them at the plugin location, but neither of which reflects the changed the html or javascript sides
Do I have to mention anything specifically in the build steps to enable this?
But the ServerFolders configuration worked and the respective pages were loaded, but I need to get the libs locally now! Otherwise where are html files deployed by default?
Also could you let me know if there is any more documentation (other than link) regarding the plugin loading and so, or do I have to go through the source to learn it?
Would it be possible to debug the plugin, in development setup, for e.g. to which process do I have to attach my debugger in order to debug the plugin?
Thanks again for the support and wish you a great weekend.
Regards
Jithu
I have just run cmake with -DALLOW_DOWNLOADS=ON and -DSTATIC_BUILD=ON and it rebuilds every time I modify viewer.html or the js code (when I run “make” again).
If you want to debug, you should build both Orthanc and the webviewer in debug mode (-DCMAKE_BUILD_TYPE=Debug) and attach the debugger process to Orthanc.
No, there’s no more documentation about plugin loading.
You can get the libs files by downloading them from your browser from the running plugin.
HTH
Alain.
Thanks for the response Alain, I tried with the flags you mentioned and it works now
I shall look into the debug side now,
Regards
Jithu