|
37 | 37 | <syntaxId>xwiki/2.1</syntaxId>
|
38 | 38 | <hidden>true</hidden>
|
39 | 39 | <content/>
|
| 40 | + <object> |
| 41 | + <name>XWiki.InteractiveLinkVisualizer.Code.MainVisualisation</name> |
| 42 | + <number>0</number> |
| 43 | + <className>XWiki.JavaScriptExtension</className> |
| 44 | + <guid>0ceb04ea-1d89-4992-a593-c623abf70f7a</guid> |
| 45 | + <class> |
| 46 | + <name>XWiki.JavaScriptExtension</name> |
| 47 | + <customClass/> |
| 48 | + <customMapping/> |
| 49 | + <defaultViewSheet/> |
| 50 | + <defaultEditSheet/> |
| 51 | + <defaultWeb/> |
| 52 | + <nameField/> |
| 53 | + <validationScript/> |
| 54 | + <cache> |
| 55 | + <cache>0</cache> |
| 56 | + <defaultValue>long</defaultValue> |
| 57 | + <disabled>0</disabled> |
| 58 | + <displayType>select</displayType> |
| 59 | + <freeText>forbidden</freeText> |
| 60 | + <largeStorage>0</largeStorage> |
| 61 | + <multiSelect>0</multiSelect> |
| 62 | + <name>cache</name> |
| 63 | + <number>5</number> |
| 64 | + <prettyName>Caching policy</prettyName> |
| 65 | + <relationalStorage>0</relationalStorage> |
| 66 | + <separator> </separator> |
| 67 | + <separators>|, </separators> |
| 68 | + <size>1</size> |
| 69 | + <unmodifiable>0</unmodifiable> |
| 70 | + <values>long|short|default|forbid</values> |
| 71 | + <classType>com.xpn.xwiki.objects.classes.StaticListClass</classType> |
| 72 | + </cache> |
| 73 | + <code> |
| 74 | + <contenttype>PureText</contenttype> |
| 75 | + <disabled>0</disabled> |
| 76 | + <editor>PureText</editor> |
| 77 | + <name>code</name> |
| 78 | + <number>2</number> |
| 79 | + <prettyName>Code</prettyName> |
| 80 | + <restricted>0</restricted> |
| 81 | + <rows>20</rows> |
| 82 | + <size>50</size> |
| 83 | + <unmodifiable>0</unmodifiable> |
| 84 | + <classType>com.xpn.xwiki.objects.classes.TextAreaClass</classType> |
| 85 | + </code> |
| 86 | + <name> |
| 87 | + <disabled>0</disabled> |
| 88 | + <name>name</name> |
| 89 | + <number>1</number> |
| 90 | + <prettyName>Name</prettyName> |
| 91 | + <size>30</size> |
| 92 | + <unmodifiable>0</unmodifiable> |
| 93 | + <classType>com.xpn.xwiki.objects.classes.StringClass</classType> |
| 94 | + </name> |
| 95 | + <parse> |
| 96 | + <disabled>0</disabled> |
| 97 | + <displayFormType>select</displayFormType> |
| 98 | + <displayType>yesno</displayType> |
| 99 | + <name>parse</name> |
| 100 | + <number>4</number> |
| 101 | + <prettyName>Parse content</prettyName> |
| 102 | + <unmodifiable>0</unmodifiable> |
| 103 | + <classType>com.xpn.xwiki.objects.classes.BooleanClass</classType> |
| 104 | + </parse> |
| 105 | + <use> |
| 106 | + <cache>0</cache> |
| 107 | + <disabled>0</disabled> |
| 108 | + <displayType>select</displayType> |
| 109 | + <freeText>forbidden</freeText> |
| 110 | + <largeStorage>0</largeStorage> |
| 111 | + <multiSelect>0</multiSelect> |
| 112 | + <name>use</name> |
| 113 | + <number>3</number> |
| 114 | + <prettyName>Use this extension</prettyName> |
| 115 | + <relationalStorage>0</relationalStorage> |
| 116 | + <separator> </separator> |
| 117 | + <separators>|, </separators> |
| 118 | + <size>1</size> |
| 119 | + <unmodifiable>0</unmodifiable> |
| 120 | + <values>currentPage|onDemand|always</values> |
| 121 | + <classType>com.xpn.xwiki.objects.classes.StaticListClass</classType> |
| 122 | + </use> |
| 123 | + </class> |
| 124 | + <property> |
| 125 | + <cache>default</cache> |
| 126 | + </property> |
| 127 | + <property> |
| 128 | + <code>require(['jquery', 'visualisationAPI'], function($, visualisationAPI) { |
| 129 | + var tempData = null, |
| 130 | + edgeKeyCounter = 1; |
| 131 | + |
| 132 | + #template('colorThemeInit.vm') |
| 133 | + var themeColors = $jsontool.serialize({ |
| 134 | + 'nodeColor': $theme.linkColor, |
| 135 | + 'labelColor': $theme.textColor, |
| 136 | + 'fadeColor': $theme.highlightColor, |
| 137 | + 'labelContainerColor': $theme.pageContentBackgroundColor |
| 138 | + }); |
| 139 | + |
| 140 | + var init = function() { |
| 141 | + if ($('#sigma-container').attr('data-init-done') !== 'true') { |
| 142 | + $("kill-graph-button").click(); |
| 143 | + tempData = JSON.parse(document.getElementById('sigma-container').dataset.results); |
| 144 | + const nodes = tempData.map(function(obj) { |
| 145 | + return { |
| 146 | + key: obj.reference, |
| 147 | + attributes: { |
| 148 | + label: obj.title_, |
| 149 | + color: themeColors.nodeColor, |
| 150 | + size: 4, |
| 151 | + pageURL: new XWiki.Document(XWiki.Model.resolve(obj.reference)).getURL() |
| 152 | + } |
| 153 | + }; |
| 154 | + }); |
| 155 | + const edges = []; |
| 156 | + tempData.forEach(function(obj) { |
| 157 | + if (obj.links && obj.links.length > 0) { |
| 158 | + obj.links.forEach(function(link) { |
| 159 | + var target = link.replace(/^entity:/, ''); |
| 160 | + var isValid = tempData.some(function(item) { |
| 161 | + return item.reference === target; |
| 162 | + }); |
| 163 | + if (isValid) { |
| 164 | + edges.push({ |
| 165 | + key: edgeKeyCounter.toString(), |
| 166 | + target: target, |
| 167 | + source: obj.reference |
| 168 | + }); |
| 169 | + edgeKeyCounter++; |
| 170 | + } |
| 171 | + }); |
| 172 | + } |
| 173 | + }); |
| 174 | + var graphData = { |
| 175 | + nodes: nodes, |
| 176 | + edges: edges |
| 177 | + }; |
| 178 | + let nb = nodes.length; |
| 179 | + $('#node-count').text('Displaying ' + nb + ' documents & '); |
| 180 | + $('#edge-count').text(edges.length + ' links'); |
| 181 | + visualisationAPI.visualize(graphData, "sigma-container", themeColors, isPanel = false, nb); |
| 182 | + |
| 183 | + const sigmaContainer = document.querySelector("#sigma-container"); |
| 184 | + $('#view-fullscreen').click(function() { |
| 185 | + if (document.fullscreenElement) { |
| 186 | + if (document.exitFullscreen) { |
| 187 | + document.exitFullscreen(); |
| 188 | + } else if (document.mozCancelFullScreen) { |
| 189 | + document.mozCancelFullScreen(); |
| 190 | + } else if (document.webkitCancelFullScreen) { |
| 191 | + document.webkitCancelFullScreen(); |
| 192 | + } else if (document.msExitFullscreen) { |
| 193 | + document.msExitFullscreen(); |
| 194 | + } |
| 195 | + } else { |
| 196 | + if (!document.mozFullScreen && !document.webkitFullScreen) { |
| 197 | + if (sigmaContainer.requestFullscreen) { |
| 198 | + sigmaContainer.requestFullscreen(); |
| 199 | + } else if (sigmaContainer.mozRequestFullScreen) { |
| 200 | + sigmaContainer.mozRequestFullScreen(); |
| 201 | + } else if (sigmaContainer.webkitRequestFullScreen) { |
| 202 | + sigmaContainer.webkitRequestFullScreen(); |
| 203 | + } else if (sigmaContainer.msRequestFullscreen) { |
| 204 | + sigmaContainer.msRequestFullscreen(); |
| 205 | + } |
| 206 | + } |
| 207 | + } |
| 208 | + }); |
| 209 | + $('#sigma-container').attr('data-init-done', 'true'); |
| 210 | + }}; |
| 211 | + if ($('#sigma-container') && $('#sigma-container').data('results')) { |
| 212 | + $(init).on('xwiki:dom:updated', init); |
| 213 | + } |
| 214 | +});</code> |
| 215 | + </property> |
| 216 | + <property> |
| 217 | + <name>Visualisation API</name> |
| 218 | + </property> |
| 219 | + <property> |
| 220 | + <parse>1</parse> |
| 221 | + </property> |
| 222 | + <property> |
| 223 | + <use>currentPage</use> |
| 224 | + </property> |
| 225 | + </object> |
40 | 226 | <object>
|
41 | 227 | <name>XWiki.InteractiveLinkVisualizer.Code.MainVisualisation</name>
|
42 | 228 | <number>0</number>
|
|
145 | 331 | <property>
|
146 | 332 | <code>#sigma-container {
|
147 | 333 | width: 100%;
|
148 |
| - height: 500px; |
| 334 | + height: 100vh; |
149 | 335 | border: 1px solid @breadcrumb-bg;
|
150 | 336 | border-radius: 5px;
|
151 | 337 | box-shadow: rgba(red(@text-color), green(@text-color), blue(@text-color), 0.2) 0px 2px 6px;
|
|
156 | 342 | }
|
157 | 343 | #top-bar {
|
158 | 344 | position: absolute;
|
159 |
| - top: 0; |
| 345 | + top: 8%; |
160 | 346 | left: 50%;
|
161 | 347 | transform: translateX(-50%);
|
162 | 348 | width: 97%;
|
@@ -196,32 +382,18 @@ i {
|
196 | 382 | .search-facets {
|
197 | 383 | background-color: @panel-bg;
|
198 | 384 | }
|
199 |
| - |
200 |
| -.input-group { |
201 |
| - left: 145%; |
202 |
| - width: 60%; |
203 |
| -} |
204 |
| -.form-control { |
205 |
| - text-align: left; |
206 |
| -} |
207 |
| -#nb-results { |
208 |
| - position: absolute; |
209 |
| - bottom: 0; |
210 |
| - left: 100%; |
211 |
| -} |
212 |
| - |
213 |
| -.search-options { |
214 |
| - position: absolute; |
215 |
| - bottom: 105%; |
216 |
| -} |
217 |
| -.search-results-sort { |
218 |
| - position: absolute; |
219 |
| - bottom: 102%; |
220 |
| -} |
221 | 385 | a.options-item.active, a.options-item.active:hover {
|
222 | 386 | color: @link-color;
|
223 | 387 | text-decoration: underline;
|
224 | 388 | }
|
| 389 | +.input-group { |
| 390 | + width: 95%; |
| 391 | + position: absolute; |
| 392 | + left: 100% |
| 393 | +} |
| 394 | +#refresh-button { |
| 395 | + margin-top: -0.5%; |
| 396 | +} |
225 | 397 | #graph-buttons {
|
226 | 398 | position: absolute;
|
227 | 399 | right: 0;
|
|
0 commit comments