changeset 1555:b894072b9e2f

static JavaScript resources
author Sebastien Jodogne <s.jodogne@gmail.com>
date Mon, 17 Aug 2020 18:58:23 +0200
parents 6d14ed6163b1
children 8898f8f755c8
files Applications/StoneWebViewer/Plugin/CMakeLists.txt Applications/StoneWebViewer/Plugin/Plugin.cpp Applications/StoneWebViewer/WebApplication/index.html Applications/StoneWebViewer/WebAssembly/CMakeLists.txt Applications/StoneWebViewer/WebAssembly/JavaScriptLibraries.cmake Applications/StoneWebViewer/WebAssembly/StoneModule/CMakeLists.txt
diffstat 6 files changed, 92 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/Applications/StoneWebViewer/Plugin/CMakeLists.txt	Mon Aug 17 16:10:00 2020 +0200
+++ b/Applications/StoneWebViewer/Plugin/CMakeLists.txt	Mon Aug 17 18:58:23 2020 +0200
@@ -71,6 +71,9 @@
   # Folders
   IMAGES                 ${ORTHANC_STONE_BINARIES}/img/
   WEB_APPLICATION        ${CMAKE_SOURCE_DIR}/../WebApplication
+  LIBRARIES_CSS          ${ORTHANC_STONE_BINARIES}/css/
+  LIBRARIES_JS           ${ORTHANC_STONE_BINARIES}/js/
+  LIBRARIES_WEBFONTS     ${ORTHANC_STONE_BINARIES}/webfonts/
 
   # Individual files
   ORTHANC_EXPLORER       ${CMAKE_SOURCE_DIR}/OrthancExplorer.js
--- a/Applications/StoneWebViewer/Plugin/Plugin.cpp	Mon Aug 17 16:10:00 2020 +0200
+++ b/Applications/StoneWebViewer/Plugin/Plugin.cpp	Mon Aug 17 18:58:23 2020 +0200
@@ -206,6 +206,18 @@
       OrthancPlugins::RegisterRestCallback
         <ServeEmbeddedFolder<Orthanc::EmbeddedResources::IMAGES> >
         ("/stone-webviewer/img/(.*)", true);
+      
+      OrthancPlugins::RegisterRestCallback
+        <ServeEmbeddedFolder<Orthanc::EmbeddedResources::LIBRARIES_CSS> >
+        ("/stone-webviewer/css/(.*)", true);
+      
+      OrthancPlugins::RegisterRestCallback
+        <ServeEmbeddedFolder<Orthanc::EmbeddedResources::LIBRARIES_JS> >
+        ("/stone-webviewer/js/(.*)", true);
+      
+      OrthancPlugins::RegisterRestCallback
+        <ServeEmbeddedFolder<Orthanc::EmbeddedResources::LIBRARIES_WEBFONTS> >
+        ("/stone-webviewer/webfonts/(.*)", true);
 
       OrthancPlugins::RegisterRestCallback
         <ServeEmbeddedFolder<Orthanc::EmbeddedResources::WEB_APPLICATION> >
--- a/Applications/StoneWebViewer/WebApplication/index.html	Mon Aug 17 16:10:00 2020 +0200
+++ b/Applications/StoneWebViewer/WebApplication/index.html	Mon Aug 17 18:58:23 2020 +0200
@@ -8,9 +8,11 @@
     <meta name="apple-mobile-web-app-capable" content="yes" />
     <meta name="apple-mobile-web-app-status-bar-style" content="black-translucent" />
     <link rel="icon" href="data:;base64,iVBORw0KGgo=">
-    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.css">
-    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.4.1/css/bootstrap.css">
+    
+    <link rel="stylesheet" href="css/all.css">  <!-- Font Awesome -->
+    <link rel="stylesheet" href="css/bootstrap.css">
     <link href="https://fonts.googleapis.com/css?family=Open+Sans" rel="stylesheet">
+    
     <link rel="stylesheet" href="app.css">
 
     <!-- https://stackoverflow.com/a/16863182/881731 -->
