Mercurial > hg > orthanc
annotate Plugins/Samples/ServeFolders/Plugin.cpp @ 1813:5fc11b79b406
fix msvc build
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Tue, 24 Nov 2015 09:15:53 +0100 |
parents | 77c4cc4def0f |
children | b1291df2f780 |
rev | line source |
---|---|
1322
f497a72d9f71
fixes to the sample plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1 /** |
f497a72d9f71
fixes to the sample plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2 * Orthanc - A Lightweight, RESTful DICOM Store |
f497a72d9f71
fixes to the sample plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3 * Copyright (C) 2012-2015 Sebastien Jodogne, Medical Physics |
f497a72d9f71
fixes to the sample plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
4 * Department, University Hospital of Liege, Belgium |
f497a72d9f71
fixes to the sample plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
5 * |
1375
3d76e26b3865
fix licensing terms of samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1323
diff
changeset
|
6 * This program is free software: you can redistribute it and/or |
3d76e26b3865
fix licensing terms of samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1323
diff
changeset
|
7 * modify it under the terms of the GNU General Public License as |
3d76e26b3865
fix licensing terms of samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1323
diff
changeset
|
8 * published by the Free Software Foundation, either version 3 of the |
3d76e26b3865
fix licensing terms of samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1323
diff
changeset
|
9 * License, or (at your option) any later version. |
3d76e26b3865
fix licensing terms of samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1323
diff
changeset
|
10 * |
3d76e26b3865
fix licensing terms of samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1323
diff
changeset
|
11 * This program is distributed in the hope that it will be useful, but |
3d76e26b3865
fix licensing terms of samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1323
diff
changeset
|
12 * WITHOUT ANY WARRANTY; without even the implied warranty of |
3d76e26b3865
fix licensing terms of samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1323
diff
changeset
|
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
3d76e26b3865
fix licensing terms of samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1323
diff
changeset
|
14 * General Public License for more details. |
1322
f497a72d9f71
fixes to the sample plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
15 * |
1375
3d76e26b3865
fix licensing terms of samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1323
diff
changeset
|
16 * You should have received a copy of the GNU General Public License |
3d76e26b3865
fix licensing terms of samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1323
diff
changeset
|
17 * along with this program. If not, see <http://www.gnu.org/licenses/>. |
1322
f497a72d9f71
fixes to the sample plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
18 **/ |
f497a72d9f71
fixes to the sample plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
19 |
f497a72d9f71
fixes to the sample plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
20 |
1425
97268448bdfc
refactoring of samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1391
diff
changeset
|
21 #include <orthanc/OrthancCPlugin.h> |
1322
f497a72d9f71
fixes to the sample plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
22 |
1323
5a92665dee23
Sample plugin: Serve folders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1322
diff
changeset
|
23 #include <json/reader.h> |
5a92665dee23
Sample plugin: Serve folders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1322
diff
changeset
|
24 #include <json/value.h> |
1589
334d3a92ed83
improvements to the ServeFolders plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1588
diff
changeset
|
25 #include <boost/filesystem.hpp> |
334d3a92ed83
improvements to the ServeFolders plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1588
diff
changeset
|
26 |
1322
f497a72d9f71
fixes to the sample plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
27 |
f497a72d9f71
fixes to the sample plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
28 static OrthancPluginContext* context_ = NULL; |
1323
5a92665dee23
Sample plugin: Serve folders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1322
diff
changeset
|
29 static std::map<std::string, std::string> folders_; |
5a92665dee23
Sample plugin: Serve folders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1322
diff
changeset
|
30 static const char* INDEX_URI = "/app/plugin-serve-folders.html"; |
5a92665dee23
Sample plugin: Serve folders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1322
diff
changeset
|
31 |
5a92665dee23
Sample plugin: Serve folders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1322
diff
changeset
|
32 |
5a92665dee23
Sample plugin: Serve folders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1322
diff
changeset
|
33 static const char* GetMimeType(const std::string& path) |
5a92665dee23
Sample plugin: Serve folders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1322
diff
changeset
|
34 { |
5a92665dee23
Sample plugin: Serve folders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1322
diff
changeset
|
35 size_t dot = path.find_last_of('.'); |
5a92665dee23
Sample plugin: Serve folders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1322
diff
changeset
|
36 |
5a92665dee23
Sample plugin: Serve folders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1322
diff
changeset
|
37 std::string extension = (dot == std::string::npos) ? "" : path.substr(dot); |
5a92665dee23
Sample plugin: Serve folders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1322
diff
changeset
|
38 std::transform(extension.begin(), extension.end(), extension.begin(), tolower); |
5a92665dee23
Sample plugin: Serve folders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1322
diff
changeset
|
39 |
5a92665dee23
Sample plugin: Serve folders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1322
diff
changeset
|
40 if (extension == ".html") |
5a92665dee23
Sample plugin: Serve folders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1322
diff
changeset
|
41 { |
5a92665dee23
Sample plugin: Serve folders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1322
diff
changeset
|
42 return "text/html"; |
5a92665dee23
Sample plugin: Serve folders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1322
diff
changeset
|
43 } |
5a92665dee23
Sample plugin: Serve folders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1322
diff
changeset
|
44 else if (extension == ".css") |
5a92665dee23
Sample plugin: Serve folders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1322
diff
changeset
|
45 { |
5a92665dee23
Sample plugin: Serve folders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1322
diff
changeset
|
46 return "text/css"; |
5a92665dee23
Sample plugin: Serve folders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1322
diff
changeset
|
47 } |
5a92665dee23
Sample plugin: Serve folders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1322
diff
changeset
|
48 else if (extension == ".js") |
5a92665dee23
Sample plugin: Serve folders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1322
diff
changeset
|
49 { |
5a92665dee23
Sample plugin: Serve folders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1322
diff
changeset
|
50 return "application/javascript"; |
5a92665dee23
Sample plugin: Serve folders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1322
diff
changeset
|
51 } |
5a92665dee23
Sample plugin: Serve folders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1322
diff
changeset
|
52 else if (extension == ".gif") |
5a92665dee23
Sample plugin: Serve folders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1322
diff
changeset
|
53 { |
5a92665dee23
Sample plugin: Serve folders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1322
diff
changeset
|
54 return "image/gif"; |
5a92665dee23
Sample plugin: Serve folders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1322
diff
changeset
|
55 } |
5a92665dee23
Sample plugin: Serve folders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1322
diff
changeset
|
56 else if (extension == ".svg") |
5a92665dee23
Sample plugin: Serve folders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1322
diff
changeset
|
57 { |
5a92665dee23
Sample plugin: Serve folders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1322
diff
changeset
|
58 return "image/svg+xml"; |
5a92665dee23
Sample plugin: Serve folders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1322
diff
changeset
|
59 } |
5a92665dee23
Sample plugin: Serve folders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1322
diff
changeset
|
60 else if (extension == ".json") |
5a92665dee23
Sample plugin: Serve folders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1322
diff
changeset
|
61 { |
5a92665dee23
Sample plugin: Serve folders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1322
diff
changeset
|
62 return "application/json"; |
5a92665dee23
Sample plugin: Serve folders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1322
diff
changeset
|
63 } |
5a92665dee23
Sample plugin: Serve folders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1322
diff
changeset
|
64 else if (extension == ".xml") |
5a92665dee23
Sample plugin: Serve folders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1322
diff
changeset
|
65 { |
5a92665dee23
Sample plugin: Serve folders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1322
diff
changeset
|
66 return "application/xml"; |
5a92665dee23
Sample plugin: Serve folders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1322
diff
changeset
|
67 } |
5a92665dee23
Sample plugin: Serve folders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1322
diff
changeset
|
68 else if (extension == ".png") |
5a92665dee23
Sample plugin: Serve folders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1322
diff
changeset
|
69 { |
5a92665dee23
Sample plugin: Serve folders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1322
diff
changeset
|
70 return "image/png"; |
5a92665dee23
Sample plugin: Serve folders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1322
diff
changeset
|
71 } |
5a92665dee23
Sample plugin: Serve folders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1322
diff
changeset
|
72 else if (extension == ".jpg" || extension == ".jpeg") |
5a92665dee23
Sample plugin: Serve folders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1322
diff
changeset
|
73 { |
5a92665dee23
Sample plugin: Serve folders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1322
diff
changeset
|
74 return "image/jpeg"; |
5a92665dee23
Sample plugin: Serve folders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1322
diff
changeset
|
75 } |
1434
f9cd40166269
refactoring of OrthancPlugins, improvement in ServeFolders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1425
diff
changeset
|
76 else if (extension == ".woff") |
f9cd40166269
refactoring of OrthancPlugins, improvement in ServeFolders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1425
diff
changeset
|
77 { |
f9cd40166269
refactoring of OrthancPlugins, improvement in ServeFolders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1425
diff
changeset
|
78 return "application/x-font-woff"; |
f9cd40166269
refactoring of OrthancPlugins, improvement in ServeFolders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1425
diff
changeset
|
79 } |
1323
5a92665dee23
Sample plugin: Serve folders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1322
diff
changeset
|
80 else |
5a92665dee23
Sample plugin: Serve folders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1322
diff
changeset
|
81 { |
5a92665dee23
Sample plugin: Serve folders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1322
diff
changeset
|
82 std::string s = "Unknown MIME type for extension: " + extension; |
5a92665dee23
Sample plugin: Serve folders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1322
diff
changeset
|
83 OrthancPluginLogWarning(context_, s.c_str()); |
5a92665dee23
Sample plugin: Serve folders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1322
diff
changeset
|
84 return "application/octet-stream"; |
5a92665dee23
Sample plugin: Serve folders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1322
diff
changeset
|
85 } |
5a92665dee23
Sample plugin: Serve folders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1322
diff
changeset
|
86 } |
5a92665dee23
Sample plugin: Serve folders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1322
diff
changeset
|
87 |
1322
f497a72d9f71
fixes to the sample plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
88 |
1588
b5bc87a7212d
OrthancPluginReadFile, OrthancPluginWriteFile
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1434
diff
changeset
|
89 static bool ReadFile(std::string& target, |
1323
5a92665dee23
Sample plugin: Serve folders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1322
diff
changeset
|
90 const std::string& path) |
5a92665dee23
Sample plugin: Serve folders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1322
diff
changeset
|
91 { |
1588
b5bc87a7212d
OrthancPluginReadFile, OrthancPluginWriteFile
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1434
diff
changeset
|
92 OrthancPluginMemoryBuffer buffer; |
b5bc87a7212d
OrthancPluginReadFile, OrthancPluginWriteFile
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1434
diff
changeset
|
93 if (OrthancPluginReadFile(context_, &buffer, path.c_str())) |
1323
5a92665dee23
Sample plugin: Serve folders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1322
diff
changeset
|
94 { |
5a92665dee23
Sample plugin: Serve folders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1322
diff
changeset
|
95 return false; |
5a92665dee23
Sample plugin: Serve folders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1322
diff
changeset
|
96 } |
1588
b5bc87a7212d
OrthancPluginReadFile, OrthancPluginWriteFile
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1434
diff
changeset
|
97 else |
1323
5a92665dee23
Sample plugin: Serve folders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1322
diff
changeset
|
98 { |
1588
b5bc87a7212d
OrthancPluginReadFile, OrthancPluginWriteFile
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1434
diff
changeset
|
99 target.assign(reinterpret_cast<const char*>(buffer.data), buffer.size); |
b5bc87a7212d
OrthancPluginReadFile, OrthancPluginWriteFile
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1434
diff
changeset
|
100 OrthancPluginFreeMemoryBuffer(context_, &buffer); |
b5bc87a7212d
OrthancPluginReadFile, OrthancPluginWriteFile
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1434
diff
changeset
|
101 return true; |
1323
5a92665dee23
Sample plugin: Serve folders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1322
diff
changeset
|
102 } |
5a92665dee23
Sample plugin: Serve folders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1322
diff
changeset
|
103 } |
5a92665dee23
Sample plugin: Serve folders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1322
diff
changeset
|
104 |
5a92665dee23
Sample plugin: Serve folders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1322
diff
changeset
|
105 |
5a92665dee23
Sample plugin: Serve folders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1322
diff
changeset
|
106 static bool ReadConfiguration(Json::Value& configuration, |
5a92665dee23
Sample plugin: Serve folders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1322
diff
changeset
|
107 OrthancPluginContext* context) |
1322
f497a72d9f71
fixes to the sample plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
108 { |
1425
97268448bdfc
refactoring of samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1391
diff
changeset
|
109 std::string s; |
1323
5a92665dee23
Sample plugin: Serve folders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1322
diff
changeset
|
110 |
5a92665dee23
Sample plugin: Serve folders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1322
diff
changeset
|
111 { |
1425
97268448bdfc
refactoring of samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1391
diff
changeset
|
112 char* tmp = OrthancPluginGetConfiguration(context); |
97268448bdfc
refactoring of samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1391
diff
changeset
|
113 if (tmp == NULL) |
1323
5a92665dee23
Sample plugin: Serve folders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1322
diff
changeset
|
114 { |
1425
97268448bdfc
refactoring of samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1391
diff
changeset
|
115 OrthancPluginLogError(context, "Error while retrieving the configuration from Orthanc"); |
1323
5a92665dee23
Sample plugin: Serve folders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1322
diff
changeset
|
116 return false; |
5a92665dee23
Sample plugin: Serve folders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1322
diff
changeset
|
117 } |
5a92665dee23
Sample plugin: Serve folders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1322
diff
changeset
|
118 |
1425
97268448bdfc
refactoring of samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1391
diff
changeset
|
119 s.assign(tmp); |
97268448bdfc
refactoring of samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1391
diff
changeset
|
120 OrthancPluginFreeString(context, tmp); |
1323
5a92665dee23
Sample plugin: Serve folders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1322
diff
changeset
|
121 } |
5a92665dee23
Sample plugin: Serve folders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1322
diff
changeset
|
122 |
5a92665dee23
Sample plugin: Serve folders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1322
diff
changeset
|
123 Json::Reader reader; |
1425
97268448bdfc
refactoring of samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1391
diff
changeset
|
124 if (reader.parse(s, configuration)) |
1323
5a92665dee23
Sample plugin: Serve folders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1322
diff
changeset
|
125 { |
1425
97268448bdfc
refactoring of samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1391
diff
changeset
|
126 return true; |
97268448bdfc
refactoring of samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1391
diff
changeset
|
127 } |
97268448bdfc
refactoring of samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1391
diff
changeset
|
128 else |
97268448bdfc
refactoring of samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1391
diff
changeset
|
129 { |
97268448bdfc
refactoring of samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1391
diff
changeset
|
130 OrthancPluginLogError(context, "Unable to parse the configuration"); |
1323
5a92665dee23
Sample plugin: Serve folders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1322
diff
changeset
|
131 return false; |
5a92665dee23
Sample plugin: Serve folders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1322
diff
changeset
|
132 } |
5a92665dee23
Sample plugin: Serve folders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1322
diff
changeset
|
133 } |
5a92665dee23
Sample plugin: Serve folders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1322
diff
changeset
|
134 |
5a92665dee23
Sample plugin: Serve folders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1322
diff
changeset
|
135 |
1589
334d3a92ed83
improvements to the ServeFolders plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1588
diff
changeset
|
136 |
334d3a92ed83
improvements to the ServeFolders plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1588
diff
changeset
|
137 static bool LookupFolder(std::string& folder, |
334d3a92ed83
improvements to the ServeFolders plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1588
diff
changeset
|
138 OrthancPluginRestOutput* output, |
334d3a92ed83
improvements to the ServeFolders plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1588
diff
changeset
|
139 const OrthancPluginHttpRequest* request) |
334d3a92ed83
improvements to the ServeFolders plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1588
diff
changeset
|
140 { |
334d3a92ed83
improvements to the ServeFolders plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1588
diff
changeset
|
141 const std::string uri = request->groups[0]; |
334d3a92ed83
improvements to the ServeFolders plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1588
diff
changeset
|
142 |
334d3a92ed83
improvements to the ServeFolders plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1588
diff
changeset
|
143 std::map<std::string, std::string>::const_iterator found = folders_.find(uri); |
334d3a92ed83
improvements to the ServeFolders plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1588
diff
changeset
|
144 if (found == folders_.end()) |
334d3a92ed83
improvements to the ServeFolders plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1588
diff
changeset
|
145 { |
334d3a92ed83
improvements to the ServeFolders plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1588
diff
changeset
|
146 std::string s = "Unknown URI in plugin server-folders: " + uri; |
334d3a92ed83
improvements to the ServeFolders plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1588
diff
changeset
|
147 OrthancPluginLogError(context_, s.c_str()); |
334d3a92ed83
improvements to the ServeFolders plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1588
diff
changeset
|
148 OrthancPluginSendHttpStatusCode(context_, output, 404); |
334d3a92ed83
improvements to the ServeFolders plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1588
diff
changeset
|
149 return false; |
334d3a92ed83
improvements to the ServeFolders plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1588
diff
changeset
|
150 } |
334d3a92ed83
improvements to the ServeFolders plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1588
diff
changeset
|
151 else |
334d3a92ed83
improvements to the ServeFolders plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1588
diff
changeset
|
152 { |
334d3a92ed83
improvements to the ServeFolders plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1588
diff
changeset
|
153 folder = found->second; |
334d3a92ed83
improvements to the ServeFolders plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1588
diff
changeset
|
154 return true; |
334d3a92ed83
improvements to the ServeFolders plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1588
diff
changeset
|
155 } |
334d3a92ed83
improvements to the ServeFolders plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1588
diff
changeset
|
156 } |
334d3a92ed83
improvements to the ServeFolders plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1588
diff
changeset
|
157 |
334d3a92ed83
improvements to the ServeFolders plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1588
diff
changeset
|
158 |
1628
77c4cc4def0f
OrthancPluginErrorCode in REST callbacks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1597
diff
changeset
|
159 static OrthancPluginErrorCode FolderCallback(OrthancPluginRestOutput* output, |
77c4cc4def0f
OrthancPluginErrorCode in REST callbacks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1597
diff
changeset
|
160 const char* url, |
77c4cc4def0f
OrthancPluginErrorCode in REST callbacks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1597
diff
changeset
|
161 const OrthancPluginHttpRequest* request) |
1323
5a92665dee23
Sample plugin: Serve folders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1322
diff
changeset
|
162 { |
1597
415dfd1d1c61
Improvements to the sample "ServeFolders" plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1589
diff
changeset
|
163 namespace fs = boost::filesystem; |
415dfd1d1c61
Improvements to the sample "ServeFolders" plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1589
diff
changeset
|
164 |
1323
5a92665dee23
Sample plugin: Serve folders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1322
diff
changeset
|
165 if (request->method != OrthancPluginHttpMethod_Get) |
5a92665dee23
Sample plugin: Serve folders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1322
diff
changeset
|
166 { |
5a92665dee23
Sample plugin: Serve folders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1322
diff
changeset
|
167 OrthancPluginSendMethodNotAllowed(context_, output, "GET"); |
1628
77c4cc4def0f
OrthancPluginErrorCode in REST callbacks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1597
diff
changeset
|
168 return OrthancPluginErrorCode_Success; |
1323
5a92665dee23
Sample plugin: Serve folders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1322
diff
changeset
|
169 } |
5a92665dee23
Sample plugin: Serve folders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1322
diff
changeset
|
170 |
1589
334d3a92ed83
improvements to the ServeFolders plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1588
diff
changeset
|
171 std::string folder; |
1323
5a92665dee23
Sample plugin: Serve folders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1322
diff
changeset
|
172 |
1589
334d3a92ed83
improvements to the ServeFolders plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1588
diff
changeset
|
173 if (LookupFolder(folder, output, request)) |
1323
5a92665dee23
Sample plugin: Serve folders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1322
diff
changeset
|
174 { |
1597
415dfd1d1c61
Improvements to the sample "ServeFolders" plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1589
diff
changeset
|
175 const fs::path item(request->groups[1]); |
415dfd1d1c61
Improvements to the sample "ServeFolders" plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1589
diff
changeset
|
176 const fs::path parent((fs::path(folder) / item).parent_path()); |
1589
334d3a92ed83
improvements to the ServeFolders plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1588
diff
changeset
|
177 |
1597
415dfd1d1c61
Improvements to the sample "ServeFolders" plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1589
diff
changeset
|
178 if (item.filename().string() == "index.html" && |
415dfd1d1c61
Improvements to the sample "ServeFolders" plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1589
diff
changeset
|
179 fs::is_directory(parent) && |
415dfd1d1c61
Improvements to the sample "ServeFolders" plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1589
diff
changeset
|
180 !fs::is_regular_file(fs::path(folder) / item)) |
415dfd1d1c61
Improvements to the sample "ServeFolders" plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1589
diff
changeset
|
181 { |
415dfd1d1c61
Improvements to the sample "ServeFolders" plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1589
diff
changeset
|
182 // On-the-fly generation of an "index.html" |
415dfd1d1c61
Improvements to the sample "ServeFolders" plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1589
diff
changeset
|
183 std::string s; |
415dfd1d1c61
Improvements to the sample "ServeFolders" plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1589
diff
changeset
|
184 s += "<html>\n"; |
415dfd1d1c61
Improvements to the sample "ServeFolders" plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1589
diff
changeset
|
185 s += " <body>\n"; |
415dfd1d1c61
Improvements to the sample "ServeFolders" plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1589
diff
changeset
|
186 s += " <ul>\n"; |
415dfd1d1c61
Improvements to the sample "ServeFolders" plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1589
diff
changeset
|
187 |
415dfd1d1c61
Improvements to the sample "ServeFolders" plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1589
diff
changeset
|
188 fs::directory_iterator end; |
1323
5a92665dee23
Sample plugin: Serve folders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1322
diff
changeset
|
189 |
1597
415dfd1d1c61
Improvements to the sample "ServeFolders" plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1589
diff
changeset
|
190 for (fs::directory_iterator it(parent) ; it != end; ++it) |
415dfd1d1c61
Improvements to the sample "ServeFolders" plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1589
diff
changeset
|
191 { |
415dfd1d1c61
Improvements to the sample "ServeFolders" plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1589
diff
changeset
|
192 if (fs::is_directory(it->status())) |
415dfd1d1c61
Improvements to the sample "ServeFolders" plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1589
diff
changeset
|
193 { |
415dfd1d1c61
Improvements to the sample "ServeFolders" plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1589
diff
changeset
|
194 std::string f = it->path().filename().string(); |
415dfd1d1c61
Improvements to the sample "ServeFolders" plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1589
diff
changeset
|
195 s += " <li><a href=\"" + f + "/index.html\">" + f + "/</a></li>\n"; |
415dfd1d1c61
Improvements to the sample "ServeFolders" plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1589
diff
changeset
|
196 } |
415dfd1d1c61
Improvements to the sample "ServeFolders" plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1589
diff
changeset
|
197 } |
415dfd1d1c61
Improvements to the sample "ServeFolders" plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1589
diff
changeset
|
198 |
415dfd1d1c61
Improvements to the sample "ServeFolders" plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1589
diff
changeset
|
199 for (fs::directory_iterator it(parent) ; it != end; ++it) |
415dfd1d1c61
Improvements to the sample "ServeFolders" plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1589
diff
changeset
|
200 { |
415dfd1d1c61
Improvements to the sample "ServeFolders" plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1589
diff
changeset
|
201 if (fs::is_regular_file(it->status())) |
415dfd1d1c61
Improvements to the sample "ServeFolders" plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1589
diff
changeset
|
202 { |
415dfd1d1c61
Improvements to the sample "ServeFolders" plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1589
diff
changeset
|
203 std::string f = it->path().filename().string(); |
415dfd1d1c61
Improvements to the sample "ServeFolders" plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1589
diff
changeset
|
204 s += " <li><a href=\"" + f + "\">" + f + "</a></li>\n"; |
415dfd1d1c61
Improvements to the sample "ServeFolders" plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1589
diff
changeset
|
205 } |
415dfd1d1c61
Improvements to the sample "ServeFolders" plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1589
diff
changeset
|
206 } |
415dfd1d1c61
Improvements to the sample "ServeFolders" plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1589
diff
changeset
|
207 |
415dfd1d1c61
Improvements to the sample "ServeFolders" plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1589
diff
changeset
|
208 s += " </ul>\n"; |
415dfd1d1c61
Improvements to the sample "ServeFolders" plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1589
diff
changeset
|
209 s += " </body>\n"; |
415dfd1d1c61
Improvements to the sample "ServeFolders" plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1589
diff
changeset
|
210 s += "</html>\n"; |
415dfd1d1c61
Improvements to the sample "ServeFolders" plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1589
diff
changeset
|
211 |
415dfd1d1c61
Improvements to the sample "ServeFolders" plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1589
diff
changeset
|
212 OrthancPluginAnswerBuffer(context_, output, s.c_str(), s.size(), "text/html"); |
1589
334d3a92ed83
improvements to the ServeFolders plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1588
diff
changeset
|
213 } |
334d3a92ed83
improvements to the ServeFolders plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1588
diff
changeset
|
214 else |
334d3a92ed83
improvements to the ServeFolders plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1588
diff
changeset
|
215 { |
1597
415dfd1d1c61
Improvements to the sample "ServeFolders" plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1589
diff
changeset
|
216 std::string path = folder + "/" + item.string(); |
415dfd1d1c61
Improvements to the sample "ServeFolders" plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1589
diff
changeset
|
217 const char* mime = GetMimeType(path); |
415dfd1d1c61
Improvements to the sample "ServeFolders" plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1589
diff
changeset
|
218 |
415dfd1d1c61
Improvements to the sample "ServeFolders" plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1589
diff
changeset
|
219 std::string s; |
415dfd1d1c61
Improvements to the sample "ServeFolders" plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1589
diff
changeset
|
220 if (ReadFile(s, path)) |
415dfd1d1c61
Improvements to the sample "ServeFolders" plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1589
diff
changeset
|
221 { |
415dfd1d1c61
Improvements to the sample "ServeFolders" plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1589
diff
changeset
|
222 const char* resource = s.size() ? s.c_str() : NULL; |
415dfd1d1c61
Improvements to the sample "ServeFolders" plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1589
diff
changeset
|
223 OrthancPluginAnswerBuffer(context_, output, resource, s.size(), mime); |
415dfd1d1c61
Improvements to the sample "ServeFolders" plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1589
diff
changeset
|
224 } |
415dfd1d1c61
Improvements to the sample "ServeFolders" plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1589
diff
changeset
|
225 else |
415dfd1d1c61
Improvements to the sample "ServeFolders" plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1589
diff
changeset
|
226 { |
415dfd1d1c61
Improvements to the sample "ServeFolders" plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1589
diff
changeset
|
227 std::string s = "Inexistent file in served folder: " + path; |
415dfd1d1c61
Improvements to the sample "ServeFolders" plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1589
diff
changeset
|
228 OrthancPluginLogError(context_, s.c_str()); |
415dfd1d1c61
Improvements to the sample "ServeFolders" plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1589
diff
changeset
|
229 OrthancPluginSendHttpStatusCode(context_, output, 404); |
415dfd1d1c61
Improvements to the sample "ServeFolders" plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1589
diff
changeset
|
230 } |
1589
334d3a92ed83
improvements to the ServeFolders plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1588
diff
changeset
|
231 } |
1323
5a92665dee23
Sample plugin: Serve folders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1322
diff
changeset
|
232 } |
5a92665dee23
Sample plugin: Serve folders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1322
diff
changeset
|
233 |
1628
77c4cc4def0f
OrthancPluginErrorCode in REST callbacks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1597
diff
changeset
|
234 return OrthancPluginErrorCode_Success; |
1323
5a92665dee23
Sample plugin: Serve folders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1322
diff
changeset
|
235 } |
5a92665dee23
Sample plugin: Serve folders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1322
diff
changeset
|
236 |
5a92665dee23
Sample plugin: Serve folders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1322
diff
changeset
|
237 |
1628
77c4cc4def0f
OrthancPluginErrorCode in REST callbacks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1597
diff
changeset
|
238 static OrthancPluginErrorCode ListServedFolders(OrthancPluginRestOutput* output, |
77c4cc4def0f
OrthancPluginErrorCode in REST callbacks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1597
diff
changeset
|
239 const char* url, |
77c4cc4def0f
OrthancPluginErrorCode in REST callbacks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1597
diff
changeset
|
240 const OrthancPluginHttpRequest* request) |
1323
5a92665dee23
Sample plugin: Serve folders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1322
diff
changeset
|
241 { |
5a92665dee23
Sample plugin: Serve folders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1322
diff
changeset
|
242 if (request->method != OrthancPluginHttpMethod_Get) |
5a92665dee23
Sample plugin: Serve folders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1322
diff
changeset
|
243 { |
5a92665dee23
Sample plugin: Serve folders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1322
diff
changeset
|
244 OrthancPluginSendMethodNotAllowed(context_, output, "GET"); |
1628
77c4cc4def0f
OrthancPluginErrorCode in REST callbacks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1597
diff
changeset
|
245 return OrthancPluginErrorCode_Success; |
1323
5a92665dee23
Sample plugin: Serve folders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1322
diff
changeset
|
246 } |
5a92665dee23
Sample plugin: Serve folders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1322
diff
changeset
|
247 |
1434
f9cd40166269
refactoring of OrthancPlugins, improvement in ServeFolders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1425
diff
changeset
|
248 std::string s = "<html><body><h1>Additional folders served by Orthanc</h1>\n"; |
1323
5a92665dee23
Sample plugin: Serve folders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1322
diff
changeset
|
249 |
1434
f9cd40166269
refactoring of OrthancPlugins, improvement in ServeFolders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1425
diff
changeset
|
250 if (folders_.empty()) |
f9cd40166269
refactoring of OrthancPlugins, improvement in ServeFolders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1425
diff
changeset
|
251 { |
f9cd40166269
refactoring of OrthancPlugins, improvement in ServeFolders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1425
diff
changeset
|
252 s += "<p>Empty section <tt>ServeFolders</tt> in your configuration file: No additional folder is served.</p>\n"; |
f9cd40166269
refactoring of OrthancPlugins, improvement in ServeFolders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1425
diff
changeset
|
253 } |
f9cd40166269
refactoring of OrthancPlugins, improvement in ServeFolders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1425
diff
changeset
|
254 else |
1323
5a92665dee23
Sample plugin: Serve folders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1322
diff
changeset
|
255 { |
1434
f9cd40166269
refactoring of OrthancPlugins, improvement in ServeFolders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1425
diff
changeset
|
256 s += "<ul>\n"; |
f9cd40166269
refactoring of OrthancPlugins, improvement in ServeFolders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1425
diff
changeset
|
257 for (std::map<std::string, std::string>::const_iterator |
f9cd40166269
refactoring of OrthancPlugins, improvement in ServeFolders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1425
diff
changeset
|
258 it = folders_.begin(); it != folders_.end(); ++it) |
f9cd40166269
refactoring of OrthancPlugins, improvement in ServeFolders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1425
diff
changeset
|
259 { |
1597
415dfd1d1c61
Improvements to the sample "ServeFolders" plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1589
diff
changeset
|
260 // The URI is relative to INDEX_URI ("/app/plugin-serve-folders.html") |
415dfd1d1c61
Improvements to the sample "ServeFolders" plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1589
diff
changeset
|
261 s += "<li><a href=\"../" + it->first + "/index.html\">" + it->first + "</li>\n"; |
1434
f9cd40166269
refactoring of OrthancPlugins, improvement in ServeFolders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1425
diff
changeset
|
262 } |
f9cd40166269
refactoring of OrthancPlugins, improvement in ServeFolders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1425
diff
changeset
|
263 |
f9cd40166269
refactoring of OrthancPlugins, improvement in ServeFolders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1425
diff
changeset
|
264 s += "</ul>\n"; |
1323
5a92665dee23
Sample plugin: Serve folders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1322
diff
changeset
|
265 } |
5a92665dee23
Sample plugin: Serve folders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1322
diff
changeset
|
266 |
1434
f9cd40166269
refactoring of OrthancPlugins, improvement in ServeFolders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1425
diff
changeset
|
267 s += "</body></html>\n"; |
1323
5a92665dee23
Sample plugin: Serve folders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1322
diff
changeset
|
268 |
5a92665dee23
Sample plugin: Serve folders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1322
diff
changeset
|
269 OrthancPluginAnswerBuffer(context_, output, s.c_str(), s.size(), "text/html"); |
5a92665dee23
Sample plugin: Serve folders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1322
diff
changeset
|
270 |
1628
77c4cc4def0f
OrthancPluginErrorCode in REST callbacks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1597
diff
changeset
|
271 return OrthancPluginErrorCode_Success; |
1322
f497a72d9f71
fixes to the sample plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
272 } |
f497a72d9f71
fixes to the sample plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
273 |
f497a72d9f71
fixes to the sample plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
274 |
f497a72d9f71
fixes to the sample plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
275 extern "C" |
f497a72d9f71
fixes to the sample plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
276 { |
f497a72d9f71
fixes to the sample plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
277 ORTHANC_PLUGINS_API int32_t OrthancPluginInitialize(OrthancPluginContext* context) |
f497a72d9f71
fixes to the sample plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
278 { |
f497a72d9f71
fixes to the sample plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
279 context_ = context; |
f497a72d9f71
fixes to the sample plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
280 |
f497a72d9f71
fixes to the sample plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
281 /* Check the version of the Orthanc core */ |
f497a72d9f71
fixes to the sample plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
282 if (OrthancPluginCheckVersion(context_) == 0) |
f497a72d9f71
fixes to the sample plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
283 { |
f497a72d9f71
fixes to the sample plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
284 char info[1024]; |
f497a72d9f71
fixes to the sample plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
285 sprintf(info, "Your version of Orthanc (%s) must be above %d.%d.%d to run this plugin", |
f497a72d9f71
fixes to the sample plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
286 context_->orthancVersion, |
f497a72d9f71
fixes to the sample plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
287 ORTHANC_PLUGINS_MINIMAL_MAJOR_NUMBER, |
f497a72d9f71
fixes to the sample plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
288 ORTHANC_PLUGINS_MINIMAL_MINOR_NUMBER, |
f497a72d9f71
fixes to the sample plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
289 ORTHANC_PLUGINS_MINIMAL_REVISION_NUMBER); |
1323
5a92665dee23
Sample plugin: Serve folders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1322
diff
changeset
|
290 OrthancPluginLogError(context_, info); |
1322
f497a72d9f71
fixes to the sample plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
291 return -1; |
f497a72d9f71
fixes to the sample plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
292 } |
f497a72d9f71
fixes to the sample plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
293 |
f497a72d9f71
fixes to the sample plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
294 OrthancPluginSetDescription(context_, "Serve additional folders with the HTTP server of Orthanc."); |
f497a72d9f71
fixes to the sample plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
295 |
1323
5a92665dee23
Sample plugin: Serve folders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1322
diff
changeset
|
296 Json::Value configuration; |
5a92665dee23
Sample plugin: Serve folders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1322
diff
changeset
|
297 if (!ReadConfiguration(configuration, context_)) |
5a92665dee23
Sample plugin: Serve folders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1322
diff
changeset
|
298 { |
5a92665dee23
Sample plugin: Serve folders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1322
diff
changeset
|
299 return -1; |
5a92665dee23
Sample plugin: Serve folders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1322
diff
changeset
|
300 } |
5a92665dee23
Sample plugin: Serve folders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1322
diff
changeset
|
301 |
1434
f9cd40166269
refactoring of OrthancPlugins, improvement in ServeFolders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1425
diff
changeset
|
302 if (configuration.isMember("ServeFolders")) |
1323
5a92665dee23
Sample plugin: Serve folders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1322
diff
changeset
|
303 { |
1434
f9cd40166269
refactoring of OrthancPlugins, improvement in ServeFolders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1425
diff
changeset
|
304 if (configuration["ServeFolders"].type() != Json::objectValue) |
1323
5a92665dee23
Sample plugin: Serve folders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1322
diff
changeset
|
305 { |
1434
f9cd40166269
refactoring of OrthancPlugins, improvement in ServeFolders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1425
diff
changeset
|
306 OrthancPluginLogError(context_, "The \"ServeFolders\" configuration section is badly formatted (must be a JSON object)"); |
f9cd40166269
refactoring of OrthancPlugins, improvement in ServeFolders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1425
diff
changeset
|
307 return -1; |
1323
5a92665dee23
Sample plugin: Serve folders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1322
diff
changeset
|
308 } |
5a92665dee23
Sample plugin: Serve folders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1322
diff
changeset
|
309 } |
5a92665dee23
Sample plugin: Serve folders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1322
diff
changeset
|
310 else |
5a92665dee23
Sample plugin: Serve folders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1322
diff
changeset
|
311 { |
5a92665dee23
Sample plugin: Serve folders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1322
diff
changeset
|
312 OrthancPluginLogWarning(context_, "No section \"ServeFolders\" in your configuration file: " |
5a92665dee23
Sample plugin: Serve folders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1322
diff
changeset
|
313 "No additional folder will be served!"); |
1434
f9cd40166269
refactoring of OrthancPlugins, improvement in ServeFolders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1425
diff
changeset
|
314 configuration["ServeFolders"] = Json::objectValue; |
1323
5a92665dee23
Sample plugin: Serve folders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1322
diff
changeset
|
315 } |
5a92665dee23
Sample plugin: Serve folders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1322
diff
changeset
|
316 |
1434
f9cd40166269
refactoring of OrthancPlugins, improvement in ServeFolders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1425
diff
changeset
|
317 |
f9cd40166269
refactoring of OrthancPlugins, improvement in ServeFolders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1425
diff
changeset
|
318 Json::Value::Members members = configuration["ServeFolders"].getMemberNames(); |
f9cd40166269
refactoring of OrthancPlugins, improvement in ServeFolders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1425
diff
changeset
|
319 |
f9cd40166269
refactoring of OrthancPlugins, improvement in ServeFolders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1425
diff
changeset
|
320 // Register the callback for each base URI |
f9cd40166269
refactoring of OrthancPlugins, improvement in ServeFolders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1425
diff
changeset
|
321 for (Json::Value::Members::const_iterator |
f9cd40166269
refactoring of OrthancPlugins, improvement in ServeFolders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1425
diff
changeset
|
322 it = members.begin(); it != members.end(); ++it) |
f9cd40166269
refactoring of OrthancPlugins, improvement in ServeFolders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1425
diff
changeset
|
323 { |
1588
b5bc87a7212d
OrthancPluginReadFile, OrthancPluginWriteFile
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1434
diff
changeset
|
324 std::string baseUri = *it; |
b5bc87a7212d
OrthancPluginReadFile, OrthancPluginWriteFile
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1434
diff
changeset
|
325 |
1589
334d3a92ed83
improvements to the ServeFolders plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1588
diff
changeset
|
326 // Remove the heading and trailing slashes in the root URI, if any |
1588
b5bc87a7212d
OrthancPluginReadFile, OrthancPluginWriteFile
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1434
diff
changeset
|
327 while (!baseUri.empty() && |
b5bc87a7212d
OrthancPluginReadFile, OrthancPluginWriteFile
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1434
diff
changeset
|
328 *baseUri.begin() == '/') |
b5bc87a7212d
OrthancPluginReadFile, OrthancPluginWriteFile
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1434
diff
changeset
|
329 { |
b5bc87a7212d
OrthancPluginReadFile, OrthancPluginWriteFile
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1434
diff
changeset
|
330 baseUri = baseUri.substr(1); |
b5bc87a7212d
OrthancPluginReadFile, OrthancPluginWriteFile
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1434
diff
changeset
|
331 } |
1434
f9cd40166269
refactoring of OrthancPlugins, improvement in ServeFolders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1425
diff
changeset
|
332 |
1588
b5bc87a7212d
OrthancPluginReadFile, OrthancPluginWriteFile
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1434
diff
changeset
|
333 while (!baseUri.empty() && |
b5bc87a7212d
OrthancPluginReadFile, OrthancPluginWriteFile
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1434
diff
changeset
|
334 *baseUri.rbegin() == '/') |
1434
f9cd40166269
refactoring of OrthancPlugins, improvement in ServeFolders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1425
diff
changeset
|
335 { |
1588
b5bc87a7212d
OrthancPluginReadFile, OrthancPluginWriteFile
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1434
diff
changeset
|
336 baseUri.resize(baseUri.size() - 1); |
b5bc87a7212d
OrthancPluginReadFile, OrthancPluginWriteFile
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1434
diff
changeset
|
337 } |
b5bc87a7212d
OrthancPluginReadFile, OrthancPluginWriteFile
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1434
diff
changeset
|
338 |
b5bc87a7212d
OrthancPluginReadFile, OrthancPluginWriteFile
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1434
diff
changeset
|
339 if (baseUri.empty()) |
b5bc87a7212d
OrthancPluginReadFile, OrthancPluginWriteFile
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1434
diff
changeset
|
340 { |
b5bc87a7212d
OrthancPluginReadFile, OrthancPluginWriteFile
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1434
diff
changeset
|
341 OrthancPluginLogError(context_, "The URI of a folder to be served cannot be empty"); |
1434
f9cd40166269
refactoring of OrthancPlugins, improvement in ServeFolders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1425
diff
changeset
|
342 return -1; |
f9cd40166269
refactoring of OrthancPlugins, improvement in ServeFolders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1425
diff
changeset
|
343 } |
f9cd40166269
refactoring of OrthancPlugins, improvement in ServeFolders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1425
diff
changeset
|
344 |
1589
334d3a92ed83
improvements to the ServeFolders plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1588
diff
changeset
|
345 // Check whether the source folder exists and is indeed a directory |
334d3a92ed83
improvements to the ServeFolders plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1588
diff
changeset
|
346 const std::string folder = configuration["ServeFolders"][*it].asString(); |
334d3a92ed83
improvements to the ServeFolders plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1588
diff
changeset
|
347 if (!boost::filesystem::is_directory(folder)) |
334d3a92ed83
improvements to the ServeFolders plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1588
diff
changeset
|
348 { |
334d3a92ed83
improvements to the ServeFolders plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1588
diff
changeset
|
349 std::string msg = "Trying and serve an inexistent folder: " + folder; |
334d3a92ed83
improvements to the ServeFolders plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1588
diff
changeset
|
350 OrthancPluginLogError(context_, msg.c_str()); |
334d3a92ed83
improvements to the ServeFolders plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1588
diff
changeset
|
351 return -1; |
334d3a92ed83
improvements to the ServeFolders plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1588
diff
changeset
|
352 } |
334d3a92ed83
improvements to the ServeFolders plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1588
diff
changeset
|
353 |
334d3a92ed83
improvements to the ServeFolders plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1588
diff
changeset
|
354 folders_[baseUri] = folder; |
1588
b5bc87a7212d
OrthancPluginReadFile, OrthancPluginWriteFile
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1434
diff
changeset
|
355 |
1589
334d3a92ed83
improvements to the ServeFolders plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1588
diff
changeset
|
356 // Register the callback to serve the folder |
334d3a92ed83
improvements to the ServeFolders plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1588
diff
changeset
|
357 { |
334d3a92ed83
improvements to the ServeFolders plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1588
diff
changeset
|
358 const std::string regex = "/(" + baseUri + ")/(.*)"; |
334d3a92ed83
improvements to the ServeFolders plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1588
diff
changeset
|
359 OrthancPluginRegisterRestCallback(context, regex.c_str(), FolderCallback); |
334d3a92ed83
improvements to the ServeFolders plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1588
diff
changeset
|
360 } |
1434
f9cd40166269
refactoring of OrthancPlugins, improvement in ServeFolders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1425
diff
changeset
|
361 } |
f9cd40166269
refactoring of OrthancPlugins, improvement in ServeFolders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1425
diff
changeset
|
362 |
1588
b5bc87a7212d
OrthancPluginReadFile, OrthancPluginWriteFile
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1434
diff
changeset
|
363 OrthancPluginRegisterRestCallback(context, INDEX_URI, ListServedFolders); |
1434
f9cd40166269
refactoring of OrthancPlugins, improvement in ServeFolders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1425
diff
changeset
|
364 OrthancPluginSetRootUri(context, INDEX_URI); |
f9cd40166269
refactoring of OrthancPlugins, improvement in ServeFolders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1425
diff
changeset
|
365 |
1322
f497a72d9f71
fixes to the sample plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
366 return 0; |
f497a72d9f71
fixes to the sample plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
367 } |
f497a72d9f71
fixes to the sample plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
368 |
f497a72d9f71
fixes to the sample plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
369 |
f497a72d9f71
fixes to the sample plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
370 ORTHANC_PLUGINS_API void OrthancPluginFinalize() |
f497a72d9f71
fixes to the sample plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
371 { |
f497a72d9f71
fixes to the sample plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
372 } |
f497a72d9f71
fixes to the sample plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
373 |
f497a72d9f71
fixes to the sample plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
374 |
f497a72d9f71
fixes to the sample plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
375 ORTHANC_PLUGINS_API const char* OrthancPluginGetName() |
f497a72d9f71
fixes to the sample plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
376 { |
f497a72d9f71
fixes to the sample plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
377 return "serve-folders"; |
f497a72d9f71
fixes to the sample plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
378 } |
f497a72d9f71
fixes to the sample plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
379 |
f497a72d9f71
fixes to the sample plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
380 |
f497a72d9f71
fixes to the sample plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
381 ORTHANC_PLUGINS_API const char* OrthancPluginGetVersion() |
f497a72d9f71
fixes to the sample plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
382 { |
1391
b3119c32c920
version in ServerFolders plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1384
diff
changeset
|
383 return SERVE_FOLDERS_VERSION; |
1322
f497a72d9f71
fixes to the sample plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
384 } |
f497a72d9f71
fixes to the sample plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
385 } |