Mercurial > libervia-web
annotate libervia/pages/photos/new/page_meta.py @ 1346:cda5537c71d6
browser (photos/album): videos integrations:
videos can now be added to an album, the alternative media player is then used to display
them. Slides options are used to remove pagination and slidebar from slideshow (they don't
play well with media player), and video are reset when its slide is exited.
author | Goffi <goffi@goffi.org> |
---|---|
date | Tue, 25 Aug 2020 08:31:56 +0200 |
parents | 3a1cb3c5702f |
children | 39719ff4fcad |
rev | line source |
---|---|
1278
4385a75e3962
pages (photos/new): photo album creation
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
1 #!/usr/bin/env python3 |
4385a75e3962
pages (photos/new): photo album creation
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
2 |
4385a75e3962
pages (photos/new): photo album creation
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
3 from libervia.server.constants import Const as C |
4385a75e3962
pages (photos/new): photo album creation
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
4 from twisted.internet import defer |
4385a75e3962
pages (photos/new): photo album creation
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
5 from sat.core.log import getLogger |
4385a75e3962
pages (photos/new): photo album creation
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
6 from sat.core.i18n import D_ |
1339 | 7 from sat.core import exceptions |
1278
4385a75e3962
pages (photos/new): photo album creation
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
8 |
4385a75e3962
pages (photos/new): photo album creation
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
9 """creation of new events""" |
4385a75e3962
pages (photos/new): photo album creation
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
10 |
4385a75e3962
pages (photos/new): photo album creation
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
11 name = "photos_new" |
4385a75e3962
pages (photos/new): photo album creation
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
12 access = C.PAGES_ACCESS_PROFILE |
4385a75e3962
pages (photos/new): photo album creation
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
13 template = "photo/create.html" |
4385a75e3962
pages (photos/new): photo album creation
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
14 log = getLogger(__name__) |
4385a75e3962
pages (photos/new): photo album creation
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
15 |
4385a75e3962
pages (photos/new): photo album creation
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
16 |
4385a75e3962
pages (photos/new): photo album creation
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
17 async def on_data_post(self, request): |
4385a75e3962
pages (photos/new): photo album creation
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
18 request_data = self.getRData(request) |
4385a75e3962
pages (photos/new): photo album creation
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
19 profile = self.getProfile(request) |
1280
198605982d15
pages (photos/new): create albums in "/albums/" path in default namespace
Goffi <goffi@goffi.org>
parents:
1278
diff
changeset
|
20 name = self.getPostedData(request, "name").replace('/', '_') |
1278
4385a75e3962
pages (photos/new): photo album creation
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
21 if profile is None: |
4385a75e3962
pages (photos/new): photo album creation
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
22 self.pageError(request, C.HTTP_BAD_REQUEST) |
4385a75e3962
pages (photos/new): photo album creation
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
23 fis_ns = self.host.ns_map["fis"] |
4385a75e3962
pages (photos/new): photo album creation
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
24 http_upload_ns = self.host.ns_map["http_upload"] |
4385a75e3962
pages (photos/new): photo album creation
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
25 entities_services, __, __ = await self.host.bridgeCall( |
4385a75e3962
pages (photos/new): photo album creation
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
26 "discoFindByFeatures", |
4385a75e3962
pages (photos/new): photo album creation
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
27 [fis_ns, http_upload_ns], |
4385a75e3962
pages (photos/new): photo album creation
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
28 [], |
4385a75e3962
pages (photos/new): photo album creation
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
29 False, |
4385a75e3962
pages (photos/new): photo album creation
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
30 True, |
4385a75e3962
pages (photos/new): photo album creation
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
31 False, |
4385a75e3962
pages (photos/new): photo album creation
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
32 False, |
4385a75e3962
pages (photos/new): photo album creation
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
33 False, |
4385a75e3962
pages (photos/new): photo album creation
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
34 profile |
4385a75e3962
pages (photos/new): photo album creation
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
35 ) |
4385a75e3962
pages (photos/new): photo album creation
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
36 try: |
4385a75e3962
pages (photos/new): photo album creation
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
37 fis_service = next(iter(entities_services)) |
4385a75e3962
pages (photos/new): photo album creation
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
38 except StopIteration: |
1339 | 39 raise exceptions.DataError(D_( |
40 "You server has no service to create a photo album, please ask your server " | |
1278
4385a75e3962
pages (photos/new): photo album creation
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
41 "administrator to add one")) |
4385a75e3962
pages (photos/new): photo album creation
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
42 |
4385a75e3962
pages (photos/new): photo album creation
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
43 await self.host.bridgeCall( |
4385a75e3962
pages (photos/new): photo album creation
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
44 "interestsRegisterFileSharing", |
4385a75e3962
pages (photos/new): photo album creation
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
45 fis_service, |
4385a75e3962
pages (photos/new): photo album creation
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
46 "photos", |
4385a75e3962
pages (photos/new): photo album creation
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
47 "", |
1280
198605982d15
pages (photos/new): create albums in "/albums/" path in default namespace
Goffi <goffi@goffi.org>
parents:
1278
diff
changeset
|
48 f"/albums/{name}", |
1278
4385a75e3962
pages (photos/new): photo album creation
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
49 name, |
4385a75e3962
pages (photos/new): photo album creation
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
50 "", |
4385a75e3962
pages (photos/new): photo album creation
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
51 profile |
4385a75e3962
pages (photos/new): photo album creation
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
52 ) |
4385a75e3962
pages (photos/new): photo album creation
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
53 log.info(f"album {name} created") |
4385a75e3962
pages (photos/new): photo album creation
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
54 request_data["post_redirect_page"] = self.getPageByName("photos") |
4385a75e3962
pages (photos/new): photo album creation
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
55 defer.returnValue(C.POST_NO_CONFIRM) |