274 |
274 |
return 'opendocument'
|
275 |
275 |
raise UploadValidationError(_('Only RTF and OpenDocument files can be used'))
|
276 |
276 |
|
|
277 |
def get_parameters(self):
|
|
278 |
parameters = ('method', 'by', 'label', 'model_file', 'attach_to_history',
|
|
279 |
'backoffice_info_text', 'varname')
|
|
280 |
if transform_to_pdf is not None:
|
|
281 |
parameters += ('convert_to_pdf',)
|
|
282 |
if has_portfolio():
|
|
283 |
parameters += ('push_to_portfolio',)
|
|
284 |
return parameters
|
|
285 |
|
277 |
286 |
def add_parameters_widgets(self, form, parameters, prefix='',
|
278 |
287 |
formdef=None):
|
279 |
288 |
methods = collections.OrderedDict(
|
... | ... | |
309 |
318 |
form.add(UploadWidget, widget_name, directory='models',
|
310 |
319 |
filename=filename, title=_('Model'), hint=hint,
|
311 |
320 |
validation=self.model_file_validation, value=value)
|
312 |
|
if 'attach_to_history' in parameters:
|
313 |
|
form.add(CheckboxWidget, '%sattach_to_history' % prefix,
|
314 |
|
title=_('Attach generated file to the form history'),
|
315 |
|
value=self.attach_to_history)
|
316 |
321 |
if 'convert_to_pdf' in parameters:
|
317 |
322 |
form.add(CheckboxWidget, '%sconvert_to_pdf' % prefix,
|
318 |
323 |
title=_('Convert generated file to PDF'),
|
319 |
324 |
value=self.convert_to_pdf)
|
320 |
|
if 'push_to_portfolio' in parameters:
|
321 |
|
form.add(CheckboxWidget, '%spush_to_portfolio' % prefix,
|
322 |
|
title=_('Push generated file to portfolio'),
|
323 |
|
value=self.push_to_portfolio)
|
|
325 |
if 'attach_to_history' in parameters:
|
|
326 |
form.add(CheckboxWidget, '%sattach_to_history' % prefix,
|
|
327 |
title=_('Attach generated file to the form history'),
|
|
328 |
value=self.attach_to_history)
|
324 |
329 |
if 'varname' in parameters:
|
325 |
330 |
form.add(VarnameWidget, '%svarname' % prefix,
|
326 |
331 |
title=_('Identifier'), value=self.varname,
|
327 |
332 |
hint=_('This is used to get generated document in expressions.'))
|
|
333 |
if 'push_to_portfolio' in parameters:
|
|
334 |
form.add(CheckboxWidget, '%spush_to_portfolio' % prefix,
|
|
335 |
title=_('Push generated file to portfolio'),
|
|
336 |
value=self.push_to_portfolio)
|
328 |
337 |
|
329 |
338 |
if 'method' in parameters:
|
330 |
339 |
form.add(RadiobuttonsWidget, '%smethod' % prefix,
|
... | ... | |
470 |
479 |
outstream.seek(0)
|
471 |
480 |
return outstream
|
472 |
481 |
|
473 |
|
def get_parameters(self):
|
474 |
|
parameters = ('method', 'by', 'label', 'model_file', 'attach_to_history',
|
475 |
|
'backoffice_info_text', 'varname')
|
476 |
|
if transform_to_pdf is not None:
|
477 |
|
parameters += ('convert_to_pdf',)
|
478 |
|
if has_portfolio():
|
479 |
|
parameters += ('push_to_portfolio',)
|
480 |
|
return parameters
|
481 |
|
|
482 |
482 |
def model_file_export_to_xml(self, xml_item, charset, include_id=False):
|
483 |
483 |
if not self.model_file:
|
484 |
484 |
return
|
485 |
|
-
|