|
@@ -130,38 +130,39 @@ class UserRoleInWorkspace(DeclarativeBase):
|
130
|
130
|
CONTENT_MANAGER = 4
|
131
|
131
|
WORKSPACE_MANAGER = 8
|
132
|
132
|
|
133
|
|
- LABEL = dict()
|
134
|
|
- LABEL[0] = l_('N/A')
|
135
|
|
- LABEL[1] = l_('Reader')
|
136
|
|
- LABEL[2] = l_('Contributor')
|
137
|
|
- LABEL[4] = l_('Content Manager')
|
138
|
|
- LABEL[8] = l_('Workspace Manager')
|
139
|
|
-
|
140
|
|
- STYLE = dict()
|
141
|
|
- STYLE[0] = ''
|
142
|
|
- STYLE[1] = 'color: #1fdb11;'
|
143
|
|
- STYLE[2] = 'color: #759ac5;'
|
144
|
|
- STYLE[4] = 'color: #ea983d;'
|
145
|
|
- STYLE[8] = 'color: #F00;'
|
146
|
|
-
|
147
|
|
- ICON = dict()
|
148
|
|
- ICON[0] = ''
|
149
|
|
- ICON[1] = 'fa-eye'
|
150
|
|
- ICON[2] = 'fa-pencil'
|
151
|
|
- ICON[4] = 'fa-graduation-cap'
|
152
|
|
- ICON[8] = 'fa-legal'
|
153
|
|
-
|
154
|
|
-
|
155
|
|
- @property
|
156
|
|
- def icon(self):
|
157
|
|
- return UserRoleInWorkspace.ICON[self.role]
|
158
|
|
-
|
159
|
|
- @property
|
160
|
|
- def style(self):
|
161
|
|
- return UserRoleInWorkspace.STYLE[self.role]
|
162
|
|
-
|
163
|
|
- def role_as_label(self):
|
164
|
|
- return UserRoleInWorkspace.LABEL[self.role]
|
|
133
|
+ # TODO - G.M - 10-04-2018 - [Cleanup] Drop this
|
|
134
|
+ # LABEL = dict()
|
|
135
|
+ # LABEL[0] = l_('N/A')
|
|
136
|
+ # LABEL[1] = l_('Reader')
|
|
137
|
+ # LABEL[2] = l_('Contributor')
|
|
138
|
+ # LABEL[4] = l_('Content Manager')
|
|
139
|
+ # LABEL[8] = l_('Workspace Manager')
|
|
140
|
+ #
|
|
141
|
+ # STYLE = dict()
|
|
142
|
+ # STYLE[0] = ''
|
|
143
|
+ # STYLE[1] = 'color: #1fdb11;'
|
|
144
|
+ # STYLE[2] = 'color: #759ac5;'
|
|
145
|
+ # STYLE[4] = 'color: #ea983d;'
|
|
146
|
+ # STYLE[8] = 'color: #F00;'
|
|
147
|
+ #
|
|
148
|
+ # ICON = dict()
|
|
149
|
+ # ICON[0] = ''
|
|
150
|
+ # ICON[1] = 'fa-eye'
|
|
151
|
+ # ICON[2] = 'fa-pencil'
|
|
152
|
+ # ICON[4] = 'fa-graduation-cap'
|
|
153
|
+ # ICON[8] = 'fa-legal'
|
|
154
|
+ #
|
|
155
|
+ #
|
|
156
|
+ # @property
|
|
157
|
+ # def icon(self):
|
|
158
|
+ # return UserRoleInWorkspace.ICON[self.role]
|
|
159
|
+ #
|
|
160
|
+ # @property
|
|
161
|
+ # def style(self):
|
|
162
|
+ # return UserRoleInWorkspace.STYLE[self.role]
|
|
163
|
+ #
|
|
164
|
+ # def role_as_label(self):
|
|
165
|
+ # return UserRoleInWorkspace.LABEL[self.role]
|
165
|
166
|
|
166
|
167
|
@classmethod
|
167
|
168
|
def get_all_role_values(self):
|
|
@@ -175,15 +176,18 @@ class UserRoleInWorkspace(DeclarativeBase):
|
175
|
176
|
class RoleType(object):
|
176
|
177
|
def __init__(self, role_id):
|
177
|
178
|
self.role_type_id = role_id
|
178
|
|
- self.icon = UserRoleInWorkspace.ICON[role_id]
|
179
|
|
- self.role_label = UserRoleInWorkspace.LABEL[role_id]
|
180
|
|
- self.css_style = UserRoleInWorkspace.STYLE[role_id]
|
|
179
|
+ # TODO - G.M - 10-04-2018 - [Cleanup] Drop this
|
|
180
|
+ # self.icon = UserRoleInWorkspace.ICON[role_id]
|
|
181
|
+ # self.role_label = UserRoleInWorkspace.LABEL[role_id]
|
|
182
|
+ # self.css_style = UserRoleInWorkspace.STYLE[role_id]
|
181
|
183
|
|
182
|
184
|
|
183
|
|
-class LinkItem(object):
|
184
|
|
- def __init__(self, href, label):
|
185
|
|
- self.href = href
|
186
|
|
- self.label = label
|
|
185
|
+# TODO - G.M - 09-04-2018 [Cleanup] It this items really needed ?
|
|
186
|
+# class LinkItem(object):
|
|
187
|
+# def __init__(self, href, label):
|
|
188
|
+# self.href = href
|
|
189
|
+# self.label = label
|
|
190
|
+
|
187
|
191
|
|
188
|
192
|
class ActionDescription(object):
|
189
|
193
|
"""
|
|
@@ -206,40 +210,42 @@ class ActionDescription(object):
|
206
|
210
|
UNDELETION = 'undeletion'
|
207
|
211
|
MOVE = 'move'
|
208
|
212
|
|
209
|
|
- _ICONS = {
|
210
|
|
- 'archiving': 'fa fa-archive',
|
211
|
|
- 'content-comment': 'fa-comment-o',
|
212
|
|
- 'creation': 'fa-magic',
|
213
|
|
- 'deletion': 'fa-trash',
|
214
|
|
- 'edition': 'fa-edit',
|
215
|
|
- 'revision': 'fa-history',
|
216
|
|
- 'status-update': 'fa-random',
|
217
|
|
- 'unarchiving': 'fa-file-archive-o',
|
218
|
|
- 'undeletion': 'fa-trash-o',
|
219
|
|
- 'move': 'fa-arrows',
|
220
|
|
- 'copy': 'fa-files-o',
|
221
|
|
- }
|
222
|
|
-
|
223
|
|
- _LABELS = {
|
224
|
|
- 'archiving': l_('archive'),
|
225
|
|
- 'content-comment': l_('Item commented'),
|
226
|
|
- 'creation': l_('Item created'),
|
227
|
|
- 'deletion': l_('Item deleted'),
|
228
|
|
- 'edition': l_('item modified'),
|
229
|
|
- 'revision': l_('New revision'),
|
230
|
|
- 'status-update': l_('New status'),
|
231
|
|
- 'unarchiving': l_('Item unarchived'),
|
232
|
|
- 'undeletion': l_('Item undeleted'),
|
233
|
|
- 'move': l_('Item moved'),
|
234
|
|
- 'copy': l_('Item copied'),
|
235
|
|
- }
|
|
213
|
+ # TODO - G.M - 10-04-2018 - [Cleanup] Drop this
|
|
214
|
+ # _ICONS = {
|
|
215
|
+ # 'archiving': 'fa fa-archive',
|
|
216
|
+ # 'content-comment': 'fa-comment-o',
|
|
217
|
+ # 'creation': 'fa-magic',
|
|
218
|
+ # 'deletion': 'fa-trash',
|
|
219
|
+ # 'edition': 'fa-edit',
|
|
220
|
+ # 'revision': 'fa-history',
|
|
221
|
+ # 'status-update': 'fa-random',
|
|
222
|
+ # 'unarchiving': 'fa-file-archive-o',
|
|
223
|
+ # 'undeletion': 'fa-trash-o',
|
|
224
|
+ # 'move': 'fa-arrows',
|
|
225
|
+ # 'copy': 'fa-files-o',
|
|
226
|
+ # }
|
|
227
|
+ #
|
|
228
|
+ # _LABELS = {
|
|
229
|
+ # 'archiving': l_('archive'),
|
|
230
|
+ # 'content-comment': l_('Item commented'),
|
|
231
|
+ # 'creation': l_('Item created'),
|
|
232
|
+ # 'deletion': l_('Item deleted'),
|
|
233
|
+ # 'edition': l_('item modified'),
|
|
234
|
+ # 'revision': l_('New revision'),
|
|
235
|
+ # 'status-update': l_('New status'),
|
|
236
|
+ # 'unarchiving': l_('Item unarchived'),
|
|
237
|
+ # 'undeletion': l_('Item undeleted'),
|
|
238
|
+ # 'move': l_('Item moved'),
|
|
239
|
+ # 'copy': l_('Item copied'),
|
|
240
|
+ # }
|
236
|
241
|
|
237
|
242
|
def __init__(self, id):
|
238
|
243
|
assert id in ActionDescription.allowed_values()
|
239
|
244
|
self.id = id
|
240
|
|
- self.label = ActionDescription._LABELS[id]
|
241
|
|
- self.icon = ActionDescription._ICONS[id]
|
242
|
|
- self.css = ''
|
|
245
|
+ # TODO - G.M - 10-04-2018 - [Cleanup] Drop this
|
|
246
|
+ # self.label = ActionDescription._LABELS[id]
|
|
247
|
+ # self.icon = ActionDescription._ICONS[id]
|
|
248
|
+ # self.css = ''
|
243
|
249
|
|
244
|
250
|
@classmethod
|
245
|
251
|
def allowed_values(cls):
|
|
@@ -271,105 +277,126 @@ class ContentStatus(object):
|
271
|
277
|
CLOSED_UNVALIDATED = 'closed-unvalidated'
|
272
|
278
|
CLOSED_DEPRECATED = 'closed-deprecated'
|
273
|
279
|
|
274
|
|
- _LABELS = {'open': l_('work in progress'),
|
275
|
|
- 'closed-validated': l_('closed — validated'),
|
276
|
|
- 'closed-unvalidated': l_('closed — cancelled'),
|
277
|
|
- 'closed-deprecated': l_('deprecated')}
|
278
|
|
-
|
279
|
|
- _LABELS_THREAD = {'open': l_('subject in progress'),
|
280
|
|
- 'closed-validated': l_('subject closed — resolved'),
|
281
|
|
- 'closed-unvalidated': l_('subject closed — cancelled'),
|
282
|
|
- 'closed-deprecated': l_('deprecated')}
|
283
|
|
-
|
284
|
|
- _LABELS_FILE = {'open': l_('work in progress'),
|
285
|
|
- 'closed-validated': l_('closed — validated'),
|
286
|
|
- 'closed-unvalidated': l_('closed — cancelled'),
|
287
|
|
- 'closed-deprecated': l_('deprecated')}
|
288
|
|
-
|
289
|
|
- _ICONS = {
|
290
|
|
- 'open': 'fa fa-square-o',
|
291
|
|
- 'closed-validated': 'fa fa-check-square-o',
|
292
|
|
- 'closed-unvalidated': 'fa fa-close',
|
293
|
|
- 'closed-deprecated': 'fa fa-warning',
|
294
|
|
- }
|
295
|
|
-
|
296
|
|
- _CSS = {
|
297
|
|
- 'open': 'tracim-status-open',
|
298
|
|
- 'closed-validated': 'tracim-status-closed-validated',
|
299
|
|
- 'closed-unvalidated': 'tracim-status-closed-unvalidated',
|
300
|
|
- 'closed-deprecated': 'tracim-status-closed-deprecated',
|
301
|
|
- }
|
302
|
|
-
|
303
|
|
- def __init__(self, id, type=''):
|
|
280
|
+ # TODO - G.M - 10-04-2018 - [Cleanup] Drop this
|
|
281
|
+ # _LABELS = {'open': l_('work in progress'),
|
|
282
|
+ # 'closed-validated': l_('closed — validated'),
|
|
283
|
+ # 'closed-unvalidated': l_('closed — cancelled'),
|
|
284
|
+ # 'closed-deprecated': l_('deprecated')}
|
|
285
|
+ #
|
|
286
|
+ # _LABELS_THREAD = {'open': l_('subject in progress'),
|
|
287
|
+ # 'closed-validated': l_('subject closed — resolved'),
|
|
288
|
+ # 'closed-unvalidated': l_('subject closed — cancelled'),
|
|
289
|
+ # 'closed-deprecated': l_('deprecated')}
|
|
290
|
+ #
|
|
291
|
+ # _LABELS_FILE = {'open': l_('work in progress'),
|
|
292
|
+ # 'closed-validated': l_('closed — validated'),
|
|
293
|
+ # 'closed-unvalidated': l_('closed — cancelled'),
|
|
294
|
+ # 'closed-deprecated': l_('deprecated')}
|
|
295
|
+ #
|
|
296
|
+ # _ICONS = {
|
|
297
|
+ # 'open': 'fa fa-square-o',
|
|
298
|
+ # 'closed-validated': 'fa fa-check-square-o',
|
|
299
|
+ # 'closed-unvalidated': 'fa fa-close',
|
|
300
|
+ # 'closed-deprecated': 'fa fa-warning',
|
|
301
|
+ # }
|
|
302
|
+ #
|
|
303
|
+ # _CSS = {
|
|
304
|
+ # 'open': 'tracim-status-open',
|
|
305
|
+ # 'closed-validated': 'tracim-status-closed-validated',
|
|
306
|
+ # 'closed-unvalidated': 'tracim-status-closed-unvalidated',
|
|
307
|
+ # 'closed-deprecated': 'tracim-status-closed-deprecated',
|
|
308
|
+ # }
|
|
309
|
+
|
|
310
|
+ def __init__(self,
|
|
311
|
+ id,
|
|
312
|
+ # TODO - G.M - 10-04-2018 - [Cleanup] Drop this
|
|
313
|
+ # type=''
|
|
314
|
+ ):
|
304
|
315
|
self.id = id
|
305
|
|
- self.icon = ContentStatus._ICONS[id]
|
306
|
|
- self.css = ContentStatus._CSS[id]
|
307
|
|
-
|
308
|
|
- if type==ContentType.Thread:
|
309
|
|
- self.label = ContentStatus._LABELS_THREAD[id]
|
310
|
|
- elif type==ContentType.File:
|
311
|
|
- self.label = ContentStatus._LABELS_FILE[id]
|
312
|
|
- else:
|
313
|
|
- self.label = ContentStatus._LABELS[id]
|
|
316
|
+ # TODO - G.M - 10-04-2018 - [Cleanup] Drop this
|
|
317
|
+ # self.icon = ContentStatus._ICONS[id]
|
|
318
|
+ # self.css = ContentStatus._CSS[id]
|
|
319
|
+ #
|
|
320
|
+ # if type==ContentType.Thread:
|
|
321
|
+ # self.label = ContentStatus._LABELS_THREAD[id]
|
|
322
|
+ # elif type==ContentType.File:
|
|
323
|
+ # self.label = ContentStatus._LABELS_FILE[id]
|
|
324
|
+ # else:
|
|
325
|
+ # self.label = ContentStatus._LABELS[id]
|
314
|
326
|
|
315
|
327
|
|
316
|
328
|
@classmethod
|
317
|
329
|
def all(cls, type='') -> ['ContentStatus']:
|
318
|
|
- all = []
|
319
|
|
- all.append(ContentStatus('open', type))
|
320
|
|
- all.append(ContentStatus('closed-validated', type))
|
321
|
|
- all.append(ContentStatus('closed-unvalidated', type))
|
322
|
|
- all.append(ContentStatus('closed-deprecated', type))
|
323
|
|
- return all
|
|
330
|
+ # TODO - G.M - 10-04-2018 - [Cleanup] Drop this
|
|
331
|
+ # all = []
|
|
332
|
+ # all.append(ContentStatus('open', type))
|
|
333
|
+ # all.append(ContentStatus('closed-validated', type))
|
|
334
|
+ # all.append(ContentStatus('closed-unvalidated', type))
|
|
335
|
+ # all.append(ContentStatus('closed-deprecated', type))
|
|
336
|
+ # return all
|
|
337
|
+ status_list = list()
|
|
338
|
+ for elem in cls.allowed_values():
|
|
339
|
+ status_list.append(ContentStatus(elem))
|
|
340
|
+ return status_list
|
324
|
341
|
|
325
|
342
|
@classmethod
|
326
|
343
|
def allowed_values(cls):
|
327
|
|
- return ContentStatus._LABELS.keys()
|
|
344
|
+ # TODO - G.M - 10-04-2018 - [Cleanup] Drop this
|
|
345
|
+ # return ContentStatus._LABELS.keys()
|
|
346
|
+ return [
|
|
347
|
+ ContentStatus.OPEN,
|
|
348
|
+ ContentStatus.CLOSED_UNVALIDATED,
|
|
349
|
+ ContentStatus.CLOSED_VALIDATED,
|
|
350
|
+ ContentStatus.CLOSED_DEPRECATED
|
|
351
|
+ ]
|
|
352
|
+
|
328
|
353
|
|
329
|
354
|
class ContentType(object):
|
330
|
355
|
Any = 'any'
|
331
|
356
|
|
332
|
|
- Folder = 'folder'
|
333
|
|
- File = 'file'
|
|
357
|
+ Folder = 'folder'
|
|
358
|
+ File = 'file'
|
334
|
359
|
Comment = 'comment'
|
335
|
360
|
Thread = 'thread'
|
336
|
361
|
Page = 'page'
|
337
|
362
|
Event = 'event'
|
338
|
363
|
|
339
|
|
- _STRING_LIST_SEPARATOR = ','
|
340
|
|
-
|
341
|
|
- _ICONS = { # Deprecated
|
342
|
|
- 'dashboard': 'fa-home',
|
343
|
|
- 'workspace': 'fa-bank',
|
344
|
|
- 'folder': 'fa fa-folder-open-o',
|
345
|
|
- 'file': 'fa fa-paperclip',
|
346
|
|
- 'page': 'fa fa-file-text-o',
|
347
|
|
- 'thread': 'fa fa-comments-o',
|
348
|
|
- 'comment': 'fa fa-comment-o',
|
349
|
|
- 'event': 'fa fa-calendar-o',
|
350
|
|
- }
|
351
|
|
-
|
352
|
|
- _CSS_ICONS = {
|
353
|
|
- 'dashboard': 'fa fa-home',
|
354
|
|
- 'workspace': 'fa fa-bank',
|
355
|
|
- 'folder': 'fa fa-folder-open-o',
|
356
|
|
- 'file': 'fa fa-paperclip',
|
357
|
|
- 'page': 'fa fa-file-text-o',
|
358
|
|
- 'thread': 'fa fa-comments-o',
|
359
|
|
- 'comment': 'fa fa-comment-o',
|
360
|
|
- 'event': 'fa fa-calendar-o',
|
361
|
|
- }
|
362
|
|
-
|
363
|
|
- _CSS_COLORS = {
|
364
|
|
- 'dashboard': 't-dashboard-color',
|
365
|
|
- 'workspace': 't-less-visible',
|
366
|
|
- 'folder': 't-folder-color',
|
367
|
|
- 'file': 't-file-color',
|
368
|
|
- 'page': 't-page-color',
|
369
|
|
- 'thread': 't-thread-color',
|
370
|
|
- 'comment': 't-thread-color',
|
371
|
|
- 'event': 't-event-color',
|
372
|
|
- }
|
|
364
|
+ # TODO - G.M - 10-04-2018 - [Cleanup] Do we really need this ?
|
|
365
|
+ # _STRING_LIST_SEPARATOR = ','
|
|
366
|
+
|
|
367
|
+ # TODO - G.M - 10-04-2018 - [Cleanup] Drop this
|
|
368
|
+ # _ICONS = { # Deprecated
|
|
369
|
+ # 'dashboard': 'fa-home',
|
|
370
|
+ # 'workspace': 'fa-bank',
|
|
371
|
+ # 'folder': 'fa fa-folder-open-o',
|
|
372
|
+ # 'file': 'fa fa-paperclip',
|
|
373
|
+ # 'page': 'fa fa-file-text-o',
|
|
374
|
+ # 'thread': 'fa fa-comments-o',
|
|
375
|
+ # 'comment': 'fa fa-comment-o',
|
|
376
|
+ # 'event': 'fa fa-calendar-o',
|
|
377
|
+ # }
|
|
378
|
+ #
|
|
379
|
+ # _CSS_ICONS = {
|
|
380
|
+ # 'dashboard': 'fa fa-home',
|
|
381
|
+ # 'workspace': 'fa fa-bank',
|
|
382
|
+ # 'folder': 'fa fa-folder-open-o',
|
|
383
|
+ # 'file': 'fa fa-paperclip',
|
|
384
|
+ # 'page': 'fa fa-file-text-o',
|
|
385
|
+ # 'thread': 'fa fa-comments-o',
|
|
386
|
+ # 'comment': 'fa fa-comment-o',
|
|
387
|
+ # 'event': 'fa fa-calendar-o',
|
|
388
|
+ # }
|
|
389
|
+ #
|
|
390
|
+ # _CSS_COLORS = {
|
|
391
|
+ # 'dashboard': 't-dashboard-color',
|
|
392
|
+ # 'workspace': 't-less-visible',
|
|
393
|
+ # 'folder': 't-folder-color',
|
|
394
|
+ # 'file': 't-file-color',
|
|
395
|
+ # 'page': 't-page-color',
|
|
396
|
+ # 'thread': 't-thread-color',
|
|
397
|
+ # 'comment': 't-thread-color',
|
|
398
|
+ # 'event': 't-event-color',
|
|
399
|
+ # }
|
373
|
400
|
|
374
|
401
|
_ORDER_WEIGHT = {
|
375
|
402
|
'folder': 0,
|
|
@@ -380,32 +407,33 @@ class ContentType(object):
|
380
|
407
|
'event': 5,
|
381
|
408
|
}
|
382
|
409
|
|
383
|
|
- _LABEL = {
|
384
|
|
- 'dashboard': '',
|
385
|
|
- 'workspace': l_('workspace'),
|
386
|
|
- 'folder': l_('folder'),
|
387
|
|
- 'file': l_('file'),
|
388
|
|
- 'page': l_('page'),
|
389
|
|
- 'thread': l_('thread'),
|
390
|
|
- 'comment': l_('comment'),
|
391
|
|
- 'event': l_('event'),
|
392
|
|
- }
|
393
|
|
-
|
394
|
|
- _DELETE_LABEL = {
|
395
|
|
- 'dashboard': '',
|
396
|
|
- 'workspace': l_('Delete this workspace'),
|
397
|
|
- 'folder': l_('Delete this folder'),
|
398
|
|
- 'file': l_('Delete this file'),
|
399
|
|
- 'page': l_('Delete this page'),
|
400
|
|
- 'thread': l_('Delete this thread'),
|
401
|
|
- 'comment': l_('Delete this comment'),
|
402
|
|
- 'event': l_('Delete this event'),
|
403
|
|
- }
|
404
|
|
-
|
405
|
|
- @classmethod
|
406
|
|
- def get_icon(cls, type: str):
|
407
|
|
- assert(type in ContentType._ICONS) # DYN_REMOVE
|
408
|
|
- return ContentType._ICONS[type]
|
|
410
|
+ # TODO - G.M - 10-04-2018 - [Cleanup] Drop this
|
|
411
|
+ # _LABEL = {
|
|
412
|
+ # 'dashboard': '',
|
|
413
|
+ # 'workspace': l_('workspace'),
|
|
414
|
+ # 'folder': l_('folder'),
|
|
415
|
+ # 'file': l_('file'),
|
|
416
|
+ # 'page': l_('page'),
|
|
417
|
+ # 'thread': l_('thread'),
|
|
418
|
+ # 'comment': l_('comment'),
|
|
419
|
+ # 'event': l_('event'),
|
|
420
|
+ # }
|
|
421
|
+ #
|
|
422
|
+ # _DELETE_LABEL = {
|
|
423
|
+ # 'dashboard': '',
|
|
424
|
+ # 'workspace': l_('Delete this workspace'),
|
|
425
|
+ # 'folder': l_('Delete this folder'),
|
|
426
|
+ # 'file': l_('Delete this file'),
|
|
427
|
+ # 'page': l_('Delete this page'),
|
|
428
|
+ # 'thread': l_('Delete this thread'),
|
|
429
|
+ # 'comment': l_('Delete this comment'),
|
|
430
|
+ # 'event': l_('Delete this event'),
|
|
431
|
+ # }
|
|
432
|
+ #
|
|
433
|
+ # @classmethod
|
|
434
|
+ # def get_icon(cls, type: str):
|
|
435
|
+ # assert(type in ContentType._ICONS) # DYN_REMOVE
|
|
436
|
+ # return ContentType._ICONS[type]
|
409
|
437
|
|
410
|
438
|
@classmethod
|
411
|
439
|
def all(cls):
|
|
@@ -418,37 +446,39 @@ class ContentType(object):
|
418
|
446
|
|
419
|
447
|
@classmethod
|
420
|
448
|
def allowed_types_for_folding(cls):
|
421
|
|
- # This method is used for showing only "main" types in the left-side treeview
|
|
449
|
+ # This method is used for showing only "main"
|
|
450
|
+ # types in the left-side treeview
|
422
|
451
|
return [cls.Folder, cls.File, cls.Thread, cls.Page]
|
423
|
452
|
|
424
|
|
- @classmethod
|
425
|
|
- def allowed_types_from_str(cls, allowed_types_as_string: str):
|
426
|
|
- allowed_types = []
|
427
|
|
- # HACK - THIS
|
428
|
|
- for item in allowed_types_as_string.split(ContentType._STRING_LIST_SEPARATOR):
|
429
|
|
- if item and item in ContentType.allowed_types_for_folding():
|
430
|
|
- allowed_types.append(item)
|
431
|
|
- return allowed_types
|
432
|
|
-
|
433
|
|
- @classmethod
|
434
|
|
- def fill_url(cls, content: 'Content'):
|
435
|
|
- # TODO - DYNDATATYPE - D.A. - 2014-12-02
|
436
|
|
- # Make this code dynamic loading data types
|
437
|
|
-
|
438
|
|
- if content.type==ContentType.Folder:
|
439
|
|
- return '/workspaces/{}/folders/{}'.format(content.workspace_id, content.content_id)
|
440
|
|
- elif content.type==ContentType.File:
|
441
|
|
- return '/workspaces/{}/folders/{}/files/{}'.format(content.workspace_id, content.parent_id, content.content_id)
|
442
|
|
- elif content.type==ContentType.Thread:
|
443
|
|
- return '/workspaces/{}/folders/{}/threads/{}'.format(content.workspace_id, content.parent_id, content.content_id)
|
444
|
|
- elif content.type==ContentType.Page:
|
445
|
|
- return '/workspaces/{}/folders/{}/pages/{}'.format(content.workspace_id, content.parent_id, content.content_id)
|
446
|
|
-
|
447
|
|
- @classmethod
|
448
|
|
- def fill_url_for_workspace(cls, workspace: Workspace):
|
449
|
|
- # TODO - DYNDATATYPE - D.A. - 2014-12-02
|
450
|
|
- # Make this code dynamic loading data types
|
451
|
|
- return '/workspaces/{}'.format(workspace.workspace_id)
|
|
453
|
+ # TODO - G.M - 10-04-2018 - [Cleanup] Drop this
|
|
454
|
+ # @classmethod
|
|
455
|
+ # def allowed_types_from_str(cls, allowed_types_as_string: str):
|
|
456
|
+ # allowed_types = []
|
|
457
|
+ # # HACK - THIS
|
|
458
|
+ # for item in allowed_types_as_string.split(ContentType._STRING_LIST_SEPARATOR):
|
|
459
|
+ # if item and item in ContentType.allowed_types_for_folding():
|
|
460
|
+ # allowed_types.append(item)
|
|
461
|
+ # return allowed_types
|
|
462
|
+ #
|
|
463
|
+ # @classmethod
|
|
464
|
+ # def fill_url(cls, content: 'Content'):
|
|
465
|
+ # # TODO - DYNDATATYPE - D.A. - 2014-12-02
|
|
466
|
+ # # Make this code dynamic loading data types
|
|
467
|
+ #
|
|
468
|
+ # if content.type==ContentType.Folder:
|
|
469
|
+ # return '/workspaces/{}/folders/{}'.format(content.workspace_id, content.content_id)
|
|
470
|
+ # elif content.type==ContentType.File:
|
|
471
|
+ # return '/workspaces/{}/folders/{}/files/{}'.format(content.workspace_id, content.parent_id, content.content_id)
|
|
472
|
+ # elif content.type==ContentType.Thread:
|
|
473
|
+ # return '/workspaces/{}/folders/{}/threads/{}'.format(content.workspace_id, content.parent_id, content.content_id)
|
|
474
|
+ # elif content.type==ContentType.Page:
|
|
475
|
+ # return '/workspaces/{}/folders/{}/pages/{}'.format(content.workspace_id, content.parent_id, content.content_id)
|
|
476
|
+ #
|
|
477
|
+ # @classmethod
|
|
478
|
+ # def fill_url_for_workspace(cls, workspace: Workspace):
|
|
479
|
+ # # TODO - DYNDATATYPE - D.A. - 2014-12-02
|
|
480
|
+ # # Make this code dynamic loading data types
|
|
481
|
+ # return '/workspaces/{}'.format(workspace.workspace_id)
|
452
|
482
|
|
453
|
483
|
@classmethod
|
454
|
484
|
def sorted(cls, types: ['ContentType']) -> ['ContentType']:
|
|
@@ -460,18 +490,20 @@ class ContentType(object):
|
460
|
490
|
|
461
|
491
|
def __init__(self, type):
|
462
|
492
|
self.id = type
|
463
|
|
- self.icon = ContentType._CSS_ICONS[type]
|
464
|
|
- self.color = ContentType._CSS_COLORS[type] # deprecated
|
465
|
|
- self.css = ContentType._CSS_COLORS[type]
|
466
|
|
- self.label = ContentType._LABEL[type]
|
|
493
|
+ # TODO - G.M - 10-04-2018 - [Cleanup] Drop this
|
|
494
|
+ # self.icon = ContentType._CSS_ICONS[type]
|
|
495
|
+ # self.color = ContentType._CSS_COLORS[type] # deprecated
|
|
496
|
+ # self.css = ContentType._CSS_COLORS[type]
|
|
497
|
+ # self.label = ContentType._LABEL[type]
|
467
|
498
|
self.priority = ContentType._ORDER_WEIGHT[type]
|
468
|
499
|
|
469
|
500
|
def toDict(self):
|
470
|
501
|
return dict(id=self.type,
|
471
|
502
|
type=self.type,
|
472
|
|
- icon=self.icon,
|
473
|
|
- color=self.color,
|
474
|
|
- label=self.label,
|
|
503
|
+ # TODO - G.M - 10-04-2018 - [Cleanup] Drop this
|
|
504
|
+ # icon=self.icon,
|
|
505
|
+ # color=self.color,
|
|
506
|
+ # label=self.label,
|
475
|
507
|
priority=self.priority)
|
476
|
508
|
|
477
|
509
|
|
|
@@ -479,7 +511,7 @@ class ContentChecker(object):
|
479
|
511
|
|
480
|
512
|
@classmethod
|
481
|
513
|
def check_properties(cls, item):
|
482
|
|
- if item.type==ContentType.Folder:
|
|
514
|
+ if item.type == ContentType.Folder:
|
483
|
515
|
properties = item.properties
|
484
|
516
|
if 'allowed_content' not in properties.keys():
|
485
|
517
|
return False
|
|
@@ -515,7 +547,7 @@ class ContentChecker(object):
|
515
|
547
|
|
516
|
548
|
@classmethod
|
517
|
549
|
def reset_properties(cls, item):
|
518
|
|
- if item.type==ContentType.Folder:
|
|
550
|
+ if item.type == ContentType.Folder:
|
519
|
551
|
item.properties = DEFAULT_PROPERTIES
|
520
|
552
|
return
|
521
|
553
|
|
|
@@ -665,7 +697,6 @@ class ContentRevisionRO(DeclarativeBase):
|
665
|
697
|
)
|
666
|
698
|
return copy_rev
|
667
|
699
|
|
668
|
|
-
|
669
|
700
|
def __setattr__(self, key: str, value: 'mixed'):
|
670
|
701
|
"""
|
671
|
702
|
ContentRevisionUpdateError is raised if tried to update column and revision own identity
|
|
@@ -1173,7 +1204,11 @@ class Content(DeclarativeBase):
|
1173
|
1204
|
return self.revision.get_label_as_file()
|
1174
|
1205
|
|
1175
|
1206
|
def get_status(self) -> ContentStatus:
|
1176
|
|
- return ContentStatus(self.status, self.type.__str__())
|
|
1207
|
+ return ContentStatus(
|
|
1208
|
+ self.status,
|
|
1209
|
+ # TODO - G.M - 10-04-2018 - [Cleanup] Drop this
|
|
1210
|
+ # self.type.__str__()
|
|
1211
|
+ )
|
1177
|
1212
|
|
1178
|
1213
|
def get_last_action(self) -> ActionDescription:
|
1179
|
1214
|
return ActionDescription(self.revision_type)
|
|
@@ -1222,7 +1257,7 @@ class Content(DeclarativeBase):
|
1222
|
1257
|
last_comment_updated = None
|
1223
|
1258
|
last_comment = None
|
1224
|
1259
|
for comment in self.get_comments():
|
1225
|
|
- if user.user_id==comment.owner.user_id:
|
|
1260
|
+ if user.user_id == comment.owner.user_id:
|
1226
|
1261
|
if not last_comment or last_comment_updated<comment.updated:
|
1227
|
1262
|
# take only the latest comment !
|
1228
|
1263
|
last_comment = comment
|
|
@@ -1356,9 +1391,10 @@ class VirtualEvent(object):
|
1356
|
1391
|
content_type = ContentType(content.type)
|
1357
|
1392
|
|
1358
|
1393
|
label = content.get_label()
|
1359
|
|
- if content.type==ContentType.Comment:
|
1360
|
|
- # TODO : 28-03-2018 [i18n] Internationalize this ?
|
1361
|
|
- label = ('<strong>{}</strong> wrote:').format(content.owner.get_display_name())
|
|
1394
|
+ if content.type == ContentType.Comment:
|
|
1395
|
+ # TODO - G.M - 10-04-2018 - [Cleanup] Remove label param
|
|
1396
|
+ # from this object ?
|
|
1397
|
+ label = l_('<strong>{}</strong> wrote:').format(content.owner.get_display_name())
|
1362
|
1398
|
|
1363
|
1399
|
return VirtualEvent(id=content.content_id,
|
1364
|
1400
|
created=content.created,
|
|
@@ -1390,9 +1426,10 @@ class VirtualEvent(object):
|
1390
|
1426
|
self.ref_object = ref_object
|
1391
|
1427
|
|
1392
|
1428
|
assert hasattr(type, 'id')
|
1393
|
|
- assert hasattr(type, 'css')
|
1394
|
|
- assert hasattr(type, 'icon')
|
1395
|
|
- assert hasattr(type, 'label')
|
|
1429
|
+ # TODO - G.M - 10-04-2018 - [Cleanup] Drop this
|
|
1430
|
+ # assert hasattr(type, 'css')
|
|
1431
|
+ # assert hasattr(type, 'icon')
|
|
1432
|
+ # assert hasattr(type, 'label')
|
1396
|
1433
|
|
1397
|
1434
|
def created_as_delta(self, delta_from_datetime:datetime=None):
|
1398
|
1435
|
if not delta_from_datetime:
|