Wiki source code of Apps

Last modified by hbpadmin on 2023/02/21 17:00

Show last authors
1 {{include reference="Collaboratory.Apps.Apps.Code.AppsMacros"/}}
2
3 {{velocity output="no"}}
4 $xwiki.ssx.use('Collaboratory.UX.SSX.noheader')
5 #set($displayDocExtra = false)
6
7 ## Get filter parameters from Query String, build the query and get applications that match
8 #set($searchTerm = $request.getParameter('text'))
9 #if(!$searchTerm) #set($searchTerm = '') #end
10 #set($categoryTerm = $request.getParameter('category'))
11 #if(!$categoryTerm) #set($categoryTerm = '') #end
12 #set($displayInDevApps = 0)
13 #if($request.getParameter('development') == '1')
14 #set($displayInDevApps = 1)
15 #end
16
17 #set($query = "select doc from Document doc, doc.object(Collaboratory.Apps.Apps.Catalogue.Code.CatalogueClass) as app where (app.description like :search or app.name like :search) and (:category = '' or app.category = :category) and app.development = :indev")
18 #set($applications = $services.query.xwql($query).bindValue('search', "%$searchTerm%").bindValue('category', $categoryTerm).bindValue('indev', $displayInDevApps).addFilter('hidden').execute())
19 #set($totalApplications = $applications.size()) ## Get how many applications match. Used to custom view if none or more than 0.
20
21 ## Get categories list for Category filter
22 #set($categories = $xwiki.getClass('Collaboratory.Apps.Apps.Catalogue.Code.CatalogueClass').category.getValue('values').split('[|]'))
23
24 ## Has current user permission to create an App?
25 #set($createAppGroup = $services.user.group.getMembers('xwiki:XWiki.feature:create_app', false))
26 #set($isUserAppCreator = $createAppGroup.contains($xcontext.userReference))
27 {{/velocity}}
28 {{velocity}}
29 {{html clean="false"}}
30 <script src="$services.webjars.url('eu.hbp.wiki:xwiki-webapp-collaboratory', 'clb-modal.js')"></script>
31 <div class="row external-apps-header">
32 <div class="col-md-8">
33 <h1>Community Apps</h1>
34 </div>
35 <div class="col-md-4">
36 #if($isUserAppCreator)
37 <a class="btn btn-primary pull-right" href="$doc.getURL('create')"><span class="fa fa-plus"></span> Create App</a>
38 #end
39 </div>
40 </div> ## /.row.externap-apps-header
41
42 <div class="row">
43 <div class="col-md-3">
44 ## Filter form
45 <form action="$doc.getURL('view')" method="get">
46 <div class="form-group">
47 <label for="application-text-filter">Filter by text</label>
48 <input type="text" name="text" id="application-text-filter" value="$searchTerm">
49 </div>
50 <div class="form-group">
51 <label for="application-category-filter">Filter by category</label>
52 <select name="category">
53 <option value="">All</option>
54 #foreach($category in $categories)
55 <option value="$category" #if($categoryTerm == $category)selected#end>$category</option>
56 #end
57 </select>
58 </div>
59
60 <div class="checkbox">
61 <label>
62 <input type="checkbox" name="development" value="1"#if($displayInDevApps == 1) checked#end> Show In Development Apps
63 </label>
64 </div>
65 <button class="btn btn-primary" type="submit">Filter</button>
66 <a class="btn btn-primary-inverted" href="$doc.getURL('view')">Reset</a>
67 </form>
68 </div> ## /.col-md-3
69 <div class="col-md-9">
70 ## Applications list
71 #if($totalApplications > 0)
72 ## There are applications that match, display them.
73 <div class="applications-count">
74 <strong>$totalApplications</strong> application#if($totalApplications > 1)s#end found
75 #if($searchTerm != '') for <strong>$escapetool.html($searchTerm)</strong>#end
76 #if($categoryTerm != '') in <strong>$escapetool.html($categoryTerm)</strong> category#end
77 </div>
78 #applications($applications false)
79 #else
80 ## No Application corresponds to filter, display a message to inform the user
81 <div class="applications-no-results">
82 <h3>
83 No Application Found
84 #if($searchTerm != '') for <i>'$escapetool.html($searchTerm)'</i>#end
85 #if($categoryTerm != '') in <i>'$escapetool.html($categoryTerm)'</i> category#end
86 </h3>
87 <a class="btn btn-primary-inverted" href="$doc.getURL('view')">Reset Filters</a>
88 #end
89 </div> ## /.col-md-9
90 </div> ## /.row
91 {{/html}}
92 {{/velocity}}