Mercurial > hg > orthanc-webviewer
comparison Plugin/Plugin.cpp @ 31:111689a2c177
fix issue #29
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Wed, 24 Jun 2015 16:20:41 +0200 |
parents | a6492d20b2a8 |
children | b3259b9c6dfb |
comparison
equal
deleted
inserted
replaced
30:ad7b6757965a | 31:111689a2c177 |
---|---|
178 } | 178 } |
179 #endif | 179 #endif |
180 | 180 |
181 | 181 |
182 | 182 |
183 template <enum OrthancPlugins::EmbeddedResources::DirectoryResourceId folder> | 183 template <enum Orthanc::EmbeddedResources::DirectoryResourceId folder> |
184 static int32_t ServeEmbeddedFolder(OrthancPluginRestOutput* output, | 184 static int32_t ServeEmbeddedFolder(OrthancPluginRestOutput* output, |
185 const char* url, | 185 const char* url, |
186 const OrthancPluginHttpRequest* request) | 186 const OrthancPluginHttpRequest* request) |
187 { | 187 { |
188 if (request->method != OrthancPluginHttpMethod_Get) | 188 if (request->method != OrthancPluginHttpMethod_Get) |
195 const char* mime = OrthancPlugins::GetMimeType(path); | 195 const char* mime = OrthancPlugins::GetMimeType(path); |
196 | 196 |
197 try | 197 try |
198 { | 198 { |
199 std::string s; | 199 std::string s; |
200 OrthancPlugins::EmbeddedResources::GetDirectoryResource(s, folder, path.c_str()); | 200 Orthanc::EmbeddedResources::GetDirectoryResource(s, folder, path.c_str()); |
201 | 201 |
202 const char* resource = s.size() ? s.c_str() : NULL; | 202 const char* resource = s.size() ? s.c_str() : NULL; |
203 OrthancPluginAnswerBuffer(context_, output, resource, s.size(), mime); | 203 OrthancPluginAnswerBuffer(context_, output, resource, s.size(), mime); |
204 | 204 |
205 return 0; | 205 return 0; |
375 | 375 |
376 /* Install the callbacks */ | 376 /* Install the callbacks */ |
377 OrthancPluginRegisterRestCallback(context_, "/web-viewer/series/(.*)", ServeCache<CacheBundle_SeriesInformation>); | 377 OrthancPluginRegisterRestCallback(context_, "/web-viewer/series/(.*)", ServeCache<CacheBundle_SeriesInformation>); |
378 OrthancPluginRegisterRestCallback(context_, "/web-viewer/is-stable-series/(.*)", IsStableSeries); | 378 OrthancPluginRegisterRestCallback(context_, "/web-viewer/is-stable-series/(.*)", IsStableSeries); |
379 OrthancPluginRegisterRestCallback(context_, "/web-viewer/instances/(.*)", ServeCache<CacheBundle_DecodedImage>); | 379 OrthancPluginRegisterRestCallback(context_, "/web-viewer/instances/(.*)", ServeCache<CacheBundle_DecodedImage>); |
380 OrthancPluginRegisterRestCallback(context, "/web-viewer/libs/(.*)", ServeEmbeddedFolder<EmbeddedResources::JAVASCRIPT_LIBS>); | 380 OrthancPluginRegisterRestCallback(context, "/web-viewer/libs/(.*)", ServeEmbeddedFolder<Orthanc::EmbeddedResources::JAVASCRIPT_LIBS>); |
381 | 381 |
382 #if ORTHANC_STANDALONE == 1 | 382 #if ORTHANC_STANDALONE == 1 |
383 OrthancPluginRegisterRestCallback(context, "/web-viewer/app/(.*)", ServeEmbeddedFolder<EmbeddedResources::WEB_VIEWER>); | 383 OrthancPluginRegisterRestCallback(context, "/web-viewer/app/(.*)", ServeEmbeddedFolder<Orthanc::EmbeddedResources::WEB_VIEWER>); |
384 #else | 384 #else |
385 OrthancPluginRegisterRestCallback(context, "/web-viewer/app/(.*)", ServeWebViewer); | 385 OrthancPluginRegisterRestCallback(context, "/web-viewer/app/(.*)", ServeWebViewer); |
386 #endif | 386 #endif |
387 | 387 |
388 OrthancPluginRegisterOnChangeCallback(context, OnChangeCallback); | 388 OrthancPluginRegisterOnChangeCallback(context, OnChangeCallback); |
389 | 389 |
390 | 390 |
391 /* Extend the default Orthanc Explorer with custom JavaScript */ | 391 /* Extend the default Orthanc Explorer with custom JavaScript */ |
392 std::string explorer; | 392 std::string explorer; |
393 EmbeddedResources::GetFileResource(explorer, EmbeddedResources::ORTHANC_EXPLORER); | 393 Orthanc::EmbeddedResources::GetFileResource(explorer, Orthanc::EmbeddedResources::ORTHANC_EXPLORER); |
394 OrthancPluginExtendOrthancExplorer(context_, explorer.c_str()); | 394 OrthancPluginExtendOrthancExplorer(context_, explorer.c_str()); |
395 | 395 |
396 return 0; | 396 return 0; |
397 } | 397 } |
398 | 398 |