Failed to execute template. Cause: [Access denied when checking [script] access to [xwiki:Collaboratory.UX.HbpSkin.WebHome] for user [xwiki:XWiki.Admin]]. Click on this message for details.

UpdateUserVelocity - HBP Wiki

IAM21 instance, do not create collab nor modify a team, your changes will be lost


Wiki source code of UpdateUserVelocity

Version 35.1 by messines on 2022/12/19 12:41

Hide last authors
bougault 1.1 1 {{html clean="false"}}
2
messines 35.1 3 <button id="context-script-button" class="btn btn-primary">Execute Script</button>
bougault 1.1 4
bougault 2.2 5 <pre id="context-search-response"></pre>
6 <script>
7 window.addEventListener('DOMContentLoaded', function() {
8 const contextSearchType = document.getElementById("context-search-type");
9 const contextSearchText = document.getElementById("context-search-text");
10 const contextSearchResponse = document.getElementById("context-search-response");
messines 35.1 11 const contextSearchButton = document.getElementById("context-script-button");
bougault 2.2 12 contextSearchButton.addEventListener('click', function() {
13 const context = contextSearchType.options[contextSearchType.selectedIndex].value;
bougault 2.3 14 const term = contextSearchText.value;
15 switch(context) {
16 case 'collabs':
17 document.location.href = `/bin/view/Collabs/#search=${term}`;
18 break;
19 case 'current-collab':
bougault 19.1 20 handleXWikiSearch('bougaultx');
bougault 2.3 21 break
22 default:
bougault 16.1 23 handleXWikiSearch()
bougault 2.3 24 }
25
bougault 2.2 26 });
bougault 24.1 27
28 function handleXWikiSearch(space) {
bougault 16.1 29 require(['jquery'], function($) {
30 var solrServiceURL = new XWiki.Document('SuggestSolrService', 'XWiki').getURL('get');
messines 35.1 31 const contextSearchButton = document.getElementById("context-script-button");
bougault 17.1 32 const xwikiSpace = space ? `.${space}` : '';
bougault 16.1 33 contextSearchButton.addEventListener('click', function() {
bougault 21.1 34 $.post(solrServiceURL, {
bougault 16.1 35 outputSyntax: 'plain',
36 media: 'json',
37 query: [
messines 34.4 38 'q=title:"__INPUT__"~100 OR doccontent:"__INPUT__"~100',
bougault 16.1 39 'fq=type:DOCUMENT',
bougault 18.1 40 `fq=space:Collabs${xwikiSpace}.*`
bougault 16.1 41 ].join('\n'),
42 input: $('#context-search-text').val()
bougault 23.1 43 }).then(res => {
44 contextSearchResponse.innerText = JSON.stringify(res, null, 2);
45 });
bougault 21.1 46
bougault 4.5 47 });
bougault 3.2 48 });
bougault 16.1 49 }
bougault 24.1 50 });
51
52
bougault 2.2 53 </script>
bougault 1.1 54 {{/html}}