0001-remove-FileWithPreviewAndStrongboxWidget.patch
extra/auquotidien.py | ||
---|---|---|
14 | 14 |
import modules.formpage |
15 | 15 |
import modules.template |
16 | 16 |
import modules.root |
17 |
import modules.form |
|
18 | 17 |
import modules.payments |
19 | 18 |
import modules.connectors |
20 | 19 |
import modules.abelium_domino_ui |
... | ... | |
50 | 49 |
rdb.register_directory('settings', modules.admin.SettingsDirectory()) |
51 | 50 |
rdb.register_directory('categories', modules.categories_admin.CategoriesDirectory()) |
52 | 51 | |
53 |
import wcs.fields |
|
54 |
wcs.fields.FileField.widget_class = modules.form.FileWithPreviewAndStrongboxWidget |
|
55 | ||
56 | 52 |
import wcs.admin.settings |
57 | 53 |
wcs.admin.settings.SettingsDirectory.domino = modules.abelium_domino_ui.AbeliumDominoDirectory() |
58 | 54 |
wcs.admin.settings.SettingsDirectory._q_exports.append('domino') |
extra/modules/form.py | ||
---|---|---|
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 |
|
37 |
- |