1
|
from qommon.form import *
|
2
|
|
3
|
|
4
|
class FileWithPreviewAndStrongboxWidget(FileWithPreviewWidget):
|
5
|
def render_hint(self, hint):
|
6
|
t = CompositeWidget.render_hint(self, hint)
|
7
|
if not self.allow_portfolio_picking:
|
8
|
return t
|
9
|
root_url = get_publisher().get_root_url()
|
10
|
if get_publisher().has_site_option('strongbox') and get_request().user and not self.preview:
|
11
|
get_response().add_javascript(['../../aq/js/strongbox.js'])
|
12
|
t += htmltext('''<p class="use-file-from-strongbox"><span
|
13
|
data-url="%smyspace/strongbox/pick"
|
14
|
rel="popup">%s</span></p>''') % (
|
15
|
root_url, _('Use file from strongbox'))
|
16
|
if get_publisher().get_site_option('msp') is not None and not self.preview:
|
17
|
get_response().add_javascript(['../../aq/js/msp.js'])
|
18
|
t += htmltext('''<p class="use-file-from-msp"><span
|
19
|
data-src="%smsp/pick"
|
20
|
data-width="500"
|
21
|
data-height="400"
|
22
|
data-title="%s"
|
23
|
rel="popup">%s</span></p>''') % (
|
24
|
root_url, _('Pick a file on mon.Service-Public.fr'),
|
25
|
_('Use file from mon.Service-Public.fr'))
|
26
|
if get_publisher().get_site_option('fargo_url') is not None and not self.preview:
|
27
|
get_response().add_javascript(['fargo.js'])
|
28
|
t += htmltext('''<p class="use-file-from-fargo"><span
|
29
|
data-src="%sfargo/pick"
|
30
|
data-width="500"
|
31
|
data-height="400"
|
32
|
data-title="%s"
|
33
|
rel="popup">%s</span></p>''') % (
|
34
|
root_url, _('Pick a file from your dropbox'),
|
35
|
_('Use file from my dropbox'))
|
36
|
return t
|