This repository has been archived on 2023-02-21. You can view files and clone it, but cannot push or open issues or pull requests.
auquotidien/extra/modules/form.py

35 lines
1.9 KiB
Python

from qommon.form import *
class FileWithPreviewAndStrongboxWidget(FileWithPreviewWidget):
def render_hint(self, hint):
t = CompositeWidget.render_hint(self, hint)
root_url = get_publisher().get_root_url()
if get_publisher().has_site_option('strongbox') and get_request().user and not self.preview:
get_response().add_javascript(['../../aq/js/strongbox.js'])
t += htmltext('''<p class="use-file-from-strongbox"><span
data-url="%smyspace/strongbox/pick"
rel="popup">%s</span></p>''') % (
root_url, _('Use file from strongbox'))
if get_publisher().get_site_option('msp') is not None and not self.preview:
get_response().add_javascript(['../../aq/js/msp.js'])
t += htmltext('''<p class="use-file-from-msp"><span
data-src="%smsp/pick"
data-width="500"
data-height="400"
data-title="%s"
rel="popup">%s</span></p>''') % (
root_url, _('Pick a file on mon.Service-Public.fr'),
_('Use file from mon.Service-Public.fr'))
if get_publisher().get_site_option('fargo_url') is not None and not self.preview:
get_response().add_javascript(['../../aq/js/fargo.js'])
t += htmltext('''<p class="use-file-from-fargo"><span
data-src="%sfargo/pick"
data-width="500"
data-height="400"
data-title="%s"
rel="popup">%s</span></p>''') % (
root_url, _('Pick a file from your dropbox'),
_('Use file from my dropbox'))
return t