@@ -310,19 +312,19 @@
             
             <div class="ng-scope inline-object">
               <button class="wvButton--underline text-center" id="windowing-popover">
-                <i class="fa fa-sun-o"></i>
+                <i class="fa fa-sun"></i>
               </button>
             </div>
 
             <div class="ng-scope inline-object">
               <button class="wvButton--underline text-center" v-on:click="FlipX()">
-                <i class="fas fa-exchange-alt"></i>X
+                <i class="fas fa-exchange-alt"></i>
               </button>
             </div>
 
             <div class="ng-scope inline-object">
               <button class="wvButton--underline text-center" v-on:click="FlipY()">
-                <i class="fa fa-exchange-alt fa-rotate-90"></i>Y
+                <i class="fas fa-exchange-alt fa-rotate-90"></i>
               </button>
             </div>
             
@@ -546,10 +548,10 @@
     </script>
 
 
-    <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.4.1/jquery.js"></script>
-    <script src="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.4.1/js/bootstrap.js"></script>
-    <script src="https://cdnjs.cloudflare.com/ajax/libs/vue/2.6.10/vue.js"></script>
-    <script src="https://cdnjs.cloudflare.com/ajax/libs/axios/0.19.0/axios.js"></script>
+    <script src="js/jquery-3.4.1.min.js"></script>
+    <script src="js/bootstrap.min.js"></script>
+    <script src="js/vue.min.js"></script>
+    <script src="js/axios.min.js"></script>
     
     <script src="stone.js"></script>
     <script src="app.js"></script>
--- a/Applications/StoneWebViewer/WebAssembly/CMakeLists.txt	Mon Aug 17 16:10:00 2020 +0200
+++ b/Applications/StoneWebViewer/WebAssembly/CMakeLists.txt	Mon Aug 17 18:58:23 2020 +0200
@@ -117,6 +117,8 @@
 # section above: it is considered to be the binary output of 
 # the linker.
 # ---------------------------------------------------------------
