equal
deleted
inserted
replaced
14 |
14 |
15 |
15 |
16 # import standard library |
16 # import standard library |
17 |
17 |
18 # import interfaces |
18 # import interfaces |
19 from pyams_content.component.association.interfaces import IAssociationTarget, IAssociationContainer, IAssociationInfo |
19 from pyams_content.component.association.interfaces import IAssociationContainerTarget, IAssociationContainer, \ |
|
20 IAssociationInfo |
20 from pyams_content.component.extfile.interfaces import IExtFile, IExtImage |
21 from pyams_content.component.extfile.interfaces import IExtFile, IExtImage |
21 from pyams_i18n.interfaces import II18n |
22 from pyams_i18n.interfaces import II18n |
22 from pyams_skin.layer import IPyAMSLayer |
23 from pyams_skin.layer import IPyAMSLayer |
23 |
24 |
24 # import packages |
25 # import packages |
35 @view_config(name='get-files-list.json', context=Interface, request_type=IPyAMSLayer, |
36 @view_config(name='get-files-list.json', context=Interface, request_type=IPyAMSLayer, |
36 renderer='json', xhr=True) |
37 renderer='json', xhr=True) |
37 def get_files_list(request): |
38 def get_files_list(request): |
38 """Get container files in JSON format for TinyMCE editor""" |
39 """Get container files in JSON format for TinyMCE editor""" |
39 result = [] |
40 result = [] |
40 target = get_parent(request.context, IAssociationTarget) |
41 target = get_parent(request.context, IAssociationContainerTarget) |
41 if target is not None: |
42 if target is not None: |
42 container = IAssociationContainer(target) |
43 container = IAssociationContainer(target) |
43 result.extend([{'title': IAssociationInfo(item).user_title, |
44 result.extend([{'title': IAssociationInfo(item).user_title, |
44 'value': absolute_url(II18n(item).query_attribute('data', request=request), |
45 'value': absolute_url(II18n(item).query_attribute('data', request=request), |
45 request=request)} |
46 request=request)} |
50 @view_config(name='get-images-list.json', context=Interface, request_type=IPyAMSLayer, |
51 @view_config(name='get-images-list.json', context=Interface, request_type=IPyAMSLayer, |
51 renderer='json', xhr=True) |
52 renderer='json', xhr=True) |
52 def get_images_list(request): |
53 def get_images_list(request): |
53 """Get container images in JSON format for TinyMCE editor""" |
54 """Get container images in JSON format for TinyMCE editor""" |
54 result = [] |
55 result = [] |
55 target = get_parent(request.context, IAssociationTarget) |
56 target = get_parent(request.context, IAssociationContainerTarget) |
56 if target is not None: |
57 if target is not None: |
57 container = IAssociationContainer(target) |
58 container = IAssociationContainer(target) |
58 result.extend([{'title': IAssociationInfo(item).user_title, |
59 result.extend([{'title': IAssociationInfo(item).user_title, |
59 'value': absolute_url(II18n(item).query_attribute('data', request=request), |
60 'value': absolute_url(II18n(item).query_attribute('data', request=request), |
60 request=request)} |
61 request=request)} |