20 from pyams_content.component.association.zmi import AssociationItemAJAXAddForm, AssociationItemAJAXEditForm |
20 from pyams_content.component.association.zmi import AssociationItemAJAXAddForm, AssociationItemAJAXEditForm |
21 from pyams_content.component.association.zmi.interfaces import IAssociationsView |
21 from pyams_content.component.association.zmi.interfaces import IAssociationsView |
22 from pyams_content.component.extfile import EXTERNAL_FILES_FACTORIES |
22 from pyams_content.component.extfile import EXTERNAL_FILES_FACTORIES |
23 from pyams_content.component.extfile.interfaces import IExtAudio, IExtFile, IExtFileContainerTarget, IExtImage, \ |
23 from pyams_content.component.extfile.interfaces import IExtAudio, IExtFile, IExtFileContainerTarget, IExtImage, \ |
24 IExtMedia, IExtVideo |
24 IExtMedia, IExtVideo |
|
25 from pyams_content.component.extfile.zmi.widget import ExtFileTitleFieldWidget, I18nExtFileTitleFieldWidget |
25 from pyams_content.component.paragraph.zmi import get_json_paragraph_markers_refresh_event |
26 from pyams_content.component.paragraph.zmi import get_json_paragraph_markers_refresh_event |
26 from pyams_content.component.paragraph.zmi.container import ParagraphContainerCounterBase |
27 from pyams_content.component.paragraph.zmi.container import ParagraphContainerCounterBase |
27 from pyams_content.component.paragraph.zmi.interfaces import IParagraphContainerTable, IParagraphTitleToolbar |
28 from pyams_content.component.paragraph.zmi.interfaces import IParagraphContainerTable, IParagraphTitleToolbar |
28 from pyams_content.interfaces import MANAGE_CONTENT_PERMISSION |
29 from pyams_content.interfaces import MANAGE_CONTENT_PERMISSION |
29 from pyams_form.form import ajax_config |
30 from pyams_form.form import ajax_config |
97 |
98 |
98 legend = _("Add new external file") |
99 legend = _("Add new external file") |
99 icon_css_class = 'fa fa-fw fa-file-text-o' |
100 icon_css_class = 'fa fa-fw fa-file-text-o' |
100 |
101 |
101 fields = field.Fields(IExtFile).select('data', 'filename', 'title', 'description', 'author', 'language') |
102 fields = field.Fields(IExtFile).select('data', 'filename', 'title', 'description', 'author', 'language') |
|
103 fields['title'].widgetFactory = I18nExtFileTitleFieldWidget |
|
104 |
102 edit_permission = MANAGE_CONTENT_PERMISSION |
105 edit_permission = MANAGE_CONTENT_PERMISSION |
103 |
106 |
104 def create(self, data): |
107 def create(self, data): |
105 factory = EXTERNAL_FILES_FACTORIES.get('file') |
108 factory = EXTERNAL_FILES_FACTORIES.get('file') |
106 if factory is not None: |
109 if factory is not None: |
128 legend = _("Update file properties") |
131 legend = _("Update file properties") |
129 icon_css_class = 'fa fa-fw fa-file-text-o' |
132 icon_css_class = 'fa fa-fw fa-file-text-o' |
130 dialog_class = 'modal-large' |
133 dialog_class = 'modal-large' |
131 |
134 |
132 fields = field.Fields(IExtFile).select('data', 'filename', 'title', 'description', 'author', 'language') |
135 fields = field.Fields(IExtFile).select('data', 'filename', 'title', 'description', 'author', 'language') |
|
136 fields['title'].widgetFactory = I18nExtFileTitleFieldWidget |
|
137 |
133 edit_permission = MANAGE_CONTENT_PERMISSION |
138 edit_permission = MANAGE_CONTENT_PERMISSION |
134 |
139 |
135 def get_ajax_output(self, changes): |
140 def get_ajax_output(self, changes): |
136 if changes: |
141 if changes: |
137 return self.get_associations_table() |
142 return self.get_associations_table() |
182 |
187 |
183 legend = _("Add new image") |
188 legend = _("Add new image") |
184 icon_css_class = 'fa fa-fw fa-file-image-o' |
189 icon_css_class = 'fa fa-fw fa-file-image-o' |
185 |
190 |
186 fields = field.Fields(IExtImage).select('data', 'filename', 'title', 'description', 'author') |
191 fields = field.Fields(IExtImage).select('data', 'filename', 'title', 'description', 'author') |
|
192 fields['title'].widgetFactory = I18nExtFileTitleFieldWidget |
187 |
193 |
188 def updateWidgets(self, prefix=None): |
194 def updateWidgets(self, prefix=None): |
189 super(ExtImageAddForm, self).updateWidgets(prefix) |
195 super(ExtImageAddForm, self).updateWidgets(prefix) |
190 if 'title' in self.widgets: |
196 if 'title' in self.widgets: |
191 self.widgets['title'].description = None |
197 self.widgets['title'].description = None |
213 |
219 |
214 legend = _("Update image properties") |
220 legend = _("Update image properties") |
215 icon_css_class = 'fa fa-fw fa-file-image-o' |
221 icon_css_class = 'fa fa-fw fa-file-image-o' |
216 |
222 |
217 fields = field.Fields(IExtImage).select('data', 'filename', 'title', 'description', 'author') |
223 fields = field.Fields(IExtImage).select('data', 'filename', 'title', 'description', 'author') |
|
224 fields['title'].widgetFactory = I18nExtFileTitleFieldWidget |
218 |
225 |
219 def updateWidgets(self, prefix=None): |
226 def updateWidgets(self, prefix=None): |
220 super(ExtImagePropertiesEditForm, self).updateWidgets(prefix) |
227 super(ExtImagePropertiesEditForm, self).updateWidgets(prefix) |
221 if 'title' in self.widgets: |
228 if 'title' in self.widgets: |
222 self.widgets['title'].description = None |
229 self.widgets['title'].description = None |
273 |
280 |
274 legend = _("Add new video") |
281 legend = _("Add new video") |
275 icon_css_class = 'fa fa-fw fa-file-video-o' |
282 icon_css_class = 'fa fa-fw fa-file-video-o' |
276 |
283 |
277 fields = field.Fields(IExtVideo).select('data', 'filename', 'title', 'description', 'author', 'language') |
284 fields = field.Fields(IExtVideo).select('data', 'filename', 'title', 'description', 'author', 'language') |
|
285 fields['title'].widgetFactory = I18nExtFileTitleFieldWidget |
278 |
286 |
279 def create(self, data): |
287 def create(self, data): |
280 factory = EXTERNAL_FILES_FACTORIES.get('video') |
288 factory = EXTERNAL_FILES_FACTORIES.get('video') |
281 if factory is not None: |
289 if factory is not None: |
282 return factory[0]() |
290 return factory[0]() |
297 |
305 |
298 legend = _("Update video properties") |
306 legend = _("Update video properties") |
299 icon_css_class = 'fa fa-fw fa-file-video-o' |
307 icon_css_class = 'fa fa-fw fa-file-video-o' |
300 |
308 |
301 fields = field.Fields(IExtVideo).select('data', 'filename', 'title', 'description', 'author', 'language') |
309 fields = field.Fields(IExtVideo).select('data', 'filename', 'title', 'description', 'author', 'language') |
|
310 fields['title'].widgetFactory = I18nExtFileTitleFieldWidget |
302 |
311 |
303 def get_ajax_output(self, changes): |
312 def get_ajax_output(self, changes): |
304 if changes: |
313 if changes: |
305 return self.get_associations_table() |
314 return self.get_associations_table() |
306 else: |
315 else: |
350 |
359 |
351 legend = _("Add new audio file") |
360 legend = _("Add new audio file") |
352 icon_css_class = 'fa fa-fw fa-file-audio-o' |
361 icon_css_class = 'fa fa-fw fa-file-audio-o' |
353 |
362 |
354 fields = field.Fields(IExtAudio).select('data', 'filename', 'title', 'description', 'author', 'language') |
363 fields = field.Fields(IExtAudio).select('data', 'filename', 'title', 'description', 'author', 'language') |
|
364 fields['title'].widgetFactory = I18nExtFileTitleFieldWidget |
355 |
365 |
356 def create(self, data): |
366 def create(self, data): |
357 factory = EXTERNAL_FILES_FACTORIES.get('audio') |
367 factory = EXTERNAL_FILES_FACTORIES.get('audio') |
358 if factory is not None: |
368 if factory is not None: |
359 return factory[0]() |
369 return factory[0]() |
374 |
384 |
375 legend = _("Update audio file properties") |
385 legend = _("Update audio file properties") |
376 icon_css_class = 'fa fa-fw fa-file-audio-o' |
386 icon_css_class = 'fa fa-fw fa-file-audio-o' |
377 |
387 |
378 fields = field.Fields(IExtAudio).select('data', 'filename', 'title', 'description', 'author', 'language') |
388 fields = field.Fields(IExtAudio).select('data', 'filename', 'title', 'description', 'author', 'language') |
|
389 fields['title'].widgetFactory = I18nExtFileTitleFieldWidget |
379 |
390 |
380 def get_ajax_output(self, changes): |
391 def get_ajax_output(self, changes): |
381 if changes: |
392 if changes: |
382 return self.get_associations_table() |
393 return self.get_associations_table() |
383 else: |
394 else: |