forked from vpasquier/nuxeo-workshop-restapi
-
Notifications
You must be signed in to change notification settings - Fork 0
/
restapi.html
334 lines (326 loc) · 12.2 KB
/
restapi.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"/>
<meta name="viewport"
content="width=device-width, initial-scale=1.0, maximum-scale=1.0">
<title>REST API - Workshop</title>
<link rel="stylesheet" type="text/css"
href="resources/css/semantic.min.css">
<script src="resources/javascript/jquery.js"></script>
<script src="resources/javascript/jquery.address.js"></script>
<script src="resources/javascript/semantic.min.js"></script>
<script src="resources/javascript/mustache.js"
type="text/javascript"></script>
<link rel="stylesheet" type="text/css" href="resources/restapi.css">
<script src="resources/ui.js"></script>
<script src="restapi.js"></script>
<script src="resources/javascript/nuxeo.js"></script>
</head>
<body id="restapi">
<div class="ui large inverted vertical sidebar menu" id="targetUserInfos">
<i class="user big icon"></i>
<script id="userInfos" type="x-tmpl-mustache">
{{#user.properties}}
<div class="item">
Mail: <span class="ui small label">{{email}}</span>
</div>
<div class="item">
Username: <span class="ui small label">{{username}}</span>
</div>
<div class="item">
Name: <span class="ui small label">{{firstName}} {{lastName}}</span>
</div>
<div class="item">
Company: <span class="ui small label">{{company}}</span>
</div>
{{/user.properties}}
</script>
</div>
<div class="ui celled grid">
<div class="ten wide middle column">
<div class="ui black launch mini button"
id="targetUserId"></div>
<script id="userId" type="x-tmpl-mustache">
<i class="user big icon"></i>
{{userId}}
</script>
<div id="importAction" class="ui down button green">
<i class="double angle down icon"></i>
Import
</div>
<a target="_blank" href="http://localhost:8080/nuxeo/nxdoc/default/7b8c6203-098f-4827-bf18-71ac2cbef99a/view_documents" class="ui down mini button blue floated right">
<i class="forward mail icon"></i>
Intranet
</a>
<a target="_blank" href="welcome.html" class="ui down mini button blue floated right">
<i class="backward icon"></i>
Welcome
</a>
<div style="margin-top:30px;margin-bottom:20px;width:100%"
class="ui form action big icon input">
<input id="searchInput" placeholder="SELECT * FROM Document where ecm:path STARTSWITH '/default-domain/workspaces/workspace'"
type="text">
<div class="ui animated button" id="search">
<div class="visible content">Search</div>
<div class="hidden content">
<i class="right arrow icon"></i>
</div>
</div>
</div>
<h2 class="ui header">
<i class="inbox icon"></i>
Documents
</h2>
<div id="refresh" class="ui blue icon button floated right">
<i class="refresh icon"></i>
</div>
<div id="create" class="ui green icon button floated right">
<i class="add icon"></i>
</div>
<div class="ui tabular filter menu">
<a class="active item" data-tab="unread">/default-domain/workspaces/workspace</a>
</div>
<div class="ui divided selection active tab"
data-tab="unread" id="targetChildren"></div>
<script id="children" type="x-tmpl-mustache">
<table class="ui four column table segment" style="cursor:pointer">
<thead>
<tr><th class="four wide">Title</th>
<th class="four wide">Description</th>
<th class="four wide">Creator</th>
<th class="four wide">Type</th>
</tr></thead>
<tbody>
{{#children}}
<tr class="item" onClick="javascript:RestAPI.fetchDocument('{{uid}}');">
<td>{{#properties}}{{dc:title}}{{/properties}}</td>
<td>{{#properties}}{{dc:description}}{{/properties}}</td>
<td>{{#properties}}{{dc:creator}}{{/properties}}</td>
<td>{{type}}</td>
</tr>
{{/children}}
</tbody>
<tfoot>
<tr>
<th></th>
<th></th>
<th></th>
<th>{{children.length}} Documents</th>
</tr></tfoot>
</table>
</script>
</div>
<div class="six wide right column" id="displayForm"></div>
<script id="displayMetadata" type="x-tmpl-mustache">
{{#doc.properties}}
<h1 class="ui header">{{dc:title}}</h1>
<h2>Description: {{dc:description}}</h2>
<h4>Creator: {{dc:creator}}</h4>
<h4>Creation Date: {{dc:created}}</h4>
<h4>Language: {{dc:language}}</h4>
<h4>Nature: {{dc:nature}}</h4>
{{/doc.properties}}
<h4>State: {{doc.state}}</h4>
<h4>Version: {{doc.versionLabel}}</h4>
<h4>Path:</h4> <pre> {{doc.path}}</pre>
{{#doc.properties}}
<h4>Icon: {{common:icon}}</h4>
{{/doc.properties}}
<h4>Rights:</h4>
{{#ace}}
<ul>
<li>Granted: {{granted}}</li>
<li>Username: {{username}}</li>
<li>Permission: {{permission}}</li>
</ul>
{{/ace}}
<div class="ui divider"></div>
<div class="ui blue icon button" onClick="javascript:toggle()">
<i class="edit icon"></i>
Edit
</div>
<div class="ui red icon button" onClick="javascript:displayDelete()">
<i class="remove icon"></i>
Delete
</div>
<div class="ui icon button" onClick="javascript:displayBlob()">
<i class="attachment icon"></i>
Attach File
</div>
</script>
<div class="six wide right column form" style="display: none"
id="editionForm"></div>
<script id="editionMetadata" type="x-tmpl-mustache">
<div id="docId" style="display:none">{{doc.uid}}</div>
{{#doc.properties}}
<div id="docForm" class="ui form segment">
<div class="two fields">
<div class="field">
<label>Title:</label>
<input type="text" name="dc:title" value="{{dc:title}}"/>
<div class="ui pointing label">
Please enter a value
</div>
</div>
<div class="field">
<label>Description:</label>
<input type="text" name="dc:description" value="{{dc:description}}"/>
<div class="ui pointing label">
Please enter a value
</div>
</div>
<div class="field">
<label>Language:</label>
<input type="text" name="dc:language" value="{{dc:language}}"/>
<div class="ui pointing label">
Please enter a value
</div>
</div>
<div class="field">
<label>Nature:</label>
<input type="text" name="dc:nature" value="{{dc:nature}}"/>
<div class="ui pointing label">
Please enter a value
</div>
</div>
</div>
</div>
{{/doc.properties}}
<div class="ui buttons">
<div class="ui button" onClick="javascript:toggle()">Cancel</div>
<div class="or"></div>
<div onClick="javascript:save()" class="ui blue button">Save</div>
</div>
</script>
<div id="modalImport" class="ui small modal">
<div class="header">
Import
</div>
<div id="loading" class="ui segment" style="display:none">
<div class="ui active dimmer">
<div class="ui text loader">Loading</div>
</div>
</div>
<div class="content">
<label for="files" class="ui icon button">
<i class="file icon"></i>
Import files</label>
<input type="file" id="files" multiple="true">
</div>
<div class="actions">
<div id="importFiles" class="ui button green">Import
Files
</div>
<div class="ui button">
Cancel
</div>
</div>
</div>
<div id="modalError" class="ui small modal">
<i class="close icon"></i>
<div class="header">
ERROR
</div>
<div class="content">
<p id="errorValue"></p>
</div>
<div class="actions">
<div class="ui red button">
<i class="remove icon"></i>
Close
</div>
</div>
</div>
<div id="modalDelete" class="ui small modal">
<i class="close icon"></i>
<div class="header">
Please confirm
</div>
<div class="content">
Delete the current document?
</div>
<div class="actions">
<div class="ui negative button">
<i class="remove icon"></i>
Cancel
</div>
<div id="deleteDoc" class="ui positive button">
<i class="checkmark icon"></i>
Yes
</div>
</div>
</div>
<div id="modalCreate" class="ui small modal">
<i class="close icon"></i>
<div class="header">
New Document
</div>
<div class="content">
<div id="createDocForm" class="ui form segment">
<div class="two fields">
<div class="field">
<label>Title:</label>
<input type="text" name="dc:title" value=""/>
<div class="ui pointing label">
Please enter a value
</div>
</div>
<div class="field">
<label>Description:</label>
<input type="text" name="dc:description" value=""/>
<div class="ui pointing label">
Please enter a value
</div>
</div>
<div class="field">
<label>Language:</label>
<input type="text" name="dc:language" value=""/>
<div class="ui pointing label">
Please enter a value
</div>
</div>
<div class="field">
<label>Nature:</label>
<input type="text" name="dc:nature" value=""/>
<div class="ui pointing label">
Please enter a value
</div>
</div>
</div>
</div>
</div>
<div class="actions">
<div class="ui negative button">
<i class="remove icon"></i>
Cancel
</div>
<div id="createDoc" class="ui positive button">
<i class="checkmark icon"></i>
Create
</div>
</div>
</div>
<div id="modalBlob" class="ui small modal">
<div class="header">
Attach blob
</div>
<div class="content">
<label for="blob" class="ui icon button">
<i class="file icon"></i>
Attach blob</label>
<input type="file" id="blob">
</div>
<div class="actions">
<div id="importBlob" class="ui button green">Import
File
</div>
<div class="ui button">
Cancel
</div>
</div>
</div>
</div>
</body>
</html>