+include(${CMAKE_SOURCE_DIR}/JavaScriptLibraries.cmake)
+
 install(
   FILES
   ${CMAKE_CURRENT_BINARY_DIR}/StoneWebViewer.wasm
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Applications/StoneWebViewer/WebAssembly/JavaScriptLibraries.cmake	Mon Aug 17 18:58:23 2020 +0200
@@ -0,0 +1,63 @@
+set(BASE_URL "http://orthanc.osimis.io/ThirdPartyDownloads")
+
+DownloadPackage(
+  "f9746611d1d77072f5ce5a1d9e915c42"
+  "${BASE_URL}/fontawesome-free-5.14.0-web.zip"
+  "${CMAKE_CURRENT_BINARY_DIR}/fontawesome-free-5.14.0-web")
+
+DownloadPackage(
+  "b40f2ec8769ebee23a395fa2b907e4b4"
+  "${BASE_URL}/bootstrap-3.4.1-dist.zip"
+  "${CMAKE_CURRENT_BINARY_DIR}/bootstrap-3.4.1-dist")
+
+DownloadPackage(
+  "8242afdc5bd44105d9dc9e6535315484"
+  "${BASE_URL}/dicom-web/vuejs-2.6.10.tar.gz"
+  "${CMAKE_CURRENT_BINARY_DIR}/vue-2.6.10")
+
+DownloadPackage(
+  "3e2b4e1522661f7fcf8ad49cb933296c"
+  "${BASE_URL}/dicom-web/axios-0.19.0.tar.gz"
+  "${CMAKE_CURRENT_BINARY_DIR}/axios-0.19.0")
+
+DownloadFile(
+  "220afd743d9e9643852e31a135a9f3ae"
+  "${BASE_URL}/jquery-3.4.1.min.js")
+
+
+install(
+  FILES
+  ${CMAKE_CURRENT_BINARY_DIR}/fontawesome-free-5.14.0-web/css/all.css
+  ${CMAKE_CURRENT_BINARY_DIR}/bootstrap-3.4.1-dist/css/bootstrap.css
+  DESTINATION ${ORTHANC_STONE_INSTALL_PREFIX}/css
+  )
+
+install(
+  FILES
+  ${CMAKE_CURRENT_BINARY_DIR}/bootstrap-3.4.1-dist/js/bootstrap.min.js
+  ${CMAKE_SOURCE_DIR}/ThirdPartyDownloads/jquery-3.4.1.min.js
+  ${CMAKE_CURRENT_BINARY_DIR}/vue-2.6.10/dist/vue.min.js
+  ${CMAKE_CURRENT_BINARY_DIR}/axios-0.19.0/dist/axios.min.js
+  ${CMAKE_CURRENT_BINARY_DIR}/axios-0.19.0/dist/axios.min.map
+  DESTINATION ${ORTHANC_STONE_INSTALL_PREFIX}/js
+  )
+
+install(
+  FILES
+  ${CMAKE_CURRENT_BINARY_DIR}/fontawesome-free-5.14.0-web/webfonts/fa-brands-400.eot
+  ${CMAKE_CURRENT_BINARY_DIR}/fontawesome-free-5.14.0-web/webfonts/fa-brands-400.svg
+  ${CMAKE_CURRENT_BINARY_DIR}/fontawesome-free-5.14.0-web/webfonts/fa-brands-400.ttf
+  ${CMAKE_CURRENT_BINARY_DIR}/fontawesome-free-5.14.0-web/webfonts/fa-brands-400.woff
+  ${CMAKE_CURRENT_BINARY_DIR}/fontawesome-free-5.14.0-web/webfonts/fa-brands-400.woff2
+  ${CMAKE_CURRENT_BINARY_DIR}/fontawesome-free-5.14.0-web/webfonts/fa-regular-400.eot
+  ${CMAKE_CURRENT_BINARY_DIR}/fontawesome-free-5.14.0-web/webfonts/fa-regular-400.svg
+  ${CMAKE_CURRENT_BINARY_DIR}/fontawesome-free-5.14.0-web/webfonts/fa-regular-400.ttf
+  ${CMAKE_CURRENT_BINARY_DIR}/fontawesome-free-5.14.0-web/webfonts/fa-regular-400.woff
+  ${CMAKE_CURRENT_BINARY_DIR}/fontawesome-free-5.14.0-web/webfonts/fa-regular-400.woff2
+  ${CMAKE_CURRENT_BINARY_DIR}/fontawesome-free-5.14.0-web/webfonts/fa-solid-900.eot
+  ${CMAKE_CURRENT_BINARY_DIR}/fontawesome-free-5.14.0-web/webfonts/fa-solid-900.svg
+  ${CMAKE_CURRENT_BINARY_DIR}/fontawesome-free-5.14.0-web/webfonts/fa-solid-900.ttf
+  ${CMAKE_CURRENT_BINARY_DIR}/fontawesome-free-5.14.0-web/webfonts/fa-solid-900.woff
+  ${CMAKE_CURRENT_BINARY_DIR}/fontawesome-free-5.14.0-web/webfonts/fa-solid-900.woff2
+  DESTINATION ${ORTHANC_STONE_INSTALL_PREFIX}/webfonts
+  )
--- a/Applications/StoneWebViewer/WebAssembly/StoneModule/CMakeLists.txt	Mon Aug 17 16:10:00 2020 +0200
+++ b/Applications/StoneWebViewer/WebAssembly/StoneModule/CMakeLists.txt	Mon Aug 17 18:58:23 2020 +0200
@@ -44,6 +44,7 @@
 
 
 include(${CMAKE_SOURCE_DIR}/../../../../OrthancStone/Resources/Orthanc/CMake/Compiler.cmake)
+include(${CMAKE_SOURCE_DIR}/../../../../OrthancStone/Resources/Orthanc/CMake/DownloadPackage.cmake)
 
 add_definitions(
   -DORTHANC_STONE_MAX_TAG_LENGTH=256  # TODO => share with OrthancStone