Compare commits

..

76 commits

Author SHA1 Message Date
1c5e9c87af Keep Django's migration history check unless it actually fails 2026-10-16 17:49:43 +03:00
d0de8db029 Make manage.py migrate handle restored old databases and create the sites 2026-10-16 17:42:19 +03:00
b535d1c8f9 Document that the command can be overridden now 2026-10-16 14:39:11 +03:00
0100daf8b9 Read the database settings from the environment instead of a generated file 2026-10-16 14:39:11 +03:00
6e2dd6b555 Clarify PostgreSQL setup instructions and update testing notes in Kubernetes guide 2026-10-09 22:01:35 +03:00
a80010c0bc Rewrite the Kubernetes guide around the Helm chart 2026-10-09 21:44:38 +03:00
fdb9ce6033 Add a Helm chart that migrates with a Job and replaces the raw manifest 2026-10-09 21:44:34 +03:00
fcac609728 Describe the restore, migrate and start order in the Kubernetes steps 2026-10-09 20:45:57 +03:00
6c6aef8309 Run migrations in a Job and stop Kubernetes injecting service env vars 2026-10-09 20:45:57 +03:00
4a6460f129 Replace the Kubernetes guide with a manifest and short steps 2026-10-09 20:00:02 +03:00
3eb05bef6d Document the roles and add the Kubernetes guide 2026-10-09 19:36:30 +03:00
9ee1a3bd49 Pick the container role with ROLE instead of a command 2026-10-09 19:36:30 +03:00
d488b565d9 Serve with gunicorn and WhiteNoise instead of runserver 2026-10-09 19:36:29 +03:00
aecedc6c90 Build one shared image for web and celery 2026-10-09 19:15:41 +03:00
f77619708e Build on Docker's default network and document the IPv6-only DNS fix 2026-10-09 15:51:18 +03:00
3422a87410 Use Postgres 18 in the compose stack 2026-10-07 15:33:05 +03:00
cbecab344b Add sortedm2m to INSTALLED_APPS
Its widget template was not found, so the news article add form returned 500.
2026-10-06 20:24:57 +03:00
ffddf5b7d1 Restore LogEntry.objects.log_action for django-cms
Django 6 removed it; publishing and unpublishing a page returned 500.
2026-10-06 20:24:57 +03:00
5fcdeb60d5 Fix aldryn-categories admin with treebeard 7
treebeard 7 renamed the move form fields to treebeard_position and
treebeard_ref_node; the category add form raised FieldError.
2026-10-06 20:24:57 +03:00
c9cbcc9d55 Fix CMS page tree admin on Django 6: pass cl to the change list templates
Django 6's change list templates read cl.opts, but django-cms 3.11 only
provides opts, so /admin/cms/page/ and /admin/cms/pagetype/ returned 500.
2026-10-06 20:24:56 +03:00
88098f5b25 Use Redis for the cache instead of memcached
CACHE_URL (default redis://redis:6379/1) feeds the built-in RedisCache
backend. Redis is already part of compose for Celery, so this drops
pylibmc, python-memcached and libmemcached-dev.
2026-10-06 19:55:18 +03:00
aeced67121 prod settings: use PyLibMCCache (MemcachedCache was removed in Django 4.1) 2026-10-06 14:32:56 +03:00
096a8cbd0b DOCKER.md: state Postgres and Python/Django versions 2026-10-06 14:31:17 +03:00
e2c6e291e2 Set integer env defaults in .env.docker to silence log noise 2026-10-06 14:31:17 +03:00
392ff8e459 Dockerfile: drop unused openldap-dev and libldap_r workaround 2026-10-06 14:31:16 +03:00
5e4ce6713b Adapt to Django 6.1: compat app config, django.contrib.postgres 2026-10-06 13:56:47 +03:00
82d5292b05 Make FilerPluginManager a treebeard MP_NodeManager 2026-10-06 13:56:47 +03:00
099e8ef11b Pin dependencies for Django 6.1 2026-10-06 13:56:47 +03:00
55c1dc2f75 Adapt code to Django 5.2: django_recaptcha app, utc in old migrations 2026-10-06 13:48:26 +03:00
1a0f4b17e1 Drop the half-configured debug toolbar 2026-10-06 13:48:26 +03:00
73e2890409 Migrate legacy databases with the history check off 2026-10-06 13:48:26 +03:00
c397e94f38 Move to Python 3.12 and PostgreSQL 16, pin dependencies for Django 5.2 2026-10-06 13:48:26 +03:00
eeb6e1b397 Adapt code to Django 4.2: re_path, gettext, force_str, is_ajax 2026-10-06 13:10:20 +03:00
3b5fcafd3f Add compat shims for removed Django names used by unmaintained packages 2026-10-06 13:10:20 +03:00
f784a61cc7 Move to Python 3.10 and pin dependencies for Django 4.2 2026-10-06 13:10:20 +03:00
28546434dc Use the static template library and drop six in the mailer 2026-10-06 12:31:27 +03:00
1dc1c2601d Settings for Django 3.2: DEFAULT_AUTO_FIELD, multisite SITE_ID check, aldryn compat shim 2026-10-06 12:31:27 +03:00
5376d1c611 Pin dependencies for Django 3.2 2026-10-06 12:31:27 +03:00
569948b7bb Add license files and a note for the vendored packages 2026-10-06 10:56:34 +03:00
9c4c223390 Adapt code to Django 2.2: urls, on_delete, app_name, auth views, template tags 2026-10-06 10:32:20 +03:00
aebf065449 Bring legacy django-reversion tables to the 3.x schema on start 2026-10-06 10:32:20 +03:00
a54ebfd749 Move to Python 3.8 and Django 2.2 dependency pins 2026-10-06 10:32:20 +03:00
f20e757777 Drop custom view_* permissions that clash with Django's built-in ones 2026-10-06 10:32:20 +03:00
7cbbbc0a3a Implement CMSMultiSiteMiddleware in the repo instead of the unmaintained fork 2026-10-06 10:32:20 +03:00
9c465422b6 Vendor stored_messages and cmsplugin_filer packages patched for Django 2 2026-10-06 10:32:20 +03:00
3f36b0899b Apply legacy migration dependencies before migrating 2026-10-06 01:10:06 +03:00
292f3d0513 Adapt code to django CMS 3.6 and Django 1.11
Decide the home redirect per request instead of querying at import time,
replace the removed _get_placeholder helper, stop shadowing the
is_superuser field, and set the seeded home page as the CMS home.
2026-10-06 01:10:06 +03:00
61af03b342 Use the merged django-meta template path 2026-10-06 01:10:06 +03:00
8e5761e62a Move settings and middleware to Django 1.11 style
Use MIDDLEWARE with adapted old-style middleware, the template context
processors, explicit bootstrap3 URLs, the captcha app name, and drop the
obsolete migration module overrides and removed apps.
2026-10-06 01:10:06 +03:00
b4e73d50c6 Pin dependencies for Django 1.11 2026-10-06 01:10:05 +03:00
8c1cfcfc11 Add a script to restore the snapshot into the compose stack 2026-10-05 22:59:58 +03:00
b003bbcc52 Add a Django 1.9 sample-database snapshot for testing migrations 2026-10-05 22:59:58 +03:00
2beebb9c9f Document the startup delay, the smoke test and the login behavior 2026-10-05 22:46:47 +03:00
a0d4ed2497 Add a smoke test that opens every site and logs in to the admin 2026-10-05 22:46:47 +03:00
07de15c795 Use plain Django login in dev when no LDAP server is configured 2026-10-05 22:46:47 +03:00
96639c4d4b Update VPS URL in Docker documentation for clarity 2026-10-01 13:13:49 +03:00
d4f765c400 Add network configuration to app build in docker-compose 2026-10-01 13:13:45 +03:00
920348637e Rewrite docker guide: VPS quick start, production checklist, known limits 2026-09-30 16:49:20 +03:00
fbc6c215ae Seed production-like content, and only into a database without page content 2026-09-30 16:35:15 +03:00
691863b78e Keep required settings strict and supply their dev values in .env.docker 2026-09-30 16:35:15 +03:00
31fe762077 Seed each site's pages with the CMS template it uses in production 2026-09-30 16:14:54 +03:00
748000afd9 Avoid nested hostnames when /dev-sites/ is opened on a site address 2026-09-30 16:03:37 +03:00
4379e9fb89 Disable caching and report the chosen site in dev responses
Adds Cache-Control: no-store and an X-Dev-Site header to the dev site
switcher so a browser cannot reuse another site's page or redirect, and
the selected site is visible in dev tools.
2026-09-30 15:52:54 +03:00
8874fe4298 Update docker guide for per-site hostnames and richer dummy data 2026-09-30 15:44:43 +03:00
e77a17b82f Seed richer dummy data with a fixed admin login
Each site gets a home page and four child pages, and there are twelve
dummy customers. The dummy admin password is now fixed through
DUMMY_ADMIN_PASSWORD. --purge removes all of it.
2026-09-30 15:44:43 +03:00
63c17a6cdf Choose the dev site from the hostname so tabs stay independent
The cookie is shared by all tabs and redirects dropped ?site=, so opening
several sites made them all show the last one. The site is now taken from
<domain>.<anything> hosts (each site its own origin), with ?site= and the
cookie as fallback, and redirects keep ?site=. /dev-sites/ links use the
per-site hostnames, via sslip.io when accessed by IP.
2026-09-30 15:44:43 +03:00
39ba7e5f21 Document dummy data in the docker guide 2026-09-30 15:33:02 +03:00
d6653400c6 Add optional dummy data seeding on start
The seed_dummy_data command creates one CMS page per site and a dummy
admin and customer, idempotently. --purge removes exactly what it
created. It runs on start when SEED_DUMMY_DATA=True and a failure does
not stop the web server.
2026-09-30 15:33:02 +03:00
17bf42c895 Read the secret key from the persisted key file when unset
docker compose exec skips the entrypoint, so commands run that way had no
DJANGO_SECRET_KEY. Fall back to the file the entrypoint writes.
2026-09-30 15:33:02 +03:00
fc4532e89b Add guide for running the docker compose stack 2026-09-30 14:54:38 +03:00
d4d3884d7c Add dev site switcher for testing every site from one host
With DEBUG on, ?site=<domain> selects the site without DNS or hosts
entries and is remembered in a cookie. /dev-sites/ lists all
configured sites as links.
2026-09-30 14:54:38 +03:00
619a20394e Add docker compose stack for test deployments
Runs postgres, redis, the web app and a celery worker. Dev defaults live
in .env.docker with an optional .env override. The entrypoint generates
and persists the Django secret key and waits for postgres; the web
service migrates and creates a Site row for every configured domain.
SQL dumps placed in db-init/ are restored on first start and are
git-ignored.
2026-09-30 14:54:38 +03:00
7fdd70022b Make the djangocms_blog column rename conditional
Databases created from scratch already have customuser_id, so the
unconditional rename failed on them.
2026-09-30 14:54:38 +03:00
3c9102167d Make settings tolerate missing environment values
env() accepts a default and treats empty values as unset. Values that
crashed startup when absent now fall back to safe defaults.
2026-09-30 14:54:38 +03:00
fdaf8a18a2 Fix Docker image build
Stop the libldap linker workaround from overwriting the real shared
library, and add the missing django-recaptcha requirement.
2026-09-30 14:54:38 +03:00
e4c50ca785 ha 2026-09-30 13:42:43 +03:00
432 changed files with 13671 additions and 923 deletions

View file

@ -1,2 +1,5 @@
.git
.env
*.pyc
__pycache__
dynamicweb/settings/dynamic.py

60
.env.docker Normal file
View file

@ -0,0 +1,60 @@
# Dev defaults for docker compose. Override any value in a local ".env" file.
# DEBUG=True makes settings load local.py (ALLOWED_HOSTS=*, console email).
DEBUG=True
ENABLE_LOGGING=False
LOG_LEVEL=DEBUG
# Leave empty: the entrypoint generates and persists one in the "appdata" volume
DJANGO_SECRET_KEY=
POSTGRES_DB=app
POSTGRES_USER=app
POSTGRES_PASSWORD=app
POSTGRES_HOST=db
CELERY_BROKER_URL=redis://redis:6379/0
CELERY_RESULT_BACKEND=redis://redis:6379/0
CACHE_URL=redis://redis:6379/1
# Host -> urlconf. Add the VPS IP / domain here if you access it that way.
UNGLEICH_SITE_CONFIGS={"ungleich.ch":{"MULTISITE_CMS_URL":"dynamicweb.urls"},"blog.ungleich.ch":{"MULTISITE_CMS_URL":"dynamicweb.urls"},"comic.ungleich.ch":{"MULTISITE_CMS_URL":"dynamicweb.urls"},"digitalglarus.ch":{"MULTISITE_CMS_URL":"dynamicweb.urls"},"datacenterlight.ch":{"MULTISITE_CMS_URL":"dynamicweb.urls"},"rails-hosting.ch":{"MULTISITE_CMS_URL":"dynamicweb.urls"},"django-hosting.ch":{"MULTISITE_CMS_URL":"dynamicweb.urls"},"node-hosting.ch":{"MULTISITE_CMS_URL":"dynamicweb.urls"},"devuanhosting.ch":{"MULTISITE_CMS_URL":"dynamicweb.urls"},"devuanhosting.com":{"MULTISITE_CMS_URL":"dynamicweb.urls"},"ipv6onlyhosting.com":{"MULTISITE_CMS_URL":"dynamicweb.urls"},"digitalezukunft.ch":{"MULTISITE_CMS_URL":"dynamicweb.urls"},"hack4glarus.ch":{"MULTISITE_CMS_URL":"dynamicweb.urls"},"xn--nglarus-n2a.ch":{"MULTISITE_CMS_URL":"dynamicweb.urls"},"localhost:8000":{"MULTISITE_CMS_URL":"dynamicweb.urls"},"127.0.0.1:8000":{"MULTISITE_CMS_URL":"dynamicweb.urls"}}
UNGLEICH_BLOG_SITE_ID=1
MULTISITE_CMS_FALLBACK=
EMAIL_HOST=localhost
DCL_ERROR_EMAILS_TO=dev@example.com
ADMIN_EMAIL=dev@example.com
DCL_SUPPORT_FROM_ADDRESS=dev@example.com
WEBHOOK_SECRET=dev
RECAPTCHA_PUBLIC_KEY=dev
RECAPTCHA_PRIVATE_KEY=dev
STRIPE_API_PRIVATE_KEY=
STRIPE_API_PUBLIC_KEY=
STRIPE_API_PRIVATE_KEY_TEST=
# Values the settings require; the app has no defaults for them
LDAP_CUSTOMER_GROUP_ID=0
LDAP_DEFAULT_START_UID=10000
PRE_EU_VAT_RATE=0
VM_BASE_PRICE=0
# OpenNebula / LDAP are not available in the test env
OPENNEBULA_USERNAME=oneadmin
OPENNEBULA_PASSWORD=opennebula
OPENNEBULA_PROTOCOL=http
# "test_domain" skips the import-time VMTemplate query (tables do not exist before migrate)
OPENNEBULA_DOMAIN=test_domain
OPENNEBULA_PORT=2633
OPENNEBULA_ENDPOINT=/RPC2
# Create sample pages/users on start, only into a database without page content
# (idempotent). Set to False to turn off;
# remove existing dummy data with: docker compose exec web python manage.py seed_dummy_data --purge
SEED_DUMMY_DATA=True
# Fixed dev login: dummy-admin@example.com / this password
DUMMY_ADMIN_PASSWORD=dummy-admin
# Integer settings (silence "failed to get env value" log lines)
EMAIL_PORT=25
CELERY_MAX_RETRIES=5
FIRST_VM_ID_AFTER_EU_VAT=0
MAX_TIME_TO_WAIT_FOR_VM_TERMINATE=15

7
.gitignore vendored
View file

@ -47,3 +47,10 @@ secret-key
2024-*
2025-*
2023-*
.env
dynamicweb/settings/dynamic.py
# database dumps are kept out of git (personal data)
db-init/*.sql
db-init/*.sql.gz

121
DOCKER.md Normal file
View file

@ -0,0 +1,121 @@
# Running dynamicweb with Docker Compose
Postgres 18, Redis, the web app (Django 6.1, Python 3.12) and a Celery worker in one stack. Only Docker is needed.
## Quick start (VPS or local)
```sh
git clone <this repo> && cd dynamicweb
docker compose up -d --build
docker compose logs -f web # ready when it prints "Listening at"
```
The first start takes a few minutes (image build, migrations, secret key, sample data).
`docker compose ps` shows "Up" about 1.5 minutes before the site answers, so wait for the log line.
Open port **8000** in the server firewall, then in your browser go to:
- **VPS:** `http://185.203.114.159:8000/dev-sites/`
- **Local machine:** `http://localhost:8000/dev-sites/`
That page lists all 14 sites as links. Each opens as its own site, so you can keep several
open in different tabs. (On a VPS the links look like `http://<domain>.<ip>.sslip.io:8000/`;
sslip.io is public wildcard DNS, so your *browser* needs internet, the server doesn't.)
Admin login: `dummy-admin@example.com` / `dummy-admin` at `/en-us/admin/login/`
(on any site address).
## What you will see
- Every site has sample pages (Home, About, Services, Pricing, Contact) with realistic text.
- ungleich.ch (and blog, comic), datacenterlight.ch and digitalglarus.ch use their own
design. **The templates of the other 9 sites are not known**, so they show the plain
Digital Glarus page. That is a test-data limit, not a bug: in production every site's
pages and template come from the CMS database.
- OpenNebula (VM creation), LDAP accounts and Stripe payments are placeholders and will not
work (logins use plain Django authentication when no LDAP server is set). Email is printed in the web log.
## Deploying with your own Postgres (production-like)
Create `.env` next to `docker-compose.yml`; values there override `.env.docker`:
```
POSTGRES_HOST=<host> # PostgreSQL 14 or newer
POSTGRES_PORT=5432
POSTGRES_DB=<db>
POSTGRES_USER=<user>
POSTGRES_PASSWORD=<password>
SEED_DUMMY_DATA=False
DEBUG=False
UNGLEICH_SITE_CONFIGS=<your real JSON>
```
plus your real OpenNebula, LDAP, Stripe, email and reCAPTCHA values. Then:
```sh
docker compose up -d --build --no-deps web celery redis
```
Checklist:
- The database already holds the pages, sites and templates (they are stored in the
CMS; nothing is created for you). Sample data is skipped anyway when it finds page content.
- `DEBUG=False` loads the production settings and turns off the `/dev-sites/` switcher,
so reach each site by its real domain name.
- The web container runs gunicorn (static files via WhiteNoise); put a TLS-terminating proxy in
front. Behind one that sets `X-Forwarded-Proto`, set `BEHIND_TLS_PROXY=True`.
## Image and Kubernetes
One image, `dynamicweb:latest`, serves every role; the `ROLE` variable picks it (compose sets
`ROLE=celery` on the worker):
- `web` (default): migrations, then gunicorn on port 8000
- `celery`: the Celery worker
- `migrate`: run the migrations and exit
The entrypoint only picks the role, creates a secret key if `DJANGO_SECRET_KEY` is empty and waits for
Postgres. The settings read `POSTGRES_*` directly, so you can also override `command:` (for example
`python manage.py migrate` in an init container); then set `DJANGO_SECRET_KEY` yourself.
`migrate` is the project's own: it also copes with a restored old database and creates the sites
from `UNGLEICH_SITE_CONFIGS`.
See [K8S.md](K8S.md) for the Kubernetes deployment.
## Configuration
- `.env.docker`: committed dev defaults. `.env`: your overrides (git-ignored).
- Add a site: add it to `UNGLEICH_SITE_CONFIGS` (a `Site` row is created on start).
- Web server tuning: `GUNICORN_WORKERS` (3), `GUNICORN_TIMEOUT` (120). `RUN_MIGRATIONS=False`
skips the start-up migrations.
- Sample data off: `SEED_DUMMY_DATA=False`. Remove it later:
`docker compose exec web python manage.py seed_dummy_data --purge`.
- Restore a real dump: put a `.sql` or `.sql.gz` file in `db-init/`, then
`docker compose down -v` and start again (dumps are git-ignored).
## Checking that everything works
```sh
docker compose exec web python smoke_test.py
```
Opens all sites, their pages and the admin login, and exits non-zero on any failure.
## Useful commands
```sh
docker compose ps # what is running
docker compose logs -f web celery # logs
docker compose up -d --build # after code changes (code is baked into the image)
docker compose down # stop, keep data (-v wipes it)
```
## Troubleshooting
- **The build fails at `apk add` with "temporary error (try again later)"**, or hangs there:
the server's DNS is IPv6-only, which containers on Docker's default network cannot use.
Give Docker IPv4 resolvers and rebuild:
```sh
echo '{"dns": ["1.1.1.1", "9.9.9.9"]}' > /etc/docker/daemon.json # merge if the file exists
systemctl restart docker
docker compose up -d --build
```

View file

@ -1,26 +1,19 @@
# FROM python:3.10.0-alpine3.15
FROM python:3.5-alpine3.12
FROM python:3.12-alpine3.20
WORKDIR /usr/src/app
RUN apk add --update --no-cache \
git \
build-base \
openldap-dev \
python3-dev \
postgresql-dev \
libpq-dev \
jpeg-dev \
libxml2-dev \
libxslt-dev \
libmemcached-dev \
zlib-dev \
libffi-dev \
&& rm -rf /var/cache/apk/*
## For alpine 3.15 replace postgresql-dev with libpq-dev
# FIX https://github.com/python-ldap/python-ldap/issues/432
RUN echo 'INPUT ( libldap.so )' > /usr/lib/libldap_r.so
COPY requirements.txt ./
# Pillow seems to need LIBRARY_PATH set as follows: (see: https://github.com/python-pillow/Pillow/issues/1763#issuecomment-222383534)

54
K8S.md Normal file
View file

@ -0,0 +1,54 @@
# Deploying dynamicweb on Kubernetes
The Helm chart in [charts/dynamicweb/](charts/dynamicweb/) runs the web app, a Celery worker,
Redis, a volume for uploaded media and an Ingress, and runs the database migrations as a Job
before each install or upgrade. PostgreSQL 18 is **not** in the chart: create it and point the app at it.
> Tested on a local `kind` cluster with a scratch Postgres.
## Steps
1. **Push the image** (built once from the repo):
```sh
docker compose build
docker tag dynamicweb:latest <registry>/dynamicweb:<version>
docker push <registry>/dynamicweb:<version>
```
2. **Database.** Create an empty database and user. To keep old data, restore the dump into it now
(`psql -h <host> -U <user> <db> < dump.sql`). The Job in step 5 migrates it to the new schema.
3. **Env file and Secret.** Copy `.env.docker`, set your real values, then store it:
```
DEBUG=False
SEED_DUMMY_DATA=False
DJANGO_SECRET_KEY=<a long random string>
POSTGRES_HOST=<host> POSTGRES_PORT=5432 POSTGRES_DB / POSTGRES_USER / POSTGRES_PASSWORD
BEHIND_TLS_PROXY=True # TLS ends at the ingress
UNGLEICH_SITE_CONFIGS=<your real JSON>
```
plus your OpenNebula, LDAP, Stripe, email and reCAPTCHA values. Leave the Redis URLs alone.
```sh
kubectl create secret generic dynamicweb --from-env-file=<your env file>
```
4. **Values.** Edit `image.repository`, `image.tag` and `ingress.hosts` (one per domain, with `www.`
variants) in [charts/dynamicweb/values.yaml](charts/dynamicweb/values.yaml), or pass them with `--set`.
5. **Install.** Helm starts the pods and runs the migrate Job (on upgrades, before the rollout). The site answers once the Job completes:
```sh
helm install dynamicweb charts/dynamicweb
kubectl logs -f job/dynamicweb-migrate # a few minutes
kubectl logs -f deploy/dynamicweb-web # ready at "Listening at"
```
6. **Check:** `curl -I -H 'Host: ungleich.ch' http://<ingress-address>/en-us/` returns 200. Admin is
at `/en-us/admin/login/` on any site's address.
## Good to know
- **Update:** push a new tag, then `helm upgrade dynamicweb charts/dynamicweb --set image.tag=<new>`.
The migrate Job runs again first.
- **Scale web:** `--set web.replicas=2 --set media.accessMode=ReadWriteMany` (every pod must see the
same uploads, so the storage class has to support it).
- **Keep the original `Host` header** at the ingress (the default). The site is chosen from the host,
and every domain must be in `UNGLEICH_SITE_CONFIGS` and `ALLOWED_HOSTS` (`dynamicweb/settings/prod.py`).
- **The Secret must exist before `helm install`** (the Job reads it).
- **Logs:** `kubectl logs deploy/dynamicweb-web`, `deploy/dynamicweb-celery`.
- **Why a database Service named `postgres` is safe:** the pods set `enableServiceLinks: false`;
otherwise Kubernetes injects `POSTGRES_PORT=tcp://...` and the app crashes.

View file

@ -18,3 +18,4 @@ Website for ungleich GmbH
- /hosting/nodejs/
--

7
VENDORED.md Normal file
View file

@ -0,0 +1,7 @@
# Vendored packages
Copied into the repo because upstream is abandoned (last release 2016) and does not
run on Django 2+. Only compatibility edits were made; tables and migrations are unchanged.
- `cmsplugin_filer_*` (cmsplugin-filer 1.1.3, BSD, license in each folder)
- `stored_messages` (django-stored-messages, BSD, license in folder)

View file

@ -1,4 +1,4 @@
{% load staticfiles i18n%}
{% load static i18n%}
<!DOCTYPE html>
<html lang={{language}}>

View file

@ -1,4 +1,4 @@
{% load staticfiles i18n%}
{% load static i18n%}
<!DOCTYPE html>
<html lang="en">

View file

@ -1,12 +1,14 @@
from django.conf.urls import url
from django.urls import re_path
from .views import IndexView, LoginView, ContactView
app_name = 'alplora'
urlpatterns = [
url(r'^$', IndexView.as_view(), name='index'),
url(r'login/', LoginView.as_view(), name='login'),
url(r'contact', ContactView.as_view(), name='contact'),
# url(r'^/beta-program/?$', BetaProgramView.as_view(), name='beta'),
# url(r'^/landing/?$', LandingProgramView.as_view(), name='landing'),
re_path(r'^$', IndexView.as_view(), name='index'),
re_path(r'login/', LoginView.as_view(), name='login'),
re_path(r'contact', ContactView.as_view(), name='contact'),
# re_path(r'^/beta-program/?$', BetaProgramView.as_view(), name='beta'),
# re_path(r'^/landing/?$', LandingProgramView.as_view(), name='landing'),
]

View file

@ -1,7 +1,7 @@
from django.views.generic import TemplateView
from django.utils.translation import get_language, get_language_info
from django.utils.translation import ugettext_lazy as _
from django.utils.translation import gettext_lazy as _
from django.views.generic.edit import FormView
from django.contrib import messages
from django.shortcuts import render

View file

@ -0,0 +1,6 @@
apiVersion: v2
name: dynamicweb
description: ungleich dynamicweb (Django CMS) with a Celery worker and Redis
type: application
version: 0.1.0
appVersion: "latest"

View file

@ -0,0 +1,4 @@
{{- define "dw.image" -}}{{ .Values.image.repository }}:{{ .Values.image.tag }}{{- end -}}
{{- define "dw.pod" -}}
enableServiceLinks: false # else a Service named "postgres" injects POSTGRES_PORT=tcp://...
{{- end -}}

View file

@ -0,0 +1,16 @@
apiVersion: apps/v1
kind: Deployment
metadata: {name: {{ .Release.Name }}-celery}
spec:
replicas: {{ .Values.celery.replicas }}
selector: {matchLabels: {app: {{ .Release.Name }}-celery}}
template:
metadata: {labels: {app: {{ .Release.Name }}-celery}}
spec:
{{- include "dw.pod" . | nindent 6 }}
containers:
- name: celery
image: {{ include "dw.image" . }}
imagePullPolicy: {{ .Values.image.pullPolicy }}
env: [{name: ROLE, value: celery}]
envFrom: [{secretRef: {name: {{ .Values.existingSecret }}}}]

View file

@ -0,0 +1,15 @@
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata: {name: {{ .Release.Name }}}
spec:
ingressClassName: {{ .Values.ingress.className }}
{{- with .Values.ingress.tlsSecret }}
tls: [{secretName: {{ . }}, hosts: {{ $.Values.ingress.hosts | toJson }}}]
{{- end }}
rules:
{{- range .Values.ingress.hosts }}
- host: {{ . }}
http:
paths:
- {path: /, pathType: Prefix, backend: {service: {name: {{ $.Release.Name }}-web, port: {number: 80}}}}
{{- end }}

View file

@ -0,0 +1,25 @@
# Runs after the first install and before each upgrade. Web pods don't migrate.
# (After install it needs Redis, which the app uses while loading, so it waits for it.)
apiVersion: batch/v1
kind: Job
metadata:
name: {{ .Release.Name }}-migrate
annotations:
"helm.sh/hook": post-install,pre-upgrade
"helm.sh/hook-delete-policy": before-hook-creation
spec:
backoffLimit: 2
template:
spec:
{{- include "dw.pod" . | nindent 6 }}
restartPolicy: Never
initContainers:
- name: wait-for-redis
image: redis:6-alpine
command: [sh, -c, "until redis-cli -h redis ping; do sleep 2; done"]
containers:
- name: migrate
image: {{ include "dw.image" . }}
imagePullPolicy: {{ .Values.image.pullPolicy }}
env: [{name: ROLE, value: migrate}]
envFrom: [{secretRef: {name: {{ .Values.existingSecret }}}}]

View file

@ -0,0 +1,21 @@
# The app's env points at a Service called "redis" (CELERY_BROKER_URL=redis://redis:6379/0)
apiVersion: apps/v1
kind: Deployment
metadata: {name: redis}
spec:
replicas: 1
selector: {matchLabels: {app: redis}}
template:
metadata: {labels: {app: redis}}
spec:
containers:
- name: redis
image: redis:6-alpine
ports: [{containerPort: 6379}]
---
apiVersion: v1
kind: Service
metadata: {name: redis}
spec:
selector: {app: redis}
ports: [{port: 6379}]

View file

@ -0,0 +1,39 @@
apiVersion: apps/v1
kind: Deployment
metadata: {name: {{ .Release.Name }}-web}
spec:
replicas: {{ .Values.web.replicas }}
selector: {matchLabels: {app: {{ .Release.Name }}-web}}
template:
metadata: {labels: {app: {{ .Release.Name }}-web}}
spec:
{{- include "dw.pod" . | nindent 6 }}
containers:
- name: web
image: {{ include "dw.image" . }}
imagePullPolicy: {{ .Values.image.pullPolicy }}
env: [{name: RUN_MIGRATIONS, value: "False"}] # the migrate Job does it
envFrom: [{secretRef: {name: {{ .Values.existingSecret }}}}]
ports: [{containerPort: 8000}]
readinessProbe: {tcpSocket: {port: 8000}, periodSeconds: 10}
volumeMounts: [{name: media, mountPath: /usr/src/app/media}]
volumes:
- name: media
persistentVolumeClaim: {claimName: {{ .Release.Name }}-media}
---
apiVersion: v1
kind: Service
metadata: {name: {{ .Release.Name }}-web}
spec:
selector: {app: {{ .Release.Name }}-web}
ports: [{port: 80, targetPort: 8000}]
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata: {name: {{ .Release.Name }}-media}
spec:
accessModes: [{{ .Values.media.accessMode }}]
{{- with .Values.media.storageClass }}
storageClassName: {{ . }}
{{- end }}
resources: {requests: {storage: {{ .Values.media.size }}}}

View file

@ -0,0 +1,24 @@
image:
repository: REGISTRY/dynamicweb
tag: VERSION
pullPolicy: IfNotPresent
# Secret holding the app's environment (kubectl create secret generic ... --from-env-file=...)
# It must exist before the install. See K8S.md.
existingSecret: dynamicweb
# One host per domain in UNGLEICH_SITE_CONFIGS (add the www. variants)
ingress:
className: nginx
hosts: [ungleich.ch, www.ungleich.ch]
tlsSecret: "" # set to enable TLS for the hosts above
web:
replicas: 1
celery:
replicas: 1
media:
size: 5Gi
accessMode: ReadWriteOnce # ReadWriteMany if web.replicas > 1
storageClass: ""

View file

@ -1,4 +1,4 @@
{% load cms_tags staticfiles %}
{% load cms_tags static %}
{% load i18n %}
<!-- Page Header -->
<!-- Set your background image for this header on the line below. -->

View file

@ -2,7 +2,7 @@
{% block meta %}
{% if meta %}
{% include "meta_mixin/meta.html" %}
{% include "meta/meta.html" %}
{% endif %}
{% endblock meta %}

View file

@ -1,5 +1,5 @@
{% extends "base_glarus.html" %}
{% load staticfiles cms_tags %}
{% load static cms_tags %}
{% block content %}

View file

@ -1,5 +1,5 @@
{% extends "base_glarus.html" %}
{% load staticfiles cms_tags %}
{% load static cms_tags %}
{% block title %}crowdfunding{% endblock %}
{% block content %}

View file

@ -1,5 +1,5 @@
{% extends "base_glarus.html" %}
{% load staticfiles cms_tags %}
{% load static cms_tags %}
{% block title %}About{% endblock %}
{% block content %}

View file

@ -1,5 +1,5 @@
{% extends "base_glarus.html" %}
{% load staticfiles cms_tags %}
{% load static cms_tags %}
{% block title %}About{% endblock %}
{% block content %}

View file

@ -0,0 +1,24 @@
Copyright (c) 2012, Stefan Foulis and contributors
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
* Neither the name of the authors nor the
names of its contributors may be used to endorse or promote products
derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

View file

@ -0,0 +1 @@
__version__ = "1.1.3"

View file

@ -0,0 +1,61 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.template.loader import select_template
from django.templatetags.static import static
from django.utils.translation import gettext_lazy as _
from cms.plugin_pool import plugin_pool
from cms.plugin_base import CMSPluginBase
from .conf import settings
from .forms import FilerFileForm
from .models import FilerFile
class FilerFilePlugin(CMSPluginBase):
form = FilerFileForm
module = 'Filer'
model = FilerFile
name = _("File")
TEMPLATE_NAME = 'cmsplugin_filer_file/plugins/file/%s.html'
render_template = TEMPLATE_NAME % 'default'
text_enabled = True
fieldsets = (
(None, {
'fields': [
'title', 'file', 'target_blank'
]
}),
(_('Advanced'), {
'classes': ['collapse', ],
'fields': [
'link_attributes',
]
})
)
if settings.CMSPLUGIN_FILER_FILE_STYLE_CHOICES:
fieldsets[0][1]['fields'].append('style')
def render(self, context, instance, placeholder):
context['object'] = instance
return super(FilerFilePlugin, self).render(context, instance, placeholder)
def get_render_template(self, context, instance, placeholder):
template = select_template((
'cmsplugin_filer_file/plugins/file.html', # backwards compatibility. deprecated!
self.TEMPLATE_NAME % instance.style,
self.TEMPLATE_NAME % 'default',
))
return template
def icon_src(self, instance):
file_icon = instance.get_icon_url()
if file_icon:
return file_icon
return static("filer/icons/file_%sx%s.png" % (32, 32,))
plugin_pool.register_plugin(FilerFilePlugin)

View file

@ -0,0 +1,16 @@
# -*- coding: utf-8 -*-
from django.conf import settings # NOQA
from appconf import AppConf
class CmspluginFilerFolderAppConf(AppConf):
STYLE_CHOICES = (
# ('default', _('Default')), # define your styles here.
)
DEFAULT_STYLE = ''
def configure(self):
# set DEFAULT_STYLE to '' if it is not in STYLE_CHOICES
if not self.configured_data['DEFAULT_STYLE'] in [s for s, l in self.configured_data['STYLE_CHOICES']]:
self.configured_data['DEFAULT_STYLE'] = ''
return self.configured_data

View file

@ -0,0 +1,20 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django import forms
from djangocms_attributes_field.widgets import AttributesWidget
from .models import FilerFile
class FilerFileForm(forms.ModelForm):
class Meta:
model = FilerFile
exclude = []
def __init__(self, *args, **kwargs):
super(FilerFileForm, self).__init__(*args, **kwargs)
self.fields['link_attributes'].widget = AttributesWidget()

View file

@ -0,0 +1,47 @@
# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the PACKAGE package.
#
# Translators:
# Roger Pons <rogerpons@gmail.com>, 2015
msgid ""
msgstr ""
"Project-Id-Version: django Filer Plugins\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2016-08-23 10:26-0400\n"
"PO-Revision-Date: 2016-06-22 17:49+0000\n"
"Last-Translator: Martin Koistinen <mkoistinen@gmail.com>\n"
"Language-Team: Catalan (http://www.transifex.com/divio/cmsplugin-filer/language/ca/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Language: ca\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
#: cms_plugins.py:20
msgid "File"
msgstr "Fitxer"
#: cms_plugins.py:31
msgid "Advanced"
msgstr ""
#: models.py:34
msgid "title"
msgstr "títol"
#: models.py:36
msgid "file"
msgstr "fitxer"
#: models.py:40
msgid "Open link in new window"
msgstr "Obre l'enllaç en una nova finestra"
#: models.py:42
msgid "Style"
msgstr ""
#: models.py:44
msgid "Optional. Adds HTML attributes to the rendered link."
msgstr ""

View file

@ -0,0 +1,47 @@
# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the PACKAGE package.
#
# Translators:
# Jannik V. <me@exploide.net>, 2016
msgid ""
msgstr ""
"Project-Id-Version: django Filer Plugins\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2016-08-23 10:26-0400\n"
"PO-Revision-Date: 2016-06-22 17:49+0000\n"
"Last-Translator: Martin Koistinen <mkoistinen@gmail.com>\n"
"Language-Team: German (http://www.transifex.com/divio/cmsplugin-filer/language/de/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Language: de\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
#: cms_plugins.py:20
msgid "File"
msgstr "Datei"
#: cms_plugins.py:31
msgid "Advanced"
msgstr ""
#: models.py:34
msgid "title"
msgstr "Titel"
#: models.py:36
msgid "file"
msgstr "Datei"
#: models.py:40
msgid "Open link in new window"
msgstr "Link in neuem Fenster öffnen"
#: models.py:42
msgid "Style"
msgstr ""
#: models.py:44
msgid "Optional. Adds HTML attributes to the rendered link."
msgstr ""

View file

@ -0,0 +1,46 @@
# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the PACKAGE package.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2016-08-23 10:26-0400\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"Language: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
#: cms_plugins.py:20
msgid "File"
msgstr ""
#: cms_plugins.py:31
msgid "Advanced"
msgstr ""
#: models.py:34
msgid "title"
msgstr ""
#: models.py:36
msgid "file"
msgstr ""
#: models.py:40
msgid "Open link in new window"
msgstr ""
#: models.py:42
msgid "Style"
msgstr ""
#: models.py:44
msgid "Optional. Adds HTML attributes to the rendered link."
msgstr ""

View file

@ -0,0 +1,47 @@
# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the PACKAGE package.
#
# Translators:
# Javier Sánchez <javier@crea.me>, 2015
msgid ""
msgstr ""
"Project-Id-Version: django Filer Plugins\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2016-08-23 10:26-0400\n"
"PO-Revision-Date: 2016-06-22 17:49+0000\n"
"Last-Translator: Martin Koistinen <mkoistinen@gmail.com>\n"
"Language-Team: Spanish (http://www.transifex.com/divio/cmsplugin-filer/language/es/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Language: es\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
#: cms_plugins.py:20
msgid "File"
msgstr "Archivo"
#: cms_plugins.py:31
msgid "Advanced"
msgstr ""
#: models.py:34
msgid "title"
msgstr "título"
#: models.py:36
msgid "file"
msgstr "archivo"
#: models.py:40
msgid "Open link in new window"
msgstr "Abrir el enlace en una nueva ventana"
#: models.py:42
msgid "Style"
msgstr ""
#: models.py:44
msgid "Optional. Adds HTML attributes to the rendered link."
msgstr ""

View file

@ -0,0 +1,47 @@
# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the PACKAGE package.
#
# Translators:
# Rivo Zängov <eraser@eraser.ee>, 2012-2013
msgid ""
msgstr ""
"Project-Id-Version: django Filer Plugins\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2016-08-23 10:26-0400\n"
"PO-Revision-Date: 2016-06-22 17:49+0000\n"
"Last-Translator: Martin Koistinen <mkoistinen@gmail.com>\n"
"Language-Team: Estonian (http://www.transifex.com/divio/cmsplugin-filer/language/et/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Language: et\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
#: cms_plugins.py:20
msgid "File"
msgstr "Fail"
#: cms_plugins.py:31
msgid "Advanced"
msgstr ""
#: models.py:34
msgid "title"
msgstr "pealkiri"
#: models.py:36
msgid "file"
msgstr "fail"
#: models.py:40
msgid "Open link in new window"
msgstr "Ava link uues aknas"
#: models.py:42
msgid "Style"
msgstr ""
#: models.py:44
msgid "Optional. Adds HTML attributes to the rendered link."
msgstr ""

View file

@ -0,0 +1,46 @@
# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the PACKAGE package.
#
# Translators:
msgid ""
msgstr ""
"Project-Id-Version: django Filer Plugins\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2016-08-23 10:26-0400\n"
"PO-Revision-Date: 2016-06-22 17:49+0000\n"
"Last-Translator: Martin Koistinen <mkoistinen@gmail.com>\n"
"Language-Team: Basque (http://www.transifex.com/divio/cmsplugin-filer/language/eu/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Language: eu\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
#: cms_plugins.py:20
msgid "File"
msgstr "Fitxategia"
#: cms_plugins.py:31
msgid "Advanced"
msgstr ""
#: models.py:34
msgid "title"
msgstr "izenburua"
#: models.py:36
msgid "file"
msgstr "fitxategia"
#: models.py:40
msgid "Open link in new window"
msgstr "Ireki esteka leiho berrian"
#: models.py:42
msgid "Style"
msgstr ""
#: models.py:44
msgid "Optional. Adds HTML attributes to the rendered link."
msgstr ""

View file

@ -0,0 +1,47 @@
# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the PACKAGE package.
#
# Translators:
# Klaus Dahlén <klaus.dahlen@gmail.com>, 2012
msgid ""
msgstr ""
"Project-Id-Version: django Filer Plugins\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2016-08-23 10:26-0400\n"
"PO-Revision-Date: 2016-06-22 17:49+0000\n"
"Last-Translator: Martin Koistinen <mkoistinen@gmail.com>\n"
"Language-Team: Finnish (http://www.transifex.com/divio/cmsplugin-filer/language/fi/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Language: fi\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
#: cms_plugins.py:20
msgid "File"
msgstr "Tiedosto"
#: cms_plugins.py:31
msgid "Advanced"
msgstr ""
#: models.py:34
msgid "title"
msgstr "otsikko"
#: models.py:36
msgid "file"
msgstr ""
#: models.py:40
msgid "Open link in new window"
msgstr ""
#: models.py:42
msgid "Style"
msgstr ""
#: models.py:44
msgid "Optional. Adds HTML attributes to the rendered link."
msgstr ""

View file

@ -0,0 +1,49 @@
# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the PACKAGE package.
#
# Translators:
# Bertrand Bordage <bordage.bertrand@gmail.com>, 2012
# Frigory33 <chironsylvain@orange.fr>, 2016
# Dylann CORDEL <cordel.d@free.fr>, 2014
msgid ""
msgstr ""
"Project-Id-Version: django Filer Plugins\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2016-08-23 10:26-0400\n"
"PO-Revision-Date: 2016-07-06 18:33+0000\n"
"Last-Translator: Frigory33 <chironsylvain@orange.fr>\n"
"Language-Team: French (http://www.transifex.com/divio/cmsplugin-filer/language/fr/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Language: fr\n"
"Plural-Forms: nplurals=2; plural=(n > 1);\n"
#: cms_plugins.py:20
msgid "File"
msgstr "Fichier"
#: cms_plugins.py:31
msgid "Advanced"
msgstr "Avancé"
#: models.py:34
msgid "title"
msgstr "titre"
#: models.py:36
msgid "file"
msgstr "fichier"
#: models.py:40
msgid "Open link in new window"
msgstr "Ouvrir le lien dans une nouvelle fenêtre"
#: models.py:42
msgid "Style"
msgstr "Style"
#: models.py:44
msgid "Optional. Adds HTML attributes to the rendered link."
msgstr "Facultatif. Ajoute des attributs HTML au lien généré."

View file

@ -0,0 +1,48 @@
# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the PACKAGE package.
#
# Translators:
# yakky <i.spalletti@nephila.it>, 2012
# yakky <i.spalletti@nephila.it>, 2013,2016
msgid ""
msgstr ""
"Project-Id-Version: django Filer Plugins\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2016-08-23 10:26-0400\n"
"PO-Revision-Date: 2016-07-13 08:28+0000\n"
"Last-Translator: yakky <i.spalletti@nephila.it>\n"
"Language-Team: Italian (http://www.transifex.com/divio/cmsplugin-filer/language/it/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Language: it\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
#: cms_plugins.py:20
msgid "File"
msgstr "File"
#: cms_plugins.py:31
msgid "Advanced"
msgstr "Avanzate"
#: models.py:34
msgid "title"
msgstr "titolo"
#: models.py:36
msgid "file"
msgstr "file"
#: models.py:40
msgid "Open link in new window"
msgstr "Apri collegamento in una nuova finestra"
#: models.py:42
msgid "Style"
msgstr "Stile"
#: models.py:44
msgid "Optional. Adds HTML attributes to the rendered link."
msgstr "Opzionale. Aggiungi attributi HTML al link"

View file

@ -0,0 +1,46 @@
# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the PACKAGE package.
#
# Translators:
msgid ""
msgstr ""
"Project-Id-Version: django Filer Plugins\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2016-08-23 10:26-0400\n"
"PO-Revision-Date: 2016-06-22 17:49+0000\n"
"Last-Translator: Martin Koistinen <mkoistinen@gmail.com>\n"
"Language-Team: Italian (Italy) (http://www.transifex.com/divio/cmsplugin-filer/language/it_IT/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Language: it_IT\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
#: cms_plugins.py:20
msgid "File"
msgstr ""
#: cms_plugins.py:31
msgid "Advanced"
msgstr ""
#: models.py:34
msgid "title"
msgstr ""
#: models.py:36
msgid "file"
msgstr ""
#: models.py:40
msgid "Open link in new window"
msgstr ""
#: models.py:42
msgid "Style"
msgstr ""
#: models.py:44
msgid "Optional. Adds HTML attributes to the rendered link."
msgstr ""

View file

@ -0,0 +1,48 @@
# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the PACKAGE package.
#
# Translators:
# Matas Dailyda, 2015
# Matas Dailyda <matas@dailyda.com>, 2016
msgid ""
msgstr ""
"Project-Id-Version: django Filer Plugins\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2016-08-23 10:26-0400\n"
"PO-Revision-Date: 2016-07-18 09:19+0000\n"
"Last-Translator: Matas Dailyda <matas@dailyda.com>\n"
"Language-Team: Lithuanian (http://www.transifex.com/divio/cmsplugin-filer/language/lt/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Language: lt\n"
"Plural-Forms: nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && (n%100<10 || n%100>=20) ? 1 : 2);\n"
#: cms_plugins.py:20
msgid "File"
msgstr "Byla"
#: cms_plugins.py:31
msgid "Advanced"
msgstr "Išplėstiniai"
#: models.py:34
msgid "title"
msgstr "pavadinimas"
#: models.py:36
msgid "file"
msgstr "byla"
#: models.py:40
msgid "Open link in new window"
msgstr "Atverti nuorodą naujame lange"
#: models.py:42
msgid "Style"
msgstr "Stilius"
#: models.py:44
msgid "Optional. Adds HTML attributes to the rendered link."
msgstr "Nebūtina. Prideda HTML atributus prie atvaizduojamos nuorodos."

View file

@ -0,0 +1,46 @@
# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the PACKAGE package.
#
# Translators:
msgid ""
msgstr ""
"Project-Id-Version: django Filer Plugins\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2016-08-23 10:26-0400\n"
"PO-Revision-Date: 2016-06-22 17:49+0000\n"
"Last-Translator: Martin Koistinen <mkoistinen@gmail.com>\n"
"Language-Team: Lithuanian (Lithuania) (http://www.transifex.com/divio/cmsplugin-filer/language/lt_LT/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Language: lt_LT\n"
"Plural-Forms: nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && (n%100<10 || n%100>=20) ? 1 : 2);\n"
#: cms_plugins.py:20
msgid "File"
msgstr ""
#: cms_plugins.py:31
msgid "Advanced"
msgstr ""
#: models.py:34
msgid "title"
msgstr ""
#: models.py:36
msgid "file"
msgstr ""
#: models.py:40
msgid "Open link in new window"
msgstr ""
#: models.py:42
msgid "Style"
msgstr ""
#: models.py:44
msgid "Optional. Adds HTML attributes to the rendered link."
msgstr ""

View file

@ -0,0 +1,46 @@
# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the PACKAGE package.
#
# Translators:
msgid ""
msgstr ""
"Project-Id-Version: django Filer Plugins\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2016-08-23 10:26-0400\n"
"PO-Revision-Date: 2016-06-22 17:49+0000\n"
"Last-Translator: Martin Koistinen <mkoistinen@gmail.com>\n"
"Language-Team: Norwegian Bokmål (http://www.transifex.com/divio/cmsplugin-filer/language/nb/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Language: nb\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
#: cms_plugins.py:20
msgid "File"
msgstr ""
#: cms_plugins.py:31
msgid "Advanced"
msgstr ""
#: models.py:34
msgid "title"
msgstr ""
#: models.py:36
msgid "file"
msgstr ""
#: models.py:40
msgid "Open link in new window"
msgstr ""
#: models.py:42
msgid "Style"
msgstr ""
#: models.py:44
msgid "Optional. Adds HTML attributes to the rendered link."
msgstr ""

View file

@ -0,0 +1,48 @@
# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the PACKAGE package.
#
# Translators:
# Maikel Wever, 2013
# kurdyma <transifex.com@kurdyenviolien.nl>, 2016
msgid ""
msgstr ""
"Project-Id-Version: django Filer Plugins\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2016-08-23 10:26-0400\n"
"PO-Revision-Date: 2016-06-27 20:23+0000\n"
"Last-Translator: kurdyma <transifex.com@kurdyenviolien.nl>\n"
"Language-Team: Dutch (http://www.transifex.com/divio/cmsplugin-filer/language/nl/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Language: nl\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
#: cms_plugins.py:20
msgid "File"
msgstr "Bestand"
#: cms_plugins.py:31
msgid "Advanced"
msgstr "Geavanveerd"
#: models.py:34
msgid "title"
msgstr "titel"
#: models.py:36
msgid "file"
msgstr "bestand"
#: models.py:40
msgid "Open link in new window"
msgstr "Open link in nieuw venster"
#: models.py:42
msgid "Style"
msgstr "Stijl"
#: models.py:44
msgid "Optional. Adds HTML attributes to the rendered link."
msgstr "Optioneel. Voegt HTML attributen toe aan de gerenderde link."

View file

@ -0,0 +1,46 @@
# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the PACKAGE package.
#
# Translators:
msgid ""
msgstr ""
"Project-Id-Version: django Filer Plugins\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2016-08-23 10:26-0400\n"
"PO-Revision-Date: 2016-06-22 17:49+0000\n"
"Last-Translator: Martin Koistinen <mkoistinen@gmail.com>\n"
"Language-Team: Norwegian Nynorsk (http://www.transifex.com/divio/cmsplugin-filer/language/nn/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Language: nn\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
#: cms_plugins.py:20
msgid "File"
msgstr ""
#: cms_plugins.py:31
msgid "Advanced"
msgstr ""
#: models.py:34
msgid "title"
msgstr ""
#: models.py:36
msgid "file"
msgstr ""
#: models.py:40
msgid "Open link in new window"
msgstr ""
#: models.py:42
msgid "Style"
msgstr ""
#: models.py:44
msgid "Optional. Adds HTML attributes to the rendered link."
msgstr ""

View file

@ -0,0 +1,48 @@
# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the PACKAGE package.
#
# Translators:
# Mateusz Marzantowicz <mmarzantowicz@osdf.com.pl>, 2013
# Michal Bielicki <michal.bielicki@roamingengineer.com>, 2013
msgid ""
msgstr ""
"Project-Id-Version: django Filer Plugins\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2016-08-23 10:26-0400\n"
"PO-Revision-Date: 2016-06-22 17:49+0000\n"
"Last-Translator: Martin Koistinen <mkoistinen@gmail.com>\n"
"Language-Team: Polish (Poland) (http://www.transifex.com/divio/cmsplugin-filer/language/pl_PL/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Language: pl_PL\n"
"Plural-Forms: nplurals=3; plural=(n==1 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2);\n"
#: cms_plugins.py:20
msgid "File"
msgstr "Plik"
#: cms_plugins.py:31
msgid "Advanced"
msgstr ""
#: models.py:34
msgid "title"
msgstr "tytuł"
#: models.py:36
msgid "file"
msgstr "plik"
#: models.py:40
msgid "Open link in new window"
msgstr "Otwórz odnośnik w nowym oknie"
#: models.py:42
msgid "Style"
msgstr ""
#: models.py:44
msgid "Optional. Adds HTML attributes to the rendered link."
msgstr ""

View file

@ -0,0 +1,47 @@
# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the PACKAGE package.
#
# Translators:
# Rodrigo <rprior@infranology.com.br>, 2013
msgid ""
msgstr ""
"Project-Id-Version: django Filer Plugins\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2016-08-23 10:26-0400\n"
"PO-Revision-Date: 2016-06-22 17:49+0000\n"
"Last-Translator: Martin Koistinen <mkoistinen@gmail.com>\n"
"Language-Team: Portuguese (Brazil) (http://www.transifex.com/divio/cmsplugin-filer/language/pt_BR/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Language: pt_BR\n"
"Plural-Forms: nplurals=2; plural=(n > 1);\n"
#: cms_plugins.py:20
msgid "File"
msgstr "Arquivo"
#: cms_plugins.py:31
msgid "Advanced"
msgstr ""
#: models.py:34
msgid "title"
msgstr "título"
#: models.py:36
msgid "file"
msgstr "arquivo"
#: models.py:40
msgid "Open link in new window"
msgstr "Abrir link em uma nova janela"
#: models.py:42
msgid "Style"
msgstr ""
#: models.py:44
msgid "Optional. Adds HTML attributes to the rendered link."
msgstr ""

View file

@ -0,0 +1,48 @@
# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the PACKAGE package.
#
# Translators:
# Pavel <neoascetic@gmail.com>, 2012
# Pavel <neoascetic@gmail.com>, 2013
msgid ""
msgstr ""
"Project-Id-Version: django Filer Plugins\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2016-08-23 10:26-0400\n"
"PO-Revision-Date: 2016-06-22 17:49+0000\n"
"Last-Translator: Martin Koistinen <mkoistinen@gmail.com>\n"
"Language-Team: Russian (http://www.transifex.com/divio/cmsplugin-filer/language/ru/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Language: ru\n"
"Plural-Forms: nplurals=4; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<12 || n%100>14) ? 1 : n%10==0 || (n%10>=5 && n%10<=9) || (n%100>=11 && n%100<=14)? 2 : 3);\n"
#: cms_plugins.py:20
msgid "File"
msgstr "Файл"
#: cms_plugins.py:31
msgid "Advanced"
msgstr ""
#: models.py:34
msgid "title"
msgstr "заголовок"
#: models.py:36
msgid "file"
msgstr "файл"
#: models.py:40
msgid "Open link in new window"
msgstr "Открыть ссылку в новом окне"
#: models.py:42
msgid "Style"
msgstr ""
#: models.py:44
msgid "Optional. Adds HTML attributes to the rendered link."
msgstr ""

View file

@ -0,0 +1,47 @@
# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the PACKAGE package.
#
# Translators:
# Calvin-He <xhe.com@gmail.com>, 2015
msgid ""
msgstr ""
"Project-Id-Version: django Filer Plugins\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2016-08-23 10:26-0400\n"
"PO-Revision-Date: 2016-06-22 17:49+0000\n"
"Last-Translator: Martin Koistinen <mkoistinen@gmail.com>\n"
"Language-Team: Chinese (China) (http://www.transifex.com/divio/cmsplugin-filer/language/zh_CN/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Language: zh_CN\n"
"Plural-Forms: nplurals=1; plural=0;\n"
#: cms_plugins.py:20
msgid "File"
msgstr "文件"
#: cms_plugins.py:31
msgid "Advanced"
msgstr ""
#: models.py:34
msgid "title"
msgstr "标题"
#: models.py:36
msgid "file"
msgstr "文件"
#: models.py:40
msgid "Open link in new window"
msgstr "在新窗口打开链接"
#: models.py:42
msgid "Style"
msgstr ""
#: models.py:44
msgid "Optional. Adds HTML attributes to the rendered link."
msgstr ""

View file

@ -0,0 +1,31 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
from django.conf import settings
import filer.fields.file
class Migration(migrations.Migration):
dependencies = [
('cms', '0003_auto_20140926_2347'),
('filer', '0001_initial'),
]
operations = [
migrations.CreateModel(
name='FilerFile',
fields=[
('cmsplugin_ptr', models.OneToOneField(parent_link=True, auto_created=True, primary_key=True, serialize=False, to='cms.CMSPlugin', on_delete=models.CASCADE)),
('title', models.CharField(max_length=255, null=True, verbose_name='title', blank=True)),
('target_blank', models.BooleanField(default=False, verbose_name='Open link in new window')),
('style', models.CharField(default=settings.CMSPLUGIN_FILER_FILE_DEFAULT_STYLE, choices=settings.CMSPLUGIN_FILER_FILE_STYLE_CHOICES, verbose_name='Style', blank=True, max_length=255)),
('file', filer.fields.file.FilerFileField(verbose_name='file', to='filer.File', on_delete=models.CASCADE)),
],
options={
'abstract': False,
},
bases=('cms.cmsplugin',),
),
]

View file

@ -0,0 +1,21 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
import filer.fields.file
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('cmsplugin_filer_file', '0001_initial'),
]
operations = [
migrations.AlterField(
model_name='filerfile',
name='file',
field=filer.fields.file.FilerFileField(on_delete=django.db.models.deletion.SET_NULL, verbose_name='file', to='filer.File', null=True),
),
]

View file

@ -0,0 +1,21 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.9.6 on 2016-06-16 21:56
from __future__ import unicode_literals
from django.db import migrations
import djangocms_attributes_field.fields
class Migration(migrations.Migration):
dependencies = [
('cmsplugin_filer_file', '0002_auto_20160112_1617'),
]
operations = [
migrations.AddField(
model_name='filerfile',
name='link_attributes',
field=djangocms_attributes_field.fields.AttributesField(default=dict, help_text='Optional. Adds HTML attributes to the rendered link.'),
),
]

View file

@ -0,0 +1,21 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.9.7 on 2016-07-05 17:34
from __future__ import unicode_literals
from django.db import migrations
import djangocms_attributes_field.fields
class Migration(migrations.Migration):
dependencies = [
('cmsplugin_filer_file', '0003_filerfile_link_attributes'),
]
operations = [
migrations.AlterField(
model_name='filerfile',
name='link_attributes',
field=djangocms_attributes_field.fields.AttributesField(blank=True, default=dict, help_text='Optional. Adds HTML attributes to the rendered link.'),
),
]

View file

@ -0,0 +1,19 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('cmsplugin_filer_file', '0004_auto_20160705_1334'),
]
operations = [
migrations.AlterField(
model_name='filerfile',
name='cmsplugin_ptr',
field=models.OneToOneField(parent_link=True, related_name='cmsplugin_filer_file_filerfile', primary_key=True, serialize=False, to='cms.CMSPlugin', on_delete=models.CASCADE),
),
]

View file

@ -0,0 +1,83 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models
from django.utils.translation import gettext_lazy as _
from cms.models import CMSPlugin
from filer.fields.file import FilerFileField
from cmsplugin_filer_utils import FilerPluginManager
from djangocms_attributes_field.fields import AttributesField
from .conf import settings
class FilerFile(CMSPlugin):
"""
Plugin for storing any type of file.
Default template displays download link with icon (if available) and file size.
This could be updated to use the mimetypes library to determine the type of file rather than
storing a separate icon for each different extension.
The icon search is currently performed within get_icon_url; this is probably a performance concern.
"""
STYLE_CHOICES = settings.CMSPLUGIN_FILER_FILE_STYLE_CHOICES
DEFAULT_STYLE = settings.CMSPLUGIN_FILER_FILE_DEFAULT_STYLE
EXCLUDED_KEYS = ['href', 'target', ]
title = models.CharField(_("title"), max_length=255, null=True, blank=True)
file = FilerFileField(
verbose_name=_('file'),
null=True,
on_delete=models.SET_NULL,
)
target_blank = models.BooleanField(_('Open link in new window'), default=False)
style = models.CharField(
_('Style'), choices=STYLE_CHOICES, default=DEFAULT_STYLE, max_length=255, blank=True)
link_attributes = AttributesField(excluded_keys=EXCLUDED_KEYS, blank=True,
help_text=_('Optional. Adds HTML attributes to the rendered link.'))
cmsplugin_ptr = models.OneToOneField(
to=CMSPlugin,
related_name='%(app_label)s_%(class)s',
parent_link=True,
on_delete=models.CASCADE
)
objects = FilerPluginManager(select_related=('file',))
def get_icon_url(self):
if self.file_id:
return self.file.icons['32']
return ''
def file_exists(self):
if self.file_id:
return self.file.file.storage.exists(self.file.file.name)
return False
def get_file_name(self):
if not self.file_id:
return ''
if self.file.name in ('', None):
name = "%s" % (self.file.original_filename,)
else:
name = "%s" % (self.file.name,)
return name
def get_ext(self):
return self.file.extension
def __str__(self):
if self.title:
return self.title
elif self.file_id:
# added if, because it raised attribute error when file wasnt defined
return self.get_file_name()
return "<empty>"
search_fields = ('title',)

View file

@ -0,0 +1,7 @@
{% if object.file.url %}
<span class="file">
<a href="{{ object.file.url }}"{% if object.target_blank %} target="_blank"{% endif %} {{ object.link_attributes_str }}>
{% if object.get_icon_url %}<img src="{{ object.get_icon_url }}" style="border: 0px" alt="Icon" />{% endif %}
{% if object.title %}{{ object.title }}{% else %}{{ object.get_file_name }}{% endif %} {% if object.file_exists %}<span class="filesize">({{ object.file.size|filesizeformat }})</span>{% else %}(file missing!){% endif %}</a>
</span>
{% endif %}

View file

@ -0,0 +1,24 @@
Copyright (c) 2012, Stefan Foulis and contributors
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
* Neither the name of the authors nor the
names of its contributors may be used to endorse or promote products
derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

View file

@ -0,0 +1 @@
from cmsplugin_filer_file import __version__ # NOQA

View file

View file

@ -0,0 +1,75 @@
from cms.plugin_pool import plugin_pool
from cms.plugin_base import CMSPluginBase
from django.template.loader import select_template
from django.utils.translation import gettext_lazy as _
from . import models
from .conf import settings
from filer.models.filemodels import File
from filer.models.foldermodels import Folder
from filer.models.abstract import BaseImage
class FilerFolderPlugin(CMSPluginBase):
module = 'Filer'
model = models.FilerFolder
name = _("Folder")
TEMPLATE_NAME = 'cmsplugin_filer_folder/plugins/folder/%s.html'
render_template = TEMPLATE_NAME % 'default'
text_enabled = False
admin_preview = False
fieldsets = (
(None, {'fields': ['title', 'folder']}),
)
if settings.CMSPLUGIN_FILER_FOLDER_STYLE_CHOICES:
fieldsets[0][1]['fields'].append('style')
def get_folder_files(self, folder, user):
qs_files = folder.files.not_instance_of(BaseImage)
if user.is_staff:
return qs_files
else:
return qs_files.filter(is_public=True)
def get_folder_images(self, folder, user):
qs_files = folder.files.instance_of(BaseImage)
if user.is_staff:
return qs_files
else:
return qs_files.filter(is_public=True)
def get_children(self, folder):
return folder.get_children()
def render(self, context, instance, placeholder):
user = context['request'].user
if instance.folder_id:
folder_files = self.get_folder_files(instance.folder, user)
folder_images = self.get_folder_images(instance.folder, user)
folder_folders = self.get_children(instance.folder)
else:
folder_files = File.objects.none()
folder_images = BaseImage.objects.none()
folder_folders = Folder.objects.none()
context.update({
'object': instance,
'folder_files': sorted(folder_files),
'folder_images': sorted(folder_images),
'folder_folders': folder_folders,
'placeholder': placeholder
})
return context
def get_render_template(self, context, instance, placeholder):
template = select_template((
'cmsplugin_filer_folder/folder.html', # backwards compatibility. deprecated!
self.TEMPLATE_NAME % instance.style,
self.TEMPLATE_NAME % 'default',
))
return template
plugin_pool.register_plugin(FilerFolderPlugin)

View file

@ -0,0 +1,18 @@
# -*- coding: utf-8 -*-
from django.conf import settings # NOQA
from django.utils.translation import gettext_lazy as _
from appconf import AppConf
class CmspluginFilerFolderAppConf(AppConf):
STYLE_CHOICES = (
("list", _("List")),
("slideshow", _("Slideshow"))
)
DEFAULT_STYLE = 'list'
def configure(self):
# set DEFAULT_STYLE to '' if it is not in STYLE_CHOICES
if not self.configured_data['DEFAULT_STYLE'] in [s for s, l in self.configured_data['STYLE_CHOICES']]:
self.configured_data['DEFAULT_STYLE'] = ''
return self.configured_data

View file

@ -0,0 +1,51 @@
# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the PACKAGE package.
#
# Translators:
# Roger Pons <rogerpons@gmail.com>, 2015
msgid ""
msgstr ""
"Project-Id-Version: django Filer Plugins\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2016-08-23 10:26-0400\n"
"PO-Revision-Date: 2016-06-22 17:49+0000\n"
"Last-Translator: Martin Koistinen <mkoistinen@gmail.com>\n"
"Language-Team: Catalan (http://www.transifex.com/divio/cmsplugin-filer/language/ca/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Language: ca\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
#: cms_plugins.py:16
msgid "Folder"
msgstr "Carpeta"
#: conf.py:9
msgid "List"
msgstr "Llista"
#: conf.py:10
msgid "Slideshow"
msgstr "Projecció de diapositives"
#: models.py:22
msgid "title"
msgstr "títol"
#: models.py:25
msgid "Style"
msgstr ""
#: templates/cmsplugin_filer_folder/plugins/folder/default.html:23
msgid "Folders"
msgstr "Carpetes"
#: templates/cmsplugin_filer_folder/plugins/folder/default.html:31
msgid "Files"
msgstr "Fitxers"
#: templates/cmsplugin_filer_folder/plugins/folder/default.html:39
msgid "Images"
msgstr "Imatges"

View file

@ -0,0 +1,51 @@
# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the PACKAGE package.
#
# Translators:
# Jannik V. <me@exploide.net>, 2016
msgid ""
msgstr ""
"Project-Id-Version: django Filer Plugins\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2016-08-23 10:26-0400\n"
"PO-Revision-Date: 2016-06-22 17:49+0000\n"
"Last-Translator: Martin Koistinen <mkoistinen@gmail.com>\n"
"Language-Team: German (http://www.transifex.com/divio/cmsplugin-filer/language/de/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Language: de\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
#: cms_plugins.py:16
msgid "Folder"
msgstr "Ordner"
#: conf.py:9
msgid "List"
msgstr "Liste"
#: conf.py:10
msgid "Slideshow"
msgstr ""
#: models.py:22
msgid "title"
msgstr "Titel"
#: models.py:25
msgid "Style"
msgstr ""
#: templates/cmsplugin_filer_folder/plugins/folder/default.html:23
msgid "Folders"
msgstr "Ordner"
#: templates/cmsplugin_filer_folder/plugins/folder/default.html:31
msgid "Files"
msgstr "Dateien"
#: templates/cmsplugin_filer_folder/plugins/folder/default.html:39
msgid "Images"
msgstr "Bilder"

View file

@ -0,0 +1,50 @@
# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the PACKAGE package.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2016-08-23 10:26-0400\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"Language: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
#: cms_plugins.py:16
msgid "Folder"
msgstr ""
#: conf.py:9
msgid "List"
msgstr ""
#: conf.py:10
msgid "Slideshow"
msgstr ""
#: models.py:22
msgid "title"
msgstr ""
#: models.py:25
msgid "Style"
msgstr ""
#: templates/cmsplugin_filer_folder/plugins/folder/default.html:23
msgid "Folders"
msgstr ""
#: templates/cmsplugin_filer_folder/plugins/folder/default.html:31
msgid "Files"
msgstr ""
#: templates/cmsplugin_filer_folder/plugins/folder/default.html:39
msgid "Images"
msgstr ""

View file

@ -0,0 +1,51 @@
# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the PACKAGE package.
#
# Translators:
# Javier Sánchez <javier@crea.me>, 2015
msgid ""
msgstr ""
"Project-Id-Version: django Filer Plugins\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2016-08-23 10:26-0400\n"
"PO-Revision-Date: 2016-06-22 17:49+0000\n"
"Last-Translator: Martin Koistinen <mkoistinen@gmail.com>\n"
"Language-Team: Spanish (http://www.transifex.com/divio/cmsplugin-filer/language/es/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Language: es\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
#: cms_plugins.py:16
msgid "Folder"
msgstr "Directorio"
#: conf.py:9
msgid "List"
msgstr "Lista"
#: conf.py:10
msgid "Slideshow"
msgstr "Presentación de diapositivas"
#: models.py:22
msgid "title"
msgstr "título"
#: models.py:25
msgid "Style"
msgstr ""
#: templates/cmsplugin_filer_folder/plugins/folder/default.html:23
msgid "Folders"
msgstr "Directorios"
#: templates/cmsplugin_filer_folder/plugins/folder/default.html:31
msgid "Files"
msgstr "Archivos"
#: templates/cmsplugin_filer_folder/plugins/folder/default.html:39
msgid "Images"
msgstr "Imágenes"

View file

@ -0,0 +1,51 @@
# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the PACKAGE package.
#
# Translators:
# Rivo Zängov <eraser@eraser.ee>, 2012
msgid ""
msgstr ""
"Project-Id-Version: django Filer Plugins\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2016-08-23 10:26-0400\n"
"PO-Revision-Date: 2016-06-22 17:49+0000\n"
"Last-Translator: Martin Koistinen <mkoistinen@gmail.com>\n"
"Language-Team: Estonian (http://www.transifex.com/divio/cmsplugin-filer/language/et/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Language: et\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
#: cms_plugins.py:16
msgid "Folder"
msgstr "Kaust"
#: conf.py:9
msgid "List"
msgstr "Nimekiri"
#: conf.py:10
msgid "Slideshow"
msgstr "Slaidiseanss"
#: models.py:22
msgid "title"
msgstr "pealkiri"
#: models.py:25
msgid "Style"
msgstr ""
#: templates/cmsplugin_filer_folder/plugins/folder/default.html:23
msgid "Folders"
msgstr "Kaustad"
#: templates/cmsplugin_filer_folder/plugins/folder/default.html:31
msgid "Files"
msgstr "Failid"
#: templates/cmsplugin_filer_folder/plugins/folder/default.html:39
msgid "Images"
msgstr "Pildid"

View file

@ -0,0 +1,50 @@
# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the PACKAGE package.
#
# Translators:
msgid ""
msgstr ""
"Project-Id-Version: django Filer Plugins\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2016-08-23 10:26-0400\n"
"PO-Revision-Date: 2016-06-22 17:49+0000\n"
"Last-Translator: Martin Koistinen <mkoistinen@gmail.com>\n"
"Language-Team: Basque (http://www.transifex.com/divio/cmsplugin-filer/language/eu/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Language: eu\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
#: cms_plugins.py:16
msgid "Folder"
msgstr "Karpeta"
#: conf.py:9
msgid "List"
msgstr "Zerrenda"
#: conf.py:10
msgid "Slideshow"
msgstr "Diapositibak"
#: models.py:22
msgid "title"
msgstr "izenburua"
#: models.py:25
msgid "Style"
msgstr ""
#: templates/cmsplugin_filer_folder/plugins/folder/default.html:23
msgid "Folders"
msgstr "Karpetak"
#: templates/cmsplugin_filer_folder/plugins/folder/default.html:31
msgid "Files"
msgstr "Fitxategiak"
#: templates/cmsplugin_filer_folder/plugins/folder/default.html:39
msgid "Images"
msgstr "Irudiak"

View file

@ -0,0 +1,51 @@
# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the PACKAGE package.
#
# Translators:
# Klaus Dahlén <klaus.dahlen@gmail.com>, 2012
msgid ""
msgstr ""
"Project-Id-Version: django Filer Plugins\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2016-08-23 10:26-0400\n"
"PO-Revision-Date: 2016-06-22 17:49+0000\n"
"Last-Translator: Martin Koistinen <mkoistinen@gmail.com>\n"
"Language-Team: Finnish (http://www.transifex.com/divio/cmsplugin-filer/language/fi/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Language: fi\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
#: cms_plugins.py:16
msgid "Folder"
msgstr "Kansio"
#: conf.py:9
msgid "List"
msgstr "Lista"
#: conf.py:10
msgid "Slideshow"
msgstr "Diaesitys"
#: models.py:22
msgid "title"
msgstr "otsikko"
#: models.py:25
msgid "Style"
msgstr ""
#: templates/cmsplugin_filer_folder/plugins/folder/default.html:23
msgid "Folders"
msgstr "Kansiot"
#: templates/cmsplugin_filer_folder/plugins/folder/default.html:31
msgid "Files"
msgstr "Tiedostot"
#: templates/cmsplugin_filer_folder/plugins/folder/default.html:39
msgid "Images"
msgstr "Kuvat"

View file

@ -0,0 +1,52 @@
# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the PACKAGE package.
#
# Translators:
# Bertrand Bordage <bordage.bertrand@gmail.com>, 2012
# Frigory33 <chironsylvain@orange.fr>, 2016
msgid ""
msgstr ""
"Project-Id-Version: django Filer Plugins\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2016-08-23 10:26-0400\n"
"PO-Revision-Date: 2016-07-06 18:33+0000\n"
"Last-Translator: Frigory33 <chironsylvain@orange.fr>\n"
"Language-Team: French (http://www.transifex.com/divio/cmsplugin-filer/language/fr/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Language: fr\n"
"Plural-Forms: nplurals=2; plural=(n > 1);\n"
#: cms_plugins.py:16
msgid "Folder"
msgstr "Dossier"
#: conf.py:9
msgid "List"
msgstr "Liste"
#: conf.py:10
msgid "Slideshow"
msgstr "Diaporama"
#: models.py:22
msgid "title"
msgstr "titre"
#: models.py:25
msgid "Style"
msgstr "Style"
#: templates/cmsplugin_filer_folder/plugins/folder/default.html:23
msgid "Folders"
msgstr "Dossiers"
#: templates/cmsplugin_filer_folder/plugins/folder/default.html:31
msgid "Files"
msgstr "Fichiers"
#: templates/cmsplugin_filer_folder/plugins/folder/default.html:39
msgid "Images"
msgstr "Images"

View file

@ -0,0 +1,52 @@
# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the PACKAGE package.
#
# Translators:
# yakky <i.spalletti@nephila.it>, 2012
# yakky <i.spalletti@nephila.it>, 2016
msgid ""
msgstr ""
"Project-Id-Version: django Filer Plugins\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2016-08-23 10:26-0400\n"
"PO-Revision-Date: 2016-07-13 08:28+0000\n"
"Last-Translator: yakky <i.spalletti@nephila.it>\n"
"Language-Team: Italian (http://www.transifex.com/divio/cmsplugin-filer/language/it/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Language: it\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
#: cms_plugins.py:16
msgid "Folder"
msgstr "Cartella"
#: conf.py:9
msgid "List"
msgstr "Lista"
#: conf.py:10
msgid "Slideshow"
msgstr "Slideshow"
#: models.py:22
msgid "title"
msgstr "titolo"
#: models.py:25
msgid "Style"
msgstr "Stile"
#: templates/cmsplugin_filer_folder/plugins/folder/default.html:23
msgid "Folders"
msgstr "Cartelle"
#: templates/cmsplugin_filer_folder/plugins/folder/default.html:31
msgid "Files"
msgstr "File"
#: templates/cmsplugin_filer_folder/plugins/folder/default.html:39
msgid "Images"
msgstr "Immagini"

View file

@ -0,0 +1,50 @@
# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the PACKAGE package.
#
# Translators:
msgid ""
msgstr ""
"Project-Id-Version: django Filer Plugins\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2016-08-23 10:26-0400\n"
"PO-Revision-Date: 2016-06-22 17:49+0000\n"
"Last-Translator: Martin Koistinen <mkoistinen@gmail.com>\n"
"Language-Team: Italian (Italy) (http://www.transifex.com/divio/cmsplugin-filer/language/it_IT/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Language: it_IT\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
#: cms_plugins.py:16
msgid "Folder"
msgstr ""
#: conf.py:9
msgid "List"
msgstr ""
#: conf.py:10
msgid "Slideshow"
msgstr ""
#: models.py:22
msgid "title"
msgstr ""
#: models.py:25
msgid "Style"
msgstr ""
#: templates/cmsplugin_filer_folder/plugins/folder/default.html:23
msgid "Folders"
msgstr ""
#: templates/cmsplugin_filer_folder/plugins/folder/default.html:31
msgid "Files"
msgstr ""
#: templates/cmsplugin_filer_folder/plugins/folder/default.html:39
msgid "Images"
msgstr ""

View file

@ -0,0 +1,52 @@
# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the PACKAGE package.
#
# Translators:
# Matas Dailyda, 2015
# Matas Dailyda <matas@dailyda.com>, 2016
msgid ""
msgstr ""
"Project-Id-Version: django Filer Plugins\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2016-08-23 10:26-0400\n"
"PO-Revision-Date: 2016-07-18 09:19+0000\n"
"Last-Translator: Matas Dailyda <matas@dailyda.com>\n"
"Language-Team: Lithuanian (http://www.transifex.com/divio/cmsplugin-filer/language/lt/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Language: lt\n"
"Plural-Forms: nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && (n%100<10 || n%100>=20) ? 1 : 2);\n"
#: cms_plugins.py:16
msgid "Folder"
msgstr "Aplankas"
#: conf.py:9
msgid "List"
msgstr "Sąrašas"
#: conf.py:10
msgid "Slideshow"
msgstr "Sąrašas su paveikslėliais"
#: models.py:22
msgid "title"
msgstr "pavadinimas"
#: models.py:25
msgid "Style"
msgstr "Stilius"
#: templates/cmsplugin_filer_folder/plugins/folder/default.html:23
msgid "Folders"
msgstr "Aplankai"
#: templates/cmsplugin_filer_folder/plugins/folder/default.html:31
msgid "Files"
msgstr "Bylos"
#: templates/cmsplugin_filer_folder/plugins/folder/default.html:39
msgid "Images"
msgstr "Paveikslėliai"

View file

@ -0,0 +1,50 @@
# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the PACKAGE package.
#
# Translators:
msgid ""
msgstr ""
"Project-Id-Version: django Filer Plugins\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2016-08-23 10:26-0400\n"
"PO-Revision-Date: 2016-06-22 17:49+0000\n"
"Last-Translator: Martin Koistinen <mkoistinen@gmail.com>\n"
"Language-Team: Lithuanian (Lithuania) (http://www.transifex.com/divio/cmsplugin-filer/language/lt_LT/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Language: lt_LT\n"
"Plural-Forms: nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && (n%100<10 || n%100>=20) ? 1 : 2);\n"
#: cms_plugins.py:16
msgid "Folder"
msgstr ""
#: conf.py:9
msgid "List"
msgstr ""
#: conf.py:10
msgid "Slideshow"
msgstr ""
#: models.py:22
msgid "title"
msgstr ""
#: models.py:25
msgid "Style"
msgstr ""
#: templates/cmsplugin_filer_folder/plugins/folder/default.html:23
msgid "Folders"
msgstr ""
#: templates/cmsplugin_filer_folder/plugins/folder/default.html:31
msgid "Files"
msgstr ""
#: templates/cmsplugin_filer_folder/plugins/folder/default.html:39
msgid "Images"
msgstr ""

View file

@ -0,0 +1,50 @@
# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the PACKAGE package.
#
# Translators:
msgid ""
msgstr ""
"Project-Id-Version: django Filer Plugins\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2016-08-23 10:26-0400\n"
"PO-Revision-Date: 2016-06-22 17:49+0000\n"
"Last-Translator: Martin Koistinen <mkoistinen@gmail.com>\n"
"Language-Team: Norwegian Bokmål (http://www.transifex.com/divio/cmsplugin-filer/language/nb/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Language: nb\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
#: cms_plugins.py:16
msgid "Folder"
msgstr ""
#: conf.py:9
msgid "List"
msgstr ""
#: conf.py:10
msgid "Slideshow"
msgstr ""
#: models.py:22
msgid "title"
msgstr ""
#: models.py:25
msgid "Style"
msgstr ""
#: templates/cmsplugin_filer_folder/plugins/folder/default.html:23
msgid "Folders"
msgstr ""
#: templates/cmsplugin_filer_folder/plugins/folder/default.html:31
msgid "Files"
msgstr ""
#: templates/cmsplugin_filer_folder/plugins/folder/default.html:39
msgid "Images"
msgstr ""

View file

@ -0,0 +1,52 @@
# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the PACKAGE package.
#
# Translators:
# Maikel Wever, 2013
# kurdyma <transifex.com@kurdyenviolien.nl>, 2016
msgid ""
msgstr ""
"Project-Id-Version: django Filer Plugins\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2016-08-23 10:26-0400\n"
"PO-Revision-Date: 2016-06-27 20:24+0000\n"
"Last-Translator: kurdyma <transifex.com@kurdyenviolien.nl>\n"
"Language-Team: Dutch (http://www.transifex.com/divio/cmsplugin-filer/language/nl/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Language: nl\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
#: cms_plugins.py:16
msgid "Folder"
msgstr "Map"
#: conf.py:9
msgid "List"
msgstr "Lijst"
#: conf.py:10
msgid "Slideshow"
msgstr "Slideshow"
#: models.py:22
msgid "title"
msgstr "titel"
#: models.py:25
msgid "Style"
msgstr "Stijl"
#: templates/cmsplugin_filer_folder/plugins/folder/default.html:23
msgid "Folders"
msgstr "Mappen"
#: templates/cmsplugin_filer_folder/plugins/folder/default.html:31
msgid "Files"
msgstr "Bestanden"
#: templates/cmsplugin_filer_folder/plugins/folder/default.html:39
msgid "Images"
msgstr "Afbeeldingen"

View file

@ -0,0 +1,50 @@
# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the PACKAGE package.
#
# Translators:
msgid ""
msgstr ""
"Project-Id-Version: django Filer Plugins\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2016-08-23 10:26-0400\n"
"PO-Revision-Date: 2016-06-22 17:49+0000\n"
"Last-Translator: Martin Koistinen <mkoistinen@gmail.com>\n"
"Language-Team: Norwegian Nynorsk (http://www.transifex.com/divio/cmsplugin-filer/language/nn/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Language: nn\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
#: cms_plugins.py:16
msgid "Folder"
msgstr ""
#: conf.py:9
msgid "List"
msgstr ""
#: conf.py:10
msgid "Slideshow"
msgstr ""
#: models.py:22
msgid "title"
msgstr ""
#: models.py:25
msgid "Style"
msgstr ""
#: templates/cmsplugin_filer_folder/plugins/folder/default.html:23
msgid "Folders"
msgstr ""
#: templates/cmsplugin_filer_folder/plugins/folder/default.html:31
msgid "Files"
msgstr ""
#: templates/cmsplugin_filer_folder/plugins/folder/default.html:39
msgid "Images"
msgstr ""

View file

@ -0,0 +1,51 @@
# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the PACKAGE package.
#
# Translators:
# Mateusz Marzantowicz <mmarzantowicz@osdf.com.pl>, 2013
msgid ""
msgstr ""
"Project-Id-Version: django Filer Plugins\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2016-08-23 10:26-0400\n"
"PO-Revision-Date: 2016-06-22 17:49+0000\n"
"Last-Translator: Martin Koistinen <mkoistinen@gmail.com>\n"
"Language-Team: Polish (Poland) (http://www.transifex.com/divio/cmsplugin-filer/language/pl_PL/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Language: pl_PL\n"
"Plural-Forms: nplurals=3; plural=(n==1 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2);\n"
#: cms_plugins.py:16
msgid "Folder"
msgstr "Katalog"
#: conf.py:9
msgid "List"
msgstr "Lista"
#: conf.py:10
msgid "Slideshow"
msgstr "Pokaz slajdów"
#: models.py:22
msgid "title"
msgstr "tytuł"
#: models.py:25
msgid "Style"
msgstr ""
#: templates/cmsplugin_filer_folder/plugins/folder/default.html:23
msgid "Folders"
msgstr "Katalogi"
#: templates/cmsplugin_filer_folder/plugins/folder/default.html:31
msgid "Files"
msgstr "Pliki"
#: templates/cmsplugin_filer_folder/plugins/folder/default.html:39
msgid "Images"
msgstr "Obrazy"

View file

@ -0,0 +1,51 @@
# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the PACKAGE package.
#
# Translators:
# Rodrigo <rprior@infranology.com.br>, 2013
msgid ""
msgstr ""
"Project-Id-Version: django Filer Plugins\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2016-08-23 10:26-0400\n"
"PO-Revision-Date: 2016-06-22 17:49+0000\n"
"Last-Translator: Martin Koistinen <mkoistinen@gmail.com>\n"
"Language-Team: Portuguese (Brazil) (http://www.transifex.com/divio/cmsplugin-filer/language/pt_BR/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Language: pt_BR\n"
"Plural-Forms: nplurals=2; plural=(n > 1);\n"
#: cms_plugins.py:16
msgid "Folder"
msgstr "Pasta"
#: conf.py:9
msgid "List"
msgstr "Lista"
#: conf.py:10
msgid "Slideshow"
msgstr "Slideshow"
#: models.py:22
msgid "title"
msgstr "título"
#: models.py:25
msgid "Style"
msgstr ""
#: templates/cmsplugin_filer_folder/plugins/folder/default.html:23
msgid "Folders"
msgstr "Pastas"
#: templates/cmsplugin_filer_folder/plugins/folder/default.html:31
msgid "Files"
msgstr "Arquivos"
#: templates/cmsplugin_filer_folder/plugins/folder/default.html:39
msgid "Images"
msgstr "Imagens"

View file

@ -0,0 +1,51 @@
# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the PACKAGE package.
#
# Translators:
# Pavel <neoascetic@gmail.com>, 2012
msgid ""
msgstr ""
"Project-Id-Version: django Filer Plugins\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2016-08-23 10:26-0400\n"
"PO-Revision-Date: 2016-06-22 17:49+0000\n"
"Last-Translator: Martin Koistinen <mkoistinen@gmail.com>\n"
"Language-Team: Russian (http://www.transifex.com/divio/cmsplugin-filer/language/ru/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Language: ru\n"
"Plural-Forms: nplurals=4; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<12 || n%100>14) ? 1 : n%10==0 || (n%10>=5 && n%10<=9) || (n%100>=11 && n%100<=14)? 2 : 3);\n"
#: cms_plugins.py:16
msgid "Folder"
msgstr "Папка"
#: conf.py:9
msgid "List"
msgstr "Список"
#: conf.py:10
msgid "Slideshow"
msgstr "Слайдшоу"
#: models.py:22
msgid "title"
msgstr "заголовок"
#: models.py:25
msgid "Style"
msgstr ""
#: templates/cmsplugin_filer_folder/plugins/folder/default.html:23
msgid "Folders"
msgstr "Папки"
#: templates/cmsplugin_filer_folder/plugins/folder/default.html:31
msgid "Files"
msgstr "Файлы"
#: templates/cmsplugin_filer_folder/plugins/folder/default.html:39
msgid "Images"
msgstr "Изображения"

View file

@ -0,0 +1,51 @@
# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the PACKAGE package.
#
# Translators:
# Calvin-He <xhe.com@gmail.com>, 2015
msgid ""
msgstr ""
"Project-Id-Version: django Filer Plugins\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2016-08-23 10:26-0400\n"
"PO-Revision-Date: 2016-06-22 17:49+0000\n"
"Last-Translator: Martin Koistinen <mkoistinen@gmail.com>\n"
"Language-Team: Chinese (China) (http://www.transifex.com/divio/cmsplugin-filer/language/zh_CN/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Language: zh_CN\n"
"Plural-Forms: nplurals=1; plural=0;\n"
#: cms_plugins.py:16
msgid "Folder"
msgstr "文件夹"
#: conf.py:9
msgid "List"
msgstr "列表"
#: conf.py:10
msgid "Slideshow"
msgstr "幻灯片"
#: models.py:22
msgid "title"
msgstr "标题"
#: models.py:25
msgid "Style"
msgstr ""
#: templates/cmsplugin_filer_folder/plugins/folder/default.html:23
msgid "Folders"
msgstr "文件夹"
#: templates/cmsplugin_filer_folder/plugins/folder/default.html:31
msgid "Files"
msgstr "文件"
#: templates/cmsplugin_filer_folder/plugins/folder/default.html:39
msgid "Images"
msgstr "图片"

View file

@ -0,0 +1,30 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
from django.conf import settings
import filer.fields.folder
class Migration(migrations.Migration):
dependencies = [
('cms', '0003_auto_20140926_2347'),
('filer', '0001_initial'),
]
operations = [
migrations.CreateModel(
name='FilerFolder',
fields=[
('cmsplugin_ptr', models.OneToOneField(parent_link=True, auto_created=True, primary_key=True, serialize=False, to='cms.CMSPlugin', on_delete=models.CASCADE)),
('title', models.CharField(max_length=255, null=True, verbose_name='title', blank=True)),
('style', models.CharField(default=settings.CMSPLUGIN_FILER_FOLDER_DEFAULT_STYLE, max_length=50, verbose_name='Style', choices=settings.CMSPLUGIN_FILER_FOLDER_STYLE_CHOICES)),
('folder', filer.fields.folder.FilerFolderField(to='filer.Folder', on_delete=models.CASCADE)),
],
options={
'abstract': False,
},
bases=('cms.cmsplugin',),
),
]

View file

@ -0,0 +1,21 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
import filer.fields.folder
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('cmsplugin_filer_folder', '0001_initial'),
]
operations = [
migrations.AlterField(
model_name='filerfolder',
name='folder',
field=filer.fields.folder.FilerFolderField(on_delete=django.db.models.deletion.SET_NULL, to='filer.Folder', null=True),
),
]

View file

@ -0,0 +1,19 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('cmsplugin_filer_folder', '0002_auto_20160113_1318'),
]
operations = [
migrations.AlterField(
model_name='filerfolder',
name='cmsplugin_ptr',
field=models.OneToOneField(parent_link=True, related_name='cmsplugin_filer_folder_filerfolder', primary_key=True, serialize=False, to='cms.CMSPlugin', on_delete=models.CASCADE),
),
]

View file

@ -0,0 +1,49 @@
from __future__ import unicode_literals
import warnings
from django.db import models
from cms.models import CMSPlugin
from django.utils.translation import gettext_lazy as _
from filer.fields.folder import FilerFolderField
from .conf import settings
from cmsplugin_filer_utils import FilerPluginManager
class FilerFolder(CMSPlugin):
"""
Plugin for storing any type of Folder.
Default template displays files store inside this folder.
"""
STYLE_CHOICES = settings.CMSPLUGIN_FILER_FOLDER_STYLE_CHOICES
DEFAULT_STYLE = settings.CMSPLUGIN_FILER_FOLDER_DEFAULT_STYLE
title = models.CharField(_("title"), max_length=255, null=True, blank=True)
folder = FilerFolderField(null=True, on_delete=models.SET_NULL)
style = models.CharField(
_('Style'), choices=STYLE_CHOICES, default=DEFAULT_STYLE, max_length=50)
cmsplugin_ptr = models.OneToOneField(
to=CMSPlugin,
related_name='%(app_label)s_%(class)s',
parent_link=True,
on_delete=models.CASCADE
)
objects = FilerPluginManager(select_related=('folder',))
@property
def view_option(self):
warnings.warn("view_option on cmsplugin_filer_folder.FilderFolder is deprecated. Use .style instead.",
DeprecationWarning)
return self.style
def __str__(self):
return self.get_display_name()
def get_display_name(self):
if self.title:
return self.title
elif self.folder_id and self.folder.name:
return self.folder.name
return "<empty>"
search_fields = ('title',)

View file

@ -0,0 +1,2 @@
.cmsplugin_filer_folder_slideshow { padding: 5px; }
.cmsplugin_filer_folder_slideshow img { padding: 15px; border: 1px solid #ccc; background-color: #eee; }

View file

@ -0,0 +1,235 @@
/*!
* jQuery Cycle Lite Plugin
* http://malsup.com/jquery/cycle/lite/
* Copyright (c) 2008-2012 M. Alsup
* Version: 1.7 (20-FEB-2013)
* Dual licensed under the MIT and GPL licenses:
* http://www.opensource.org/licenses/mit-license.php
* http://www.gnu.org/licenses/gpl.html
* Requires: jQuery v1.3.2 or later
*/
;(function($) {
"use strict";
var ver = 'Lite-1.7';
var msie = /MSIE/.test(navigator.userAgent);
$.fn.cycle = function(options) {
return this.each(function() {
options = options || {};
if (this.cycleTimeout)
clearTimeout(this.cycleTimeout);
this.cycleTimeout = 0;
this.cyclePause = 0;
var $cont = $(this);
var $slides = options.slideExpr ? $(options.slideExpr, this) : $cont.children();
var els = $slides.get();
if (els.length < 2) {
if (window.console)
console.log('terminating; too few slides: ' + els.length);
return; // don't bother
}
// support metadata plugin (v1.0 and v2.0)
var opts = $.extend({}, $.fn.cycle.defaults, options || {}, $.metadata ? $cont.metadata() : $.meta ? $cont.data() : {});
var meta = $.isFunction($cont.data) ? $cont.data(opts.metaAttr) : null;
if (meta)
opts = $.extend(opts, meta);
opts.before = opts.before ? [opts.before] : [];
opts.after = opts.after ? [opts.after] : [];
opts.after.unshift(function(){ opts.busy=0; });
// allow shorthand overrides of width, height and timeout
var cls = this.className;
opts.width = parseInt((cls.match(/w:(\d+)/)||[])[1], 10) || opts.width;
opts.height = parseInt((cls.match(/h:(\d+)/)||[])[1], 10) || opts.height;
opts.timeout = parseInt((cls.match(/t:(\d+)/)||[])[1], 10) || opts.timeout;
if ($cont.css('position') == 'static')
$cont.css('position', 'relative');
if (opts.width)
$cont.width(opts.width);
if (opts.height && opts.height != 'auto')
$cont.height(opts.height);
var first = 0;
$slides.css({position: 'absolute', top:0}).each(function(i) {
$(this).css('z-index', els.length-i);
});
$(els[first]).css('opacity',1).show(); // opacity bit needed to handle reinit case
if (msie)
els[first].style.removeAttribute('filter');
if (opts.fit && opts.width)
$slides.width(opts.width);
if (opts.fit && opts.height && opts.height != 'auto')
$slides.height(opts.height);
if (opts.pause)
$cont.hover(function(){this.cyclePause=1;}, function(){this.cyclePause=0;});
var txFn = $.fn.cycle.transitions[opts.fx];
if (txFn)
txFn($cont, $slides, opts);
$slides.each(function() {
var $el = $(this);
this.cycleH = (opts.fit && opts.height) ? opts.height : $el.height();
this.cycleW = (opts.fit && opts.width) ? opts.width : $el.width();
});
if (opts.cssFirst)
$($slides[first]).css(opts.cssFirst);
if (opts.timeout) {
// ensure that timeout and speed settings are sane
if (opts.speed.constructor == String)
opts.speed = {slow: 600, fast: 200}[opts.speed] || 400;
if (!opts.sync)
opts.speed = opts.speed / 2;
while((opts.timeout - opts.speed) < 250)
opts.timeout += opts.speed;
}
opts.speedIn = opts.speed;
opts.speedOut = opts.speed;
opts.slideCount = els.length;
opts.currSlide = first;
opts.nextSlide = 1;
// fire artificial events
var e0 = $slides[first];
if (opts.before.length)
opts.before[0].apply(e0, [e0, e0, opts, true]);
if (opts.after.length > 1)
opts.after[1].apply(e0, [e0, e0, opts, true]);
if (opts.click && !opts.next)
opts.next = opts.click;
if (opts.next)
$(opts.next).unbind('click.cycle').bind('click.cycle', function(){return advance(els,opts,opts.rev?-1:1);});
if (opts.prev)
$(opts.prev).unbind('click.cycle').bind('click.cycle', function(){return advance(els,opts,opts.rev?1:-1);});
if (opts.timeout)
this.cycleTimeout = setTimeout(function() {
go(els,opts,0,!opts.rev);
}, opts.timeout + (opts.delay||0));
});
};
function go(els, opts, manual, fwd) {
if (opts.busy)
return;
var p = els[0].parentNode, curr = els[opts.currSlide], next = els[opts.nextSlide];
if (p.cycleTimeout === 0 && !manual)
return;
if (manual || !p.cyclePause) {
if (opts.before.length)
$.each(opts.before, function(i,o) { o.apply(next, [curr, next, opts, fwd]); });
var after = function() {
if (msie)
this.style.removeAttribute('filter');
$.each(opts.after, function(i,o) { o.apply(next, [curr, next, opts, fwd]); });
queueNext(opts);
};
if (opts.nextSlide != opts.currSlide) {
opts.busy = 1;
$.fn.cycle.custom(curr, next, opts, after);
}
var roll = (opts.nextSlide + 1) == els.length;
opts.nextSlide = roll ? 0 : opts.nextSlide+1;
opts.currSlide = roll ? els.length-1 : opts.nextSlide-1;
} else {
queueNext(opts);
}
function queueNext(opts) {
if (opts.timeout)
p.cycleTimeout = setTimeout(function() { go(els,opts,0,!opts.rev); }, opts.timeout);
}
}
// advance slide forward or back
function advance(els, opts, val) {
var p = els[0].parentNode, timeout = p.cycleTimeout;
if (timeout) {
clearTimeout(timeout);
p.cycleTimeout = 0;
}
opts.nextSlide = opts.currSlide + val;
if (opts.nextSlide < 0) {
opts.nextSlide = els.length - 1;
}
else if (opts.nextSlide >= els.length) {
opts.nextSlide = 0;
}
go(els, opts, 1, val>=0);
return false;
}
$.fn.cycle.custom = function(curr, next, opts, cb) {
var $l = $(curr), $n = $(next);
$n.css(opts.cssBefore);
var fn = function() {$n.animate(opts.animIn, opts.speedIn, opts.easeIn, cb);};
$l.animate(opts.animOut, opts.speedOut, opts.easeOut, function() {
$l.css(opts.cssAfter);
if (!opts.sync)
fn();
});
if (opts.sync)
fn();
};
$.fn.cycle.transitions = {
fade: function($cont, $slides, opts) {
$slides.not(':eq(0)').hide();
opts.cssBefore = { opacity: 0, display: 'block' };
opts.cssAfter = { display: 'none' };
opts.animOut = { opacity: 0 };
opts.animIn = { opacity: 1 };
},
fadeout: function($cont, $slides, opts) {
opts.before.push(function(curr,next,opts,fwd) {
$(curr).css('zIndex',opts.slideCount + (fwd === true ? 1 : 0));
$(next).css('zIndex',opts.slideCount + (fwd === true ? 0 : 1));
});
$slides.not(':eq(0)').hide();
opts.cssBefore = { opacity: 1, display: 'block', zIndex: 1 };
opts.cssAfter = { display: 'none', zIndex: 0 };
opts.animOut = { opacity: 0 };
opts.animIn = { opacity: 1 };
}
};
$.fn.cycle.ver = function() { return ver; };
// @see: http://malsup.com/jquery/cycle/lite/
$.fn.cycle.defaults = {
animIn: {},
animOut: {},
fx: 'fade',
after: null,
before: null,
cssBefore: {},
cssAfter: {},
delay: 0,
fit: 0,
height: 'auto',
metaAttr: 'cycle',
next: null,
pause: false,
prev: null,
speed: 1000,
slideExpr: null,
sync: true,
timeout: 4000
};
})(jQuery);

View file

@ -0,0 +1,55 @@
{% load i18n thumbnail sekizai_tags static %}
{% addtoblock "css" %}<link rel="stylesheet" type="text/css" href="{% static 'cmsplugin_filer_folder/css/slideshow.css' %}" media="screen, projection" />{% endaddtoblock "css" %}
{% addtoblock "js" %}<script type="text/javascript" src="{% static 'cmsplugin_filer_folder/js/jquery.cycle.lite-1.7.js' %}"></script>{% endaddtoblock "js" %}
{% addtoblock "js" %}
<script type="text/javascript">
//<![CDATA[
jQuery(document).ready(function ($) {
$('.cmsplugin_filer_folder_slideshow').cycle({
fx: 'fade'
});
});
//]]>
</script>
{% endaddtoblock %}
{{ object.get_display_name }}
{% if object.view_option == "list" %}
<div class="cmsplugin_filer_folder_list" id="folder_{{ instance.id }}">
<!--The files should go there -->
{% if folder_folders %}
<p>{% trans "Folders" %}</p>
<ul>
{% for folder in folder_folders %}
<li>{{ folder }}</li>
{% endfor %}
</ul>
{% endif %}
{% if folder_files %}
<p>{% trans "Files" %}</p>
<ul>
{% for files in folder_files %}
<li>{{ files }}</li>
{% endfor %}
</ul>
{% endif %}
{% if folder_images %}
<p>{% trans "Images" %}</p>
<ul>
{% for image in folder_images %}
<li><img src="{% thumbnail image.file 32x32 crop="True" upscale="True" %}" width="32" height="32" alt="{{ image.label }}"></li>
{% endfor %}
</ul>
{% endif %}
</div>
{% else %}
<!-- start: slideshow -->
<div class="cmsplugin_filer_folder_slideshow" id="folder_{{ object.id }}">
{% for image in folder_images %}
<img src="{% thumbnail image.file 200x200 crop="True" upscale="True" %}">
{% endfor %}
</div>
<!-- end: gallery -->
{% endif %}

View file

@ -0,0 +1,24 @@
Copyright (c) 2012, Stefan Foulis and contributors
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
* Neither the name of the authors nor the
names of its contributors may be used to endorse or promote products
derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

View file

@ -0,0 +1,4 @@
from cmsplugin_filer_file import __version__ # NOQA
__authors__ = ["Stefan Foulis <stefan.foulis@gmail.com>", ]
default_app_config = 'cmsplugin_filer_image.apps.FilerImageConfig'

View file

@ -0,0 +1,7 @@
from django.apps import AppConfig
from django.utils.translation import gettext_lazy as _
class FilerImageConfig(AppConfig):
name = 'cmsplugin_filer_image'
verbose_name = _('django filer image')

View file

@ -0,0 +1,147 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.template.loader import select_template
from django.templatetags.static import static
from django.utils.translation import gettext_lazy as _
from cms.plugin_base import CMSPluginBase
from cms.plugin_pool import plugin_pool
from .forms import FilerImageForm
from .models import FilerImage
from .conf import settings
class FilerImagePlugin(CMSPluginBase):
admin_preview = False
form = FilerImageForm
model = FilerImage
module = 'Filer'
name = _("Image")
raw_id_fields = ('image', 'page_link')
text_enabled = True
TEMPLATE_NAME = 'cmsplugin_filer_image/plugins/image/%s.html'
render_template = TEMPLATE_NAME % 'default'
fieldsets = (
(None, {
'fields': [
'caption_text',
'image',
'image_url',
'alt_text',
]
}),
(_('Image resizing options'), {
'fields': (
'use_original_image',
('width', 'height',),
('crop', 'upscale',),
'thumbnail_option',
'use_autoscale',
)
}),
(None, {
'fields': ('alignment',)
}),
(_('More'), {
'classes': ('collapse',),
'fields': (
'free_link',
'page_link',
'file_link',
('original_link', 'target_blank',),
'link_attributes',
'description',
),
}),
)
if settings.CMSPLUGIN_FILER_IMAGE_STYLE_CHOICES:
fieldsets[0][1]['fields'].append('style')
def _get_thumbnail_options(self, context, instance):
"""
Return the size and options of the thumbnail that should be inserted
"""
width, height = None, None
crop, upscale = False, False
subject_location = False
placeholder_width = context.get('width', None)
placeholder_height = context.get('height', None)
if instance.thumbnail_option:
# thumbnail option overrides everything else
if instance.thumbnail_option.width:
width = instance.thumbnail_option.width
if instance.thumbnail_option.height:
height = instance.thumbnail_option.height
crop = instance.thumbnail_option.crop
upscale = instance.thumbnail_option.upscale
else:
if instance.use_autoscale and placeholder_width:
# use the placeholder width as a hint for sizing
width = int(placeholder_width)
elif instance.width:
width = instance.width
if instance.use_autoscale and placeholder_height:
height = int(placeholder_height)
elif instance.height:
height = instance.height
crop = instance.crop
upscale = instance.upscale
if instance.image:
if instance.image.subject_location:
subject_location = instance.image.subject_location
if not height and width:
# height was not externally defined: use ratio to scale it by the width
height = int(float(width) * float(instance.image.height) / float(instance.image.width))
if not width and height:
# width was not externally defined: use ratio to scale it by the height
width = int(float(height) * float(instance.image.width) / float(instance.image.height))
if not width:
# width is still not defined. fallback the actual image width
width = instance.image.width
if not height:
# height is still not defined. fallback the actual image height
height = instance.image.height
return {'size': (width, height),
'crop': crop,
'upscale': upscale,
'subject_location': subject_location}
def get_thumbnail(self, context, instance):
if instance.image:
return instance.image.file.get_thumbnail(self._get_thumbnail_options(context, instance))
def render(self, context, instance, placeholder):
options = self._get_thumbnail_options(context, instance)
context.update({
'instance': instance,
'link': instance.link,
'opts': options,
'size': options.get('size', None),
'placeholder': placeholder
})
return context
def get_render_template(self, context, instance, placeholder):
template = select_template((
'cmsplugin_filer_image/plugins/image.html', # backwards compatibility. deprecated!
self.TEMPLATE_NAME % instance.style,
self.TEMPLATE_NAME % 'default',
))
return template
def icon_src(self, instance):
if instance.image:
if getattr(settings, 'FILER_IMAGE_USE_ICON', False) and '32' in instance.image.icons:
return instance.image.icons['32']
else:
# Fake the context with a reasonable width value because it is not
# available at this stage
thumbnail = self.get_thumbnail({'width': 200}, instance)
return thumbnail.url
else:
return static("filer/icons/missingfile_%sx%s.png" % (32, 32,))
plugin_pool.register_plugin(FilerImagePlugin)

View file

@ -0,0 +1,16 @@
# -*- coding: utf-8 -*-
from django.conf import settings # NOQA
from appconf import AppConf
class CmspluginFilerImageAppConf(AppConf):
STYLE_CHOICES = (
# ('default', _('Default')), # define your styles here.
)
DEFAULT_STYLE = ''
def configure(self):
# set DEFAULT_STYLE to '' if it is not in STYLE_CHOICES
if not self.configured_data['DEFAULT_STYLE'] in [s for s, l in self.configured_data['STYLE_CHOICES']]:
self.configured_data['DEFAULT_STYLE'] = ''
return self.configured_data

View file

@ -0,0 +1,20 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django import forms
from djangocms_attributes_field.widgets import AttributesWidget
from .models import FilerImage
class FilerImageForm(forms.ModelForm):
class Meta:
model = FilerImage
exclude = []
def __init__(self, *args, **kwargs):
super(FilerImageForm, self).__init__(*args, **kwargs)
self.fields['link_attributes'].widget = AttributesWidget()

View file

@ -0,0 +1 @@
# -*- coding: utf-8 -*-

View file

@ -0,0 +1,29 @@
# -*- coding: utf-8 -*-
from cms.models.pluginmodel import CMSPlugin
from django.core.files.uploadedfile import SimpleUploadedFile
def create_image_plugin(filename, image, parent_plugin, **kwargs):
"""
Used for drag-n-drop image insertion with djangocms-text-ckeditor.
Set TEXT_SAVE_IMAGE_FUNCTION='cmsplugin_filer_image.integrations.ckeditor.create_image_plugin' to enable.
"""
from cmsplugin_filer_image.models import FilerImage
from filer.models import Image
image_plugin = FilerImage()
image_plugin.placeholder = parent_plugin.placeholder
image_plugin.parent = CMSPlugin.objects.get(pk=parent_plugin.id)
image_plugin.position = CMSPlugin.objects.filter(parent=parent_plugin).count()
image_plugin.language = parent_plugin.language
image_plugin.plugin_type = 'FilerImagePlugin'
image.seek(0)
image_model = Image.objects.create(file=SimpleUploadedFile(name=filename, content=image.read()))
image_plugin.image = image_model
image_plugin.save()
return image_plugin
def update_image_plugin(plugin, width=None, height=None):
plugin.width = width
plugin.heigt = height
plugin.save()

View file

@ -0,0 +1,162 @@
# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the PACKAGE package.
#
# Translators:
# Roger Pons <rogerpons@gmail.com>, 2015
msgid ""
msgstr ""
"Project-Id-Version: django Filer Plugins\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2016-08-23 10:26-0400\n"
"PO-Revision-Date: 2016-06-22 17:49+0000\n"
"Last-Translator: Martin Koistinen <mkoistinen@gmail.com>\n"
"Language-Team: Catalan (http://www.transifex.com/divio/cmsplugin-filer/language/ca/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Language: ca\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
#: apps.py:7
msgid "django filer image"
msgstr ""
#: cms_plugins.py:21
msgid "Image"
msgstr "Imatge"
#: cms_plugins.py:37
msgid "Image resizing options"
msgstr "Opcions de redimensionat d'imatge"
#: cms_plugins.py:49
msgid "More"
msgstr "Més"
#: models.py:25
msgid "left"
msgstr "esquerra"
#: models.py:26
msgid "right"
msgstr "dreta"
#: models.py:27
msgid "center"
msgstr ""
#: models.py:34
msgid "Style"
msgstr ""
#: models.py:35
msgid "caption text"
msgstr "text de la llegenda"
#: models.py:40
msgid "image"
msgstr "imatge"
#: models.py:43
msgid "alternative image url"
msgstr "url alternativa de la imatge"
#: models.py:44
msgid "alt text"
msgstr "text alternatiu"
#: models.py:46
msgid "use the original image"
msgstr "utilitza la imatge original"
#: models.py:47
msgid "do not resize the image. use the original image instead."
msgstr "no redimensionar la imatge, utilitzar la imatge original."
#: models.py:49
msgid "thumbnail option"
msgstr "opció de miniatura"
#: models.py:50
msgid ""
"overrides width, height, crop and upscale with values from the selected "
"thumbnail option"
msgstr "sobreescriu l'amplada, l'alçada, el retall i l'augment d'escala amb els valors de l'opció de miniatura seleccionat"
#: models.py:51
msgid "use automatic scaling"
msgstr "utilitzar escalat automàtic"
#: models.py:52
msgid "tries to auto scale the image based on the placeholder context"
msgstr "intenta escalar automàticament la imatge segons el context del marcado de posició"
#: models.py:53
msgid "width"
msgstr "amplada"
#: models.py:54
msgid "height"
msgstr "alçada"
#: models.py:55
msgid "crop"
msgstr "retall"
#: models.py:56
msgid "upscale"
msgstr "augment d'escala"
#: models.py:57
msgid "image alignment"
msgstr "aliniació de la imatge"
#: models.py:59
msgid "link"
msgstr "enllaç"
#: models.py:60 models.py:62 models.py:69 models.py:74
msgid "if present image will be clickable"
msgstr "si la imatge està present es podrà fer clic"
#: models.py:63
msgid "page link"
msgstr "enllaç a pàgina"
#: models.py:68
msgid "file link"
msgstr "enllaç a fitxer"
#: models.py:73
msgid "link original image"
msgstr "enllaça a la imatge original"
#: models.py:75
msgid "description"
msgstr "descripció"
#: models.py:76
msgid "Open link in new window"
msgstr "Obre l'enllaç en una finestra nova"
#: models.py:78
msgid "Optional. Adds HTML attributes to the rendered link."
msgstr ""
#: models.py:86
msgid "filer image"
msgstr "imatge del filer"
#: models.py:87
msgid "filer images"
msgstr "imatges del filer"
#: models.py:93
msgid "Either an image or an image url must be selected."
msgstr "Cal seleccionar una imatge o l'url d'una imatge"
#: models.py:99
#, python-format
msgid "Image Publication %(caption)s"
msgstr "Publicació d'Imatge %(caption)s"

View file

@ -0,0 +1,163 @@
# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the PACKAGE package.
#
# Translators:
# Michal Bielicki <michal.bielicki@roamingengineer.com>, 2013
# Stefan Foulis <stefan.foulis@gmail.com>, 2013
msgid ""
msgstr ""
"Project-Id-Version: django Filer Plugins\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2016-08-23 10:26-0400\n"
"PO-Revision-Date: 2016-06-22 17:49+0000\n"
"Last-Translator: Martin Koistinen <mkoistinen@gmail.com>\n"
"Language-Team: German (http://www.transifex.com/divio/cmsplugin-filer/language/de/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Language: de\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
#: apps.py:7
msgid "django filer image"
msgstr ""
#: cms_plugins.py:21
msgid "Image"
msgstr "Bild"
#: cms_plugins.py:37
msgid "Image resizing options"
msgstr "Bildgrössenanpassungsoptionen"
#: cms_plugins.py:49
msgid "More"
msgstr "Mehr"
#: models.py:25
msgid "left"
msgstr "links"
#: models.py:26
msgid "right"
msgstr "rechts"
#: models.py:27
msgid "center"
msgstr ""
#: models.py:34
msgid "Style"
msgstr ""
#: models.py:35
msgid "caption text"
msgstr "Beschriftungstext"
#: models.py:40
msgid "image"
msgstr "Bild"
#: models.py:43
msgid "alternative image url"
msgstr "alternative Bild URL"
#: models.py:44
msgid "alt text"
msgstr "alt Text"
#: models.py:46
msgid "use the original image"
msgstr "Original-Bild verwenden"
#: models.py:47
msgid "do not resize the image. use the original image instead."
msgstr "Bildgrösse nicht anpassen, sondern das Original-Bild verwenden."
#: models.py:49
msgid "thumbnail option"
msgstr "Thumbnail Optionen"
#: models.py:50
msgid ""
"overrides width, height, crop and upscale with values from the selected "
"thumbnail option"
msgstr "Übersteuert Breite, Höhe, Zuschnitt und Vergrösserung mit Werten von der ausgewählten Thumbnail-Option."
#: models.py:51
msgid "use automatic scaling"
msgstr "automatisch skalieren"
#: models.py:52
msgid "tries to auto scale the image based on the placeholder context"
msgstr "versucht die benötigte Bildgröße automatisch an den Seiteninhalt anzupassen"
#: models.py:53
msgid "width"
msgstr "Breite"
#: models.py:54
msgid "height"
msgstr "Höhe"
#: models.py:55
msgid "crop"
msgstr "Zuschneiden"
#: models.py:56
msgid "upscale"
msgstr "Vergrößern"
#: models.py:57
msgid "image alignment"
msgstr "Bildausrichtung"
#: models.py:59
msgid "link"
msgstr "Link"
#: models.py:60 models.py:62 models.py:69 models.py:74
msgid "if present image will be clickable"
msgstr "wenn angegeben, wird das Bild verlinkt"
#: models.py:63
msgid "page link"
msgstr "Seitenlink"
#: models.py:68
msgid "file link"
msgstr "Datei-Link"
#: models.py:73
msgid "link original image"
msgstr "Original-Bild verlinken"
#: models.py:75
msgid "description"
msgstr "Beschreibung"
#: models.py:76
msgid "Open link in new window"
msgstr "Link in neuem Fenster öffnen"
#: models.py:78
msgid "Optional. Adds HTML attributes to the rendered link."
msgstr ""
#: models.py:86
msgid "filer image"
msgstr "Filer Bild"
#: models.py:87
msgid "filer images"
msgstr "Filer Bilder"
#: models.py:93
msgid "Either an image or an image url must be selected."
msgstr "Entweder muss ein Bild oder eine Bild-Url ausgewählt sein."
#: models.py:99
#, python-format
msgid "Image Publication %(caption)s"
msgstr "Bildveröffentlichung %(caption)s"

Some files were not shown because too many files have changed in this diff Show more