Merge branch 'develop' into wip/laravel-5.9

This commit is contained in:
Ben Thomson 2019-11-21 23:18:25 +08:00
commit 7e3136564f
No known key found for this signature in database
GPG Key ID: B2BAFACC5ED68F87
431 changed files with 11866 additions and 3978 deletions

13
.babelrc Normal file
View File

@ -0,0 +1,13 @@
{
"presets": ["@babel/preset-env"],
"plugins": [
[
"module-resolver", {
"root": ["."],
"alias": {
"helpers": "./tests/js/helpers"
}
}
]
]
}

View File

@ -1,10 +1,21 @@
# Contributing to OctoberCMS
Thank you for your interest in contributing to the OctoberCMS project!
Thank you for your interest in contributing to the OctoberCMS project. We appreciate any assistance that community members and users of OctoberCMS are willing to provide. You can contribute to the project in several different ways:
- [Reporting a Security Vulnerability](#reporting-a-security-vulnerability)
- [Reporting an issue with OctoberCMS](#reporting-an-issue-with-octobercms)
- [Reporting an issue with an OctoberCMS plugin](#reporting-an-issue-with-an-octobercms-plugin)
- [Making a Feature Request](#making-a-feature-request)
- [Making a Pull Request](#making-a-pull-request)
- [Testing Pull Requests](#testing-a-pull-request)
## Reporting a Security Vulnerability
Please review [our security policy](https://github.com/octobercms/october/security/policy) on how to report security vulnerabilities.
## Reporting an issue with OctoberCMS
**Please don't use the main GitHub for reporting issues with plugins.** If you have found a bug in a plugin, the best place to report it is with the [plugin author](https://octobercms.com/plugins).
>**NOTE:** If your issue is related to an OctoberCMS plugin, please see the [Reporting an issue with an OctoberCMS plugin](#reporting-an-issue-with-an-octobercms-plugin) section below.
We work hard to process bugs that are reported, to assist with this please ensure the following details are always included:
@ -16,7 +27,9 @@ We work hard to process bugs that are reported, to assist with this please ensur
- **Actual behavior**: What is the actual result on running above steps i.e. the bug behavior - **include any error messages**.
>**NOTE:** Screenshots and GIFs are very helpful in visuallizing what exactly is going wrong
If possible, please provide any screenshots or GIFs of the issue occurring to provide us with additional context to determine the cause of the issue.
>**NOTE**: If you're reporting an issue that you intend to fix yourself, you can skip the Issue step and just submit a Pull Request that fixes the issue (along with a detailed description of the original problem) instead.
#### Here's how to report an issue on GitHub
@ -32,13 +45,21 @@ We work hard to process bugs that are reported, to assist with this please ensur
If you find out your bug is actually a duplicate of another bug and only notice that after you created it, please also close your bug with a short reference to the other issue that was there before.
#### Reporting security issues
#### Reporting an issue with an OctoberCMS plugin
If you wish to contact us privately about any security exploits in OctoberCMS you may find, you can find our email on the [OctoberCMS website](https://octobercms.com).
>Please don't use the main GitHub for reporting issues with plugins.
## Feature requests
If you have found a bug in a plugin, the best place to report it is with the [plugin author](https://octobercms.com/plugins).
**Please don't use GitHub issues for suggesting a new feature.** If you have a feature idea, the best place to suggest it is the [OctoberCMS website forum](https://octobercms.com/forum/chan/feature-requests).
If you are unable to contact the plugin author and the issue prevents the plugin from being used correctly, please feel free to email `hello@octobercms.com`, mentioning the plugin name, URL and the issue found. We will then determine if the plugin needs to be delisted.
#### Escalation process
We do our best to attend to all reported issues. If you have an important issue that requires attention, consider submitting a bounty using the [OctoberCMS Bounty Program](https://www.bountysource.com/teams/october).
## Making a Feature Request
>**NOTE:** Please don't use GitHub issues for suggesting a new feature. If you have a feature idea, the best place to suggest it is the [OctoberCMS website forum](https://octobercms.com/forum/chan/feature-requests).
Only use GitHub if you are planning on contributing a new feature and developing it. If you want to discuss your idea first, before "officially" posting it anywhere, you can always join us on [IRC](https://octobercms.com/chat) or [Slack](https://octobercms.slack.com).
@ -48,7 +69,7 @@ Feature Requests submitted as GitHub Issues specifically mean *"I'd like to see
It's a great way to launch discussions on the developer side of things because both the core team and the community developer get a chance to talk about the technical side of the feature implementation. It's a great way to exchange ideas about how the logic could work in code.
## Pull Requests
## Making a Pull Request
Your contributions to the project are very welcome. If you would like to fix a bug or propose a new feature, you can submit a Pull Request.
@ -61,6 +82,43 @@ To help us merge your Pull Request, please make sure you follow these points:
Thank you for your contributions!
#### Best practices
It is ideal to keep your development branch or fork synchronised with the core OctoberCMS `develop` branch when submitting Pull Requests, as this minimises the possibility of merge conflicts.
To keep in sync with OctoberCMS, add the core OctoberCMS repository as a Git remote (ie. `upstream`) and pull changes from the OctoberCMS repository into your local `develop` branch as often as possible:
```
git remote add upstream git@github.com:octobercms/october.git
git fetch upstream
git checkout develop
git pull upstream develop
```
This ensures that your local `develop` branch matches OctoberCMS. When developing a pull request, it is best to use your own development branch. For example, creating a fix to improve spelling on a language file could be made into a branch called `lang-en-spelling-fixes`, which can be branched off from the `develop` branch.
```
git checkout -b lang-en-spelling-fixes develop
```
When you wish to update your development branch with the latest changes from the `develop` branch, it is just a simple merge:
```
git merge develop
```
This will merge all the latest changes from the OctoberCMS `develop` branch into your development branch.
#### Resolving merge conflicts
Occassionally, you may encounter a merge conflict with your Pull Request. This most commonly occurs if another change made to the OctoberCMS repository was made to a file that your Pull Request has also changed.
It is the responsibility of the author of the Pull Request to resolve any merge conflicts before their Pull Request is accepted.
You should ensure that your local copy of OctoberCMS is synchronised with with the `develop` branch in the OctoberCMS repository. Please follow the [steps above](#best-practices) to synchronise the repositories.
If Git reports that your changes have conflicts, you will need to resolve the changes in a way that includes the changes from the OctoberCMS repository as well as implementing your Pull Request's changes. See GitHub's guide to [resolving a merge conflict](https://help.github.com/en/articles/resolving-a-merge-conflict-using-the-command-line) for tips on resolving conflicts.
#### PSR Coding standards
Please ensure that your Pull Request satisfies the following coding standards:
@ -69,10 +127,28 @@ Please ensure that your Pull Request satisfies the following coding standards:
- [PSR 1 Coding Style Guide](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-1-basic-coding-standard.md)
- [PSR 0 Coding Style Guide](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-0.md)
To validate your changes against our coding standards, you may run `./vendor/bin/phpcs -nq --extensions="php"` in your development folder.
#### Team rules
The October team follows the [developer guidelines](https://octobercms.com/docs/help/developer-guide) as much as possible.
The OctoberCMS team follows the [developer guidelines](https://octobercms.com/docs/help/developer-guide) as much as possible.
#### Escalation process
## Testing a Pull Request
We do our best to attend to all reported issues. If you have an important issue that requires attention, consider submitting a bounty using the [OctoberCMS Bounty Program](https://www.bountysource.com/teams/october).
Although we aim to test all pull requests made to the OctoberCMS repository, the maintainers of OctoberCMS are volunteers and may not be able to promptly attend to all pull requests.
To help speed things up, any assistance with testing Pull Requests and fixes will be very appreciated. The best Pull Requests to test are those that are tagged as [**Testing Needed**](https://github.com/octobercms/october/pulls?q=is%3Apr+is%3Aopen+label%3A%22Testing+Needed%22) in the repository.
To test a Pull Request, you can use the steps below in a terminal or command-line interface to create a fresh installation of OctoberCMS with the changes made in the Pull Request, ready to test. In this example, we have a user called `qwerty123` that has created a pull request with an ID of `#4509`.
1. Check out a copy of the OctoberCMS repository to a folder that you can view in your web browser: `git clone git@github.com:octobercms/october.git`. This will add the files into a subfolder called `october`.
2. Then, go to the `october` subfolder and check out **@qwerty123**'s changes in a branch in your local repository: `git fetch origin pull/4509/head:pr-4509`. This will pull their changes into a branch called `pr-4509`. You will then need to check out the branch: `git checkout pr-4509`.
3. Next, get the Composer dependencies: `composer update`.
4. Next, run `php artisan october:env` to create a `.env` file in your folder. This will contain the configuration values for the database and site.
5. Finally, once you've populated that file with your database and site details, run `php artisan october:up` to install the necessary database tables.
At this point, you should have a working copy of the Pull Request ready to test.

5
.github/FUNDING.yml vendored Normal file
View File

@ -0,0 +1,5 @@
# These are supported funding model platforms
custom: ['https://octobercms.com/fundraising']
open_collective: octobercms
github: LukeTowers
patreon: LukeTowers

View File

@ -0,0 +1,15 @@
---
name: "🚨 Immediate Support"
about: 'I use October and it just broke! Help me!'
---
This repository is only for reporting reproducible bugs or problems. If you need support, please use the following options:
- Slack: https://octobercms.slack.com (Get an invite: https://octobercms-slack.herokuapp.com/)
- Live chat (IRC): https://octobercms.com/chat - **Note:** Not as active as Slack
- Forum: https://octobercms.com/forum
- Stack Overflow: https://stackoverflow.com/questions/tagged/octobercms
If you rely on OctoberCMS for your business consider purchasing a paid support plan! Send an email to octobercms@luketowers.ca to get started.
Thanks!

View File

@ -0,0 +1,8 @@
---
name: "🛒 Marketplace Support"
about: 'For reporting any issues with the marketplace, send an email to hello@octobercms.com'
---
All marketplace support issues will be addressed through email support.
Thanks!

View File

@ -1,12 +1,12 @@
---
name: "⚠️ Support Question"
about: 'This repository is only for reporting bugs or problems. If you need help, see: https://octobercms.com/support'
name: "⚠️ General Support"
about: 'This repository is only for reporting bugs or problems. If you need help using OctoberCMS, see: https://octobercms.com/support'
---
This repository is only for reporting bugs or problems. If you need support, please use the following options:
- Forum: https://octobercms.com/forum
- Slack: https://octobercms.slack.com (Invite link: https://octobercms-slack.herokuapp.com/)
- Slack: https://octobercms.slack.com (Get an invite: https://octobercms-slack.herokuapp.com/)
- Stack Overflow: https://stackoverflow.com/questions/tagged/octobercms
Thanks!

View File

@ -1,8 +0,0 @@
---
name: "🔒 Security Vulnerabilities"
about: 'For reporting security-related issues, send an email to hello@octobercms.com'
---
PLEASE DON'T DISCLOSE SECURITY-RELATED ISSUES PUBLICLY, SEE BELOW.
If you discover a security vulnerability within OctoberCMS or dependencies, please send an e-mail to Samuel Georges & Luke Towers via hello@octobercms.com and octobercms@luketowers.ca respectively. All security vulnerabilities will be promptly addressed.

21
.github/workflows/archive.yml vendored Normal file
View File

@ -0,0 +1,21 @@
name: Archive
on:
schedule:
- cron: "0 0 * * *"
jobs:
archive:
runs-on: ubuntu-latest
steps:
- uses: actions/stale@v1
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
days-before-stale: 30
days-before-close: 3
stale-issue-message: 'This issue will be closed and archived in 3 days, as there has been no activity in the last 30 days. If this issue is still relevant or you would like to see action on it, please respond and we will get the ball rolling.'
stale-pr-message: 'This pull request will be closed and archived in 3 days, as there has been no activity in the last 30 days. If this is still being worked on, please respond and we will re-open this pull request.'
stale-issue-label: 'Status: Archived'
stale-pr-label: 'Status: Archived'
exempt-issue-label: 'Status: In Progress'
exempt-pr-label: 'Status: In Progress'

30
.github/workflows/code-quality-pr.yaml vendored Normal file
View File

@ -0,0 +1,30 @@
name: Code Quality
on:
pull_request:
jobs:
codeQuality:
runs-on: ubuntu-latest
name: PHP
steps:
- name: Checkout changes
uses: actions/checkout@v1
- name: Install PHP
uses: shivammathur/setup-php@master
with:
php-version: 7.2
- name: Install Composer dependencies
run: composer install --no-interaction --no-progress --no-suggest
- name: Reset October modules and library
run: |
git reset --hard HEAD
rm -rf ./vendor/october/rain
wget https://github.com/octobercms/library/archive/develop.zip -O ./vendor/october/develop.zip
unzip ./vendor/october/develop.zip -d ./vendor/october
mv ./vendor/october/library-develop ./vendor/october/rain
composer dump-autoload
- name: Run code quality checks
run: |
git config remote.origin.fetch "+refs/heads/*:refs/remotes/origin/*" && git fetch
./vendor/bin/phpcs --colors -nq --report="full" --extensions="php" $(git diff --name-only --diff-filter=ACMR origin/${{ github.base_ref }} HEAD)

View File

@ -0,0 +1,31 @@
name: Code Quality
on:
push:
branches:
- master
- develop
jobs:
codeQuality:
runs-on: ubuntu-latest
name: PHP
steps:
- name: Checkout changes
uses: actions/checkout@v1
- name: Install PHP
uses: shivammathur/setup-php@master
with:
php-version: 7.2
- name: Install Composer dependencies
run: composer install --no-interaction --no-progress --no-suggest
- name: Reset October modules and library
run: |
git reset --hard HEAD
rm -rf ./vendor/october/rain
wget https://github.com/octobercms/library/archive/develop.zip -O ./vendor/october/develop.zip
unzip ./vendor/october/develop.zip -d ./vendor/october
mv ./vendor/october/library-develop ./vendor/october/rain
composer dump-autoload
- name: Run code quality checks
run: ./vendor/bin/phpcs --colors -nq --report="full" --extensions="php" $(git show --name-only --pretty="" --diff-filter=ACMR ${{ github.sha }})

24
.github/workflows/frontend-tests.yaml vendored Normal file
View File

@ -0,0 +1,24 @@
name: Tests
on:
push:
branches:
- master
- develop
pull_request:
jobs:
frontendTests:
runs-on: ubuntu-latest
name: JavaScript
steps:
- name: Checkout changes
uses: actions/checkout@v1
- name: Install Node
uses: actions/setup-node@v1
with:
node-version: 8
- name: Install Node dependencies
run: npm install
- name: Run tests
run: npm run test

39
.github/workflows/tests.yml vendored Normal file
View File

@ -0,0 +1,39 @@
name: Tests
on:
push:
branches:
- master
- develop
pull_request:
jobs:
phpUnitTests:
runs-on: ubuntu-latest
strategy:
max-parallel: 6
matrix:
phpVersions: ['7.1', '7.2', '7.3']
fail-fast: false
name: PHP ${{ matrix.phpVersions }}
steps:
- name: Checkout changes
uses: actions/checkout@v1
- name: Install PHP
uses: shivammathur/setup-php@master
with:
php-version: ${{ matrix.phpVersions }}
- name: Install Composer dependencies
run: composer install --no-interaction --no-progress --no-suggest
- name: Reset October modules and library
run: |
git reset --hard HEAD
rm -rf ./vendor/october/rain
wget https://github.com/octobercms/library/archive/develop.zip -O ./vendor/october/develop.zip
unzip ./vendor/october/develop.zip -d ./vendor/october
mv ./vendor/october/library-develop ./vendor/october/rain
composer dump-autoload
- name: Run Linting and Tests
run: |
./vendor/bin/parallel-lint --exclude vendor --exclude storage --exclude tests/fixtures/plugins/testvendor/goto/Plugin.php .
./vendor/bin/phpunit

View File

@ -0,0 +1,29 @@
name: Wrong Branch
on:
pull_request:
types: [opened]
branches:
- master
jobs:
wrongBranch:
runs-on: ubuntu-latest
name: Fix Wrong Branch
steps:
- name: Alert submitter
run: |
export ISSUE_NUMBER=$(echo '${{ github.ref }}' | cut -d'/' -f3)
curl -s --request POST \
--url https://api.github.com/repos/${{ github.repository }}/issues/${ISSUE_NUMBER}/comments \
--header 'authorization: Bearer ${{ secrets.GITHUB_TOKEN }}' \
--header 'content-type: application/json' \
--data '{"body": "This pull request has been made to the wrong branch. Please review [the contributing guidelines](https://github.com/octobercms/october/blob/master/.github/CONTRIBUTING.md#making-a-pull-request) as all PRs need to be made to the `develop` branch.\n\nWe'\''ll fix it for you this time, but please ensure you make any future PRs to the `develop` branch, not the `master` branch."}' > /dev/null
- name: Change base branch
run: |
export ISSUE_NUMBER=$(echo '${{ github.ref }}' | cut -d'/' -f3)
curl -s --request PATCH \
--url https://api.github.com/repos/${{ github.repository }}/pulls/${ISSUE_NUMBER} \
--header 'authorization: Bearer ${{ secrets.GITHUB_TOKEN }}' \
--header 'content-type: application/json' \
--data '{"base": "develop"}' > /dev/null

3
.gitignore vendored
View File

@ -16,6 +16,9 @@ sftp-config.json
.ftpconfig
selenium.php
composer.lock
package-lock.json
/node_modules
_ide_helper.php
# for netbeans
nbproject

5
.jshintrc Normal file
View File

@ -0,0 +1,5 @@
{
"esversion": 6,
"curly": true,
"asi": true
}

View File

@ -1,22 +0,0 @@
language: php
php:
- 7.0
- 7.1
- 7.2
- 7.3
- nightly
matrix:
allow_failures:
- php: nightly
sudo: false
install:
- composer self-update
- travis_retry composer install --no-interaction --prefer-source
before_script: git reset --hard HEAD
script: vendor/bin/phpunit

View File

@ -2,20 +2,14 @@
<img src="https://github.com/octobercms/october/blob/master/themes/demo/assets/images/october.png?raw=true" alt="October" width="25%" height="25%" />
</p>
[October](http://octobercms.com) is a Content Management System (CMS) and web platform whose sole purpose is to make your development workflow simple again. It was born out of frustration with existing systems. We feel building websites has become a convoluted and confusing process that leaves developers unsatisfied. We want to turn you around to the simpler side and get back to basics.
[October](https://octobercms.com) is a Content Management Framework (CMF) and web platform whose sole purpose is to make your development workflow simple again. It was born out of frustration with existing systems. We feel building websites has become a convoluted and confusing process that leaves developers unsatisfied. We want to turn you around to the simpler side and get back to basics.
October's mission is to show the world that web development is not rocket science.
[![Build Status](https://travis-ci.org/octobercms/october.svg?branch=develop)](https://travis-ci.org/octobercms/october)
[![License](https://poser.pugx.org/october/october/license.svg)](https://packagist.org/packages/october/october)
### Learning October
The best place to learn October is by [reading the documentation](https://octobercms.com/docs) or [following some tutorials](https://octobercms.com/support/articles/tutorials).
You may also watch these introductory videos for [beginners](https://vimeo.com/79963873) and [advanced users](https://vimeo.com/172202661).
### Installing October
## Installing October
Instructions on how to install October can be found at the [installation guide](https://octobercms.com/docs/setup/installation).
@ -33,35 +27,54 @@ If you plan on using a database, run this command:
php artisan october:install
```
### Development Team
## Learning October
October was created by [Alexey Bobkov](http://ca.linkedin.com/pub/aleksey-bobkov/2b/ba0/232) and [Samuel Georges](https://www.linkedin.com/in/samuel-georges-0a964131/), who (along with [Luke Towers](https://luketowers.ca/)) continue to develop the platform.
The best place to learn October is by [reading the documentation](https://octobercms.com/docs) or [following some tutorials](https://octobercms.com/support/articles/tutorials).
### Foundation library
You may also watch these introductory videos for [beginners](https://vimeo.com/79963873) and [advanced users](https://vimeo.com/172202661). There is also the excellent video series by [Watch & Learn](https://watch-learn.com/series/making-websites-with-october-cms).
The CMS uses [Laravel](https://laravel.com) as a foundation PHP framework.
### Contact
You can communicate with us using the following mediums:
* [Follow us on Twitter](https://twitter.com/octobercms) for announcements and updates.
* [Follow us on Facebook](https://facebook.com/octobercms) for announcements and updates.
* [Join us on IRC](https://octobercms.com/chat) to chat with us.
* [Join us on Slack](https://octobercms-slack.herokuapp.com/) to chat with us.
### License
The OctoberCMS platform is open-sourced software licensed under the [MIT license](https://opensource.org/licenses/MIT).
### Contributing
## Contributing
Before sending a Pull Request, be sure to review the [Contributing Guidelines](.github/CONTRIBUTING.md) first.
### Coding standards
### Help and support this project
You can also help the project by reviewing and testing open Pull Requests with the "**Status: Testing Needed**" tag.
[Read more...](https://github.com/octobercms/october/blob/master/.github/CONTRIBUTING.md#testing-pull-requests)
## Coding standards
Please follow the following guides and code standards:
* [PSR 4 Coding Standards](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-4-autoloader.md)
* [PSR 2 Coding Style Guide](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-2-coding-style-guide.md)
* [PSR 1 Coding Standards](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-1-basic-coding-standard.md)
## Code of Conduct
In order to ensure that the OctoberCMS community is welcoming to all, please review and abide by the [Code of Conduct](CODE_OF_CONDUCT.md).
## Security Vulnerabilities
Please review [our security policy](https://github.com/octobercms/october/security/policy) on how to report security vulnerabilities.
## Development Team
October was created by [Alexey Bobkov](http://ca.linkedin.com/pub/aleksey-bobkov/2b/ba0/232) and [Samuel Georges](https://www.linkedin.com/in/samuel-georges-0a964131/). The core maintainer is [Luke Towers](https://luketowers.ca/) and other maintainers include [Ben Thomson](https://github.com/bennothommo) and [Denis Denisov](https://github.com/w20k).
## Foundation library
The CMS uses [Laravel](https://laravel.com) as a foundation PHP framework.
## Contact
You can communicate with us using the following mediums:
* [Follow us on Twitter](https://twitter.com/octobercms) for announcements and updates.
* [Follow us on Facebook](https://facebook.com/octobercms) for announcements and updates.
* [Join us on Slack](https://octobercms-slack.herokuapp.com/) to chat with us.
* [Join us on IRC](https://octobercms.com/chat) to chat with us.
## License
The OctoberCMS platform is open-sourced software licensed under the [MIT license](https://opensource.org/licenses/MIT).

11
SECURITY.md Normal file
View File

@ -0,0 +1,11 @@
# Security Policy
**PLEASE DON'T DISCLOSE SECURITY-RELATED ISSUES PUBLICLY, [SEE BELOW](#reporting-a-vulnerability).**
## Supported Versions
October is evergreen, no one version is singled out for security fixes because there is no way to update just one version. Builds are continually released and security fixes will always be available in the latest build.
## Reporting a Vulnerability
If you discover a security vulnerability within OctoberCMS, please send an email to Samuel Georges at hello@octobercms.com and Luke Towers at octobercms@luketowers.ca. All security vulnerabilities will be promptly addressed.

View File

@ -1,7 +1,8 @@
{
"name": "october/october",
"description": "October CMS",
"description": "OctoberCMS",
"homepage": "https://octobercms.com",
"type": "project",
"keywords": ["october", "cms", "octobercms", "laravel"],
"license": "MIT",
"authors": [
@ -42,12 +43,16 @@
},
"require-dev": {
"fzaninotto/faker": "~1.7",
"phpunit/phpunit": "~5.7",
"phpunit/phpunit": "~6.5",
"phpunit/phpunit-selenium": "~1.2",
"meyfa/phpunit-assert-gd": "1.1.0"
"meyfa/phpunit-assert-gd": "1.1.0",
"squizlabs/php_codesniffer": "3.*",
"jakub-onderka/php-parallel-lint": "^1.0"
},
"autoload-dev": {
"classmap": [
"tests/concerns/InteractsWithAuthentication.php",
"tests/fixtures/backend/models/UserFixture.php",
"tests/TestCase.php",
"tests/UiTestCase.php",
"tests/PluginTestCase.php"

View File

@ -93,6 +93,21 @@ return [
'backendSkin' => 'Backend\Skins\Standard',
/*
|--------------------------------------------------------------------------
| Automatically run migrations on login
|--------------------------------------------------------------------------
|
| If value is true, UpdateManager will be run on logging in to the backend.
| It's recommended to set this value to 'null' in production enviroments
| because it clears the cache every time a user logs in to the backend.
| If set to null, this setting is enabled when debug mode (app.debug) is enabled
| and disabled when debug mode is disabled.
|
*/
'runMigrationsOnLogin' => null,
/*
|--------------------------------------------------------------------------
| Determines which modules to load
@ -359,8 +374,8 @@ return [
| Cross Site Request Forgery (CSRF) Protection
|--------------------------------------------------------------------------
|
| If the CSRF protection is enabled, all "postback" requests are checked
| for a valid security token.
| If the CSRF protection is enabled, all "postback" & AJAX requests are
| checked for a valid security token.
|
*/
@ -413,4 +428,26 @@ return [
'restrictBaseDir' => true,
/*
|--------------------------------------------------------------------------
| Backend Service Worker
|--------------------------------------------------------------------------
|
| Allow plugins to run Service Workers in the backend.
|
| WARNING: This should always be disabled for security reasons as Service
| Workers can be hijacked and used to run XSS into the backend. Turning
| this feature on can create a conflict if you have a frontend Service
| Worker running. The 'scope' needs to be correctly set and not have a
| duplicate subfolder structure on the frontend, otherwise it will run
| on both the frontend and backend of your website.
|
| true - allow service workers to run in the backend
|
| false - disallow service workers to run in the backend
|
*/
'enableBackendServiceWorkers' => false,
];

24
config/develop.php Normal file
View File

@ -0,0 +1,24 @@
<?php
return [
/*
|--------------------------------------------------------------------------
| Decompile backend assets
|--------------------------------------------------------------------------
|
| Enabling this will load all individual backend asset files, instead of
| loading the compiled asset files generated by `october:util compile
| assets`. This is useful only for development purposes, and should not be
| enabled in production. Please note that enabling this will make the
| Backend load a LOT of individual asset files.
|
| true - allow decompiled backend assets
|
| false - use compiled backend assets (default)
|
*/
'decompileBackendAssets' => false,
];

View File

@ -46,6 +46,7 @@ return [
'local' => [
'driver' => 'local',
'root' => storage_path('app'),
'url' => '/storage/app',
],
's3' => [

View File

@ -17,6 +17,7 @@ return [
'mailgun' => [
'domain' => '',
'secret' => '',
'endpoint' => 'api.mailgun.net', // api.eu.mailgun.net for EU
],
'mandrill' => [
@ -29,6 +30,10 @@ return [
'region' => 'us-east-1',
],
'sparkpost' => [
'secret' => '',
],
'stripe' => [
'model' => 'User',
'secret' => '',

View File

@ -109,4 +109,16 @@ return [
'themesPathLocal' => base_path('tests/fixtures/themes'),
/*
|--------------------------------------------------------------------------
| Cross Site Request Forgery (CSRF) Protection
|--------------------------------------------------------------------------
|
| If the CSRF protection is enabled, all "postback" requests are checked
| for a valid security token.
|
*/
'enableCsrfProtection' => false
];

View File

@ -76,6 +76,8 @@ class ServiceProvider extends ModuleServiceProvider
$combiner->registerBundle('~/modules/backend/formwidgets/fileupload/assets/less/fileupload.less');
$combiner->registerBundle('~/modules/backend/formwidgets/nestedform/assets/less/nestedform.less');
$combiner->registerBundle('~/modules/backend/formwidgets/richeditor/assets/js/build-plugins.js');
$combiner->registerBundle('~/modules/backend/formwidgets/colorpicker/assets/less/colorpicker.less');
$combiner->registerBundle('~/modules/backend/formwidgets/permissioneditor/assets/less/permissioneditor.less');
/*
* Rich Editor is protected by DRM

View File

@ -169,9 +169,9 @@ html.mobile .control-scrollbar {overflow:auto;-webkit-overflow-scrolling:touch}
.control-filelist ul li.group >h4 a:after,
.control-filelist ul li.group >div.group >h4 a:after {width:10px;height:10px;display:block;position:absolute;top:1px}
.control-filelist ul li.group >h4 a:after,
.control-filelist ul li.group >div.group >h4 a:after {left:33px;top:9px;font-family:FontAwesome;font-weight:normal;font-style:normal;text-decoration:inherit;-webkit-font-smoothing:antialiased;*margin-right:.3em;content:"\f07b";color:#a1aab1;font-size:16px}
.control-filelist ul li.group >div.group >h4 a:after {left:33px;top:9px;font-family:FontAwesome;font-weight:normal;font-style:normal;text-decoration:inherit;-webkit-font-smoothing:antialiased;content:"\f07b";color:#a1aab1;font-size:16px}
.control-filelist ul li.group >h4 a:before,
.control-filelist ul li.group >div.group >h4 a:before {left:20px;top:9px;color:#cfcfcf;font-family:FontAwesome;font-weight:normal;font-style:normal;text-decoration:inherit;-webkit-font-smoothing:antialiased;*margin-right:.3em;content:"\f0da";-webkit-transform:rotate(90deg) translate(5px,0);-ms-transform:rotate(90deg) translate(5px,0);transform:rotate(90deg) translate(5px,0);-webkit-transition:all 0.1s ease;transition:all 0.1s ease}
.control-filelist ul li.group >div.group >h4 a:before {left:20px;top:9px;color:#cfcfcf;font-family:FontAwesome;font-weight:normal;font-style:normal;text-decoration:inherit;-webkit-font-smoothing:antialiased;content:"\f0da";-webkit-transform:rotate(90deg) translate(5px,0);-ms-transform:rotate(90deg) translate(5px,0);transform:rotate(90deg) translate(5px,0);-webkit-transition:all 0.1s ease;transition:all 0.1s ease}
.control-filelist ul li.group >ul >li >a {padding-left:52px}
.control-filelist ul li.group >ul >li.group {padding-left:20px}
.control-filelist ul li.group >ul >li.group >ul >li >a {padding-left:324px;margin-left:-270px}
@ -276,10 +276,10 @@ html.mobile .control-scrollbar {overflow:auto;-webkit-overflow-scrolling:touch}
.control-treelist >ol >li >div.record:before {display:none}
.control-treelist li {margin:0;padding:0}
.control-treelist li >div.record {margin:0;font-size:12px;margin-bottom:5px;position:relative;display:block}
.control-treelist li >div.record:before {color:#bdc3c7;font-family:FontAwesome;font-weight:normal;font-style:normal;text-decoration:inherit;-webkit-font-smoothing:antialiased;*margin-right:.3em;content:"\f111";font-size:6px;position:absolute;left:-18px;top:11px}
.control-treelist li >div.record:before {color:#bdc3c7;font-family:FontAwesome;font-weight:normal;font-style:normal;text-decoration:inherit;-webkit-font-smoothing:antialiased;content:"\f111";font-size:6px;position:absolute;left:-18px;top:11px}
.control-treelist li >div.record >a.move {display:inline-block;padding:7px 0 7px 10px;text-decoration:none;color:#bdc3c7}
.control-treelist li >div.record >a.move:hover {color:#4ea5e0}
.control-treelist li >div.record >a.move:before {font-family:FontAwesome;font-weight:normal;font-style:normal;text-decoration:inherit;-webkit-font-smoothing:antialiased;*margin-right:.3em;content:"\f0c9"}
.control-treelist li >div.record >a.move:before {font-family:FontAwesome;font-weight:normal;font-style:normal;text-decoration:inherit;-webkit-font-smoothing:antialiased;content:"\f0c9"}
.control-treelist li >div.record >span {color:#666;display:inline-block;padding:7px 15px 7px 5px}
.control-treelist li.dragged {position:absolute;z-index:2000;width:auto !important;height:auto !important}
.control-treelist li.dragged >div.record {opacity:0.5;filter:alpha(opacity=50);background:#4ea5e0 !important}
@ -287,7 +287,7 @@ html.mobile .control-scrollbar {overflow:auto;-webkit-overflow-scrolling:touch}
.control-treelist li.dragged >div.record >span {color:white}
.control-treelist li.dragged >div.record:before {display:none}
.control-treelist li.placeholder {display:inline-block;position:relative;background:#4ea5e0 !important;height:25px;margin-bottom:5px}
.control-treelist li.placeholder:before {display:block;position:absolute;font-family:FontAwesome;font-weight:normal;font-style:normal;text-decoration:inherit;-webkit-font-smoothing:antialiased;*margin-right:.3em;content:"\f053";color:#d35714;left:-10px;top:8px;z-index:2000}
.control-treelist li.placeholder:before {display:block;position:absolute;font-family:FontAwesome;font-weight:normal;font-style:normal;text-decoration:inherit;-webkit-font-smoothing:antialiased;content:"\f053";color:#d35714;left:-10px;top:8px;z-index:2000}
.control-treeview {margin-bottom:40px}
.control-treeview ol {margin:0;padding:0;list-style:none;background:#fff}
.control-treeview ol >li {-webkit-transition:width 1s;transition:width 1s}
@ -296,9 +296,9 @@ html.mobile .control-scrollbar {overflow:auto;-webkit-overflow-scrolling:touch}
.control-treeview ol >li >div:before {content:' ';background-image:url(../images/treeview-icons.png);background-position:0 -28px;background-repeat:no-repeat;background-size:42px auto;position:absolute;width:21px;height:22px;left:28px;top:15px}
.control-treeview ol >li >div span.comment {display:block;font-weight:400;color:#95a5a6;font-size:13px;margin-top:2px;overflow:hidden;text-overflow:ellipsis}
.control-treeview ol >li >div >span.expand {font:0/0 a;color:transparent;text-shadow:none;background-color:transparent;border:0;display:none;position:absolute;width:20px;height:20px;top:19px;left:2px;cursor:pointer;color:#bdc3c7;-webkit-transition:transform 0.1s ease;transition:transform 0.1s ease}
.control-treeview ol >li >div >span.expand:before {font-family:FontAwesome;font-weight:normal;font-style:normal;text-decoration:inherit;-webkit-font-smoothing:antialiased;*margin-right:.3em;content:"\f0da";line-height:100%;font-size:15px;position:relative;left:8px;top:2px}
.control-treeview ol >li >div >span.expand:before {font-family:FontAwesome;font-weight:normal;font-style:normal;text-decoration:inherit;-webkit-font-smoothing:antialiased;content:"\f0da";line-height:100%;font-size:15px;position:relative;left:8px;top:2px}
.control-treeview ol >li >div >span.drag-handle {font:0/0 a;color:transparent;text-shadow:none;background-color:transparent;border:0;-webkit-transition:opacity 0.4s;transition:opacity 0.4s;position:absolute;right:9px;bottom:0;width:18px;height:19px;cursor:move;color:#bdc3c7;opacity:0;filter:alpha(opacity=0)}
.control-treeview ol >li >div >span.drag-handle:before {font-family:FontAwesome;font-weight:normal;font-style:normal;text-decoration:inherit;-webkit-font-smoothing:antialiased;*margin-right:.3em;content:"\f0c9";font-size:18px}
.control-treeview ol >li >div >span.drag-handle:before {font-family:FontAwesome;font-weight:normal;font-style:normal;text-decoration:inherit;-webkit-font-smoothing:antialiased;content:"\f0c9";font-size:18px}
.control-treeview ol >li >div span.borders {font-size:0}
.control-treeview ol >li >div >ul.submenu {position:absolute;left:20px;bottom:-36.9px;padding:0;list-style:none;z-index:200;height:37px;display:none;margin-left:15px;background:transparent url(../images/treeview-submenu-tabs.png) repeat-x left -39px}
.control-treeview ol >li >div >ul.submenu:before,
@ -449,7 +449,7 @@ body.dragging .control-treeview.treeview-light ol.dragging ol >li >div {backgrou
.sidenav-tree ul.top-level >li[data-status=collapsed] ul {display:none}
.sidenav-tree ul.top-level >li >div.group {position:relative}
.sidenav-tree ul.top-level >li >div.group h3 {background:rgba(0,0,0,0.15);color:#ecf0f1;text-transform:uppercase;font-size:15px;padding:15px 15px 15px 40px;margin:0;position:relative;cursor:pointer;font-weight:400}
.sidenav-tree ul.top-level >li >div.group h3:before {display:block;position:absolute;width:10px;height:10px;left:16px;top:15px;color:#cfcfcf;font-family:FontAwesome;font-weight:normal;font-style:normal;text-decoration:inherit;-webkit-font-smoothing:antialiased;*margin-right:.3em;content:"\f105";-webkit-transform:rotate(90deg) translate(5px,-3px);-ms-transform:rotate(90deg) translate(5px,-3px);transform:rotate(90deg) translate(5px,-3px);-webkit-transition:all 0.1s ease;transition:all 0.1s ease;font-size:16px}
.sidenav-tree ul.top-level >li >div.group h3:before {display:block;position:absolute;width:10px;height:10px;left:16px;top:15px;color:#cfcfcf;font-family:FontAwesome;font-weight:normal;font-style:normal;text-decoration:inherit;-webkit-font-smoothing:antialiased;content:"\f105";-webkit-transform:rotate(90deg) translate(5px,-3px);-ms-transform:rotate(90deg) translate(5px,-3px);transform:rotate(90deg) translate(5px,-3px);-webkit-transition:all 0.1s ease;transition:all 0.1s ease;font-size:16px}
.sidenav-tree ul.top-level >li >div.group:before,
.sidenav-tree ul.top-level >li >div.group:after {content:'';display:block;width:0;height:0;border-left:7.5px solid transparent;border-right:7.5px solid transparent;border-top:8px solid #34495e;border-bottom-width:0;position:absolute;left:15px;bottom:-8px;z-index:101}
.sidenav-tree ul.top-level >li >div.group:after {content:'';display:block;width:0;height:0;border-left:7.5px solid transparent;border-right:7.5px solid transparent;border-top:8px solid rgba(0,0,0,0.15);border-bottom-width:0}
@ -495,7 +495,7 @@ div.panel >label {margin-bottom:5px}
div.panel .nav.selector-group {margin:0 -20px 20px -20px}
ul.tree-path {list-style:none;padding:0;margin-bottom:0}
ul.tree-path li {display:inline-block;margin-right:1px;font-size:13px}
ul.tree-path li:after {font-family:FontAwesome;font-weight:normal;font-style:normal;text-decoration:inherit;-webkit-font-smoothing:antialiased;*margin-right:.3em;content:"\f105";display:inline-block;font-size:13px;margin-left:5px;position:relative;top:1px;color:#95a5a6}
ul.tree-path li:after {font-family:FontAwesome;font-weight:normal;font-style:normal;text-decoration:inherit;-webkit-font-smoothing:antialiased;content:"\f105";display:inline-block;font-size:13px;margin-left:5px;position:relative;top:1px;color:#95a5a6}
ul.tree-path li:last-child a {cursor:default}
ul.tree-path li:last-child:after {display:none}
ul.tree-path li.go-up {font-size:12px;margin-right:7px}
@ -685,7 +685,7 @@ nav#layout-mainmenu ul.mainmenu-toolbar li.mainmenu-preview a {position:relative
nav#layout-mainmenu ul.mainmenu-toolbar li.mainmenu-account {margin-right:0}
nav#layout-mainmenu ul.mainmenu-toolbar li.mainmenu-account >a {padding:0 15px 0 10px;font-size:13px;position:relative}
nav#layout-mainmenu ul.mainmenu-toolbar li.mainmenu-account.highlight >a {z-index:600}
nav#layout-mainmenu ul.mainmenu-toolbar li.mainmenu-account img.account-avatar {width:45px}
nav#layout-mainmenu ul.mainmenu-toolbar li.mainmenu-account img.account-avatar {width:45px;height:45px}
nav#layout-mainmenu ul.mainmenu-toolbar li.mainmenu-account .account-name {margin-right:15px}
nav#layout-mainmenu ul.mainmenu-toolbar li.mainmenu-account ul {line-height:23px}
html.svg nav#layout-mainmenu img.svg-icon,
@ -778,7 +778,7 @@ nav#layout-mainmenu.navbar-mode-collapse .menu-toggle {display:inline-block;colo
.mainmenu-collapsed >div ul li a i {line-height:1;font-size:30px;vertical-align:middle}
.mainmenu-collapsed >div ul li a img.svg-icon {height:30px;width:30px;position:relative;top:0}
.mainmenu-collapsed .scroll-marker {position:absolute;left:0;width:100%;height:10px;display:none}
.mainmenu-collapsed .scroll-marker:after {font-family:FontAwesome;font-weight:normal;font-style:normal;text-decoration:inherit;-webkit-font-smoothing:antialiased;*margin-right:.3em;content:"\f141";display:block;position:absolute;left:50%;margin-left:-3px;top:0;height:9px;font-size:10px;color:rgba(255,255,255,0.6)}
.mainmenu-collapsed .scroll-marker:after {font-family:FontAwesome;font-weight:normal;font-style:normal;text-decoration:inherit;-webkit-font-smoothing:antialiased;content:"\f141";display:block;position:absolute;left:50%;margin-left:-3px;top:0;height:9px;font-size:10px;color:rgba(255,255,255,0.6)}
.mainmenu-collapsed .scroll-marker.before {top:0}
.mainmenu-collapsed .scroll-marker.after {bottom:3px}
.mainmenu-collapsed .scroll-marker.after:after {top:2px}
@ -940,7 +940,7 @@ body.breadcrumb-fancy .control-breadcrumb li:last-child:before,
.fancy-layout .control-tabs.master-tabs >div >div.tabs-container >ul.nav-tabs >li[data-modified] span.tab-close i,
.fancy-layout.control-tabs.master-tabs >div >div.tabs-container >ul.nav-tabs >li[data-modified] span.tab-close i {top:5px;font:0/0 a;color:transparent;text-shadow:none;background-color:transparent;border:0}
.fancy-layout .control-tabs.master-tabs >div >div.tabs-container >ul.nav-tabs >li[data-modified] span.tab-close i:before,
.fancy-layout.control-tabs.master-tabs >div >div.tabs-container >ul.nav-tabs >li[data-modified] span.tab-close i:before {font-family:FontAwesome;font-weight:normal;font-style:normal;text-decoration:inherit;-webkit-font-smoothing:antialiased;*margin-right:.3em;content:"\f111";font-size:9px}
.fancy-layout.control-tabs.master-tabs >div >div.tabs-container >ul.nav-tabs >li[data-modified] span.tab-close i:before {font-family:FontAwesome;font-weight:normal;font-style:normal;text-decoration:inherit;-webkit-font-smoothing:antialiased;content:"\f111";font-size:9px}
.fancy-layout .control-tabs.master-tabs >div >div.tabs-container >ul.nav-tabs >li:first-child,
.fancy-layout.control-tabs.master-tabs >div >div.tabs-container >ul.nav-tabs >li:first-child {margin-left:0}
.fancy-layout .control-tabs.master-tabs[data-closable] >div >div.tabs-container >ul.nav-tabs >li a >span.title,

View File

@ -1,10 +0,0 @@
// Only run on HTTPS connections
if (location.protocol === 'https:') {
// Unregister all service workers before signing in to prevent cache issues
navigator.serviceWorker.getRegistrations().then(
function(registrations) {
for (let registration of registrations) {
registration.unregister();
}
});
}

View File

@ -36,145 +36,211 @@ return(document.cookie=[encode(key),'=',stringifyCookieValue(value),options.expi
var result=key?undefined:{};var cookies=document.cookie?document.cookie.split('; '):[];for(var i=0,l=cookies.length;i<l;i++){var parts=cookies[i].split('=');var name=decode(parts.shift());var cookie=parts.join('=');if(key&&key===name){result=read(cookie,value);break;}
if(!key&&(cookie=read(cookie))!==undefined){result[name]=cookie;}}
return result;};config.defaults={};$.removeCookie=function(key,options){if($.cookie(key)===undefined){return false;}
$.cookie(key,'',$.extend({},options,{expires:-1}));return!$.cookie(key);};}));(function(){var Dropzone,Emitter,camelize,contentLoaded,detectVerticalSquash,drawImageIOSFix,noop,without,__slice=[].slice,__hasProp={}.hasOwnProperty,__extends=function(child,parent){for(var key in parent){if(__hasProp.call(parent,key))child[key]=parent[key];}function ctor(){this.constructor=child;}ctor.prototype=parent.prototype;child.prototype=new ctor();child.__super__=parent.prototype;return child;};noop=function(){};Emitter=(function(){function Emitter(){}
Emitter.prototype.addEventListener=Emitter.prototype.on;Emitter.prototype.on=function(event,fn){this._callbacks=this._callbacks||{};if(!this._callbacks[event]){this._callbacks[event]=[];}
this._callbacks[event].push(fn);return this;};Emitter.prototype.emit=function(){var args,callback,callbacks,event,_i,_len;event=arguments[0],args=2<=arguments.length?__slice.call(arguments,1):[];this._callbacks=this._callbacks||{};callbacks=this._callbacks[event];if(callbacks){for(_i=0,_len=callbacks.length;_i<_len;_i++){callback=callbacks[_i];callback.apply(this,args);}}
return this;};Emitter.prototype.removeListener=Emitter.prototype.off;Emitter.prototype.removeAllListeners=Emitter.prototype.off;Emitter.prototype.removeEventListener=Emitter.prototype.off;Emitter.prototype.off=function(event,fn){var callback,callbacks,i,_i,_len;if(!this._callbacks||arguments.length===0){this._callbacks={};return this;}
callbacks=this._callbacks[event];if(!callbacks){return this;}
$.cookie(key,'',$.extend({},options,{expires:-1}));return!$.cookie(key);};}));"use strict";var _createClass=function(){function defineProperties(target,props){for(var i=0;i<props.length;i++){var descriptor=props[i];descriptor.enumerable=descriptor.enumerable||false;descriptor.configurable=true;if("value"in descriptor)descriptor.writable=true;Object.defineProperty(target,descriptor.key,descriptor);}}return function(Constructor,protoProps,staticProps){if(protoProps)defineProperties(Constructor.prototype,protoProps);if(staticProps)defineProperties(Constructor,staticProps);return Constructor;};}();function _possibleConstructorReturn(self,call){if(!self){throw new ReferenceError("this hasn't been initialised - super() hasn't been called");}return call&&(typeof call==="object"||typeof call==="function")?call:self;}
function _inherits(subClass,superClass){if(typeof superClass!=="function"&&superClass!==null){throw new TypeError("Super expression must either be null or a function, not "+typeof superClass);}subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,enumerable:false,writable:true,configurable:true}});if(superClass)Object.setPrototypeOf?Object.setPrototypeOf(subClass,superClass):subClass.__proto__=superClass;}
function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function");}}
var Emitter=function(){function Emitter(){_classCallCheck(this,Emitter);}
_createClass(Emitter,[{key:"on",value:function on(event,fn){this._callbacks=this._callbacks||{};if(!this._callbacks[event]){this._callbacks[event]=[];}
this._callbacks[event].push(fn);return this;}},{key:"emit",value:function emit(event){this._callbacks=this._callbacks||{};var callbacks=this._callbacks[event];if(callbacks){for(var _len=arguments.length,args=Array(_len>1?_len-1:0),_key=1;_key<_len;_key++){args[_key-1]=arguments[_key];}
for(var _iterator=callbacks,_isArray=true,_i=0,_iterator=_isArray?_iterator:_iterator[Symbol.iterator]();;){var _ref;if(_isArray){if(_i>=_iterator.length)break;_ref=_iterator[_i++];}else{_i=_iterator.next();if(_i.done)break;_ref=_i.value;}
var callback=_ref;callback.apply(this,args);}}
return this;}},{key:"off",value:function off(event,fn){if(!this._callbacks||arguments.length===0){this._callbacks={};return this;}
var callbacks=this._callbacks[event];if(!callbacks){return this;}
if(arguments.length===1){delete this._callbacks[event];return this;}
for(i=_i=0,_len=callbacks.length;_i<_len;i=++_i){callback=callbacks[i];if(callback===fn){callbacks.splice(i,1);break;}}
return this;};return Emitter;})();Dropzone=(function(_super){var extend,resolveOption;__extends(Dropzone,_super);Dropzone.prototype.Emitter=Emitter;Dropzone.prototype.events=["drop","dragstart","dragend","dragenter","dragover","dragleave","addedfile","removedfile","thumbnail","error","errormultiple","processing","processingmultiple","uploadprogress","totaluploadprogress","sending","sendingmultiple","success","successmultiple","canceled","canceledmultiple","complete","completemultiple","reset","maxfilesexceeded","maxfilesreached","queuecomplete"];Dropzone.prototype.defaultOptions={url:null,method:"post",withCredentials:false,parallelUploads:2,uploadMultiple:false,maxFilesize:256,paramName:"file",createImageThumbnails:true,maxThumbnailFilesize:10,thumbnailWidth:120,thumbnailHeight:120,filesizeBase:1000,maxFiles:null,filesizeBase:1000,params:{},clickable:true,ignoreHiddenFiles:true,acceptedFiles:null,acceptedMimeTypes:null,autoProcessQueue:true,autoQueue:true,addRemoveLinks:false,previewsContainer:null,capture:null,dictDefaultMessage:"Drop files here to upload",dictFallbackMessage:"Your browser does not support drag'n'drop file uploads.",dictFallbackText:"Please use the fallback form below to upload your files like in the olden days.",dictFileTooBig:"File is too big ({{filesize}}MiB). Max filesize: {{maxFilesize}}MiB.",dictInvalidFileType:"You can't upload files of this type.",dictResponseError:"Server responded with {{statusCode}} code.",dictCancelUpload:"Cancel upload",dictCancelUploadConfirmation:"Are you sure you want to cancel this upload?",dictRemoveFile:"Remove file",dictRemoveFileConfirmation:null,dictMaxFilesExceeded:"You can not upload any more files.",accept:function(file,done){return done();},init:function(){return noop;},forceFallback:false,fallback:function(){var child,messageElement,span,_i,_len,_ref;this.element.className=""+this.element.className+" dz-browser-not-supported";_ref=this.element.getElementsByTagName("div");for(_i=0,_len=_ref.length;_i<_len;_i++){child=_ref[_i];if(/(^| )dz-message($| )/.test(child.className)){messageElement=child;child.className="dz-message";continue;}}
for(var i=0;i<callbacks.length;i++){var callback=callbacks[i];if(callback===fn){callbacks.splice(i,1);break;}}
return this;}}]);return Emitter;}();var Dropzone=function(_Emitter){_inherits(Dropzone,_Emitter);_createClass(Dropzone,null,[{key:"initClass",value:function initClass(){this.prototype.Emitter=Emitter;this.prototype.events=["drop","dragstart","dragend","dragenter","dragover","dragleave","addedfile","addedfiles","removedfile","thumbnail","error","errormultiple","processing","processingmultiple","uploadprogress","totaluploadprogress","sending","sendingmultiple","success","successmultiple","canceled","canceledmultiple","complete","completemultiple","reset","maxfilesexceeded","maxfilesreached","queuecomplete"];this.prototype.defaultOptions={url:null,method:"post",withCredentials:false,timeout:30000,parallelUploads:2,uploadMultiple:false,chunking:false,forceChunking:false,chunkSize:2000000,parallelChunkUploads:false,retryChunks:false,retryChunksLimit:3,maxFilesize:256,paramName:"file",createImageThumbnails:true,maxThumbnailFilesize:10,thumbnailWidth:120,thumbnailHeight:120,thumbnailMethod:'crop',resizeWidth:null,resizeHeight:null,resizeMimeType:null,resizeQuality:0.8,resizeMethod:'contain',filesizeBase:1000,maxFiles:null,headers:null,clickable:true,ignoreHiddenFiles:true,acceptedFiles:null,acceptedMimeTypes:null,autoProcessQueue:true,autoQueue:true,addRemoveLinks:false,previewsContainer:null,hiddenInputContainer:"body",capture:null,renameFilename:null,renameFile:null,forceFallback:false,dictDefaultMessage:"Drop files here to upload",dictFallbackMessage:"Your browser does not support drag'n'drop file uploads.",dictFallbackText:"Please use the fallback form below to upload your files like in the olden days.",dictFileTooBig:"File is too big ({{filesize}}MiB). Max filesize: {{maxFilesize}}MiB.",dictInvalidFileType:"You can't upload files of this type.",dictResponseError:"Server responded with {{statusCode}} code.",dictCancelUpload:"Cancel upload",dictUploadCanceled:"Upload canceled.",dictCancelUploadConfirmation:"Are you sure you want to cancel this upload?",dictRemoveFile:"Remove file",dictRemoveFileConfirmation:null,dictMaxFilesExceeded:"You can not upload any more files.",dictFileSizeUnits:{tb:"TB",gb:"GB",mb:"MB",kb:"KB",b:"b"},init:function init(){},params:function params(files,xhr,chunk){if(chunk){return{dzuuid:chunk.file.upload.uuid,dzchunkindex:chunk.index,dztotalfilesize:chunk.file.size,dzchunksize:this.options.chunkSize,dztotalchunkcount:chunk.file.upload.totalChunkCount,dzchunkbyteoffset:chunk.index*this.options.chunkSize};}},accept:function accept(file,done){return done();},chunksUploaded:function chunksUploaded(file,done){done();},fallback:function fallback(){var messageElement=void 0;this.element.className=this.element.className+" dz-browser-not-supported";for(var _iterator2=this.element.getElementsByTagName("div"),_isArray2=true,_i2=0,_iterator2=_isArray2?_iterator2:_iterator2[Symbol.iterator]();;){var _ref2;if(_isArray2){if(_i2>=_iterator2.length)break;_ref2=_iterator2[_i2++];}else{_i2=_iterator2.next();if(_i2.done)break;_ref2=_i2.value;}
var child=_ref2;if(/(^| )dz-message($| )/.test(child.className)){messageElement=child;child.className="dz-message";break;}}
if(!messageElement){messageElement=Dropzone.createElement("<div class=\"dz-message\"><span></span></div>");this.element.appendChild(messageElement);}
span=messageElement.getElementsByTagName("span")[0];if(span){span.textContent=this.options.dictFallbackMessage;}
return this.element.appendChild(this.getFallbackForm());},resize:function(file){var info,srcRatio,trgRatio;info={srcX:0,srcY:0,srcWidth:file.width,srcHeight:file.height};srcRatio=file.width/file.height;info.optWidth=this.options.thumbnailWidth;info.optHeight=this.options.thumbnailHeight;if((info.optWidth==null)&&(info.optHeight==null)){info.optWidth=info.srcWidth;info.optHeight=info.srcHeight;}else if(info.optWidth==null){info.optWidth=srcRatio*info.optHeight;}else if(info.optHeight==null){info.optHeight=(1/srcRatio)*info.optWidth;}
trgRatio=info.optWidth/info.optHeight;if(file.height<info.optHeight||file.width<info.optWidth){info.trgHeight=info.srcHeight;info.trgWidth=info.srcWidth;}else{if(srcRatio>trgRatio){info.srcHeight=file.height;info.srcWidth=info.srcHeight*trgRatio;}else{info.srcWidth=file.width;info.srcHeight=info.srcWidth/trgRatio;}}
info.srcX=(file.width-info.srcWidth)/2;info.srcY=(file.height-info.srcHeight)/2;return info;},drop:function(e){return this.element.classList.remove("dz-drag-hover");},dragstart:noop,dragend:function(e){return this.element.classList.remove("dz-drag-hover");},dragenter:function(e){return this.element.classList.add("dz-drag-hover");},dragover:function(e){return this.element.classList.add("dz-drag-hover");},dragleave:function(e){return this.element.classList.remove("dz-drag-hover");},paste:noop,reset:function(){return this.element.classList.remove("dz-started");},addedfile:function(file){var node,removeFileEvent,removeLink,_i,_j,_k,_len,_len1,_len2,_ref,_ref1,_ref2,_results;if(this.element===this.previewsContainer){this.element.classList.add("dz-started");}
if(this.previewsContainer){file.previewElement=Dropzone.createElement(this.options.previewTemplate.trim());file.previewTemplate=file.previewElement;this.previewsContainer.appendChild(file.previewElement);_ref=file.previewElement.querySelectorAll("[data-dz-name]");for(_i=0,_len=_ref.length;_i<_len;_i++){node=_ref[_i];node.textContent=file.name;}
_ref1=file.previewElement.querySelectorAll("[data-dz-size]");for(_j=0,_len1=_ref1.length;_j<_len1;_j++){node=_ref1[_j];node.innerHTML=this.filesize(file.size);}
var span=messageElement.getElementsByTagName("span")[0];if(span){if(span.textContent!=null){span.textContent=this.options.dictFallbackMessage;}else if(span.innerText!=null){span.innerText=this.options.dictFallbackMessage;}}
return this.element.appendChild(this.getFallbackForm());},resize:function resize(file,width,height,resizeMethod){var info={srcX:0,srcY:0,srcWidth:file.width,srcHeight:file.height};var srcRatio=file.width/file.height;if(width==null&&height==null){width=info.srcWidth;height=info.srcHeight;}else if(width==null){width=height*srcRatio;}else if(height==null){height=width/srcRatio;}
width=Math.min(width,info.srcWidth);height=Math.min(height,info.srcHeight);var trgRatio=width/height;if(info.srcWidth>width||info.srcHeight>height){if(resizeMethod==='crop'){if(srcRatio>trgRatio){info.srcHeight=file.height;info.srcWidth=info.srcHeight*trgRatio;}else{info.srcWidth=file.width;info.srcHeight=info.srcWidth/trgRatio;}}else if(resizeMethod==='contain'){if(srcRatio>trgRatio){height=width/srcRatio;}else{width=height*srcRatio;}}else{throw new Error("Unknown resizeMethod '"+resizeMethod+"'");}}
info.srcX=(file.width-info.srcWidth)/2;info.srcY=(file.height-info.srcHeight)/2;info.trgWidth=width;info.trgHeight=height;return info;},transformFile:function transformFile(file,done){if((this.options.resizeWidth||this.options.resizeHeight)&&file.type.match(/image.*/)){return this.resizeImage(file,this.options.resizeWidth,this.options.resizeHeight,this.options.resizeMethod,done);}else{return done(file);}},previewTemplate:"<div class=\"dz-preview dz-file-preview\">\n <div class=\"dz-image\"><img data-dz-thumbnail /></div>\n <div class=\"dz-details\">\n <div class=\"dz-size\"><span data-dz-size></span></div>\n <div class=\"dz-filename\"><span data-dz-name></span></div>\n </div>\n <div class=\"dz-progress\"><span class=\"dz-upload\" data-dz-uploadprogress></span></div>\n <div class=\"dz-error-message\"><span data-dz-errormessage></span></div>\n <div class=\"dz-success-mark\">\n <svg width=\"54px\" height=\"54px\" viewBox=\"0 0 54 54\" version=\"1.1\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" xmlns:sketch=\"http://www.bohemiancoding.com/sketch/ns\">\n <title>Check</title>\n <defs></defs>\n <g id=\"Page-1\" stroke=\"none\" stroke-width=\"1\" fill=\"none\" fill-rule=\"evenodd\" sketch:type=\"MSPage\">\n <path d=\"M23.5,31.8431458 L17.5852419,25.9283877 C16.0248253,24.3679711 13.4910294,24.366835 11.9289322,25.9289322 C10.3700136,27.4878508 10.3665912,30.0234455 11.9283877,31.5852419 L20.4147581,40.0716123 C20.5133999,40.1702541 20.6159315,40.2626649 20.7218615,40.3488435 C22.2835669,41.8725651 24.794234,41.8626202 26.3461564,40.3106978 L43.3106978,23.3461564 C44.8771021,21.7797521 44.8758057,19.2483887 43.3137085,17.6862915 C41.7547899,16.1273729 39.2176035,16.1255422 37.6538436,17.6893022 L23.5,31.8431458 Z M27,53 C41.3594035,53 53,41.3594035 53,27 C53,12.6405965 41.3594035,1 27,1 C12.6405965,1 1,12.6405965 1,27 C1,41.3594035 12.6405965,53 27,53 Z\" id=\"Oval-2\" stroke-opacity=\"0.198794158\" stroke=\"#747474\" fill-opacity=\"0.816519475\" fill=\"#FFFFFF\" sketch:type=\"MSShapeGroup\"></path>\n </g>\n </svg>\n </div>\n <div class=\"dz-error-mark\">\n <svg width=\"54px\" height=\"54px\" viewBox=\"0 0 54 54\" version=\"1.1\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" xmlns:sketch=\"http://www.bohemiancoding.com/sketch/ns\">\n <title>Error</title>\n <defs></defs>\n <g id=\"Page-1\" stroke=\"none\" stroke-width=\"1\" fill=\"none\" fill-rule=\"evenodd\" sketch:type=\"MSPage\">\n <g id=\"Check-+-Oval-2\" sketch:type=\"MSLayerGroup\" stroke=\"#747474\" stroke-opacity=\"0.198794158\" fill=\"#FFFFFF\" fill-opacity=\"0.816519475\">\n <path d=\"M32.6568542,29 L38.3106978,23.3461564 C39.8771021,21.7797521 39.8758057,19.2483887 38.3137085,17.6862915 C36.7547899,16.1273729 34.2176035,16.1255422 32.6538436,17.6893022 L27,23.3431458 L21.3461564,17.6893022 C19.7823965,16.1255422 17.2452101,16.1273729 15.6862915,17.6862915 C14.1241943,19.2483887 14.1228979,21.7797521 15.6893022,23.3461564 L21.3431458,29 L15.6893022,34.6538436 C14.1228979,36.2202479 14.1241943,38.7516113 15.6862915,40.3137085 C17.2452101,41.8726271 19.7823965,41.8744578 21.3461564,40.3106978 L27,34.6568542 L32.6538436,40.3106978 C34.2176035,41.8744578 36.7547899,41.8726271 38.3137085,40.3137085 C39.8758057,38.7516113 39.8771021,36.2202479 38.3106978,34.6538436 L32.6568542,29 Z M27,53 C41.3594035,53 53,41.3594035 53,27 C53,12.6405965 41.3594035,1 27,1 C12.6405965,1 1,12.6405965 1,27 C1,41.3594035 12.6405965,53 27,53 Z\" id=\"Oval-2\" sketch:type=\"MSShapeGroup\"></path>\n </g>\n </g>\n </svg>\n </div>\n</div>",drop:function drop(e){return this.element.classList.remove("dz-drag-hover");},dragstart:function dragstart(e){},dragend:function dragend(e){return this.element.classList.remove("dz-drag-hover");},dragenter:function dragenter(e){return this.element.classList.add("dz-drag-hover");},dragover:function dragover(e){return this.element.classList.add("dz-drag-hover");},dragleave:function dragleave(e){return this.element.classList.remove("dz-drag-hover");},paste:function paste(e){},reset:function reset(){return this.element.classList.remove("dz-started");},addedfile:function addedfile(file){var _this2=this;if(this.element===this.previewsContainer){this.element.classList.add("dz-started");}
if(this.previewsContainer){file.previewElement=Dropzone.createElement(this.options.previewTemplate.trim());file.previewTemplate=file.previewElement;this.previewsContainer.appendChild(file.previewElement);for(var _iterator3=file.previewElement.querySelectorAll("[data-dz-name]"),_isArray3=true,_i3=0,_iterator3=_isArray3?_iterator3:_iterator3[Symbol.iterator]();;){var _ref3;if(_isArray3){if(_i3>=_iterator3.length)break;_ref3=_iterator3[_i3++];}else{_i3=_iterator3.next();if(_i3.done)break;_ref3=_i3.value;}
var node=_ref3;node.textContent=file.name;}
for(var _iterator4=file.previewElement.querySelectorAll("[data-dz-size]"),_isArray4=true,_i4=0,_iterator4=_isArray4?_iterator4:_iterator4[Symbol.iterator]();;){if(_isArray4){if(_i4>=_iterator4.length)break;node=_iterator4[_i4++];}else{_i4=_iterator4.next();if(_i4.done)break;node=_i4.value;}
node.innerHTML=this.filesize(file.size);}
if(this.options.addRemoveLinks){file._removeLink=Dropzone.createElement("<a class=\"dz-remove\" href=\"javascript:undefined;\" data-dz-remove>"+this.options.dictRemoveFile+"</a>");file.previewElement.appendChild(file._removeLink);}
removeFileEvent=(function(_this){return function(e){e.preventDefault();e.stopPropagation();if(file.status===Dropzone.UPLOADING){return Dropzone.confirm(_this.options.dictCancelUploadConfirmation,function(){return _this.removeFile(file);});}else{if(_this.options.dictRemoveFileConfirmation){return Dropzone.confirm(_this.options.dictRemoveFileConfirmation,function(){return _this.removeFile(file);});}else{return _this.removeFile(file);}}};})(this);_ref2=file.previewElement.querySelectorAll("[data-dz-remove]");_results=[];for(_k=0,_len2=_ref2.length;_k<_len2;_k++){removeLink=_ref2[_k];_results.push(removeLink.addEventListener("click",removeFileEvent));}
return _results;}},removedfile:function(file){var _ref;if(file.previewElement){if((_ref=file.previewElement)!=null){_ref.parentNode.removeChild(file.previewElement);}}
return this._updateMaxFilesReachedClass();},thumbnail:function(file,dataUrl){var thumbnailElement,_i,_len,_ref;if(file.previewElement){file.previewElement.classList.remove("dz-file-preview");_ref=file.previewElement.querySelectorAll("[data-dz-thumbnail]");for(_i=0,_len=_ref.length;_i<_len;_i++){thumbnailElement=_ref[_i];thumbnailElement.alt=file.name;thumbnailElement.src=dataUrl;}
return setTimeout(((function(_this){return function(){return file.previewElement.classList.add("dz-image-preview");};})(this)),1);}},error:function(file,message){var node,_i,_len,_ref,_results;if(file.previewElement){file.previewElement.classList.add("dz-error");if(typeof message!=="String"&&message.error){message=message.error;}
_ref=file.previewElement.querySelectorAll("[data-dz-errormessage]");_results=[];for(_i=0,_len=_ref.length;_i<_len;_i++){node=_ref[_i];_results.push(node.textContent=message);}
return _results;}},errormultiple:noop,processing:function(file){if(file.previewElement){file.previewElement.classList.add("dz-processing");if(file._removeLink){return file._removeLink.textContent=this.options.dictCancelUpload;}}},processingmultiple:noop,uploadprogress:function(file,progress,bytesSent){var node,_i,_len,_ref,_results;if(file.previewElement){_ref=file.previewElement.querySelectorAll("[data-dz-uploadprogress]");_results=[];for(_i=0,_len=_ref.length;_i<_len;_i++){node=_ref[_i];if(node.nodeName==='PROGRESS'){_results.push(node.value=progress);}else{_results.push(node.style.width=""+progress+"%");}}
return _results;}},totaluploadprogress:noop,sending:noop,sendingmultiple:noop,success:function(file){if(file.previewElement){return file.previewElement.classList.add("dz-success");}},successmultiple:noop,canceled:function(file){return this.emit("error",file,"Upload canceled.");},canceledmultiple:noop,complete:function(file){if(file._removeLink){file._removeLink.textContent=this.options.dictRemoveFile;}
if(file.previewElement){return file.previewElement.classList.add("dz-complete");}},completemultiple:noop,maxfilesexceeded:noop,maxfilesreached:noop,queuecomplete:noop,previewTemplate:"<div class=\"dz-preview dz-file-preview\">\n <div class=\"dz-image\"><img data-dz-thumbnail /></div>\n <div class=\"dz-details\">\n <div class=\"dz-size\"><span data-dz-size></span></div>\n <div class=\"dz-filename\"><span data-dz-name></span></div>\n </div>\n <div class=\"dz-progress\"><span class=\"dz-upload\" data-dz-uploadprogress></span></div>\n <div class=\"dz-error-message\"><span data-dz-errormessage></span></div>\n <div class=\"dz-success-mark\">\n <svg width=\"54px\" height=\"54px\" viewBox=\"0 0 54 54\" version=\"1.1\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" xmlns:sketch=\"http://www.bohemiancoding.com/sketch/ns\">\n <title>Check</title>\n <defs></defs>\n <g id=\"Page-1\" stroke=\"none\" stroke-width=\"1\" fill=\"none\" fill-rule=\"evenodd\" sketch:type=\"MSPage\">\n <path d=\"M23.5,31.8431458 L17.5852419,25.9283877 C16.0248253,24.3679711 13.4910294,24.366835 11.9289322,25.9289322 C10.3700136,27.4878508 10.3665912,30.0234455 11.9283877,31.5852419 L20.4147581,40.0716123 C20.5133999,40.1702541 20.6159315,40.2626649 20.7218615,40.3488435 C22.2835669,41.8725651 24.794234,41.8626202 26.3461564,40.3106978 L43.3106978,23.3461564 C44.8771021,21.7797521 44.8758057,19.2483887 43.3137085,17.6862915 C41.7547899,16.1273729 39.2176035,16.1255422 37.6538436,17.6893022 L23.5,31.8431458 Z M27,53 C41.3594035,53 53,41.3594035 53,27 C53,12.6405965 41.3594035,1 27,1 C12.6405965,1 1,12.6405965 1,27 C1,41.3594035 12.6405965,53 27,53 Z\" id=\"Oval-2\" stroke-opacity=\"0.198794158\" stroke=\"#747474\" fill-opacity=\"0.816519475\" fill=\"#FFFFFF\" sketch:type=\"MSShapeGroup\"></path>\n </g>\n </svg>\n </div>\n <div class=\"dz-error-mark\">\n <svg width=\"54px\" height=\"54px\" viewBox=\"0 0 54 54\" version=\"1.1\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" xmlns:sketch=\"http://www.bohemiancoding.com/sketch/ns\">\n <title>Error</title>\n <defs></defs>\n <g id=\"Page-1\" stroke=\"none\" stroke-width=\"1\" fill=\"none\" fill-rule=\"evenodd\" sketch:type=\"MSPage\">\n <g id=\"Check-+-Oval-2\" sketch:type=\"MSLayerGroup\" stroke=\"#747474\" stroke-opacity=\"0.198794158\" fill=\"#FFFFFF\" fill-opacity=\"0.816519475\">\n <path d=\"M32.6568542,29 L38.3106978,23.3461564 C39.8771021,21.7797521 39.8758057,19.2483887 38.3137085,17.6862915 C36.7547899,16.1273729 34.2176035,16.1255422 32.6538436,17.6893022 L27,23.3431458 L21.3461564,17.6893022 C19.7823965,16.1255422 17.2452101,16.1273729 15.6862915,17.6862915 C14.1241943,19.2483887 14.1228979,21.7797521 15.6893022,23.3461564 L21.3431458,29 L15.6893022,34.6538436 C14.1228979,36.2202479 14.1241943,38.7516113 15.6862915,40.3137085 C17.2452101,41.8726271 19.7823965,41.8744578 21.3461564,40.3106978 L27,34.6568542 L32.6538436,40.3106978 C34.2176035,41.8744578 36.7547899,41.8726271 38.3137085,40.3137085 C39.8758057,38.7516113 39.8771021,36.2202479 38.3106978,34.6538436 L32.6568542,29 Z M27,53 C41.3594035,53 53,41.3594035 53,27 C53,12.6405965 41.3594035,1 27,1 C12.6405965,1 1,12.6405965 1,27 C1,41.3594035 12.6405965,53 27,53 Z\" id=\"Oval-2\" sketch:type=\"MSShapeGroup\"></path>\n </g>\n </g>\n </svg>\n </div>\n</div>"};extend=function(){var key,object,objects,target,val,_i,_len;target=arguments[0],objects=2<=arguments.length?__slice.call(arguments,1):[];for(_i=0,_len=objects.length;_i<_len;_i++){object=objects[_i];for(key in object){val=object[key];target[key]=val;}}
return target;};function Dropzone(element,options){var elementOptions,fallback,_ref;this.element=element;this.version=Dropzone.version;this.defaultOptions.previewTemplate=this.defaultOptions.previewTemplate.replace(/\n*/g,"");this.clickableElements=[];this.listeners=[];this.files=[];if(typeof this.element==="string"){this.element=document.querySelector(this.element);}
if(!(this.element&&(this.element.nodeType!=null))){throw new Error("Invalid dropzone element.");}
if(this.element.dropzone){throw new Error("Dropzone already attached.");}
Dropzone.instances.push(this);this.element.dropzone=this;elementOptions=(_ref=Dropzone.optionsForElement(this.element))!=null?_ref:{};this.options=extend({},this.defaultOptions,elementOptions,options!=null?options:{});if(this.options.forceFallback||!Dropzone.isBrowserSupported()){return this.options.fallback.call(this);}
if(this.options.url==null){this.options.url=this.element.getAttribute("action");}
if(!this.options.url){throw new Error("No URL provided.");}
if(this.options.acceptedFiles&&this.options.acceptedMimeTypes){throw new Error("You can't provide both 'acceptedFiles' and 'acceptedMimeTypes'. 'acceptedMimeTypes' is deprecated.");}
if(this.options.acceptedMimeTypes){this.options.acceptedFiles=this.options.acceptedMimeTypes;delete this.options.acceptedMimeTypes;}
this.options.method=this.options.method.toUpperCase();if((fallback=this.getExistingFallback())&&fallback.parentNode){fallback.parentNode.removeChild(fallback);}
if(this.options.previewsContainer!==false){if(this.options.previewsContainer){this.previewsContainer=Dropzone.getElement(this.options.previewsContainer,"previewsContainer");}else{this.previewsContainer=this.element;}}
if(this.options.clickable){if(this.options.clickable===true){this.clickableElements=[this.element];}else{this.clickableElements=Dropzone.getElements(this.options.clickable,"clickable");}}
this.init();}
Dropzone.prototype.getAcceptedFiles=function(){var file,_i,_len,_ref,_results;_ref=this.files;_results=[];for(_i=0,_len=_ref.length;_i<_len;_i++){file=_ref[_i];if(file.accepted){_results.push(file);}}
return _results;};Dropzone.prototype.getRejectedFiles=function(){var file,_i,_len,_ref,_results;_ref=this.files;_results=[];for(_i=0,_len=_ref.length;_i<_len;_i++){file=_ref[_i];if(!file.accepted){_results.push(file);}}
return _results;};Dropzone.prototype.getFilesWithStatus=function(status){var file,_i,_len,_ref,_results;_ref=this.files;_results=[];for(_i=0,_len=_ref.length;_i<_len;_i++){file=_ref[_i];if(file.status===status){_results.push(file);}}
return _results;};Dropzone.prototype.getQueuedFiles=function(){return this.getFilesWithStatus(Dropzone.QUEUED);};Dropzone.prototype.getUploadingFiles=function(){return this.getFilesWithStatus(Dropzone.UPLOADING);};Dropzone.prototype.getActiveFiles=function(){var file,_i,_len,_ref,_results;_ref=this.files;_results=[];for(_i=0,_len=_ref.length;_i<_len;_i++){file=_ref[_i];if(file.status===Dropzone.UPLOADING||file.status===Dropzone.QUEUED){_results.push(file);}}
return _results;};Dropzone.prototype.init=function(){var eventName,noPropagation,setupHiddenFileInput,_i,_len,_ref,_ref1;if(this.element.tagName==="form"){this.element.setAttribute("enctype","multipart/form-data");}
var removeFileEvent=function removeFileEvent(e){e.preventDefault();e.stopPropagation();if(file.status===Dropzone.UPLOADING){return Dropzone.confirm(_this2.options.dictCancelUploadConfirmation,function(){return _this2.removeFile(file);});}else{if(_this2.options.dictRemoveFileConfirmation){return Dropzone.confirm(_this2.options.dictRemoveFileConfirmation,function(){return _this2.removeFile(file);});}else{return _this2.removeFile(file);}}};for(var _iterator5=file.previewElement.querySelectorAll("[data-dz-remove]"),_isArray5=true,_i5=0,_iterator5=_isArray5?_iterator5:_iterator5[Symbol.iterator]();;){var _ref4;if(_isArray5){if(_i5>=_iterator5.length)break;_ref4=_iterator5[_i5++];}else{_i5=_iterator5.next();if(_i5.done)break;_ref4=_i5.value;}
var removeLink=_ref4;removeLink.addEventListener("click",removeFileEvent);}}},removedfile:function removedfile(file){if(file.previewElement!=null&&file.previewElement.parentNode!=null){file.previewElement.parentNode.removeChild(file.previewElement);}
return this._updateMaxFilesReachedClass();},thumbnail:function thumbnail(file,dataUrl){if(file.previewElement){file.previewElement.classList.remove("dz-file-preview");for(var _iterator6=file.previewElement.querySelectorAll("[data-dz-thumbnail]"),_isArray6=true,_i6=0,_iterator6=_isArray6?_iterator6:_iterator6[Symbol.iterator]();;){var _ref5;if(_isArray6){if(_i6>=_iterator6.length)break;_ref5=_iterator6[_i6++];}else{_i6=_iterator6.next();if(_i6.done)break;_ref5=_i6.value;}
var thumbnailElement=_ref5;thumbnailElement.alt=file.name;thumbnailElement.src=dataUrl;}
return setTimeout(function(){return file.previewElement.classList.add("dz-image-preview");},1);}},error:function error(file,message){if(file.previewElement){file.previewElement.classList.add("dz-error");if(typeof message!=="String"&&message.error){message=message.error;}
for(var _iterator7=file.previewElement.querySelectorAll("[data-dz-errormessage]"),_isArray7=true,_i7=0,_iterator7=_isArray7?_iterator7:_iterator7[Symbol.iterator]();;){var _ref6;if(_isArray7){if(_i7>=_iterator7.length)break;_ref6=_iterator7[_i7++];}else{_i7=_iterator7.next();if(_i7.done)break;_ref6=_i7.value;}
var node=_ref6;node.textContent=message;}}},errormultiple:function errormultiple(){},processing:function processing(file){if(file.previewElement){file.previewElement.classList.add("dz-processing");if(file._removeLink){return file._removeLink.innerHTML=this.options.dictCancelUpload;}}},processingmultiple:function processingmultiple(){},uploadprogress:function uploadprogress(file,progress,bytesSent){if(file.previewElement){for(var _iterator8=file.previewElement.querySelectorAll("[data-dz-uploadprogress]"),_isArray8=true,_i8=0,_iterator8=_isArray8?_iterator8:_iterator8[Symbol.iterator]();;){var _ref7;if(_isArray8){if(_i8>=_iterator8.length)break;_ref7=_iterator8[_i8++];}else{_i8=_iterator8.next();if(_i8.done)break;_ref7=_i8.value;}
var node=_ref7;node.nodeName==='PROGRESS'?node.value=progress:node.style.width=progress+"%";}}},totaluploadprogress:function totaluploadprogress(){},sending:function sending(){},sendingmultiple:function sendingmultiple(){},success:function success(file){if(file.previewElement){return file.previewElement.classList.add("dz-success");}},successmultiple:function successmultiple(){},canceled:function canceled(file){return this.emit("error",file,this.options.dictUploadCanceled);},canceledmultiple:function canceledmultiple(){},complete:function complete(file){if(file._removeLink){file._removeLink.innerHTML=this.options.dictRemoveFile;}
if(file.previewElement){return file.previewElement.classList.add("dz-complete");}},completemultiple:function completemultiple(){},maxfilesexceeded:function maxfilesexceeded(){},maxfilesreached:function maxfilesreached(){},queuecomplete:function queuecomplete(){},addedfiles:function addedfiles(){}};this.prototype._thumbnailQueue=[];this.prototype._processingThumbnail=false;}},{key:"extend",value:function extend(target){for(var _len2=arguments.length,objects=Array(_len2>1?_len2-1:0),_key2=1;_key2<_len2;_key2++){objects[_key2-1]=arguments[_key2];}
for(var _iterator9=objects,_isArray9=true,_i9=0,_iterator9=_isArray9?_iterator9:_iterator9[Symbol.iterator]();;){var _ref8;if(_isArray9){if(_i9>=_iterator9.length)break;_ref8=_iterator9[_i9++];}else{_i9=_iterator9.next();if(_i9.done)break;_ref8=_i9.value;}
var object=_ref8;for(var key in object){var val=object[key];target[key]=val;}}
return target;}}]);function Dropzone(el,options){_classCallCheck(this,Dropzone);var _this=_possibleConstructorReturn(this,(Dropzone.__proto__||Object.getPrototypeOf(Dropzone)).call(this));var fallback=void 0,left=void 0;_this.element=el;_this.version=Dropzone.version;_this.defaultOptions.previewTemplate=_this.defaultOptions.previewTemplate.replace(/\n*/g,"");_this.clickableElements=[];_this.listeners=[];_this.files=[];if(typeof _this.element==="string"){_this.element=document.querySelector(_this.element);}
if(!_this.element||_this.element.nodeType==null){throw new Error("Invalid dropzone element.");}
if(_this.element.dropzone){throw new Error("Dropzone already attached.");}
Dropzone.instances.push(_this);_this.element.dropzone=_this;var elementOptions=(left=Dropzone.optionsForElement(_this.element))!=null?left:{};_this.options=Dropzone.extend({},_this.defaultOptions,elementOptions,options!=null?options:{});if(_this.options.forceFallback||!Dropzone.isBrowserSupported()){var _ret;return _ret=_this.options.fallback.call(_this),_possibleConstructorReturn(_this,_ret);}
if(_this.options.url==null){_this.options.url=_this.element.getAttribute("action");}
if(!_this.options.url){throw new Error("No URL provided.");}
if(_this.options.acceptedFiles&&_this.options.acceptedMimeTypes){throw new Error("You can't provide both 'acceptedFiles' and 'acceptedMimeTypes'. 'acceptedMimeTypes' is deprecated.");}
if(_this.options.uploadMultiple&&_this.options.chunking){throw new Error('You cannot set both: uploadMultiple and chunking.');}
if(_this.options.acceptedMimeTypes){_this.options.acceptedFiles=_this.options.acceptedMimeTypes;delete _this.options.acceptedMimeTypes;}
if(_this.options.renameFilename!=null){_this.options.renameFile=function(file){return _this.options.renameFilename.call(_this,file.name,file);};}
_this.options.method=_this.options.method.toUpperCase();if((fallback=_this.getExistingFallback())&&fallback.parentNode){fallback.parentNode.removeChild(fallback);}
if(_this.options.previewsContainer!==false){if(_this.options.previewsContainer){_this.previewsContainer=Dropzone.getElement(_this.options.previewsContainer,"previewsContainer");}else{_this.previewsContainer=_this.element;}}
if(_this.options.clickable){if(_this.options.clickable===true){_this.clickableElements=[_this.element];}else{_this.clickableElements=Dropzone.getElements(_this.options.clickable,"clickable");}}
_this.init();return _this;}
_createClass(Dropzone,[{key:"getAcceptedFiles",value:function getAcceptedFiles(){return this.files.filter(function(file){return file.accepted;}).map(function(file){return file;});}},{key:"getRejectedFiles",value:function getRejectedFiles(){return this.files.filter(function(file){return!file.accepted;}).map(function(file){return file;});}},{key:"getFilesWithStatus",value:function getFilesWithStatus(status){return this.files.filter(function(file){return file.status===status;}).map(function(file){return file;});}},{key:"getQueuedFiles",value:function getQueuedFiles(){return this.getFilesWithStatus(Dropzone.QUEUED);}},{key:"getUploadingFiles",value:function getUploadingFiles(){return this.getFilesWithStatus(Dropzone.UPLOADING);}},{key:"getAddedFiles",value:function getAddedFiles(){return this.getFilesWithStatus(Dropzone.ADDED);}},{key:"getActiveFiles",value:function getActiveFiles(){return this.files.filter(function(file){return file.status===Dropzone.UPLOADING||file.status===Dropzone.QUEUED;}).map(function(file){return file;});}},{key:"init",value:function init(){var _this3=this;if(this.element.tagName==="form"){this.element.setAttribute("enctype","multipart/form-data");}
if(this.element.classList.contains("dropzone")&&!this.element.querySelector(".dz-message")){this.element.appendChild(Dropzone.createElement("<div class=\"dz-default dz-message\"><span>"+this.options.dictDefaultMessage+"</span></div>"));}
if(this.clickableElements.length){setupHiddenFileInput=(function(_this){return function(){if(_this.hiddenFileInput){document.body.removeChild(_this.hiddenFileInput);}
_this.hiddenFileInput=document.createElement("input");_this.hiddenFileInput.setAttribute("type","file");if((_this.options.maxFiles==null)||_this.options.maxFiles>1){_this.hiddenFileInput.setAttribute("multiple","multiple");}
_this.hiddenFileInput.className="dz-hidden-input";if(_this.options.acceptedFiles!=null){_this.hiddenFileInput.setAttribute("accept",_this.options.acceptedFiles);}
if(_this.options.capture!=null){_this.hiddenFileInput.setAttribute("capture",_this.options.capture);}
_this.hiddenFileInput.style.visibility="hidden";_this.hiddenFileInput.style.position="absolute";_this.hiddenFileInput.style.top="0";_this.hiddenFileInput.style.left="0";_this.hiddenFileInput.style.height="0";_this.hiddenFileInput.style.width="0";document.body.appendChild(_this.hiddenFileInput);return _this.hiddenFileInput.addEventListener("change",function(){var file,files,_i,_len;files=_this.hiddenFileInput.files;if(files.length){for(_i=0,_len=files.length;_i<_len;_i++){file=files[_i];_this.addFile(file);}}
return setupHiddenFileInput();});};})(this);setupHiddenFileInput();}
this.URL=(_ref=window.URL)!=null?_ref:window.webkitURL;_ref1=this.events;for(_i=0,_len=_ref1.length;_i<_len;_i++){eventName=_ref1[_i];this.on(eventName,this.options[eventName]);}
this.on("uploadprogress",(function(_this){return function(){return _this.updateTotalUploadProgress();};})(this));this.on("removedfile",(function(_this){return function(){return _this.updateTotalUploadProgress();};})(this));this.on("canceled",(function(_this){return function(file){return _this.emit("complete",file);};})(this));this.on("complete",(function(_this){return function(file){if(_this.getUploadingFiles().length===0&&_this.getQueuedFiles().length===0){return setTimeout((function(){return _this.emit("queuecomplete");}),0);}};})(this));noPropagation=function(e){e.stopPropagation();if(e.preventDefault){return e.preventDefault();}else{return e.returnValue=false;}};this.listeners=[{element:this.element,events:{"dragstart":(function(_this){return function(e){return _this.emit("dragstart",e);};})(this),"dragenter":(function(_this){return function(e){noPropagation(e);return _this.emit("dragenter",e);};})(this),"dragover":(function(_this){return function(e){var efct;try{efct=e.dataTransfer.effectAllowed;}catch(_error){}
e.dataTransfer.dropEffect='move'===efct||'linkMove'===efct?'move':'copy';noPropagation(e);return _this.emit("dragover",e);};})(this),"dragleave":(function(_this){return function(e){return _this.emit("dragleave",e);};})(this),"drop":(function(_this){return function(e){noPropagation(e);return _this.drop(e);};})(this),"dragend":(function(_this){return function(e){return _this.emit("dragend",e);};})(this)}}];this.clickableElements.forEach((function(_this){return function(clickableElement){return _this.listeners.push({element:clickableElement,events:{"click":function(evt){if((clickableElement!==_this.element)||(evt.target===_this.element||Dropzone.elementInside(evt.target,_this.element.querySelector(".dz-message")))){return _this.hiddenFileInput.click();}}}});};})(this));this.enable();return this.options.init.call(this);};Dropzone.prototype.destroy=function(){var _ref;this.disable();this.removeAllFiles(true);if((_ref=this.hiddenFileInput)!=null?_ref.parentNode:void 0){this.hiddenFileInput.parentNode.removeChild(this.hiddenFileInput);this.hiddenFileInput=null;}
delete this.element.dropzone;return Dropzone.instances.splice(Dropzone.instances.indexOf(this),1);};Dropzone.prototype.updateTotalUploadProgress=function(){var activeFiles,file,totalBytes,totalBytesSent,totalUploadProgress,_i,_len,_ref;totalBytesSent=0;totalBytes=0;activeFiles=this.getActiveFiles();if(activeFiles.length){_ref=this.getActiveFiles();for(_i=0,_len=_ref.length;_i<_len;_i++){file=_ref[_i];totalBytesSent+=file.upload.bytesSent;totalBytes+=file.upload.total;}
if(this.clickableElements.length){var setupHiddenFileInput=function setupHiddenFileInput(){if(_this3.hiddenFileInput){_this3.hiddenFileInput.parentNode.removeChild(_this3.hiddenFileInput);}
_this3.hiddenFileInput=document.createElement("input");_this3.hiddenFileInput.setAttribute("type","file");if(_this3.options.maxFiles===null||_this3.options.maxFiles>1){_this3.hiddenFileInput.setAttribute("multiple","multiple");}
_this3.hiddenFileInput.className="dz-hidden-input";if(_this3.options.acceptedFiles!==null){_this3.hiddenFileInput.setAttribute("accept",_this3.options.acceptedFiles);}
if(_this3.options.capture!==null){_this3.hiddenFileInput.setAttribute("capture",_this3.options.capture);}
_this3.hiddenFileInput.style.visibility="hidden";_this3.hiddenFileInput.style.position="absolute";_this3.hiddenFileInput.style.top="0";_this3.hiddenFileInput.style.left="0";_this3.hiddenFileInput.style.height="0";_this3.hiddenFileInput.style.width="0";Dropzone.getElement(_this3.options.hiddenInputContainer,'hiddenInputContainer').appendChild(_this3.hiddenFileInput);return _this3.hiddenFileInput.addEventListener("change",function(){var files=_this3.hiddenFileInput.files;if(files.length){for(var _iterator10=files,_isArray10=true,_i10=0,_iterator10=_isArray10?_iterator10:_iterator10[Symbol.iterator]();;){var _ref9;if(_isArray10){if(_i10>=_iterator10.length)break;_ref9=_iterator10[_i10++];}else{_i10=_iterator10.next();if(_i10.done)break;_ref9=_i10.value;}
var file=_ref9;_this3.addFile(file);}}
_this3.emit("addedfiles",files);return setupHiddenFileInput();});};setupHiddenFileInput();}
this.URL=window.URL!==null?window.URL:window.webkitURL;for(var _iterator11=this.events,_isArray11=true,_i11=0,_iterator11=_isArray11?_iterator11:_iterator11[Symbol.iterator]();;){var _ref10;if(_isArray11){if(_i11>=_iterator11.length)break;_ref10=_iterator11[_i11++];}else{_i11=_iterator11.next();if(_i11.done)break;_ref10=_i11.value;}
var eventName=_ref10;this.on(eventName,this.options[eventName]);}
this.on("uploadprogress",function(){return _this3.updateTotalUploadProgress();});this.on("removedfile",function(){return _this3.updateTotalUploadProgress();});this.on("canceled",function(file){return _this3.emit("complete",file);});this.on("complete",function(file){if(_this3.getAddedFiles().length===0&&_this3.getUploadingFiles().length===0&&_this3.getQueuedFiles().length===0){return setTimeout(function(){return _this3.emit("queuecomplete");},0);}});var noPropagation=function noPropagation(e){e.stopPropagation();if(e.preventDefault){return e.preventDefault();}else{return e.returnValue=false;}};this.listeners=[{element:this.element,events:{"dragstart":function dragstart(e){return _this3.emit("dragstart",e);},"dragenter":function dragenter(e){noPropagation(e);return _this3.emit("dragenter",e);},"dragover":function dragover(e){var efct=void 0;try{efct=e.dataTransfer.effectAllowed;}catch(error){}
e.dataTransfer.dropEffect='move'===efct||'linkMove'===efct?'move':'copy';noPropagation(e);return _this3.emit("dragover",e);},"dragleave":function dragleave(e){return _this3.emit("dragleave",e);},"drop":function drop(e){noPropagation(e);return _this3.drop(e);},"dragend":function dragend(e){return _this3.emit("dragend",e);}}}];this.clickableElements.forEach(function(clickableElement){return _this3.listeners.push({element:clickableElement,events:{"click":function click(evt){if(clickableElement!==_this3.element||evt.target===_this3.element||Dropzone.elementInside(evt.target,_this3.element.querySelector(".dz-message"))){_this3.hiddenFileInput.click();}
return true;}}});});this.enable();return this.options.init.call(this);}},{key:"destroy",value:function destroy(){this.disable();this.removeAllFiles(true);if(this.hiddenFileInput!=null?this.hiddenFileInput.parentNode:undefined){this.hiddenFileInput.parentNode.removeChild(this.hiddenFileInput);this.hiddenFileInput=null;}
delete this.element.dropzone;return Dropzone.instances.splice(Dropzone.instances.indexOf(this),1);}},{key:"updateTotalUploadProgress",value:function updateTotalUploadProgress(){var totalUploadProgress=void 0;var totalBytesSent=0;var totalBytes=0;var activeFiles=this.getActiveFiles();if(activeFiles.length){for(var _iterator12=this.getActiveFiles(),_isArray12=true,_i12=0,_iterator12=_isArray12?_iterator12:_iterator12[Symbol.iterator]();;){var _ref11;if(_isArray12){if(_i12>=_iterator12.length)break;_ref11=_iterator12[_i12++];}else{_i12=_iterator12.next();if(_i12.done)break;_ref11=_i12.value;}
var file=_ref11;totalBytesSent+=file.upload.bytesSent;totalBytes+=file.upload.total;}
totalUploadProgress=100*totalBytesSent/totalBytes;}else{totalUploadProgress=100;}
return this.emit("totaluploadprogress",totalUploadProgress,totalBytes,totalBytesSent);};Dropzone.prototype._getParamName=function(n){if(typeof this.options.paramName==="function"){return this.options.paramName(n);}else{return""+this.options.paramName+(this.options.uploadMultiple?"["+n+"]":"");}};Dropzone.prototype.getFallbackForm=function(){var existingFallback,fields,fieldsString,form;if(existingFallback=this.getExistingFallback()){return existingFallback;}
fieldsString="<div class=\"dz-fallback\">";if(this.options.dictFallbackText){fieldsString+="<p>"+this.options.dictFallbackText+"</p>";}
fieldsString+="<input type=\"file\" name=\""+(this._getParamName(0))+"\" "+(this.options.uploadMultiple?'multiple="multiple"':void 0)+" /><input type=\"submit\" value=\"Upload!\"></div>";fields=Dropzone.createElement(fieldsString);if(this.element.tagName!=="FORM"){form=Dropzone.createElement("<form action=\""+this.options.url+"\" enctype=\"multipart/form-data\" method=\""+this.options.method+"\"></form>");form.appendChild(fields);}else{this.element.setAttribute("enctype","multipart/form-data");this.element.setAttribute("method",this.options.method);}
return form!=null?form:fields;};Dropzone.prototype.getExistingFallback=function(){var fallback,getFallback,tagName,_i,_len,_ref;getFallback=function(elements){var el,_i,_len;for(_i=0,_len=elements.length;_i<_len;_i++){el=elements[_i];if(/(^| )fallback($| )/.test(el.className)){return el;}}};_ref=["div","form"];for(_i=0,_len=_ref.length;_i<_len;_i++){tagName=_ref[_i];if(fallback=getFallback(this.element.getElementsByTagName(tagName))){return fallback;}}};Dropzone.prototype.setupEventListeners=function(){var elementListeners,event,listener,_i,_len,_ref,_results;_ref=this.listeners;_results=[];for(_i=0,_len=_ref.length;_i<_len;_i++){elementListeners=_ref[_i];_results.push((function(){var _ref1,_results1;_ref1=elementListeners.events;_results1=[];for(event in _ref1){listener=_ref1[event];_results1.push(elementListeners.element.addEventListener(event,listener,false));}
return _results1;})());}
return _results;};Dropzone.prototype.removeEventListeners=function(){var elementListeners,event,listener,_i,_len,_ref,_results;_ref=this.listeners;_results=[];for(_i=0,_len=_ref.length;_i<_len;_i++){elementListeners=_ref[_i];_results.push((function(){var _ref1,_results1;_ref1=elementListeners.events;_results1=[];for(event in _ref1){listener=_ref1[event];_results1.push(elementListeners.element.removeEventListener(event,listener,false));}
return _results1;})());}
return _results;};Dropzone.prototype.disable=function(){var file,_i,_len,_ref,_results;this.clickableElements.forEach(function(element){return element.classList.remove("dz-clickable");});this.removeEventListeners();_ref=this.files;_results=[];for(_i=0,_len=_ref.length;_i<_len;_i++){file=_ref[_i];_results.push(this.cancelUpload(file));}
return _results;};Dropzone.prototype.enable=function(){this.clickableElements.forEach(function(element){return element.classList.add("dz-clickable");});return this.setupEventListeners();};Dropzone.prototype.filesize=function(size){var cutoff,i,selectedSize,selectedUnit,unit,units,_i,_len;units=['TB','GB','MB','KB','b'];selectedSize=selectedUnit=null;for(i=_i=0,_len=units.length;_i<_len;i=++_i){unit=units[i];cutoff=Math.pow(this.options.filesizeBase,4-i)/10;if(size>=cutoff){selectedSize=size/Math.pow(this.options.filesizeBase,4-i);selectedUnit=unit;break;}}
selectedSize=Math.round(10*selectedSize)/10;return"<strong>"+selectedSize+"</strong> "+selectedUnit;};Dropzone.prototype._updateMaxFilesReachedClass=function(){if((this.options.maxFiles!=null)&&this.getAcceptedFiles().length>=this.options.maxFiles){if(this.getAcceptedFiles().length===this.options.maxFiles){this.emit('maxfilesreached',this.files);}
return this.element.classList.add("dz-max-files-reached");}else{return this.element.classList.remove("dz-max-files-reached");}};Dropzone.prototype.drop=function(e){var files,items;if(!e.dataTransfer){return;}
this.emit("drop",e);files=e.dataTransfer.files;if(files.length){items=e.dataTransfer.items;if(items&&items.length&&(items[0].webkitGetAsEntry!=null)){this._addFilesFromItems(items);}else{this.handleFiles(files);}}};Dropzone.prototype.paste=function(e){var items,_ref;if((e!=null?(_ref=e.clipboardData)!=null?_ref.items:void 0:void 0)==null){return;}
this.emit("paste",e);items=e.clipboardData.items;if(items.length){return this._addFilesFromItems(items);}};Dropzone.prototype.handleFiles=function(files){var file,_i,_len,_results;_results=[];for(_i=0,_len=files.length;_i<_len;_i++){file=files[_i];_results.push(this.addFile(file));}
return _results;};Dropzone.prototype._addFilesFromItems=function(items){var entry,item,_i,_len,_results;_results=[];for(_i=0,_len=items.length;_i<_len;_i++){item=items[_i];if((item.webkitGetAsEntry!=null)&&(entry=item.webkitGetAsEntry())){if(entry.isFile){_results.push(this.addFile(item.getAsFile()));}else if(entry.isDirectory){_results.push(this._addFilesFromDirectory(entry,entry.name));}else{_results.push(void 0);}}else if(item.getAsFile!=null){if((item.kind==null)||item.kind==="file"){_results.push(this.addFile(item.getAsFile()));}else{_results.push(void 0);}}else{_results.push(void 0);}}
return _results;};Dropzone.prototype._addFilesFromDirectory=function(directory,path){var dirReader,entriesReader;dirReader=directory.createReader();entriesReader=(function(_this){return function(entries){var entry,_i,_len;for(_i=0,_len=entries.length;_i<_len;_i++){entry=entries[_i];if(entry.isFile){entry.file(function(file){if(_this.options.ignoreHiddenFiles&&file.name.substring(0,1)==='.'){return;}
file.fullPath=""+path+"/"+file.name;return _this.addFile(file);});}else if(entry.isDirectory){_this._addFilesFromDirectory(entry,""+path+"/"+entry.name);}}};})(this);return dirReader.readEntries(entriesReader,function(error){return typeof console!=="undefined"&&console!==null?typeof console.log==="function"?console.log(error):void 0:void 0;});};Dropzone.prototype.accept=function(file,done){if(file.size>this.options.maxFilesize*1024*1024){return done(this.options.dictFileTooBig.replace("{{filesize}}",Math.round(file.size/1024/10.24)/100).replace("{{maxFilesize}}",this.options.maxFilesize));}else if(!Dropzone.isValidFile(file,this.options.acceptedFiles)){return done(this.options.dictInvalidFileType);}else if((this.options.maxFiles!=null)&&this.getAcceptedFiles().length>=this.options.maxFiles){done(this.options.dictMaxFilesExceeded.replace("{{maxFiles}}",this.options.maxFiles));return this.emit("maxfilesexceeded",file);}else{return this.options.accept.call(this,file,done);}};Dropzone.prototype.addFile=function(file){file.upload={progress:0,total:file.size,bytesSent:0};this.files.push(file);file.status=Dropzone.ADDED;this.emit("addedfile",file);this._enqueueThumbnail(file);return this.accept(file,(function(_this){return function(error){if(error){file.accepted=false;_this._errorProcessing([file],error);}else{file.accepted=true;if(_this.options.autoQueue){_this.enqueueFile(file);}}
return _this._updateMaxFilesReachedClass();};})(this));};Dropzone.prototype.enqueueFiles=function(files){var file,_i,_len;for(_i=0,_len=files.length;_i<_len;_i++){file=files[_i];this.enqueueFile(file);}
return null;};Dropzone.prototype.enqueueFile=function(file){if(file.status===Dropzone.ADDED&&file.accepted===true){file.status=Dropzone.QUEUED;if(this.options.autoProcessQueue){return setTimeout(((function(_this){return function(){return _this.processQueue();};})(this)),0);}}else{throw new Error("This file can't be queued because it has already been processed or was rejected.");}};Dropzone.prototype._thumbnailQueue=[];Dropzone.prototype._processingThumbnail=false;Dropzone.prototype._enqueueThumbnail=function(file){if(this.options.createImageThumbnails&&file.type.match(/image.*/)&&file.size<=this.options.maxThumbnailFilesize*1024*1024){this._thumbnailQueue.push(file);return setTimeout(((function(_this){return function(){return _this._processThumbnailQueue();};})(this)),0);}};Dropzone.prototype._processThumbnailQueue=function(){if(this._processingThumbnail||this._thumbnailQueue.length===0){return;}
this._processingThumbnail=true;return this.createThumbnail(this._thumbnailQueue.shift(),(function(_this){return function(){_this._processingThumbnail=false;return _this._processThumbnailQueue();};})(this));};Dropzone.prototype.removeFile=function(file){if(file.status===Dropzone.UPLOADING){this.cancelUpload(file);}
this.files=without(this.files,file);this.emit("removedfile",file);if(this.files.length===0){return this.emit("reset");}};Dropzone.prototype.removeAllFiles=function(cancelIfNecessary){var file,_i,_len,_ref;if(cancelIfNecessary==null){cancelIfNecessary=false;}
_ref=this.files.slice();for(_i=0,_len=_ref.length;_i<_len;_i++){file=_ref[_i];if(file.status!==Dropzone.UPLOADING||cancelIfNecessary){this.removeFile(file);}}
return null;};Dropzone.prototype.createThumbnail=function(file,callback){var fileReader;fileReader=new FileReader;fileReader.onload=(function(_this){return function(){if(file.type==="image/svg+xml"){_this.emit("thumbnail",file,fileReader.result);if(callback!=null){callback();}
return this.emit("totaluploadprogress",totalUploadProgress,totalBytes,totalBytesSent);}},{key:"_getParamName",value:function _getParamName(n){if(typeof this.options.paramName==="function"){return this.options.paramName(n);}else{return""+this.options.paramName+(this.options.uploadMultiple?"["+n+"]":"");}}},{key:"_renameFile",value:function _renameFile(file){if(typeof this.options.renameFile!=="function"){return file.name;}
return this.options.renameFile(file);}},{key:"getFallbackForm",value:function getFallbackForm(){var existingFallback=void 0,form=void 0;if(existingFallback=this.getExistingFallback()){return existingFallback;}
var fieldsString="<div class=\"dz-fallback\">";if(this.options.dictFallbackText){fieldsString+="<p>"+this.options.dictFallbackText+"</p>";}
fieldsString+="<input type=\"file\" name=\""+this._getParamName(0)+"\" "+(this.options.uploadMultiple?'multiple="multiple"':undefined)+" /><input type=\"submit\" value=\"Upload!\"></div>";var fields=Dropzone.createElement(fieldsString);if(this.element.tagName!=="FORM"){form=Dropzone.createElement("<form action=\""+this.options.url+"\" enctype=\"multipart/form-data\" method=\""+this.options.method+"\"></form>");form.appendChild(fields);}else{this.element.setAttribute("enctype","multipart/form-data");this.element.setAttribute("method",this.options.method);}
return form!=null?form:fields;}},{key:"getExistingFallback",value:function getExistingFallback(){var getFallback=function getFallback(elements){for(var _iterator13=elements,_isArray13=true,_i13=0,_iterator13=_isArray13?_iterator13:_iterator13[Symbol.iterator]();;){var _ref12;if(_isArray13){if(_i13>=_iterator13.length)break;_ref12=_iterator13[_i13++];}else{_i13=_iterator13.next();if(_i13.done)break;_ref12=_i13.value;}
var el=_ref12;if(/(^| )fallback($| )/.test(el.className)){return el;}}};var _arr=["div","form"];for(var _i14=0;_i14<_arr.length;_i14++){var tagName=_arr[_i14];var fallback;if(fallback=getFallback(this.element.getElementsByTagName(tagName))){return fallback;}}}},{key:"setupEventListeners",value:function setupEventListeners(){return this.listeners.map(function(elementListeners){return function(){var result=[];for(var event in elementListeners.events){var listener=elementListeners.events[event];result.push(elementListeners.element.addEventListener(event,listener,false));}
return result;}();});}},{key:"removeEventListeners",value:function removeEventListeners(){return this.listeners.map(function(elementListeners){return function(){var result=[];for(var event in elementListeners.events){var listener=elementListeners.events[event];result.push(elementListeners.element.removeEventListener(event,listener,false));}
return result;}();});}},{key:"disable",value:function disable(){var _this4=this;this.clickableElements.forEach(function(element){return element.classList.remove("dz-clickable");});this.removeEventListeners();this.disabled=true;return this.files.map(function(file){return _this4.cancelUpload(file);});}},{key:"enable",value:function enable(){delete this.disabled;this.clickableElements.forEach(function(element){return element.classList.add("dz-clickable");});return this.setupEventListeners();}},{key:"filesize",value:function filesize(size){var selectedSize=0;var selectedUnit="b";if(size>0){var units=['tb','gb','mb','kb','b'];for(var i=0;i<units.length;i++){var unit=units[i];var cutoff=Math.pow(this.options.filesizeBase,4-i)/10;if(size>=cutoff){selectedSize=size/Math.pow(this.options.filesizeBase,4-i);selectedUnit=unit;break;}}
selectedSize=Math.round(10*selectedSize)/10;}
return"<strong>"+selectedSize+"</strong> "+this.options.dictFileSizeUnits[selectedUnit];}},{key:"_updateMaxFilesReachedClass",value:function _updateMaxFilesReachedClass(){if(this.options.maxFiles!=null&&this.getAcceptedFiles().length>=this.options.maxFiles){if(this.getAcceptedFiles().length===this.options.maxFiles){this.emit('maxfilesreached',this.files);}
return this.element.classList.add("dz-max-files-reached");}else{return this.element.classList.remove("dz-max-files-reached");}}},{key:"drop",value:function drop(e){if(!e.dataTransfer){return;}
this.emit("drop",e);var files=[];for(var i=0;i<e.dataTransfer.files.length;i++){files[i]=e.dataTransfer.files[i];}
this.emit("addedfiles",files);if(files.length){var items=e.dataTransfer.items;if(items&&items.length&&items[0].webkitGetAsEntry!=null){this._addFilesFromItems(items);}else{this.handleFiles(files);}}}},{key:"paste",value:function paste(e){if(__guard__(e!=null?e.clipboardData:undefined,function(x){return x.items;})==null){return;}
this.emit("paste",e);var items=e.clipboardData.items;if(items.length){return this._addFilesFromItems(items);}}},{key:"handleFiles",value:function handleFiles(files){for(var _iterator14=files,_isArray14=true,_i15=0,_iterator14=_isArray14?_iterator14:_iterator14[Symbol.iterator]();;){var _ref13;if(_isArray14){if(_i15>=_iterator14.length)break;_ref13=_iterator14[_i15++];}else{_i15=_iterator14.next();if(_i15.done)break;_ref13=_i15.value;}
var file=_ref13;this.addFile(file);}}},{key:"_addFilesFromItems",value:function _addFilesFromItems(items){var _this5=this;return function(){var result=[];for(var _iterator15=items,_isArray15=true,_i16=0,_iterator15=_isArray15?_iterator15:_iterator15[Symbol.iterator]();;){var _ref14;if(_isArray15){if(_i16>=_iterator15.length)break;_ref14=_iterator15[_i16++];}else{_i16=_iterator15.next();if(_i16.done)break;_ref14=_i16.value;}
var item=_ref14;var entry;if(item.webkitGetAsEntry!=null&&(entry=item.webkitGetAsEntry())){if(entry.isFile){result.push(_this5.addFile(item.getAsFile()));}else if(entry.isDirectory){result.push(_this5._addFilesFromDirectory(entry,entry.name));}else{result.push(undefined);}}else if(item.getAsFile!=null){if(item.kind==null||item.kind==="file"){result.push(_this5.addFile(item.getAsFile()));}else{result.push(undefined);}}else{result.push(undefined);}}
return result;}();}},{key:"_addFilesFromDirectory",value:function _addFilesFromDirectory(directory,path){var _this6=this;var dirReader=directory.createReader();var errorHandler=function errorHandler(error){return __guardMethod__(console,'log',function(o){return o.log(error);});};var readEntries=function readEntries(){return dirReader.readEntries(function(entries){if(entries.length>0){for(var _iterator16=entries,_isArray16=true,_i17=0,_iterator16=_isArray16?_iterator16:_iterator16[Symbol.iterator]();;){var _ref15;if(_isArray16){if(_i17>=_iterator16.length)break;_ref15=_iterator16[_i17++];}else{_i17=_iterator16.next();if(_i17.done)break;_ref15=_i17.value;}
var entry=_ref15;if(entry.isFile){entry.file(function(file){if(_this6.options.ignoreHiddenFiles&&file.name.substring(0,1)==='.'){return;}
file.fullPath=path+"/"+file.name;return _this6.addFile(file);});}else if(entry.isDirectory){_this6._addFilesFromDirectory(entry,path+"/"+entry.name);}}
readEntries();}
return null;},errorHandler);};return readEntries();}},{key:"accept",value:function accept(file,done){if(this.options.maxFilesize&&file.size>this.options.maxFilesize*1024*1024){return done(this.options.dictFileTooBig.replace("{{filesize}}",Math.round(file.size/1024/10.24)/100).replace("{{maxFilesize}}",this.options.maxFilesize));}else if(!Dropzone.isValidFile(file,this.options.acceptedFiles)){return done(this.options.dictInvalidFileType);}else if(this.options.maxFiles!=null&&this.getAcceptedFiles().length>=this.options.maxFiles){done(this.options.dictMaxFilesExceeded.replace("{{maxFiles}}",this.options.maxFiles));return this.emit("maxfilesexceeded",file);}else{return this.options.accept.call(this,file,done);}}},{key:"addFile",value:function addFile(file){var _this7=this;file.upload={uuid:Dropzone.uuidv4(),progress:0,total:file.size,bytesSent:0,filename:this._renameFile(file),chunked:this.options.chunking&&(this.options.forceChunking||file.size>this.options.chunkSize),totalChunkCount:Math.ceil(file.size/this.options.chunkSize)};this.files.push(file);file.status=Dropzone.ADDED;this.emit("addedfile",file);this._enqueueThumbnail(file);return this.accept(file,function(error){if(error){file.accepted=false;_this7._errorProcessing([file],error);}else{file.accepted=true;if(_this7.options.autoQueue){_this7.enqueueFile(file);}}
return _this7._updateMaxFilesReachedClass();});}},{key:"enqueueFiles",value:function enqueueFiles(files){for(var _iterator17=files,_isArray17=true,_i18=0,_iterator17=_isArray17?_iterator17:_iterator17[Symbol.iterator]();;){var _ref16;if(_isArray17){if(_i18>=_iterator17.length)break;_ref16=_iterator17[_i18++];}else{_i18=_iterator17.next();if(_i18.done)break;_ref16=_i18.value;}
var file=_ref16;this.enqueueFile(file);}
return null;}},{key:"enqueueFile",value:function enqueueFile(file){var _this8=this;if(file.status===Dropzone.ADDED&&file.accepted===true){file.status=Dropzone.QUEUED;if(this.options.autoProcessQueue){return setTimeout(function(){return _this8.processQueue();},0);}}else{throw new Error("This file can't be queued because it has already been processed or was rejected.");}}},{key:"_enqueueThumbnail",value:function _enqueueThumbnail(file){var _this9=this;if(this.options.createImageThumbnails&&file.type.match(/image.*/)&&file.size<=this.options.maxThumbnailFilesize*1024*1024){this._thumbnailQueue.push(file);return setTimeout(function(){return _this9._processThumbnailQueue();},0);}}},{key:"_processThumbnailQueue",value:function _processThumbnailQueue(){var _this10=this;if(this._processingThumbnail||this._thumbnailQueue.length===0){return;}
this._processingThumbnail=true;var file=this._thumbnailQueue.shift();return this.createThumbnail(file,this.options.thumbnailWidth,this.options.thumbnailHeight,this.options.thumbnailMethod,true,function(dataUrl){_this10.emit("thumbnail",file,dataUrl);_this10._processingThumbnail=false;return _this10._processThumbnailQueue();});}},{key:"removeFile",value:function removeFile(file){if(file.status===Dropzone.UPLOADING){this.cancelUpload(file);}
this.files=without(this.files,file);this.emit("removedfile",file);if(this.files.length===0){return this.emit("reset");}}},{key:"removeAllFiles",value:function removeAllFiles(cancelIfNecessary){if(cancelIfNecessary==null){cancelIfNecessary=false;}
for(var _iterator18=this.files.slice(),_isArray18=true,_i19=0,_iterator18=_isArray18?_iterator18:_iterator18[Symbol.iterator]();;){var _ref17;if(_isArray18){if(_i19>=_iterator18.length)break;_ref17=_iterator18[_i19++];}else{_i19=_iterator18.next();if(_i19.done)break;_ref17=_i19.value;}
var file=_ref17;if(file.status!==Dropzone.UPLOADING||cancelIfNecessary){this.removeFile(file);}}
return null;}},{key:"resizeImage",value:function resizeImage(file,width,height,resizeMethod,callback){var _this11=this;return this.createThumbnail(file,width,height,resizeMethod,true,function(dataUrl,canvas){if(canvas==null){return callback(file);}else{var resizeMimeType=_this11.options.resizeMimeType;if(resizeMimeType==null){resizeMimeType=file.type;}
var resizedDataURL=canvas.toDataURL(resizeMimeType,_this11.options.resizeQuality);if(resizeMimeType==='image/jpeg'||resizeMimeType==='image/jpg'){resizedDataURL=ExifRestore.restore(file.dataURL,resizedDataURL);}
return callback(Dropzone.dataURItoBlob(resizedDataURL));}});}},{key:"createThumbnail",value:function createThumbnail(file,width,height,resizeMethod,fixOrientation,callback){var _this12=this;var fileReader=new FileReader();fileReader.onload=function(){file.dataURL=fileReader.result;if(file.type==="image/svg+xml"){if(callback!=null){callback(fileReader.result);}
return;}
return _this.createThumbnailFromUrl(file,fileReader.result,callback);};})(this);return fileReader.readAsDataURL(file);};Dropzone.prototype.createThumbnailFromUrl=function(file,imageUrl,callback){var img;img=document.createElement("img");img.onload=(function(_this){return function(){var canvas,ctx,resizeInfo,thumbnail,_ref,_ref1,_ref2,_ref3;file.width=img.width;file.height=img.height;resizeInfo=_this.options.resize.call(_this,file);if(resizeInfo.trgWidth==null){resizeInfo.trgWidth=resizeInfo.optWidth;}
if(resizeInfo.trgHeight==null){resizeInfo.trgHeight=resizeInfo.optHeight;}
canvas=document.createElement("canvas");ctx=canvas.getContext("2d");canvas.width=resizeInfo.trgWidth;canvas.height=resizeInfo.trgHeight;drawImageIOSFix(ctx,img,(_ref=resizeInfo.srcX)!=null?_ref:0,(_ref1=resizeInfo.srcY)!=null?_ref1:0,resizeInfo.srcWidth,resizeInfo.srcHeight,(_ref2=resizeInfo.trgX)!=null?_ref2:0,(_ref3=resizeInfo.trgY)!=null?_ref3:0,resizeInfo.trgWidth,resizeInfo.trgHeight);thumbnail=canvas.toDataURL("image/png");_this.emit("thumbnail",file,thumbnail);if(callback!=null){return callback();}};})(this);if(callback!=null){img.onerror=callback;}
return img.src=imageUrl;};Dropzone.prototype.processQueue=function(){var i,parallelUploads,processingLength,queuedFiles;parallelUploads=this.options.parallelUploads;processingLength=this.getUploadingFiles().length;i=processingLength;if(processingLength>=parallelUploads){return;}
queuedFiles=this.getQueuedFiles();if(!(queuedFiles.length>0)){return;}
return _this12.createThumbnailFromUrl(file,width,height,resizeMethod,fixOrientation,callback);};return fileReader.readAsDataURL(file);}},{key:"createThumbnailFromUrl",value:function createThumbnailFromUrl(file,width,height,resizeMethod,fixOrientation,callback,crossOrigin){var _this13=this;var img=document.createElement("img");if(crossOrigin){img.crossOrigin=crossOrigin;}
img.onload=function(){var loadExif=function loadExif(callback){return callback(1);};if(typeof EXIF!=='undefined'&&EXIF!==null&&fixOrientation){loadExif=function loadExif(callback){return EXIF.getData(img,function(){return callback(EXIF.getTag(this,'Orientation'));});};}
return loadExif(function(orientation){file.width=img.width;file.height=img.height;var resizeInfo=_this13.options.resize.call(_this13,file,width,height,resizeMethod);var canvas=document.createElement("canvas");var ctx=canvas.getContext("2d");canvas.width=resizeInfo.trgWidth;canvas.height=resizeInfo.trgHeight;if(orientation>4){canvas.width=resizeInfo.trgHeight;canvas.height=resizeInfo.trgWidth;}
switch(orientation){case 2:ctx.translate(canvas.width,0);ctx.scale(-1,1);break;case 3:ctx.translate(canvas.width,canvas.height);ctx.rotate(Math.PI);break;case 4:ctx.translate(0,canvas.height);ctx.scale(1,-1);break;case 5:ctx.rotate(0.5*Math.PI);ctx.scale(1,-1);break;case 6:ctx.rotate(0.5*Math.PI);ctx.translate(0,-canvas.width);break;case 7:ctx.rotate(0.5*Math.PI);ctx.translate(canvas.height,-canvas.width);ctx.scale(-1,1);break;case 8:ctx.rotate(-0.5*Math.PI);ctx.translate(-canvas.height,0);break;}
drawImageIOSFix(ctx,img,resizeInfo.srcX!=null?resizeInfo.srcX:0,resizeInfo.srcY!=null?resizeInfo.srcY:0,resizeInfo.srcWidth,resizeInfo.srcHeight,resizeInfo.trgX!=null?resizeInfo.trgX:0,resizeInfo.trgY!=null?resizeInfo.trgY:0,resizeInfo.trgWidth,resizeInfo.trgHeight);var thumbnail=canvas.toDataURL("image/png");if(callback!=null){return callback(thumbnail,canvas);}});};if(callback!=null){img.onerror=callback;}
return img.src=file.dataURL;}},{key:"processQueue",value:function processQueue(){var parallelUploads=this.options.parallelUploads;var processingLength=this.getUploadingFiles().length;var i=processingLength;if(processingLength>=parallelUploads){return;}
var queuedFiles=this.getQueuedFiles();if(!(queuedFiles.length>0)){return;}
if(this.options.uploadMultiple){return this.processFiles(queuedFiles.slice(0,parallelUploads-processingLength));}else{while(i<parallelUploads){if(!queuedFiles.length){return;}
this.processFile(queuedFiles.shift());i++;}}};Dropzone.prototype.processFile=function(file){return this.processFiles([file]);};Dropzone.prototype.processFiles=function(files){var file,_i,_len;for(_i=0,_len=files.length;_i<_len;_i++){file=files[_i];file.processing=true;file.status=Dropzone.UPLOADING;this.emit("processing",file);}
this.processFile(queuedFiles.shift());i++;}}}},{key:"processFile",value:function processFile(file){return this.processFiles([file]);}},{key:"processFiles",value:function processFiles(files){for(var _iterator19=files,_isArray19=true,_i20=0,_iterator19=_isArray19?_iterator19:_iterator19[Symbol.iterator]();;){var _ref18;if(_isArray19){if(_i20>=_iterator19.length)break;_ref18=_iterator19[_i20++];}else{_i20=_iterator19.next();if(_i20.done)break;_ref18=_i20.value;}
var file=_ref18;file.processing=true;file.status=Dropzone.UPLOADING;this.emit("processing",file);}
if(this.options.uploadMultiple){this.emit("processingmultiple",files);}
return this.uploadFiles(files);};Dropzone.prototype._getFilesWithXhr=function(xhr){var file,files;return files=(function(){var _i,_len,_ref,_results;_ref=this.files;_results=[];for(_i=0,_len=_ref.length;_i<_len;_i++){file=_ref[_i];if(file.xhr===xhr){_results.push(file);}}
return _results;}).call(this);};Dropzone.prototype.cancelUpload=function(file){var groupedFile,groupedFiles,_i,_j,_len,_len1,_ref;if(file.status===Dropzone.UPLOADING){groupedFiles=this._getFilesWithXhr(file.xhr);for(_i=0,_len=groupedFiles.length;_i<_len;_i++){groupedFile=groupedFiles[_i];groupedFile.status=Dropzone.CANCELED;}
file.xhr.abort();for(_j=0,_len1=groupedFiles.length;_j<_len1;_j++){groupedFile=groupedFiles[_j];this.emit("canceled",groupedFile);}
if(this.options.uploadMultiple){this.emit("canceledmultiple",groupedFiles);}}else if((_ref=file.status)===Dropzone.ADDED||_ref===Dropzone.QUEUED){file.status=Dropzone.CANCELED;this.emit("canceled",file);if(this.options.uploadMultiple){this.emit("canceledmultiple",[file]);}}
if(this.options.autoProcessQueue){return this.processQueue();}};resolveOption=function(){var args,option;option=arguments[0],args=2<=arguments.length?__slice.call(arguments,1):[];if(typeof option==='function'){return option.apply(this,args);}
return option;};Dropzone.prototype.uploadFile=function(file){return this.uploadFiles([file]);};Dropzone.prototype.uploadFiles=function(files){var file,formData,handleError,headerName,headerValue,headers,i,input,inputName,inputType,key,method,option,progressObj,response,updateProgress,url,value,xhr,_i,_j,_k,_l,_len,_len1,_len2,_len3,_m,_ref,_ref1,_ref2,_ref3,_ref4,_ref5;xhr=new XMLHttpRequest();for(_i=0,_len=files.length;_i<_len;_i++){file=files[_i];file.xhr=xhr;}
method=resolveOption(this.options.method,files);url=resolveOption(this.options.url,files);xhr.open(method,url,true);xhr.withCredentials=!!this.options.withCredentials;response=null;handleError=(function(_this){return function(){var _j,_len1,_results;_results=[];for(_j=0,_len1=files.length;_j<_len1;_j++){file=files[_j];_results.push(_this._errorProcessing(files,response||_this.options.dictResponseError.replace("{{statusCode}}",xhr.status),xhr));}
return _results;};})(this);updateProgress=(function(_this){return function(e){var allFilesFinished,progress,_j,_k,_l,_len1,_len2,_len3,_results;if(e!=null){progress=100*e.loaded/e.total;for(_j=0,_len1=files.length;_j<_len1;_j++){file=files[_j];file.upload={progress:progress,total:e.total,bytesSent:e.loaded};}}else{allFilesFinished=true;progress=100;for(_k=0,_len2=files.length;_k<_len2;_k++){file=files[_k];if(!(file.upload.progress===100&&file.upload.bytesSent===file.upload.total)){allFilesFinished=false;}
file.upload.progress=progress;file.upload.bytesSent=file.upload.total;}
if(allFilesFinished){return;}}
_results=[];for(_l=0,_len3=files.length;_l<_len3;_l++){file=files[_l];_results.push(_this.emit("uploadprogress",file,progress,file.upload.bytesSent));}
return _results;};})(this);xhr.onload=(function(_this){return function(e){var _ref;if(files[0].status===Dropzone.CANCELED){return;}
if(xhr.readyState!==4){return;}
response=xhr.responseText;if(xhr.getResponseHeader("content-type")&&~xhr.getResponseHeader("content-type").indexOf("application/json")){try{response=JSON.parse(response);}catch(_error){e=_error;response="Invalid JSON response from server.";}}
updateProgress();if(!((200<=(_ref=xhr.status)&&_ref<300))){return handleError();}else{return _this._finished(files,response,e);}};})(this);xhr.onerror=(function(_this){return function(){if(files[0].status===Dropzone.CANCELED){return;}
return handleError();};})(this);progressObj=(_ref=xhr.upload)!=null?_ref:xhr;progressObj.onprogress=updateProgress;headers={"Accept":"application/json","Cache-Control":"no-cache","X-Requested-With":"XMLHttpRequest"};if(this.options.headers){extend(headers,this.options.headers);}
for(headerName in headers){headerValue=headers[headerName];xhr.setRequestHeader(headerName,headerValue);}
formData=new FormData();if(this.options.params){_ref1=this.options.params;for(key in _ref1){value=_ref1[key];formData.append(key,value);}}
for(_j=0,_len1=files.length;_j<_len1;_j++){file=files[_j];this.emit("sending",file,xhr,formData);}
return this.uploadFiles(files);}},{key:"_getFilesWithXhr",value:function _getFilesWithXhr(xhr){var files=void 0;return files=this.files.filter(function(file){return file.xhr===xhr;}).map(function(file){return file;});}},{key:"cancelUpload",value:function cancelUpload(file){if(file.status===Dropzone.UPLOADING){var groupedFiles=this._getFilesWithXhr(file.xhr);for(var _iterator20=groupedFiles,_isArray20=true,_i21=0,_iterator20=_isArray20?_iterator20:_iterator20[Symbol.iterator]();;){var _ref19;if(_isArray20){if(_i21>=_iterator20.length)break;_ref19=_iterator20[_i21++];}else{_i21=_iterator20.next();if(_i21.done)break;_ref19=_i21.value;}
var groupedFile=_ref19;groupedFile.status=Dropzone.CANCELED;}
if(typeof file.xhr!=='undefined'){file.xhr.abort();}
for(var _iterator21=groupedFiles,_isArray21=true,_i22=0,_iterator21=_isArray21?_iterator21:_iterator21[Symbol.iterator]();;){var _ref20;if(_isArray21){if(_i22>=_iterator21.length)break;_ref20=_iterator21[_i22++];}else{_i22=_iterator21.next();if(_i22.done)break;_ref20=_i22.value;}
var _groupedFile=_ref20;this.emit("canceled",_groupedFile);}
if(this.options.uploadMultiple){this.emit("canceledmultiple",groupedFiles);}}else if(file.status===Dropzone.ADDED||file.status===Dropzone.QUEUED){file.status=Dropzone.CANCELED;this.emit("canceled",file);if(this.options.uploadMultiple){this.emit("canceledmultiple",[file]);}}
if(this.options.autoProcessQueue){return this.processQueue();}}},{key:"resolveOption",value:function resolveOption(option){if(typeof option==='function'){for(var _len3=arguments.length,args=Array(_len3>1?_len3-1:0),_key3=1;_key3<_len3;_key3++){args[_key3-1]=arguments[_key3];}
return option.apply(this,args);}
return option;}},{key:"uploadFile",value:function uploadFile(file){return this.uploadFiles([file]);}},{key:"uploadFiles",value:function uploadFiles(files){var _this14=this;this._transformFiles(files,function(transformedFiles){if(files[0].upload.chunked){var file=files[0];var transformedFile=transformedFiles[0];var startedChunkCount=0;file.upload.chunks=[];var handleNextChunk=function handleNextChunk(){var chunkIndex=0;while(file.upload.chunks[chunkIndex]!==undefined){chunkIndex++;}
if(chunkIndex>=file.upload.totalChunkCount)return;startedChunkCount++;var start=chunkIndex*_this14.options.chunkSize;var end=Math.min(start+_this14.options.chunkSize,file.size);var dataBlock={name:_this14._getParamName(0),data:transformedFile.webkitSlice?transformedFile.webkitSlice(start,end):transformedFile.slice(start,end),filename:file.upload.filename,chunkIndex:chunkIndex};file.upload.chunks[chunkIndex]={file:file,index:chunkIndex,dataBlock:dataBlock,status:Dropzone.UPLOADING,progress:0,retries:0};_this14._uploadData(files,[dataBlock]);};file.upload.finishedChunkUpload=function(chunk){var allFinished=true;chunk.status=Dropzone.SUCCESS;chunk.dataBlock=null;chunk.xhr=null;for(var i=0;i<file.upload.totalChunkCount;i++){if(file.upload.chunks[i]===undefined){return handleNextChunk();}
if(file.upload.chunks[i].status!==Dropzone.SUCCESS){allFinished=false;}}
if(allFinished){_this14.options.chunksUploaded(file,function(){_this14._finished(files,'',null);});}};if(_this14.options.parallelChunkUploads){for(var i=0;i<file.upload.totalChunkCount;i++){handleNextChunk();}}else{handleNextChunk();}}else{var dataBlocks=[];for(var _i23=0;_i23<files.length;_i23++){dataBlocks[_i23]={name:_this14._getParamName(_i23),data:transformedFiles[_i23],filename:files[_i23].upload.filename};}
_this14._uploadData(files,dataBlocks);}});}},{key:"_getChunk",value:function _getChunk(file,xhr){for(var i=0;i<file.upload.totalChunkCount;i++){if(file.upload.chunks[i]!==undefined&&file.upload.chunks[i].xhr===xhr){return file.upload.chunks[i];}}}},{key:"_uploadData",value:function _uploadData(files,dataBlocks){var _this15=this;var xhr=new XMLHttpRequest();for(var _iterator22=files,_isArray22=true,_i24=0,_iterator22=_isArray22?_iterator22:_iterator22[Symbol.iterator]();;){var _ref21;if(_isArray22){if(_i24>=_iterator22.length)break;_ref21=_iterator22[_i24++];}else{_i24=_iterator22.next();if(_i24.done)break;_ref21=_i24.value;}
var file=_ref21;file.xhr=xhr;}
if(files[0].upload.chunked){files[0].upload.chunks[dataBlocks[0].chunkIndex].xhr=xhr;}
var method=this.resolveOption(this.options.method,files);var url=this.resolveOption(this.options.url,files);xhr.open(method,url,true);xhr.timeout=this.resolveOption(this.options.timeout,files);xhr.withCredentials=!!this.options.withCredentials;xhr.onload=function(e){_this15._finishedUploading(files,xhr,e);};xhr.onerror=function(){_this15._handleUploadError(files,xhr);};var progressObj=xhr.upload!=null?xhr.upload:xhr;progressObj.onprogress=function(e){return _this15._updateFilesUploadProgress(files,xhr,e);};var headers={"Accept":"application/json","Cache-Control":"no-cache","X-Requested-With":"XMLHttpRequest"};if(this.options.headers){Dropzone.extend(headers,this.options.headers);}
for(var headerName in headers){var headerValue=headers[headerName];if(headerValue){xhr.setRequestHeader(headerName,headerValue);}}
var formData=new FormData();if(this.options.params){var additionalParams=this.options.params;if(typeof additionalParams==='function'){additionalParams=additionalParams.call(this,files,xhr,files[0].upload.chunked?this._getChunk(files[0],xhr):null);}
for(var key in additionalParams){var value=additionalParams[key];formData.append(key,value);}}
for(var _iterator23=files,_isArray23=true,_i25=0,_iterator23=_isArray23?_iterator23:_iterator23[Symbol.iterator]();;){var _ref22;if(_isArray23){if(_i25>=_iterator23.length)break;_ref22=_iterator23[_i25++];}else{_i25=_iterator23.next();if(_i25.done)break;_ref22=_i25.value;}
var _file=_ref22;this.emit("sending",_file,xhr,formData);}
if(this.options.uploadMultiple){this.emit("sendingmultiple",files,xhr,formData);}
if(this.element.tagName==="FORM"){_ref2=this.element.querySelectorAll("input, textarea, select, button");for(_k=0,_len2=_ref2.length;_k<_len2;_k++){input=_ref2[_k];inputName=input.getAttribute("name");inputType=input.getAttribute("type");if(input.tagName==="SELECT"&&input.hasAttribute("multiple")){_ref3=input.options;for(_l=0,_len3=_ref3.length;_l<_len3;_l++){option=_ref3[_l];if(option.selected){formData.append(inputName,option.value);}}}else if(!inputType||((_ref4=inputType.toLowerCase())!=="checkbox"&&_ref4!=="radio")||input.checked){formData.append(inputName,input.value);}}}
for(i=_m=0,_ref5=files.length-1;0<=_ref5?_m<=_ref5:_m>=_ref5;i=0<=_ref5?++_m:--_m){formData.append(this._getParamName(i),files[i],files[i].name);}
return xhr.send(formData);};Dropzone.prototype._finished=function(files,responseText,e){var file,_i,_len;for(_i=0,_len=files.length;_i<_len;_i++){file=files[_i];file.status=Dropzone.SUCCESS;this.emit("success",file,responseText,e);this.emit("complete",file);}
this._addFormElementData(formData);for(var i=0;i<dataBlocks.length;i++){var dataBlock=dataBlocks[i];formData.append(dataBlock.name,dataBlock.data,dataBlock.filename);}
this.submitRequest(xhr,formData,files);}},{key:"_transformFiles",value:function _transformFiles(files,done){var _this16=this;var transformedFiles=[];var doneCounter=0;var _loop=function _loop(i){_this16.options.transformFile.call(_this16,files[i],function(transformedFile){transformedFiles[i]=transformedFile;if(++doneCounter===files.length){done(transformedFiles);}});};for(var i=0;i<files.length;i++){_loop(i);}}},{key:"_addFormElementData",value:function _addFormElementData(formData){if(this.element.tagName==="FORM"){for(var _iterator24=this.element.querySelectorAll("input, textarea, select, button"),_isArray24=true,_i26=0,_iterator24=_isArray24?_iterator24:_iterator24[Symbol.iterator]();;){var _ref23;if(_isArray24){if(_i26>=_iterator24.length)break;_ref23=_iterator24[_i26++];}else{_i26=_iterator24.next();if(_i26.done)break;_ref23=_i26.value;}
var input=_ref23;var inputName=input.getAttribute("name");var inputType=input.getAttribute("type");if(inputType)inputType=inputType.toLowerCase();if(typeof inputName==='undefined'||inputName===null)continue;if(input.tagName==="SELECT"&&input.hasAttribute("multiple")){for(var _iterator25=input.options,_isArray25=true,_i27=0,_iterator25=_isArray25?_iterator25:_iterator25[Symbol.iterator]();;){var _ref24;if(_isArray25){if(_i27>=_iterator25.length)break;_ref24=_iterator25[_i27++];}else{_i27=_iterator25.next();if(_i27.done)break;_ref24=_i27.value;}
var option=_ref24;if(option.selected){formData.append(inputName,option.value);}}}else if(!inputType||inputType!=="checkbox"&&inputType!=="radio"||input.checked){formData.append(inputName,input.value);}}}}},{key:"_updateFilesUploadProgress",value:function _updateFilesUploadProgress(files,xhr,e){var progress=void 0;if(typeof e!=='undefined'){progress=100*e.loaded/e.total;if(files[0].upload.chunked){var file=files[0];var chunk=this._getChunk(file,xhr);chunk.progress=progress;chunk.total=e.total;chunk.bytesSent=e.loaded;var fileProgress=0,fileTotal=void 0,fileBytesSent=void 0;file.upload.progress=0;file.upload.total=0;file.upload.bytesSent=0;for(var i=0;i<file.upload.totalChunkCount;i++){if(file.upload.chunks[i]!==undefined&&file.upload.chunks[i].progress!==undefined){file.upload.progress+=file.upload.chunks[i].progress;file.upload.total+=file.upload.chunks[i].total;file.upload.bytesSent+=file.upload.chunks[i].bytesSent;}}
file.upload.progress=file.upload.progress/file.upload.totalChunkCount;}else{for(var _iterator26=files,_isArray26=true,_i28=0,_iterator26=_isArray26?_iterator26:_iterator26[Symbol.iterator]();;){var _ref25;if(_isArray26){if(_i28>=_iterator26.length)break;_ref25=_iterator26[_i28++];}else{_i28=_iterator26.next();if(_i28.done)break;_ref25=_i28.value;}
var _file2=_ref25;_file2.upload.progress=progress;_file2.upload.total=e.total;_file2.upload.bytesSent=e.loaded;}}
for(var _iterator27=files,_isArray27=true,_i29=0,_iterator27=_isArray27?_iterator27:_iterator27[Symbol.iterator]();;){var _ref26;if(_isArray27){if(_i29>=_iterator27.length)break;_ref26=_iterator27[_i29++];}else{_i29=_iterator27.next();if(_i29.done)break;_ref26=_i29.value;}
var _file3=_ref26;this.emit("uploadprogress",_file3,_file3.upload.progress,_file3.upload.bytesSent);}}else{var allFilesFinished=true;progress=100;for(var _iterator28=files,_isArray28=true,_i30=0,_iterator28=_isArray28?_iterator28:_iterator28[Symbol.iterator]();;){var _ref27;if(_isArray28){if(_i30>=_iterator28.length)break;_ref27=_iterator28[_i30++];}else{_i30=_iterator28.next();if(_i30.done)break;_ref27=_i30.value;}
var _file4=_ref27;if(_file4.upload.progress!==100||_file4.upload.bytesSent!==_file4.upload.total){allFilesFinished=false;}
_file4.upload.progress=progress;_file4.upload.bytesSent=_file4.upload.total;}
if(allFilesFinished){return;}
for(var _iterator29=files,_isArray29=true,_i31=0,_iterator29=_isArray29?_iterator29:_iterator29[Symbol.iterator]();;){var _ref28;if(_isArray29){if(_i31>=_iterator29.length)break;_ref28=_iterator29[_i31++];}else{_i31=_iterator29.next();if(_i31.done)break;_ref28=_i31.value;}
var _file5=_ref28;this.emit("uploadprogress",_file5,progress,_file5.upload.bytesSent);}}}},{key:"_finishedUploading",value:function _finishedUploading(files,xhr,e){var response=void 0;if(files[0].status===Dropzone.CANCELED){return;}
if(xhr.readyState!==4){return;}
if(xhr.responseType!=='arraybuffer'&&xhr.responseType!=='blob'){response=xhr.responseText;if(xhr.getResponseHeader("content-type")&&~xhr.getResponseHeader("content-type").indexOf("application/json")){try{response=JSON.parse(response);}catch(error){e=error;response="Invalid JSON response from server.";}}}
this._updateFilesUploadProgress(files);if(!(200<=xhr.status&&xhr.status<300)){this._handleUploadError(files,xhr,response);}else{if(files[0].upload.chunked){files[0].upload.finishedChunkUpload(this._getChunk(files[0],xhr));}else{this._finished(files,response,e);}}}},{key:"_handleUploadError",value:function _handleUploadError(files,xhr,response){if(files[0].status===Dropzone.CANCELED){return;}
if(files[0].upload.chunked&&this.options.retryChunks){var chunk=this._getChunk(files[0],xhr);if(chunk.retries++<this.options.retryChunksLimit){this._uploadData(files,[chunk.dataBlock]);return;}else{console.warn('Retried this chunk too often. Giving up.');}}
for(var _iterator30=files,_isArray30=true,_i32=0,_iterator30=_isArray30?_iterator30:_iterator30[Symbol.iterator]();;){var _ref29;if(_isArray30){if(_i32>=_iterator30.length)break;_ref29=_iterator30[_i32++];}else{_i32=_iterator30.next();if(_i32.done)break;_ref29=_i32.value;}
var file=_ref29;this._errorProcessing(files,response||this.options.dictResponseError.replace("{{statusCode}}",xhr.status),xhr);}}},{key:"submitRequest",value:function submitRequest(xhr,formData,files){xhr.send(formData);}},{key:"_finished",value:function _finished(files,responseText,e){for(var _iterator31=files,_isArray31=true,_i33=0,_iterator31=_isArray31?_iterator31:_iterator31[Symbol.iterator]();;){var _ref30;if(_isArray31){if(_i33>=_iterator31.length)break;_ref30=_iterator31[_i33++];}else{_i33=_iterator31.next();if(_i33.done)break;_ref30=_i33.value;}
var file=_ref30;file.status=Dropzone.SUCCESS;this.emit("success",file,responseText,e);this.emit("complete",file);}
if(this.options.uploadMultiple){this.emit("successmultiple",files,responseText,e);this.emit("completemultiple",files);}
if(this.options.autoProcessQueue){return this.processQueue();}};Dropzone.prototype._errorProcessing=function(files,message,xhr){var file,_i,_len;for(_i=0,_len=files.length;_i<_len;_i++){file=files[_i];file.status=Dropzone.ERROR;this.emit("error",file,message,xhr);this.emit("complete",file);}
if(this.options.autoProcessQueue){return this.processQueue();}}},{key:"_errorProcessing",value:function _errorProcessing(files,message,xhr){for(var _iterator32=files,_isArray32=true,_i34=0,_iterator32=_isArray32?_iterator32:_iterator32[Symbol.iterator]();;){var _ref31;if(_isArray32){if(_i34>=_iterator32.length)break;_ref31=_iterator32[_i34++];}else{_i34=_iterator32.next();if(_i34.done)break;_ref31=_i34.value;}
var file=_ref31;file.status=Dropzone.ERROR;this.emit("error",file,message,xhr);this.emit("complete",file);}
if(this.options.uploadMultiple){this.emit("errormultiple",files,message,xhr);this.emit("completemultiple",files);}
if(this.options.autoProcessQueue){return this.processQueue();}};return Dropzone;})(Emitter);Dropzone.version="4.0.1";Dropzone.options={};Dropzone.optionsForElement=function(element){if(element.getAttribute("id")){return Dropzone.options[camelize(element.getAttribute("id"))];}else{return void 0;}};Dropzone.instances=[];Dropzone.forElement=function(element){if(typeof element==="string"){element=document.querySelector(element);}
if((element!=null?element.dropzone:void 0)==null){throw new Error("No Dropzone found for given element. This is probably because you're trying to access it before Dropzone had the time to initialize. Use the `init` option to setup any additional observers on your Dropzone.");}
return element.dropzone;};Dropzone.autoDiscover=true;Dropzone.discover=function(){var checkElements,dropzone,dropzones,_i,_len,_results;if(document.querySelectorAll){dropzones=document.querySelectorAll(".dropzone");}else{dropzones=[];checkElements=function(elements){var el,_i,_len,_results;_results=[];for(_i=0,_len=elements.length;_i<_len;_i++){el=elements[_i];if(/(^| )dropzone($| )/.test(el.className)){_results.push(dropzones.push(el));}else{_results.push(void 0);}}
return _results;};checkElements(document.getElementsByTagName("div"));checkElements(document.getElementsByTagName("form"));}
_results=[];for(_i=0,_len=dropzones.length;_i<_len;_i++){dropzone=dropzones[_i];if(Dropzone.optionsForElement(dropzone)!==false){_results.push(new Dropzone(dropzone));}else{_results.push(void 0);}}
return _results;};Dropzone.blacklistedBrowsers=[/opera.*Macintosh.*version\/12/i];Dropzone.isBrowserSupported=function(){var capableBrowser,regex,_i,_len,_ref;capableBrowser=true;if(window.File&&window.FileReader&&window.FileList&&window.Blob&&window.FormData&&document.querySelector){if(!("classList"in document.createElement("a"))){capableBrowser=false;}else{_ref=Dropzone.blacklistedBrowsers;for(_i=0,_len=_ref.length;_i<_len;_i++){regex=_ref[_i];if(regex.test(navigator.userAgent)){capableBrowser=false;continue;}}}}else{capableBrowser=false;}
return capableBrowser;};without=function(list,rejectedItem){var item,_i,_len,_results;_results=[];for(_i=0,_len=list.length;_i<_len;_i++){item=list[_i];if(item!==rejectedItem){_results.push(item);}}
return _results;};camelize=function(str){return str.replace(/[\-_](\w)/g,function(match){return match.charAt(1).toUpperCase();});};Dropzone.createElement=function(string){var div;div=document.createElement("div");div.innerHTML=string;return div.childNodes[0];};Dropzone.elementInside=function(element,container){if(element===container){return true;}
if(this.options.autoProcessQueue){return this.processQueue();}}}],[{key:"uuidv4",value:function uuidv4(){return'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g,function(c){var r=Math.random()*16|0,v=c==='x'?r:r&0x3|0x8;return v.toString(16);});}}]);return Dropzone;}(Emitter);Dropzone.initClass();Dropzone.version="5.5.1";Dropzone.options={};Dropzone.optionsForElement=function(element){if(element.getAttribute("id")){return Dropzone.options[camelize(element.getAttribute("id"))];}else{return undefined;}};Dropzone.instances=[];Dropzone.forElement=function(element){if(typeof element==="string"){element=document.querySelector(element);}
if((element!=null?element.dropzone:undefined)==null){throw new Error("No Dropzone found for given element. This is probably because you're trying to access it before Dropzone had the time to initialize. Use the `init` option to setup any additional observers on your Dropzone.");}
return element.dropzone;};Dropzone.autoDiscover=true;Dropzone.discover=function(){var dropzones=void 0;if(document.querySelectorAll){dropzones=document.querySelectorAll(".dropzone");}else{dropzones=[];var checkElements=function checkElements(elements){return function(){var result=[];for(var _iterator33=elements,_isArray33=true,_i35=0,_iterator33=_isArray33?_iterator33:_iterator33[Symbol.iterator]();;){var _ref32;if(_isArray33){if(_i35>=_iterator33.length)break;_ref32=_iterator33[_i35++];}else{_i35=_iterator33.next();if(_i35.done)break;_ref32=_i35.value;}
var el=_ref32;if(/(^| )dropzone($| )/.test(el.className)){result.push(dropzones.push(el));}else{result.push(undefined);}}
return result;}();};checkElements(document.getElementsByTagName("div"));checkElements(document.getElementsByTagName("form"));}
return function(){var result=[];for(var _iterator34=dropzones,_isArray34=true,_i36=0,_iterator34=_isArray34?_iterator34:_iterator34[Symbol.iterator]();;){var _ref33;if(_isArray34){if(_i36>=_iterator34.length)break;_ref33=_iterator34[_i36++];}else{_i36=_iterator34.next();if(_i36.done)break;_ref33=_i36.value;}
var dropzone=_ref33;if(Dropzone.optionsForElement(dropzone)!==false){result.push(new Dropzone(dropzone));}else{result.push(undefined);}}
return result;}();};Dropzone.blacklistedBrowsers=[/opera.*(Macintosh|Windows Phone).*version\/12/i];Dropzone.isBrowserSupported=function(){var capableBrowser=true;if(window.File&&window.FileReader&&window.FileList&&window.Blob&&window.FormData&&document.querySelector){if(!("classList"in document.createElement("a"))){capableBrowser=false;}else{for(var _iterator35=Dropzone.blacklistedBrowsers,_isArray35=true,_i37=0,_iterator35=_isArray35?_iterator35:_iterator35[Symbol.iterator]();;){var _ref34;if(_isArray35){if(_i37>=_iterator35.length)break;_ref34=_iterator35[_i37++];}else{_i37=_iterator35.next();if(_i37.done)break;_ref34=_i37.value;}
var regex=_ref34;if(regex.test(navigator.userAgent)){capableBrowser=false;continue;}}}}else{capableBrowser=false;}
return capableBrowser;};Dropzone.dataURItoBlob=function(dataURI){var byteString=atob(dataURI.split(',')[1]);var mimeString=dataURI.split(',')[0].split(':')[1].split(';')[0];var ab=new ArrayBuffer(byteString.length);var ia=new Uint8Array(ab);for(var i=0,end=byteString.length,asc=0<=end;asc?i<=end:i>=end;asc?i++:i--){ia[i]=byteString.charCodeAt(i);}
return new Blob([ab],{type:mimeString});};var without=function without(list,rejectedItem){return list.filter(function(item){return item!==rejectedItem;}).map(function(item){return item;});};var camelize=function camelize(str){return str.replace(/[\-_](\w)/g,function(match){return match.charAt(1).toUpperCase();});};Dropzone.createElement=function(string){var div=document.createElement("div");div.innerHTML=string;return div.childNodes[0];};Dropzone.elementInside=function(element,container){if(element===container){return true;}
while(element=element.parentNode){if(element===container){return true;}}
return false;};Dropzone.getElement=function(el,name){var element;if(typeof el==="string"){element=document.querySelector(el);}else if(el.nodeType!=null){element=el;}
return false;};Dropzone.getElement=function(el,name){var element=void 0;if(typeof el==="string"){element=document.querySelector(el);}else if(el.nodeType!=null){element=el;}
if(element==null){throw new Error("Invalid `"+name+"` option provided. Please provide a CSS selector or a plain HTML element.");}
return element;};Dropzone.getElements=function(els,name){var e,el,elements,_i,_j,_len,_len1,_ref;if(els instanceof Array){elements=[];try{for(_i=0,_len=els.length;_i<_len;_i++){el=els[_i];elements.push(this.getElement(el,name));}}catch(_error){e=_error;elements=null;}}else if(typeof els==="string"){elements=[];_ref=document.querySelectorAll(els);for(_j=0,_len1=_ref.length;_j<_len1;_j++){el=_ref[_j];elements.push(el);}}else if(els.nodeType!=null){elements=[els];}
if(!((elements!=null)&&elements.length)){throw new Error("Invalid `"+name+"` option provided. Please provide a CSS selector, a plain HTML element or a list of those.");}
return elements;};Dropzone.confirm=function(question,accepted,rejected){if(window.confirm(question)){return accepted();}else if(rejected!=null){return rejected();}};Dropzone.isValidFile=function(file,acceptedFiles){var baseMimeType,mimeType,validType,_i,_len;if(!acceptedFiles){return true;}
acceptedFiles=acceptedFiles.split(",");mimeType=file.type;baseMimeType=mimeType.replace(/\/.*$/,"");for(_i=0,_len=acceptedFiles.length;_i<_len;_i++){validType=acceptedFiles[_i];validType=validType.trim();if(validType.charAt(0)==="."){if(file.name.toLowerCase().indexOf(validType.toLowerCase(),file.name.length-validType.length)!==-1){return true;}}else if(/\/\*$/.test(validType)){if(baseMimeType===validType.replace(/\/.*$/,"")){return true;}}else{if(mimeType===validType){return true;}}}
return false;};if(typeof jQuery!=="undefined"&&jQuery!==null){jQuery.fn.dropzone=function(options){return this.each(function(){return new Dropzone(this,options);});};}
if(typeof module!=="undefined"&&module!==null){module.exports=Dropzone;}else{window.Dropzone=Dropzone;}
Dropzone.ADDED="added";Dropzone.QUEUED="queued";Dropzone.ACCEPTED=Dropzone.QUEUED;Dropzone.UPLOADING="uploading";Dropzone.PROCESSING=Dropzone.UPLOADING;Dropzone.CANCELED="canceled";Dropzone.ERROR="error";Dropzone.SUCCESS="success";detectVerticalSquash=function(img){var alpha,canvas,ctx,data,ey,ih,iw,py,ratio,sy;iw=img.naturalWidth;ih=img.naturalHeight;canvas=document.createElement("canvas");canvas.width=1;canvas.height=ih;ctx=canvas.getContext("2d");ctx.drawImage(img,0,0);data=ctx.getImageData(0,0,1,ih).data;sy=0;ey=ih;py=ih;while(py>sy){alpha=data[(py-1)*4+3];if(alpha===0){ey=py;}else{sy=py;}
py=(ey+sy)>>1;}
ratio=py/ih;if(ratio===0){return 1;}else{return ratio;}};drawImageIOSFix=function(ctx,img,sx,sy,sw,sh,dx,dy,dw,dh){var vertSquashRatio;vertSquashRatio=detectVerticalSquash(img);return ctx.drawImage(img,sx,sy,sw,sh,dx,dy,dw,dh/vertSquashRatio);};contentLoaded=function(win,fn){var add,doc,done,init,poll,pre,rem,root,top;done=false;top=true;doc=win.document;root=doc.documentElement;add=(doc.addEventListener?"addEventListener":"attachEvent");rem=(doc.addEventListener?"removeEventListener":"detachEvent");pre=(doc.addEventListener?"":"on");init=function(e){if(e.type==="readystatechange"&&doc.readyState!=="complete"){return;}
(e.type==="load"?win:doc)[rem](pre+e.type,init,false);if(!done&&(done=true)){return fn.call(win,e.type||e);}};poll=function(){var e;try{root.doScroll("left");}catch(_error){e=_error;setTimeout(poll,50);return;}
return init("poll");};if(doc.readyState!=="complete"){if(doc.createEventObject&&root.doScroll){try{top=!win.frameElement;}catch(_error){}
return element;};Dropzone.getElements=function(els,name){var el=void 0,elements=void 0;if(els instanceof Array){elements=[];try{for(var _iterator36=els,_isArray36=true,_i38=0,_iterator36=_isArray36?_iterator36:_iterator36[Symbol.iterator]();;){if(_isArray36){if(_i38>=_iterator36.length)break;el=_iterator36[_i38++];}else{_i38=_iterator36.next();if(_i38.done)break;el=_i38.value;}
elements.push(this.getElement(el,name));}}catch(e){elements=null;}}else if(typeof els==="string"){elements=[];for(var _iterator37=document.querySelectorAll(els),_isArray37=true,_i39=0,_iterator37=_isArray37?_iterator37:_iterator37[Symbol.iterator]();;){if(_isArray37){if(_i39>=_iterator37.length)break;el=_iterator37[_i39++];}else{_i39=_iterator37.next();if(_i39.done)break;el=_i39.value;}
elements.push(el);}}else if(els.nodeType!=null){elements=[els];}
if(elements==null||!elements.length){throw new Error("Invalid `"+name+"` option provided. Please provide a CSS selector, a plain HTML element or a list of those.");}
return elements;};Dropzone.confirm=function(question,accepted,rejected){if(window.confirm(question)){return accepted();}else if(rejected!=null){return rejected();}};Dropzone.isValidFile=function(file,acceptedFiles){if(!acceptedFiles){return true;}
acceptedFiles=acceptedFiles.split(",");var mimeType=file.type;var baseMimeType=mimeType.replace(/\/.*$/,"");for(var _iterator38=acceptedFiles,_isArray38=true,_i40=0,_iterator38=_isArray38?_iterator38:_iterator38[Symbol.iterator]();;){var _ref35;if(_isArray38){if(_i40>=_iterator38.length)break;_ref35=_iterator38[_i40++];}else{_i40=_iterator38.next();if(_i40.done)break;_ref35=_i40.value;}
var validType=_ref35;validType=validType.trim();if(validType.charAt(0)==="."){if(file.name.toLowerCase().indexOf(validType.toLowerCase(),file.name.length-validType.length)!==-1){return true;}}else if(/\/\*$/.test(validType)){if(baseMimeType===validType.replace(/\/.*$/,"")){return true;}}else{if(mimeType===validType){return true;}}}
return false;};if(typeof jQuery!=='undefined'&&jQuery!==null){jQuery.fn.dropzone=function(options){return this.each(function(){return new Dropzone(this,options);});};}
if(typeof module!=='undefined'&&module!==null){module.exports=Dropzone;}else{window.Dropzone=Dropzone;}
Dropzone.ADDED="added";Dropzone.QUEUED="queued";Dropzone.ACCEPTED=Dropzone.QUEUED;Dropzone.UPLOADING="uploading";Dropzone.PROCESSING=Dropzone.UPLOADING;Dropzone.CANCELED="canceled";Dropzone.ERROR="error";Dropzone.SUCCESS="success";var detectVerticalSquash=function detectVerticalSquash(img){var iw=img.naturalWidth;var ih=img.naturalHeight;var canvas=document.createElement("canvas");canvas.width=1;canvas.height=ih;var ctx=canvas.getContext("2d");ctx.drawImage(img,0,0);var _ctx$getImageData=ctx.getImageData(1,0,1,ih),data=_ctx$getImageData.data;var sy=0;var ey=ih;var py=ih;while(py>sy){var alpha=data[(py-1)*4+3];if(alpha===0){ey=py;}else{sy=py;}
py=ey+sy>>1;}
var ratio=py/ih;if(ratio===0){return 1;}else{return ratio;}};var drawImageIOSFix=function drawImageIOSFix(ctx,img,sx,sy,sw,sh,dx,dy,dw,dh){var vertSquashRatio=detectVerticalSquash(img);return ctx.drawImage(img,sx,sy,sw,sh,dx,dy,dw,dh/vertSquashRatio);};var ExifRestore=function(){function ExifRestore(){_classCallCheck(this,ExifRestore);}
_createClass(ExifRestore,null,[{key:"initClass",value:function initClass(){this.KEY_STR='ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';}},{key:"encode64",value:function encode64(input){var output='';var chr1=undefined;var chr2=undefined;var chr3='';var enc1=undefined;var enc2=undefined;var enc3=undefined;var enc4='';var i=0;while(true){chr1=input[i++];chr2=input[i++];chr3=input[i++];enc1=chr1>>2;enc2=(chr1&3)<<4|chr2>>4;enc3=(chr2&15)<<2|chr3>>6;enc4=chr3&63;if(isNaN(chr2)){enc3=enc4=64;}else if(isNaN(chr3)){enc4=64;}
output=output+this.KEY_STR.charAt(enc1)+this.KEY_STR.charAt(enc2)+this.KEY_STR.charAt(enc3)+this.KEY_STR.charAt(enc4);chr1=chr2=chr3='';enc1=enc2=enc3=enc4='';if(!(i<input.length)){break;}}
return output;}},{key:"restore",value:function restore(origFileBase64,resizedFileBase64){if(!origFileBase64.match('data:image/jpeg;base64,')){return resizedFileBase64;}
var rawImage=this.decode64(origFileBase64.replace('data:image/jpeg;base64,',''));var segments=this.slice2Segments(rawImage);var image=this.exifManipulation(resizedFileBase64,segments);return"data:image/jpeg;base64,"+this.encode64(image);}},{key:"exifManipulation",value:function exifManipulation(resizedFileBase64,segments){var exifArray=this.getExifArray(segments);var newImageArray=this.insertExif(resizedFileBase64,exifArray);var aBuffer=new Uint8Array(newImageArray);return aBuffer;}},{key:"getExifArray",value:function getExifArray(segments){var seg=undefined;var x=0;while(x<segments.length){seg=segments[x];if(seg[0]===255&seg[1]===225){return seg;}
x++;}
return[];}},{key:"insertExif",value:function insertExif(resizedFileBase64,exifArray){var imageData=resizedFileBase64.replace('data:image/jpeg;base64,','');var buf=this.decode64(imageData);var separatePoint=buf.indexOf(255,3);var mae=buf.slice(0,separatePoint);var ato=buf.slice(separatePoint);var array=mae;array=array.concat(exifArray);array=array.concat(ato);return array;}},{key:"slice2Segments",value:function slice2Segments(rawImageArray){var head=0;var segments=[];while(true){var length;if(rawImageArray[head]===255&rawImageArray[head+1]===218){break;}
if(rawImageArray[head]===255&rawImageArray[head+1]===216){head+=2;}else{length=rawImageArray[head+2]*256+rawImageArray[head+3];var endPoint=head+length+2;var seg=rawImageArray.slice(head,endPoint);segments.push(seg);head=endPoint;}
if(head>rawImageArray.length){break;}}
return segments;}},{key:"decode64",value:function decode64(input){var output='';var chr1=undefined;var chr2=undefined;var chr3='';var enc1=undefined;var enc2=undefined;var enc3=undefined;var enc4='';var i=0;var buf=[];var base64test=/[^A-Za-z0-9\+\/\=]/g;if(base64test.exec(input)){console.warn('There were invalid base64 characters in the input text.\nValid base64 characters are A-Z, a-z, 0-9, \'+\', \'/\',and \'=\'\nExpect errors in decoding.');}
input=input.replace(/[^A-Za-z0-9\+\/\=]/g,'');while(true){enc1=this.KEY_STR.indexOf(input.charAt(i++));enc2=this.KEY_STR.indexOf(input.charAt(i++));enc3=this.KEY_STR.indexOf(input.charAt(i++));enc4=this.KEY_STR.indexOf(input.charAt(i++));chr1=enc1<<2|enc2>>4;chr2=(enc2&15)<<4|enc3>>2;chr3=(enc3&3)<<6|enc4;buf.push(chr1);if(enc3!==64){buf.push(chr2);}
if(enc4!==64){buf.push(chr3);}
chr1=chr2=chr3='';enc1=enc2=enc3=enc4='';if(!(i<input.length)){break;}}
return buf;}}]);return ExifRestore;}();ExifRestore.initClass();var contentLoaded=function contentLoaded(win,fn){var done=false;var top=true;var doc=win.document;var root=doc.documentElement;var add=doc.addEventListener?"addEventListener":"attachEvent";var rem=doc.addEventListener?"removeEventListener":"detachEvent";var pre=doc.addEventListener?"":"on";var init=function init(e){if(e.type==="readystatechange"&&doc.readyState!=="complete"){return;}
(e.type==="load"?win:doc)[rem](pre+e.type,init,false);if(!done&&(done=true)){return fn.call(win,e.type||e);}};var poll=function poll(){try{root.doScroll("left");}catch(e){setTimeout(poll,50);return;}
return init("poll");};if(doc.readyState!=="complete"){if(doc.createEventObject&&root.doScroll){try{top=!win.frameElement;}catch(error){}
if(top){poll();}}
doc[add](pre+"DOMContentLoaded",init,false);doc[add](pre+"readystatechange",init,false);return win[add](pre+"load",init,false);}};Dropzone._autoDiscoverFunction=function(){if(Dropzone.autoDiscover){return Dropzone.discover();}};contentLoaded(window,Dropzone._autoDiscoverFunction);}).call(this);(function(window,document){var modalClass='.sweet-alert',overlayClass='.sweet-overlay',alertTypes=['error','warning','info','success'],defaultParams={title:'',text:'',type:null,allowOutsideClick:false,showCancelButton:false,showConfirmButton:true,closeOnConfirm:true,closeOnCancel:true,confirmButtonText:'OK',confirmButtonClass:'btn-primary',cancelButtonText:'Cancel',cancelButtonClass:'btn-default',containerClass:'',titleClass:'',textClass:'',imageUrl:null,imageSize:null,timer:null};var getModal=function(){return document.querySelector(modalClass);},getOverlay=function(){return document.querySelector(overlayClass);},hasClass=function(elem,className){return new RegExp(' '+className+' ').test(' '+elem.className+' ');},addClass=function(elem,className){if(className&&!hasClass(elem,className)){elem.className+=' '+className;}},removeClass=function(elem,className){var newClass=' '+elem.className.replace(/[\t\r\n]/g,' ')+' ';if(hasClass(elem,className)){while(newClass.indexOf(' '+className+' ')>=0){newClass=newClass.replace(' '+className+' ',' ');}
doc[add](pre+"DOMContentLoaded",init,false);doc[add](pre+"readystatechange",init,false);return win[add](pre+"load",init,false);}};Dropzone._autoDiscoverFunction=function(){if(Dropzone.autoDiscover){return Dropzone.discover();}};contentLoaded(window,Dropzone._autoDiscoverFunction);function __guard__(value,transform){return typeof value!=='undefined'&&value!==null?transform(value):undefined;}
function __guardMethod__(obj,methodName,transform){if(typeof obj!=='undefined'&&obj!==null&&typeof obj[methodName]==='function'){return transform(obj,methodName);}else{return undefined;}}
(function(window,document){var modalClass='.sweet-alert',overlayClass='.sweet-overlay',alertTypes=['error','warning','info','success'],defaultParams={title:'',text:'',type:null,allowOutsideClick:false,showCancelButton:false,showConfirmButton:true,closeOnConfirm:true,closeOnCancel:true,confirmButtonText:'OK',confirmButtonClass:'btn-primary',cancelButtonText:'Cancel',cancelButtonClass:'btn-default',containerClass:'',titleClass:'',textClass:'',imageUrl:null,imageSize:null,timer:null};var getModal=function(){return document.querySelector(modalClass);},getOverlay=function(){return document.querySelector(overlayClass);},hasClass=function(elem,className){return new RegExp(' '+className+' ').test(' '+elem.className+' ');},addClass=function(elem,className){if(className&&!hasClass(elem,className)){elem.className+=' '+className;}},removeClass=function(elem,className){var newClass=' '+elem.className.replace(/[\t\r\n]/g,' ')+' ';if(hasClass(elem,className)){while(newClass.indexOf(' '+className+' ')>=0){newClass=newClass.replace(' '+className+' ',' ');}
elem.className=newClass.replace(/^\s+|\s+$/g,'');}},escapeHtml=function(str){var div=document.createElement('div');div.appendChild(document.createTextNode(str));return div.innerHTML;},_show=function(elem){elem.style.opacity='';elem.style.display='block';},show=function(elems){if(elems&&!elems.length){return _show(elems);}
for(var i=0;i<elems.length;++i){_show(elems[i]);}},_hide=function(elem){elem.style.opacity='';elem.style.display='none';},hide=function(elems){if(elems&&!elems.length){return _hide(elems);}
for(var i=0;i<elems.length;++i){_hide(elems[i]);}},isDescendant=function(parent,child){var node=child.parentNode;while(node!==null){if(node===parent){return true;}
node=node.parentNode;}
return false;},getTopMargin=function(elem){elem.style.left='-9999px';elem.style.display='block';var height=elem.clientHeight;var padding=parseInt(getComputedStyle(elem).getPropertyValue('padding'),10);elem.style.left='';elem.style.display='none';return('-'+parseInt(height/2+padding)+'px');},fadeIn=function(elem,interval){if(+elem.style.opacity<1){interval=interval||16;elem.style.opacity=0;elem.style.display='block';var last=+new Date();var tick=function(){elem.style.opacity=+elem.style.opacity+(new Date()-last)/100;last=+new Date();if(+elem.style.opacity<1){setTimeout(tick,interval);}};tick();}},fadeOut=function(elem,interval){interval=interval||16;elem.style.opacity=1;var last=+new Date();var tick=function(){elem.style.opacity=+elem.style.opacity-(new Date()-last)/100;last=+new Date();if(+elem.style.opacity>0){setTimeout(tick,interval);}else{elem.style.display='none';}};tick();},fireClick=function(node){if(MouseEvent){var mevt=new MouseEvent('click',{view:window,bubbles:false,cancelable:true});node.dispatchEvent(mevt);}else if(document.createEvent){var evt=document.createEvent('MouseEvents');evt.initEvent('click',false,false);node.dispatchEvent(evt);}else if(document.createEventObject){node.fireEvent('onclick');}else if(typeof node.onclick==='function'){node.onclick();}},stopEventPropagation=function(e){if(typeof e.stopPropagation==='function'){e.stopPropagation();e.preventDefault();}else if(window.event&&window.event.hasOwnProperty('cancelBubble')){window.event.cancelBubble=true;}};var previousActiveElement,previousDocumentClick,previousWindowKeyDown,lastFocusedButton;window.sweetAlertInitialize=function(){var sweetHTML='<div class="sweet-overlay" tabIndex="-1"></div><div class="sweet-alert" tabIndex="-1"><div class="icon error"><span class="x-mark"><span class="line left"></span><span class="line right"></span></span></div><div class="icon warning"> <span class="body"></span> <span class="dot"></span> </div> <div class="icon info"></div> <div class="icon success"> <span class="line tip"></span> <span class="line long"></span> <div class="placeholder"></div> <div class="fix"></div> </div> <div class="icon custom"></div> <h2>Title</h2><p class="lead text-muted">Text</p><p><button class="cancel btn" tabIndex="2">Cancel</button> <button class="confirm btn" tabIndex="1">OK</button></p></div>',sweetWrap=document.createElement('div');sweetWrap.innerHTML=sweetHTML;document.body.appendChild(sweetWrap);}
return false;},getTopMargin=function(elem){elem.style.left='-9999px';elem.style.display='block';var height=elem.clientHeight;var padding=parseInt(getComputedStyle(elem).getPropertyValue('padding'),10);elem.style.left='';elem.style.display='none';return('-'+parseInt(height/2+padding)+'px');},fadeIn=function(elem,interval){if(+elem.style.opacity<1){interval=interval||16;elem.style.opacity=0;elem.style.display='block';var last=+new Date();var tick=function(){elem.style.opacity=+elem.style.opacity+(new Date()-last)/100;last=+new Date();if(+elem.style.opacity<1){setTimeout(tick,interval);}};tick();}},fadeOut=function(elem,interval){interval=interval||16;elem.style.opacity=1;var last=+new Date();var tick=function(){elem.style.opacity=+elem.style.opacity-(new Date()-last)/100;last=+new Date();if(+elem.style.opacity>0){setTimeout(tick,interval);}else{elem.style.display='none';}};tick();},fireClick=function(node){if(MouseEvent){var mevt=new MouseEvent('click',{view:window,bubbles:false,cancelable:true});node.dispatchEvent(mevt);}else if(document.createEvent){var evt=document.createEvent('MouseEvents');evt.initEvent('click',false,false);node.dispatchEvent(evt);}else if(document.createEventObject){node.fireEvent('onclick');}else if(typeof node.onclick==='function'){node.onclick();}},stopEventPropagation=function(e){if(typeof e.stopPropagation==='function'){e.stopPropagation();e.preventDefault();}else if(window.event&&window.event.hasOwnProperty('cancelBubble')){window.event.cancelBubble=true;}};var previousActiveElement,previousDocumentClick,previousWindowKeyDown,lastFocusedButton;window.sweetAlertInitialize=function(){var sweetHTML='<div class="sweet-overlay"></div><div class="sweet-alert"><div class="icon error"><span class="x-mark"><span class="line left"></span><span class="line right"></span></span></div><div class="icon warning"> <span class="body"></span> <span class="dot"></span> </div> <div class="icon info"></div> <div class="icon success"> <span class="line tip"></span> <span class="line long"></span> <div class="placeholder"></div> <div class="fix"></div> </div> <div class="icon custom"></div> <h2>Title</h2><p class="lead text-muted">Text</p><p><button class="cancel btn" tabIndex="2">Cancel</button> <button class="confirm btn" tabIndex="1">OK</button></p></div>',sweetWrap=document.createElement('div');sweetWrap.innerHTML=sweetHTML;document.body.appendChild(sweetWrap);}
window.sweetAlert=window.swal=function(){if(arguments[0]===undefined){window.console.error('sweetAlert expects at least 1 attribute!');return false;}
var params=extend({},defaultParams);switch(typeof arguments[0]){case'string':params.title=arguments[0];params.text=arguments[1]||'';params.type=arguments[2]||'';break;case'object':if(arguments[0].title===undefined){window.console.error('Missing "title" argument!');return false;}
params.title=arguments[0].title;params.text=arguments[0].text||defaultParams.text;params.type=arguments[0].type||defaultParams.type;params.allowOutsideClick=arguments[0].allowOutsideClick||defaultParams.allowOutsideClick;params.showCancelButton=arguments[0].showCancelButton!==undefined?arguments[0].showCancelButton:defaultParams.showCancelButton;params.showConfirmButton=arguments[0].showConfirmButton!==undefined?arguments[0].showConfirmButton:defaultParams.showConfirmButton;params.closeOnConfirm=arguments[0].closeOnConfirm!==undefined?arguments[0].closeOnConfirm:defaultParams.closeOnConfirm;params.closeOnCancel=arguments[0].closeOnCancel!==undefined?arguments[0].closeOnCancel:defaultParams.closeOnCancel;params.timer=arguments[0].timer||defaultParams.timer;params.confirmButtonText=(defaultParams.showCancelButton)?'Confirm':defaultParams.confirmButtonText;params.confirmButtonText=arguments[0].confirmButtonText||defaultParams.confirmButtonText;params.confirmButtonClass=arguments[0].confirmButtonClass||(arguments[0].type?'btn-'+arguments[0].type:null)||defaultParams.confirmButtonClass;params.cancelButtonText=arguments[0].cancelButtonText||defaultParams.cancelButtonText;params.cancelButtonClass=arguments[0].cancelButtonClass||defaultParams.cancelButtonClass;params.containerClass=arguments[0].containerClass||defaultParams.containerClass;params.titleClass=arguments[0].titleClass||defaultParams.titleClass;params.textClass=arguments[0].textClass||defaultParams.textClass;params.imageUrl=arguments[0].imageUrl||defaultParams.imageUrl;params.imageSize=arguments[0].imageSize||defaultParams.imageSize;params.doneFunction=arguments[1]||null;break;default:window.console.error('Unexpected type of argument! Expected "string" or "object", got '+typeof arguments[0]);return false;}

View File

@ -9,6 +9,7 @@
*
* Dependences:
* - Sweet Alert
* - Translations (october.lang.js)
*/
(function($){

View File

@ -172,7 +172,7 @@
}
Flyout.prototype.onDocumentKeydown = function(ev) {
if (ev.which == 27) {
if (ev.key === 'Escape') {
this.hide();
}
}

View File

@ -214,6 +214,7 @@ nav#layout-mainmenu {
img.account-avatar {
width: 45px;
height: 45px;
}
.account-name {

File diff suppressed because it is too large Load Diff

View File

@ -181,7 +181,7 @@
*/
window.sweetAlertInitialize = function() {
var sweetHTML = '<div class="sweet-overlay" tabIndex="-1"></div><div class="sweet-alert" tabIndex="-1"><div class="icon error"><span class="x-mark"><span class="line left"></span><span class="line right"></span></span></div><div class="icon warning"> <span class="body"></span> <span class="dot"></span> </div> <div class="icon info"></div> <div class="icon success"> <span class="line tip"></span> <span class="line long"></span> <div class="placeholder"></div> <div class="fix"></div> </div> <div class="icon custom"></div> <h2>Title</h2><p class="lead text-muted">Text</p><p><button class="cancel btn" tabIndex="2">Cancel</button> <button class="confirm btn" tabIndex="1">OK</button></p></div>',
var sweetHTML = '<div class="sweet-overlay"></div><div class="sweet-alert"><div class="icon error"><span class="x-mark"><span class="line left"></span><span class="line right"></span></span></div><div class="icon warning"> <span class="body"></span> <span class="dot"></span> </div> <div class="icon info"></div> <div class="icon success"> <span class="line tip"></span> <span class="line long"></span> <div class="placeholder"></div> <div class="fix"></div> </div> <div class="icon custom"></div> <h2>Title</h2><p class="lead text-muted">Text</p><p><button class="cancel btn" tabIndex="2">Cancel</button> <button class="confirm btn" tabIndex="1">OK</button></p></div>',
sweetWrap = document.createElement('div');
sweetWrap.innerHTML = sweetHTML;
@ -558,7 +558,7 @@
} else {
hide($cancelBtn);
}
// Confirm button
modal.setAttribute('data-has-confirm-button', params.showConfirmButton);
if (params.showConfirmButton) {
@ -566,7 +566,7 @@
} else {
hide($confirmBtn);
}
// Edit text on cancel and confirm buttons
if (params.cancelButtonText) {

View File

@ -159,7 +159,9 @@ class FormController extends ControllerBehavior
$this->formWidget->bindEvent('form.beforeRefresh', function ($holder) {
$result = $this->controller->formExtendRefreshData($this->formWidget, $holder->data);
if (is_array($result)) $holder->data = $result;
if (is_array($result)) {
$holder->data = $result;
}
});
$this->formWidget->bindEvent('form.refreshFields', function ($fields) {

View File

@ -886,7 +886,6 @@ class RelationController extends ControllerBehavior
* Form
*/
elseif ($this->manageMode == 'form') {
if (!$config = $this->makeConfigForMode('manage', 'form', false)) {
return null;
}
@ -900,7 +899,7 @@ class RelationController extends ControllerBehavior
* Existing record
*/
if ($this->manageId) {
$model = $config->model->find($id);
$model = $config->model->find($this->manageId);
if ($model) {
$config->model = $model;
} else {
@ -1205,7 +1204,6 @@ class RelationController extends ControllerBehavior
* Add
*/
if ($this->viewMode == 'multi') {
$checkedIds = $recordId ? [$recordId] : post('checked');
if (is_array($checkedIds)) {
@ -1221,14 +1219,12 @@ class RelationController extends ControllerBehavior
$this->relationObject->add($model, $sessionKey);
}
}
}
/*
* Link
*/
elseif ($this->viewMode == 'single') {
if ($recordId && ($model = $this->relationModel->find($recordId))) {
$this->relationObject->add($model, $sessionKey);
$this->viewWidget->setFormValues($model->attributes);
@ -1242,7 +1238,6 @@ class RelationController extends ControllerBehavior
$parentModel->save();
}
}
}
}
@ -1264,7 +1259,6 @@ class RelationController extends ControllerBehavior
* Remove
*/
if ($this->viewMode == 'multi') {
$checkedIds = $recordId ? [$recordId] : post('checked');
if (is_array($checkedIds)) {
@ -1707,7 +1701,8 @@ class RelationController extends ControllerBehavior
*
* @return \Backend\Classes\WidgetBase
*/
public function relationGetManageWidget() {
public function relationGetManageWidget()
{
return $this->manageWidget;
}
@ -1716,7 +1711,8 @@ class RelationController extends ControllerBehavior
*
* @return \Backend\Classes\WidgetBase
*/
public function relationGetViewWidget() {
public function relationGetViewWidget()
{
return $this->viewWidget;
}
}
}

View File

@ -70,7 +70,7 @@
/*
* This function transfers the supplied variables as hidden form inputs,
* to any popup that is spawned within the supplied container. The spawned
* to any popup that is spawned within the supplied container. The spawned
* popup must contain a form element.
*/
this.bindToPopups = function(container, vars) {
@ -87,7 +87,7 @@
if (typeof value == 'object') return value
try {
return JSON.parse(JSON.stringify(eval("({" + value + "})")))
return ocJSON("{" + value + "}")
}
catch (e) {
throw new Error('Error parsing the '+name+' attribute value. '+e)
@ -97,4 +97,4 @@
}
$.oc.relationBehavior = new RelationBehavior;
}(window.jQuery);
}(window.jQuery);

View File

@ -1,7 +1,11 @@
<div id="<?= $relationManageWidget->getId('managePopup') ?>">
<?php if ($relationManageId): ?>
<?= Form::ajax('onRelationManageUpdate', ['data-popup-load-indicator' => true, 'sessionKey' => $newSessionKey]) ?>
<?= Form::ajax('onRelationManageUpdate', [
'data-popup-load-indicator' => true,
'sessionKey' => $newSessionKey,
'data-request-success' => "$.oc.relationBehavior.changed('" . e($this->vars['relationField']) . "', 'updated')",
]) ?>
<!-- Passable fields -->
<input type="hidden" name="manage_id" value="<?= $relationManageId ?>" />

View File

@ -2,6 +2,7 @@
use System\Classes\PluginManager;
use October\Rain\Auth\Manager as RainAuthManager;
use October\Rain\Exception\SystemException;
/**
* Back-end authentication manager.
@ -61,7 +62,7 @@ class AuthManager extends RainAuthManager
* registerPermissions() function. The manager instance is passed to the
* callback function as an argument. Usage:
*
* BackendAuth::registerCallback(function($manager){
* BackendAuth::registerCallback(function ($manager) {
* $manager->registerPermissions([...]);
* });
*
@ -81,7 +82,7 @@ class AuthManager extends RainAuthManager
* - order - a position of the item in the menu, optional.
* - comment - a brief comment that describes the permission, optional.
* - tab - assign this permission to a tabbed group, optional.
* @param string $owner Specifies the menu items owner plugin or module in the format Vendor/Module.
* @param string $owner Specifies the permissions' owner plugin or module in the format Author.Plugin
* @param array $definitions An array of the menu item definitions.
*/
public function registerPermissions($owner, array $definitions)
@ -96,6 +97,29 @@ class AuthManager extends RainAuthManager
}
}
/**
* Removes a single back-end permission
* @param string $owner Specifies the permissions' owner plugin or module in the format Author.Plugin
* @param string $code The code of the permission to remove
* @return void
*/
public function removePermission($owner, $code)
{
if (!$this->permissions) {
throw new SystemException('Unable to remove permissions before they are loaded.');
}
$ownerPermissions = array_filter($this->permissions, function ($permission) use ($owner) {
return $permission->owner === $owner;
});
foreach ($ownerPermissions as $key => $permission) {
if ($permission->code === $code) {
unset($this->permissions[$key]);
}
}
}
/**
* Returns a list of the registered permissions items.
* @return array

View File

@ -8,10 +8,10 @@ use Event;
use Config;
use Request;
use Response;
use Closure;
use Illuminate\Routing\Controller as ControllerBase;
use October\Rain\Router\Helper as RouterHelper;
use System\Classes\PluginManager;
use Closure;
/**
* This is the master controller for all back-end pages.
@ -77,7 +77,11 @@ class BackendController extends ControllerBase
$path = implode('/', $pathParts);
$requestedController = $this->getRequestedController($path);
if (!is_null($requestedController) && count($requestedController['controller']->getMiddleware())) {
if (
!is_null($requestedController)
&& is_array($requestedController)
&& count($requestedController['controller']->getMiddleware())
) {
$action = $requestedController['action'];
// Collect applicable middleware and insert middleware into pipeline

View File

@ -36,6 +36,8 @@ class Controller extends ControllerBase
use \System\Traits\AssetMaker;
use \System\Traits\ConfigMaker;
use \System\Traits\EventEmitter;
use \System\Traits\ResponseMaker;
use \System\Traits\SecurityController;
use \Backend\Traits\ErrorMaker;
use \Backend\Traits\WidgetMaker;
use \October\Rain\Extension\ExtendableTrait;
@ -113,16 +115,6 @@ class Controller extends ControllerBase
*/
protected $guarded = [];
/**
* @var int Response status code
*/
protected $statusCode = 200;
/**
* @var mixed Override the standard controller response.
*/
protected $responseOverride = null;
/**
* Constructor.
*/
@ -210,13 +202,15 @@ class Controller extends ControllerBase
/*
* Check security token.
* @see \System\Traits\SecurityController
*/
if (!$this->verifyCsrfToken()) {
return Response::make(Lang::get('backend::lang.page.invalid_token.label'), 403);
return Response::make(Lang::get('system::lang.page.invalid_token.label'), 403);
}
/*
* Check forced HTTPS protocol.
* @see \System\Traits\SecurityController
*/
if (!$this->verifyForceSecure()) {
return Redirect::secure(Request::path());
@ -231,7 +225,6 @@ class Controller extends ControllerBase
* Check that user is logged in and has permission to view this page
*/
if (!$isPublicAction) {
/*
* Not logged in, redirect to login screen or show ajax error.
*/
@ -266,34 +259,30 @@ class Controller extends ControllerBase
* Execute AJAX event
*/
if ($ajaxResponse = $this->execAjaxHandlers()) {
return $ajaxResponse;
$result = $ajaxResponse;
}
/*
* Execute postback handler
*/
if (
elseif (
($handler = post('_handler')) &&
($handlerResponse = $this->runAjaxHandler($handler)) &&
$handlerResponse !== true
) {
return $handlerResponse;
$result = $handlerResponse;
}
/*
* Execute page action
*/
$result = $this->execPageAction($action, $params);
if ($this->responseOverride !== null) {
$result = $this->responseOverride;
else {
$result = $this->execPageAction($action, $params);
}
if (!is_string($result)) {
return $result;
}
return Response::make($result, $this->statusCode);
/*
* Prepare and return response
* @see \System\Traits\ResponseMaker
*/
return $this->makeResponse($result);
}
/**
@ -554,7 +543,7 @@ class Controller extends ControllerBase
*
* Example usage (forwards AJAX handlers to a backend widget):
*
* Event::listen('backend.ajax.beforeRunHandler', function((\Backend\Classes\Controller) $controller, (string) $handler) {
* Event::listen('backend.ajax.beforeRunHandler', function ((\Backend\Classes\Controller) $controller, (string) $handler) {
* if (strpos($handler, '::')) {
* list($componentAlias, $handlerName) = explode('::', $handler);
* if ($componentAlias === $this->getBackendWidgetAlias()) {
@ -683,27 +672,6 @@ class Controller extends ControllerBase
return $id;
}
/**
* Sets the status code for the current web response.
* @param int $code Status code
*/
public function setStatusCode($code)
{
$this->statusCode = (int) $code;
return $this;
}
/**
* Sets the response for the current page request cycle, this value takes priority
* over the standard response prepared by the controller.
* @param mixed $response Response object or string
*/
public function setResponse($response)
{
$this->responseOverride = $response;
return $this;
}
//
// Hints
//
@ -764,55 +732,4 @@ class Controller extends ControllerBase
$hiddenHints = UserPreference::forUser()->get('backend::hints.hidden', []);
return array_key_exists($name, $hiddenHints);
}
//
// Security
//
/**
* Checks the request data / headers for a valid CSRF token.
* Returns false if a valid token is not found. Override this
* method to disable the check.
* @return bool
*/
protected function verifyCsrfToken()
{
if (!Config::get('cms.enableCsrfProtection')) {
return true;
}
if (in_array(Request::method(), ['HEAD', 'GET', 'OPTIONS'])) {
return true;
}
$token = Request::input('_token') ?: Request::header('X-CSRF-TOKEN');
if (!strlen($token)) {
return false;
}
return hash_equals(
Session::token(),
$token
);
}
/**
* Checks if the back-end should force a secure protocol (HTTPS) enabled by config.
* @return bool
*/
protected function verifyForceSecure()
{
if (Request::secure() || Request::ajax()) {
return true;
}
// @todo if year >= 2018 change default from false to null
$forceSecure = Config::get('cms.backendForceSecure', false);
if ($forceSecure === null) {
$forceSecure = !Config::get('app.debug', false);
}
return !$forceSecure;
}
}

View File

@ -51,6 +51,11 @@ class FilterScope
*/
public $options;
/**
* @var array Other scope names this scope depends on, when the other scopes are modified, this scope will update.
*/
public $dependsOn;
/**
* @var string Specifies contextual visibility of this form scope.
*/
@ -113,33 +118,32 @@ class FilterScope
*/
protected function evalConfig($config)
{
if (isset($config['options'])) {
$this->options = $config['options'];
if ($config === null) {
$config = [];
}
if (isset($config['context'])) {
$this->context = $config['context'];
}
if (isset($config['default'])) {
$this->defaults = $config['default'];
}
if (isset($config['conditions'])) {
$this->conditions = $config['conditions'];
}
if (isset($config['scope'])) {
$this->scope = $config['scope'];
}
if (isset($config['cssClass'])) {
$this->cssClass = $config['cssClass'];
}
if (isset($config['nameFrom'])) {
$this->nameFrom = $config['nameFrom'];
}
if (isset($config['descriptionFrom'])) {
$this->descriptionFrom = $config['descriptionFrom'];
}
if (array_key_exists('disabled', $config)) {
$this->disabled = $config['disabled'];
/*
* Standard config:property values
*/
$applyConfigValues = [
'options',
'dependsOn',
'context',
'default',
'conditions',
'scope',
'cssClass',
'nameFrom',
'descriptionFrom',
'disabled',
];
foreach ($applyConfigValues as $value) {
if (array_key_exists($value, $config)) {
$this->{$value} = $config[$value];
}
}
return $config;
}

View File

@ -688,7 +688,6 @@ class FormField
* relation value, all others will look up the relation object as normal.
*/
foreach ($keyParts as $key) {
if ($result instanceof Model && $result->hasRelation($key)) {
if ($key == $lastField) {
$result = $result->getRelationValue($key) ?: $default;
@ -709,7 +708,6 @@ class FormField
}
$result = $result->{$key};
}
}
return $result;

View File

@ -31,12 +31,12 @@ class FormTabs implements IteratorAggregate, ArrayAccess
* @var string Default tab label to use when none is specified.
*/
public $defaultTab = 'backend::lang.form.undefined_tab';
/**
* @var array List of icons for their corresponding tabs.
*/
public $icons = [];
/**
* @var bool Should these tabs stretch to the bottom of the page layout.
*/
@ -86,11 +86,11 @@ class FormTabs implements IteratorAggregate, ArrayAccess
if (array_key_exists('defaultTab', $config)) {
$this->defaultTab = $config['defaultTab'];
}
if (array_key_exists('icons', $config)) {
$this->icons = $config['icons'];
}
if (array_key_exists('stretch', $config)) {
$this->stretch = $config['stretch'];
}
@ -182,7 +182,7 @@ class FormTabs implements IteratorAggregate, ArrayAccess
return $tablessFields;
}
/**
* Returns an icon for the tab based on the tab's name.
* @param string $name
@ -194,7 +194,7 @@ class FormTabs implements IteratorAggregate, ArrayAccess
return $this->icons[$name];
}
}
/**
* Returns a tab pane CSS class.
* @param string $index
@ -222,9 +222,10 @@ class FormTabs implements IteratorAggregate, ArrayAccess
*/
public function getIterator()
{
return new ArrayIterator($this->suppressTabs
? $this->getAllFields()
: $this->getFields()
return new ArrayIterator(
$this->suppressTabs
? $this->getAllFields()
: $this->getFields()
);
}

View File

@ -149,5 +149,4 @@ abstract class FormWidgetBase extends WidgetBase
return $this->formField->getValueFromData($this->data ?: $this->model, $defaultValue);
}
}

View File

@ -219,6 +219,17 @@ class ListColumn
return $this->align ? 'list-cell-align-' . $this->align : '';
}
/**
* Returns a raw config item value.
* @param string $value
* @param string $default
* @return mixed
*/
public function getConfig($value, $default = null)
{
return array_get($this->config, $value, $default);
}
/**
* Returns this columns value from a supplied data set, which can be
* an array or a model or another generic collection.

View File

@ -3,6 +3,10 @@
use Event;
use BackendAuth;
use System\Classes\PluginManager;
use Validator;
use SystemException;
use Log;
use Config;
/**
* Manages the backend navigation.
@ -124,7 +128,9 @@ class NavigationManager
*/
$orderCount = 0;
foreach ($item->sideMenu as $sideMenuItem) {
if ($sideMenuItem->order !== -1) continue;
if ($sideMenuItem->order !== -1) {
continue;
}
$sideMenuItem->order = ($orderCount += 100);
}
@ -148,7 +154,7 @@ class NavigationManager
* `registerMenuItems` method. The manager instance is passed to the callback
* function as an argument. Usage:
*
* BackendMenu::registerCallback(function($manager){
* BackendMenu::registerCallback(function ($manager) {
* $manager->registerMenuItems([...]);
* });
*
@ -193,6 +199,24 @@ class NavigationManager
$this->items = [];
}
$validator = Validator::make($definitions, [
'*.label' => 'required',
'*.icon' => 'required_without:*.iconSvg',
'*.url' => 'required',
'*.sideMenu.*.label' => 'nullable|required',
'*.sideMenu.*.icon' => 'nullable|required_without:*.sideMenu.*.iconSvg',
'*.sideMenu.*.url' => 'nullable|required',
]);
if ($validator->fails()) {
$errorMessage = 'Invalid menu item detected in ' . $owner . '. Contact the plugin author to fix (' . $validator->errors()->first() . ')';
if (Config::get('app.debug', false)) {
throw new SystemException($errorMessage);
} else {
Log::error($errorMessage);
}
}
$this->addMainMenuItems($owner, $definitions);
}
@ -530,4 +554,4 @@ class NavigationManager
{
return strtoupper($owner).'.'.strtoupper($code);
}
}
}

View File

@ -2,6 +2,7 @@
use Str;
use BackendAuth;
use SystemException;
use System\Classes\PluginManager;
use Event;
@ -115,10 +116,9 @@ class WidgetManager
}
/**
* Manually registers form widget for consideration.
* Usage:
* Manually registers form widget for consideration. Usage:
*
* WidgetManager::registerFormWidgets(function($manager){
* WidgetManager::registerFormWidgets(function ($manager) {
* $manager->registerFormWidget('Backend\FormWidgets\CodeEditor', 'codeeditor');
* });
*
@ -200,7 +200,7 @@ class WidgetManager
*
* Example usage:
*
* Event::listen('system.reportwidgets.extendItems', function($manager) {
* Event::listen('system.reportwidgets.extendItems', function ($manager) {
* $manager->removeReportWidget('Acme\ReportWidgets\YourWidget');
* });
*
@ -219,6 +219,15 @@ class WidgetManager
return $this->reportWidgets;
}
/**
* Returns the raw array of registered report widgets.
* @return array Array keys are class names.
*/
public function getReportWidgets()
{
return $this->reportWidgets;
}
/*
* Registers a single report widget.
*/
@ -228,10 +237,9 @@ class WidgetManager
}
/**
* Manually registers report widget for consideration.
* Usage:
* Manually registers report widget for consideration. Usage:
*
* WidgetManager::registerReportWidgets(function($manager){
* WidgetManager::registerReportWidgets(function ($manager) {
* $manager->registerReportWidget('RainLab\GoogleAnalytics\ReportWidgets\TrafficOverview', [
* 'name' => 'Google Analytics traffic overview',
* 'context' => 'dashboard'
@ -257,4 +265,4 @@ class WidgetManager
unset($this->reportWidgets[$className]);
}
}
}

View File

@ -3,6 +3,7 @@
use Mail;
use Flash;
use Backend;
use Request;
use Validator;
use BackendAuth;
use Backend\Models\AccessLog;
@ -11,6 +12,7 @@ use System\Classes\UpdateManager;
use ApplicationException;
use ValidationException;
use Exception;
use Config;
/**
* Authentication controller
@ -33,21 +35,6 @@ class Auth extends Controller
{
parent::__construct();
$this->middleware(function ($request, $response) {
// Clear Cache and any previous data to fix Invalid security token issue, see github: #3707
$response->headers->set('Cache-Control', 'no-cache, no-store, must-revalidate');
})->only('signin');
// Only run on HTTPS connections
if (isset($_SERVER["HTTPS"]) && $_SERVER["HTTPS"] === "on") {
$this->middleware(function ($request, $response) {
// Add HTTP Header 'Clear Site Data' to remove all Sensitive Data when signout, see github issue: #3707
$response->headers->set('Clear-Site-Data', 'cache, cookies, storage, executionContexts');
})->only('signout');
}
// Add JS File to un-install SW to avoid Cookie Cache Issues when Signin, see github issue: #3707
$this->addJs(url("/modules/backend/assets/js/auth/uninstall-sw.js"));
$this->layout = 'auth';
}
@ -66,14 +53,16 @@ class Auth extends Controller
{
$this->bodyClass = 'signin';
// Clear Cache and any previous data to fix invalid security token issue
$this->setResponseHeader('Cache-Control', 'no-cache, no-store, must-revalidate');
try {
if (post('postback')) {
return $this->signin_onSubmit();
}
$this->bodyClass .= ' preload';
}
catch (Exception $ex) {
} catch (Exception $ex) {
Flash::error($ex->getMessage());
}
}
@ -90,7 +79,7 @@ class Auth extends Controller
throw new ValidationException($validation);
}
if (($remember = config('cms.backendForceRemember', true)) === null) {
if (is_null($remember = Config::get('cms.backendForceRemember', true))) {
$remember = (bool) post('remember');
}
@ -100,12 +89,17 @@ class Auth extends Controller
'password' => post('password')
], $remember);
try {
// Load version updates
UpdateManager::instance()->update();
if (is_null($runMigrationsOnLogin = Config::get('cms.runMigrationsOnLogin', null))) {
$runMigrationsOnLogin = Config::get('app.debug', false);
}
catch (Exception $ex) {
Flash::error($ex->getMessage());
if ($runMigrationsOnLogin) {
try {
// Load version updates
UpdateManager::instance()->update();
} catch (Exception $ex) {
Flash::error($ex->getMessage());
}
}
// Log the sign in event
@ -126,6 +120,11 @@ class Auth extends Controller
BackendAuth::logout();
}
// Add HTTP Header 'Clear Site Data' to purge all sensitive data upon signout
if (Request::secure()) {
$this->setResponseHeader('Clear-Site-Data', 'cache, cookies, storage, executionContexts');
}
return Backend::redirect('backend');
}
@ -138,12 +137,14 @@ class Auth extends Controller
if (post('postback')) {
return $this->restore_onSubmit();
}
}
catch (Exception $ex) {
} catch (Exception $ex) {
Flash::error($ex->getMessage());
}
}
/**
* Submits the restore form.
*/
public function restore_onSubmit()
{
$rules = [
@ -165,7 +166,7 @@ class Auth extends Controller
Flash::success(trans('backend::lang.account.restore_success'));
$code = $user->getResetPasswordCode();
$link = Backend::url('backend/auth/reset/'.$user->id.'/'.$code);
$link = Backend::url('backend/auth/reset/' . $user->id . '/' . $code);
$data = [
'name' => $user->full_name,
@ -192,8 +193,7 @@ class Auth extends Controller
if (!$userId || !$code) {
throw new ApplicationException(trans('backend::lang.account.reset_error'));
}
}
catch (Exception $ex) {
} catch (Exception $ex) {
Flash::error($ex->getMessage());
}
@ -201,6 +201,9 @@ class Auth extends Controller
$this->vars['id'] = $userId;
}
/**
* Submits the reset form.
*/
public function reset_onSubmit()
{
if (!post('id') || !post('code')) {

View File

@ -30,7 +30,8 @@ class Files extends Controller
try {
return $this->findFileObject($code)->output('inline', true);
}
catch (Exception $ex) {}
catch (Exception $ex) {
}
return Response::make(View::make('backend::404'), 404);
}
@ -48,7 +49,8 @@ class Files extends Controller
true
);
}
catch (Exception $ex) {}
catch (Exception $ex) {
}
return Response::make(View::make('backend::404'), 404);
}
@ -77,11 +79,18 @@ class Files extends Controller
if (empty($path)) {
$path = $file->getDiskPath();
}
$expires = now()->addSeconds(Config::get('cms.storage.uploads.temporaryUrlTTL', 3600));
$url = Cache::remember('backend.file:' . $path, $expires, function () use ($disk, $path, $expires) {
return $disk->temporaryUrl($path, $expires);
});
// Check to see if the URL has already been generated
$pathKey = 'backend.file:' . $path;
$url = Cache::get($pathKey);
// The AWS S3 storage drivers will return a valid temporary URL even if the file does not exist
if (is_null($url) && $disk->exists($path)) {
$expires = now()->addSeconds(Config::get('cms.storage.uploads.temporaryUrlTTL', 3600));
$url = Cache::remember($pathKey, $expires, function () use ($disk, $path, $expires) {
return $disk->temporaryUrl($path, $expires);
});
}
}
return $url;

View File

@ -71,7 +71,9 @@ class Index extends Controller
protected function checkPermissionRedirect()
{
if (!$this->user->hasAccess('backend.access_dashboard')) {
$true = function () { return true; };
$true = function () {
return true;
};
if ($first = array_first(BackendMenu::listMainMenuItems(), $true)) {
return Redirect::intended($first->url);
}

View File

@ -51,7 +51,7 @@ class UserRoles extends Controller
/*
* Only super users can access
*/
$this->bindEvent('page.beforeDisplay', function() {
$this->bindEvent('page.beforeDisplay', function () {
if (!$this->user->isSuperUser()) {
return Response::make(View::make('backend::access_denied'), 403);
}

View File

@ -36,11 +36,10 @@
</button>
<button
type="button"
class="btn btn-danger pull-right"
class="oc-icon-trash-o btn-icon danger pull-right"
data-request="onDelete"
data-load-indicator="<?= e(trans('backend::lang.form.deleting')) ?>"
data-request-confirm="<?= e(trans('backend::lang.user.group.delete_confirm')) ?>">
<?= e(trans('backend::lang.form.delete')) ?>
</button>
</div>
</div>

View File

@ -36,11 +36,10 @@
</button>
<button
type="button"
class="btn btn-danger pull-right"
class="oc-icon-trash-o btn-icon danger pull-right"
data-request="onDelete"
data-load-indicator="<?= e(trans('backend::lang.form.deleting')) ?>"
data-request-confirm="<?= e(trans('backend::lang.user.role.delete_confirm')) ?>">
<?= e(trans('backend::lang.form.delete')) ?>
</button>
</div>
</div>

View File

@ -88,7 +88,8 @@ class DbBackendUserRoles extends Migration
'permissions' => $group->permissions ?? null
]);
}
catch (Exception $ex) {}
catch (Exception $ex) {
}
$permissions[$group->id] = $group->permissions ?? null;
}
@ -130,7 +131,8 @@ class DbBackendUserRoles extends Migration
$perms = json_decode($permString, true);
$userPerms = array_merge($userPerms, $perms);
}
catch (Exception $ex) {}
catch (Exception $ex) {
}
}
if (count($userPerms) > 0) {
@ -157,6 +159,7 @@ class DbBackendUserRoles extends Migration
'permissions' => json_encode($newPerms)
]);
}
catch (Exception $ex) {}
catch (Exception $ex) {
}
}
}

View File

@ -215,5 +215,4 @@ class CodeEditor extends FormWidgetBase
$this->displayIndentGuides = $preferences->editor_display_indent_guides;
$this->showPrintMargin = $preferences->editor_show_print_margin;
}
}

View File

@ -165,25 +165,35 @@ class DataTable extends FormWidgetBase
}
/**
* Dropdown/autocomplete option callback handler
*
* Looks at the model for getXXXDataTableOptions or getDataTableOptions methods
* to obtain values for autocomplete field types.
* @param string $field Table field name
* @param string $data Data for the entire table
* @return array
* to obtain values for autocomplete and dropdown column types.
*
* @param string $columnName The name of the column to pass through to the callback.
* @param array $rowData The data provided for the current row in the datatable.
* @return array The options to make available to the dropdown or autocomplete, in format ["value" => "label"]
*/
public function getDataTableOptions($field, $data)
public function getDataTableOptions($columnName, $rowData)
{
$methodName = 'get'.studly_case($this->fieldName).'DataTableOptions';
$methodName = 'get' . studly_case($this->fieldName) . 'DataTableOptions';
if (!$this->model->methodExists($methodName) && !$this->model->methodExists('getDataTableOptions')) {
throw new ApplicationException(Lang::get('backend::lang.model.missing_method', ['class' => get_class($this->model), 'method' => 'getDataTableOptions']));
throw new ApplicationException(
Lang::get(
'backend::lang.model.missing_method',
[
'class' => get_class($this->model),
'method' => 'getDataTableOptions'
]
)
);
}
if ($this->model->methodExists($methodName)) {
$result = $this->model->$methodName($field, $data);
}
else {
$result = $this->model->getDataTableOptions($this->fieldName, $field, $data);
$result = $this->model->$methodName($columnName, $rowData);
} else {
$result = $this->model->getDataTableOptions($this->fieldName, $columnName, $rowData);
}
if (!is_array($result)) {
@ -192,5 +202,4 @@ class DataTable extends FormWidgetBase
return $result;
}
}

View File

@ -122,7 +122,7 @@ class DatePicker extends FormWidgetBase
if ($this->mode === 'date' && !$this->ignoreTimezone) {
$backendTimeZone = \Backend\Models\Preference::get('timezone');
$value->setTimezone($backendTimeZone);
$value->setTime(0,0,0);
$value->setTime(0, 0, 0);
$value->setTimezone(Config::get('app.timezone'));
}
$value = $value->toDateTimeString();

View File

@ -8,7 +8,6 @@ use Validator;
use Backend\Widgets\Form;
use Backend\Classes\FormField;
use Backend\Classes\FormWidgetBase;
use Backend\Controllers\Files as FilesController;
use October\Rain\Filesystem\Definitions as FileDefinitions;
use ApplicationException;
use ValidationException;
@ -60,6 +59,11 @@ class FileUpload extends FormWidgetBase
*/
public $mimeTypes = false;
/**
* @var mixed Max file size.
*/
public $maxFilesize;
/**
* @var array Options used for generating thumbnails.
*/
@ -97,11 +101,14 @@ class FileUpload extends FormWidgetBase
*/
public function init()
{
$this->maxFilesize = $this->getUploadMaxFilesize();
$this->fillFromConfig([
'prompt',
'imageWidth',
'imageHeight',
'fileTypes',
'maxFilesize',
'mimeTypes',
'thumbOptions',
'useCaption',
@ -137,6 +144,10 @@ class FileUpload extends FormWidgetBase
$this->useCaption = false;
}
if ($this->maxFilesize > $this->getUploadMaxFilesize()) {
throw new ApplicationException('Maximum allowed size for uploaded files: ' . $this->getUploadMaxFilesize());
}
$this->vars['fileList'] = $fileList = $this->getFileList();
$this->vars['singleFile'] = $fileList->first();
$this->vars['displayMode'] = $this->getDisplayMode();
@ -144,6 +155,7 @@ class FileUpload extends FormWidgetBase
$this->vars['imageHeight'] = $this->imageHeight;
$this->vars['imageWidth'] = $this->imageWidth;
$this->vars['acceptedFileTypes'] = $this->getAcceptedFileTypes(true);
$this->vars['maxFilesize'] = $this->maxFilesize;
$this->vars['cssDimensions'] = $this->getCssDimensions();
$this->vars['cssBlockDimensions'] = $this->getCssDimensions('block');
$this->vars['useCaption'] = $this->useCaption;
@ -394,10 +406,7 @@ class FileUpload extends FormWidgetBase
protected function loadAssets()
{
$this->addCss('css/fileupload.css', 'core');
$this->addJs('js/fileupload.js', [
'build' => 'core',
'cache' => 'false'
]);
$this->addJs('js/fileupload.js', 'core');
}
/**
@ -487,25 +496,10 @@ class FileUpload extends FormWidgetBase
*/
protected function decorateFileAttributes($file)
{
/*
* File is protected, create a secure public path
*/
if (!$file->isPublic()) {
$path = $thumb = FilesController::getDownloadUrl($file);
$path = $thumb = $file->getPath();
if ($this->imageWidth || $this->imageHeight) {
$thumb = FilesController::getThumbUrl($file, $this->imageWidth, $this->imageHeight, $this->thumbOptions);
}
}
/*
* Otherwise use public paths
*/
else {
$path = $thumb = $file->getPath();
if ($this->imageWidth || $this->imageHeight) {
$thumb = $file->getThumb($this->imageWidth, $this->imageHeight, $this->thumbOptions);
}
if ($this->imageWidth || $this->imageHeight) {
$thumb = $file->getThumb($this->imageWidth, $this->imageHeight, $this->thumbOptions);
}
$file->pathUrl = $path;
@ -513,4 +507,20 @@ class FileUpload extends FormWidgetBase
return $file;
}
/**
* Return max upload filesize in Mb
* @return integer
*/
protected function getUploadMaxFilesize()
{
$size = ini_get('upload_max_filesize');
if (preg_match('/^([\d\.]+)([KMG])$/i', $size, $match)) {
$pos = array_search($match[2], ['K', 'M', 'G']);
if ($pos !== false) {
$size = $match[1] * pow(1024, $pos + 1);
}
}
return floor($size / 1024 / 1024);
}
}

View File

@ -1,7 +1,8 @@
<?php namespace Backend\FormWidgets;
use System\Classes\MediaLibrary;
use BackendAuth;
use Backend\Classes\FormField;
use System\Classes\MediaLibrary;
use Backend\Classes\FormWidgetBase;
/**
@ -63,7 +64,9 @@ class MediaFinder extends FormWidgetBase
'imageHeight'
]);
if ($this->formField->disabled) {
$user = BackendAuth::getUser();
if ($this->formField->disabled || !$user || !$user->hasAccess('media.manage_media')) {
$this->previewMode = true;
}
}

View File

@ -35,12 +35,17 @@ class NestedForm extends FormWidgetBase
/**
* @inheritDoc
*/
public function init() {
public function init()
{
$this->fillFromConfig([
'form',
'usePanelStyles',
]);
if ($this->formField->disabled) {
$this->previewMode = true;
}
$config = $this->makeConfig($this->form);
$config->model = $this->model;
$config->data = $this->getLoadValue();
@ -48,7 +53,12 @@ class NestedForm extends FormWidgetBase
$config->arrayName = $this->getFieldName();
$config->isNested = true;
if (object_get($this->getParentForm()->config, 'enableDefaults') === true) {
$config->enableDefaults = true;
}
$widget = $this->makeWidget(Form::class, $config);
$widget->previewMode = $this->previewMode;
$widget->bindToController();
$this->formWidget = $widget;
@ -62,13 +72,14 @@ class NestedForm extends FormWidgetBase
/**
* @inheritdoc
*/
function render()
public function render()
{
$this->prepareVars();
return $this->makePartial('nestedform');
}
function prepareVars() {
public function prepareVars()
{
$this->formWidget->previewMode = $this->previewMode;
}
}

View File

@ -7,6 +7,26 @@ use BackendAuth;
* User/group permission editor
* This widget is used by the system internally on the System / Administrators pages.
*
* Available Modes:
* - radio: Default mode, used by user-level permissions.
* Provides three-state control over each available permission. States are
* -1: Explicitly deny the permission
* 0: Inherit the permission's value from a parent source (User inherits from Role)
* 1: Explicitly grant the permission
* - checkbox: Used to define permissions for roles. Intended to define a base of what permissions are available
* Provides two state control over each available permission. States are
* 1: Explicitly allow the permission
* null: If the checkbox is not ticked, the permission will not be sent to the server and will not be stored.
* This is interpreted as the permission not being present and thus not allowed
* - switch: Used to define overriding permissions in a simpler UX than the radio.
* Provides two state control over each available permission. States are
* 1: Explicitly allow the permission
* -1: Explicitly deny the permission
*
* Available permissions can be defined in the form of an array of permission codes to allow:
* NOTE: Users are still not allowed to modify permissions that they themselves do not have access to
* availablePermissions: ['some.author.permission', 'some.other.permission', 'etc.some.system.permission']
*
* @package october\backend
* @author Alexey Bobkov, Samuel Georges
*/
@ -14,7 +34,15 @@ class PermissionEditor extends FormWidgetBase
{
protected $user;
public $mode;
/**
* @var string Mode to display the permission editor with. Available options: radio, checkbox, switch
*/
public $mode = 'radio';
/**
* @var array Permission codes to allow to be interacted with through this widget
*/
public $availablePermissions;
/**
* @inheritDoc
@ -22,7 +50,8 @@ class PermissionEditor extends FormWidgetBase
public function init()
{
$this->fillFromConfig([
'mode'
'mode',
'availablePermissions',
]);
$this->user = BackendAuth::getUser();
@ -51,7 +80,7 @@ class PermissionEditor extends FormWidgetBase
$permissionsData = [];
}
$this->vars['checkboxMode'] = $this->getControlMode() === 'checkbox';
$this->vars['mode'] = $this->mode;
$this->vars['permissions'] = $this->getFilteredPermissions();
$this->vars['baseFieldName'] = $this->getFieldName();
$this->vars['permissionsData'] = $permissionsData;
@ -79,11 +108,6 @@ class PermissionEditor extends FormWidgetBase
$this->addJs('js/permissioneditor.js', 'core');
}
protected function getControlMode()
{
return strlen($this->mode) ? $this->mode : 'radio';
}
/**
* Returns a safely parsed set of permissions, ensuring the user cannot elevate
* their own permissions or permissions of another user above their own.
@ -117,19 +141,19 @@ class PermissionEditor extends FormWidgetBase
/**
* Returns the available permissions; removing those that the logged-in user does not have access to
*
* @return array The permissions that the logged-in user does have access to
* @return array The permissions that the logged-in user does have access to ['permission-tab' => $arrayOfAllowedPermissionObjects]
*/
protected function getFilteredPermissions()
{
$permissions = BackendAuth::listTabbedPermissions();
if ($this->user->isSuperUser()) {
return $permissions;
}
foreach ($permissions as $tab => $permissionsArray) {
foreach ($permissionsArray as $index => $permission) {
if (!$this->user->hasAccess($permission->code)) {
if (!$this->user->hasAccess($permission->code) ||
(
is_array($this->availablePermissions) &&
!in_array($permission->code, $this->availablePermissions)
)) {
unset($permissionsArray[$index]);
}
}

View File

@ -3,7 +3,7 @@
use Db;
use Backend\Classes\FormField;
use Backend\Classes\FormWidgetBase;
use Illuminate\Database\Eloquent\Relations\Relation as RelationBase;
use October\Rain\Database\Relations\Relation as RelationBase;
/**
* Form Relationship
@ -40,6 +40,11 @@ class Relation extends FormWidgetBase
*/
public $scope;
/**
* @var string Define the order of the list query.
*/
public $order;
//
// Object properties
//
@ -63,6 +68,7 @@ class Relation extends FormWidgetBase
'nameFrom',
'emptyOption',
'scope',
'order',
]);
if (isset($this->config->select)) {
@ -109,6 +115,12 @@ class Relation extends FormWidgetBase
$field->type = 'dropdown';
}
// Order query by the configured option.
if ($this->order) {
// Using "raw" to allow authors to use a string to define the order clause.
$query->orderByRaw($this->order);
}
// It is safe to assume that if the model and related model are of
// the exact same class, then it cannot be related to itself
if ($model->exists && (get_class($model) == get_class($relationModel))) {

View File

@ -3,7 +3,6 @@
use Lang;
use ApplicationException;
use Backend\Classes\FormWidgetBase;
use October\Rain\Html\Helper as HtmlHelper;
/**
* Repeater Form Widget
@ -22,7 +21,7 @@ class Repeater extends FormWidgetBase
/**
* @var string Prompt text for adding new items.
*/
public $prompt = 'Add new item';
public $prompt;
/**
* @var bool Items can be sorted.
@ -53,11 +52,6 @@ class Repeater extends FormWidgetBase
*/
protected $defaultAlias = 'repeater';
/**
* @var int Count of repeated items.
*/
protected $indexCount = 0;
/**
* @var array Meta data associated to each field, organised by index
*/
@ -73,6 +67,20 @@ class Repeater extends FormWidgetBase
*/
protected static $onAddItemCalled = false;
/**
* Determines if a child repeater has made an AJAX request to add an item
*
* @var bool
*/
protected $childAddItemCalled = false;
/**
* Determines which child index has made the AJAX request to add an item
*
* @var int
*/
protected $childIndexCalled;
protected $useGroups = false;
protected $groupDefinitions = [];
@ -89,6 +97,8 @@ class Repeater extends FormWidgetBase
*/
public function init()
{
$this->prompt = Lang::get('backend::lang.repeater.add_new_item');
$this->fillFromConfig([
'form',
'prompt',
@ -107,8 +117,7 @@ class Repeater extends FormWidgetBase
$this->loaded = true;
}
$fieldName = $this->formField->getName(false);
$this->checkAddItemRequest();
$this->processGroupMode();
if (!self::$onAddItemCalled) {
@ -213,11 +222,30 @@ class Repeater extends FormWidgetBase
? post($this->formField->getName())
: $this->getLoadValue();
if ($currentValue === null) {
$this->indexCount = 0;
// Detect when a child widget is trying to run an AJAX handler
// outside of the form element that contains all the repeater
// fields that would normally be used to identify that case
$handler = $this->controller->getAjaxHandler();
if (!$this->loaded && starts_with($handler, $this->alias . 'Form')) {
// Attempt to get the index of the repeater
$handler = str_after($handler, $this->alias . 'Form');
preg_match("~^(\d+)~", $handler, $matches);
if (isset($matches[1])) {
$index = $matches[1];
$this->makeItemFormWidget($index);
}
}
if (!$this->childAddItemCalled && $currentValue === null) {
$this->formWidgets = [];
return;
}
}
if ($this->childAddItemCalled && !isset($currentValue[$this->childIndexCalled])) {
// If no value is available but a child repeater has added an item, add a "stub" repeater item
$this->makeItemFormWidget($this->childIndexCalled);
}
// Ensure that the minimum number of items are preinitialized
// ONLY DONE WHEN NOT IN GROUP MODE
@ -233,16 +261,14 @@ class Repeater extends FormWidgetBase
}
}
}
if (!is_array($currentValue)) {
return;
}
collect($currentValue)->each(function ($value, $index) {
$this->makeItemFormWidget($index, array_get($value, '_group', null));
});
$this->indexCount = max(count($currentValue), $this->indexCount);
}
/**
@ -260,7 +286,7 @@ class Repeater extends FormWidgetBase
$config = $this->makeConfig($configDefinition);
$config->model = $this->model;
$config->data = $this->getValueFromIndex($index);
$config->alias = $this->alias . 'Form'.$index;
$config->alias = $this->alias . 'Form' . $index;
$config->arrayName = $this->getFieldName().'['.$index.']';
$config->isNested = true;
if (self::$onAddItemCalled || $this->minItems > 0) {
@ -268,6 +294,7 @@ class Repeater extends FormWidgetBase
}
$widget = $this->makeWidget('Backend\Widgets\Form', $config);
$widget->previewMode = $this->previewMode;
$widget->bindToController();
$this->indexMeta[$index] = [
@ -300,19 +327,16 @@ class Repeater extends FormWidgetBase
public function onAddItem()
{
self::$onAddItemCalled = true;
$groupCode = post('_repeater_group');
$index = $this->getNextIndex();
$this->prepareVars();
$this->vars['widget'] = $this->makeItemFormWidget($this->indexCount, $groupCode);
$this->vars['indexValue'] = $this->indexCount;
$this->vars['widget'] = $this->makeItemFormWidget($index, $groupCode);
$this->vars['indexValue'] = $index;
$itemContainer = '@#' . $this->getId('items');
// Increase index count after item is created
++$this->indexCount;
return [
$itemContainer => $this->makePartial('repeater_item')
];
@ -333,6 +357,65 @@ class Repeater extends FormWidgetBase
return $widget->onRefresh();
}
/**
* Determines the next available index number for assigning to a new repeater item.
*
* @return int
*/
protected function getNextIndex()
{
if ($this->loaded === true) {
$data = post($this->formField->getName());
if (is_array($data) && count($data)) {
return (max(array_keys($data)) + 1);
}
} else {
$data = $this->getLoadValue();
if (is_array($data)) {
return count($data);
}
}
return 0;
}
/**
* Determines the repeater that has triggered an AJAX request to add an item.
*
* @return void
*/
protected function checkAddItemRequest()
{
$handler = $this->getParentForm()
->getController()
->getAjaxHandler();
if ($handler === null || strpos($handler, '::') === false) {
return;
}
list($widgetName, $handlerName) = explode('::', $handler);
if ($handlerName !== 'onAddItem') {
return;
}
if ($this->alias === $widgetName) {
// This repeater has made the AJAX request
self::$onAddItemCalled = true;
} else if (strpos($widgetName, $this->alias) === 0) {
// A child repeater has made the AJAX request
// Get index from AJAX handler
$handlerSuffix = str_replace($this->alias . 'Form', '', $widgetName);
preg_match('/^[0-9]+/', $handlerSuffix, $matches);
$this->childAddItemCalled = true;
$this->childIndexCalled = (int) $matches[0];
}
}
//
// Group mode
//

View File

@ -1,10 +1,12 @@
<?php namespace Backend\FormWidgets;
use App;
use Config;
use File;
use Event;
use Lang;
use Request;
use Backend;
use BackendAuth;
use Backend\Classes\FormWidgetBase;
use Backend\Models\EditorSetting;
@ -131,7 +133,16 @@ class RichEditor extends FormWidgetBase
{
$this->addCss('css/richeditor.css', 'core');
$this->addJs('js/build-min.js', 'core');
$this->addJs('js/build-plugins-min.js', 'core');
if (Config::get('develop.decompileBackendAssets', false)) {
$scripts = Backend::decompileAsset($this->getAssetPath('js/build-plugins.js'));
foreach ($scripts as $script) {
$this->addJs($script, 'core');
}
} else {
$this->addJs('js/build-plugins-min.js', 'core');
}
$this->addJs('/modules/backend/formwidgets/codeeditor/assets/js/build-min.js', 'core');
if ($lang = $this->getValidEditorLang()) {
@ -217,8 +228,8 @@ class RichEditor extends FormWidgetBase
$iterator = function ($links, $level = 0) use (&$iterator) {
$result = [];
foreach ($links as $linkUrl => $link) {
foreach ($links as $linkUrl => $link) {
/*
* Remove scheme and host from URL
*/

View File

@ -1,6 +1,7 @@
<?php namespace Backend\FormWidgets;
use Backend\Classes\FormWidgetBase;
use October\Rain\Database\Relations\Relation as RelationBase;
/**
* Tag List Form Widget
@ -168,7 +169,15 @@ class TagList extends FormWidgetBase
$options = $this->formField->options();
if (!$options && $this->mode === static::MODE_RELATION) {
$options = $this->getRelationModel()->lists($this->nameFrom);
$options = RelationBase::noConstraints(function () {
$query = $this->getRelationObject()->newQuery();
// Even though "no constraints" is applied, belongsToMany constrains the query
// by joining its pivot table. Remove all joins from the query.
$query->getQuery()->getQuery()->joins = [];
return $query->lists($this->nameFrom);
});
}
return $options;
@ -198,9 +207,10 @@ class TagList extends FormWidgetBase
protected function getSeparatorCharacter()
{
switch (strtolower($this->separator)) {
case 'comma': return ',';
case 'space': return ' ';
case 'comma':
return ',';
case 'space':
return ' ';
}
}
}

View File

@ -7,21 +7,21 @@
.field-codeeditor.size-huge {min-height:250px}
.field-codeeditor.size-giant {min-height:350px}
.field-codeeditor .ace_search {font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol";font-size:14px;color:#333;z-index:13}
.field-codeeditor .ace_search .ace_search_form.ace_nomatch {outline:none !important}
.field-codeeditor .ace_search .ace_search_form.ace_nomatch .ace_search_field {border:.0625rem solid red;-webkit-box-shadow:0 0 .1875rem .125rem red;box-shadow:0 0 .1875rem .125rem red;z-index:1;position:relative}
.field-codeeditor .editor-code {-webkit-border-radius:3px;-moz-border-radius:3px;border-radius:3px}
.field-codeeditor .editor-toolbar {position:absolute;top:-30px;right:35px;z-index:10}
.field-codeeditor .editor-toolbar {position:absolute;padding:0 5px;bottom:10px;right:25px;z-index:10;background:rgba(0,0,0,0.8);border-radius:5px}
.field-codeeditor .editor-toolbar >ul,
.field-codeeditor .editor-toolbar ul >li {list-style-type:none;padding:0;margin:0}
.field-codeeditor .editor-toolbar >ul >li {float:left}
.field-codeeditor .editor-toolbar >ul >li .tooltip.left {margin-right:25px}
.field-codeeditor .editor-toolbar >ul >li >a {display:block;height:25px;width:25px;color:#666;font-size:20px;text-align:center;text-decoration:none}
.field-codeeditor .editor-toolbar >ul >li >a {display:block;height:25px;width:25px;color:#666;font-size:20px;text-align:center;text-decoration:none;text-shadow:0 0 5px #000}
.field-codeeditor .editor-toolbar >ul >li >a >abbr {position:absolute;font:0/0 a;color:transparent;text-shadow:none;background-color:transparent;border:0}
.field-codeeditor .editor-toolbar >ul >li >a >i {opacity:0.7;filter:alpha(opacity=70);display:block}
.field-codeeditor .editor-toolbar >ul >li >a >i {opacity:1;filter:alpha(opacity=100);display:block}
.field-codeeditor .editor-toolbar >ul >li >a >i:before {font-size:15px}
.field-codeeditor .editor-toolbar >ul >li >a:hover >i,
.field-codeeditor .editor-toolbar >ul >li >a:focus >i {opacity:1;filter:alpha(opacity=100)}
.field-codeeditor .editor-toolbar >ul >li >a:focus >i {opacity:1;filter:alpha(opacity=100);color:#fff}
.field-codeeditor.editor-fullscreen {z-index:301;position:fixed !important;top:0;left:0;height:100%;border-width:0;-webkit-border-radius:0;-moz-border-radius:0;border-radius:0}
.field-codeeditor.editor-fullscreen .editor-toolbar {z-index:302}
.field-codeeditor.editor-fullscreen .editor-code {-webkit-border-radius:0;-moz-border-radius:0;border-radius:0}
.field-codeeditor.editor-fullscreen .editor-toolbar {z-index:302;border-radius:0 0 5px 5px;right:25px;background-color:#ddd;border:1px solid #cbcbcb;border-right-color:#cbcbcb;border-right-style:solid;border-right-width:1px;border-top:0 none;max-width:125px;overflow:hidden;margin:0;padding:4px;position:absolute;top:0;white-space:normal}
.field-codeeditor.editor-fullscreen .editor-toolbar >ul >li >a {color:#666}
.field-codeeditor.editor-fullscreen .ace_search {z-index:303}
.field-codeeditor .secondary-tabs .editor-toolbar >ul >li >a {color:#fff}
.field-codeeditor.editor-fullscreen .ace_search {z-index:303}

View File

@ -4586,7 +4586,7 @@ ace.require('ace/config').set('basePath',this.options.vendorPath)
editor.setOptions({enableEmmet:options.enableEmmet,enableBasicAutocompletion:options.autocompletion==='basic',enableSnippets:options.enableSnippets,enableLiveAutocompletion:options.autocompletion==='live'})
editor.renderer.setScrollMargin(options.margin,options.margin,0,0)
editor.renderer.setPadding(options.margin)
this.$toolbar.find('>ul>li>a').each(function(){var abbr=$(this).find('>abbr'),label=abbr.text(),help=abbr.attr('title'),title=label+' (<strong>'+help+'</strong>)';$(this).attr('title',title)}).tooltip({delay:500,placement:'bottom',html:true});this.$fullscreenDisable.hide()
this.$toolbar.find('>ul>li>a').each(function(){var abbr=$(this).find('>abbr'),label=abbr.text(),help=abbr.attr('title'),title=label+' (<strong>'+help+'</strong>)';$(this).attr('title',title)}).tooltip({delay:500,placement:'top',html:true});this.$fullscreenDisable.hide()
this.$fullscreenEnable.on('click.codeeditor','>a',$.proxy(this.toggleFullscreen,this))
this.$fullscreenDisable.on('click.codeeditor','>a',$.proxy(this.toggleFullscreen,this))
this.$searchboxDisable.hide()

View File

@ -5,7 +5,7 @@
* - data-control="codeeditor" - enables the code editor plugin
* - data-vendor-path="/" - sets the path to find Ace editor files
* - data-language="php" - set the coding language used
* - data-theme="textmate" - the colour scheme and theme
* - data-theme="textmate" - the colour scheme and theme
*
* JavaScript API:
* $('textarea').codeEditor({ vendorPath: '/', language: 'php '})
@ -186,7 +186,7 @@
})
.tooltip({
delay: 500,
placement: 'bottom',
placement: 'top',
html: true
})
;
@ -201,7 +201,7 @@
this.$replaceboxDisable.hide()
this.$replaceboxEnable.on('click.codeeditor', '>a', $.proxy(this.toggleReplacebox, this))
this.$replaceboxDisable.on('click.codeeditor', '>a', $.proxy(this.toggleReplacebox, this))
this.$replaceboxDisable.on('click.codeeditor', '>a', $.proxy(this.toggleReplacebox, this))
/*
* Hotkeys
@ -372,11 +372,11 @@
this.editor.resize()
this.editor.focus()
}
CodeEditor.prototype.toggleSearchbox = function() {
this.$searchboxEnable.toggle()
this.$searchboxDisable.toggle()
this.editor.execCommand("find")
this.editor.resize()
@ -386,7 +386,7 @@
CodeEditor.prototype.toggleReplacebox = function() {
this.$replaceboxEnable.toggle()
this.$replaceboxDisable.toggle()
this.editor.execCommand("replace")
this.editor.resize()
@ -406,7 +406,7 @@
var options = $.extend({}, CodeEditor.DEFAULTS, $this.data(), typeof option == 'object' && option)
if (!data) $this.data('oc.codeEditor', (data = new CodeEditor(this, options)))
if (typeof option == 'string') result = data[option].apply(data, args)
if (typeof result != 'undefined') return false
if (typeof result != 'undefined') return false
})
return result ? result : this

View File

@ -1,10 +1,5 @@
@import "../../../../assets/less/core/boot.less";
@color_1: #666;
@color_2: #fff;
@background_color_1: #ddd;
@border_right_color_1: #cbcbcb;
.field-codeeditor {
width: 100%;
position: relative;
@ -25,6 +20,19 @@
font-size: 14px;
color: @text-color;
z-index: @zindex-form + 3;
// Fixes double focus on search box
.ace_search_form.ace_nomatch {
outline: none !important;
.ace_search_field {
border: .0625rem solid red;
-webkit-box-shadow: 0 0 .1875rem .125rem red;
box-shadow: 0 0 .1875rem .125rem red;
z-index: 1;
position: relative;
}
}
}
.editor-code {
@ -33,9 +41,13 @@
.editor-toolbar {
position: absolute;
top: -30px;
right: 35px;
padding: 0 5px;
bottom: 10px;
right: 25px;
z-index: @zindex-form;
background: rgba(0,0,0,.8);
border-radius: 5px;
> ul, ul > li { list-style-type: none; padding: 0; margin: 0; }
> ul > li {
float: left;
@ -52,71 +64,40 @@
font-size: 20px;
text-align: center;
text-decoration: none;
text-shadow: 0 0 5px #000;
> abbr {
position: absolute;
.text-hide();
}
> i {
.opacity(.7);
.opacity(1);
display: block;
&:before {
font-size: 15px;
}
}
&:hover, &:focus {
> i { .opacity(1); }
> i {
.opacity(1);
color: #fff;
}
}
}
}
&.editor-fullscreen {
z-index: @zindex-fullscreen + 1;
position: fixed!important;
position: fixed !important;
top: 0;
left: 0;
height: 100%;
border-width: 0;
.border-radius(0);
.editor-code { .border-radius(0); }
.editor-toolbar {
z-index: @zindex-fullscreen + 2;
border-radius: 0 0 5px 5px;
right: 25px;
background-color: @background_color_1;
border: 1px solid #cbcbcb;
border-right-color: @border_right_color_1;
border-right-style: solid;
border-right-width: 1px;
border-top: 0 none;
max-width: 125px;
overflow: hidden;
margin: 0;
padding: 4px;
position: absolute;
top: 0;
white-space: normal;
>ul {
>li {
>a {
color: @color_1;
}
}
}
}
.editor-code { .border-radius(0); }
.ace_search { z-index: @zindex-fullscreen + 3; }
}
.secondary-tabs {
.editor-toolbar {
>ul {
>li {
>a {
color: @color_2;
}
}
}
}
}
}
}

View File

@ -1,151 +1,36 @@
.field-colorpicker > ul {
list-style-type: none;
padding: 0;
margin: 0;
margin-top: -8px;
}
.field-colorpicker > ul li {
float: left;
text-indent: -9999px;
padding: 3px;
margin: 14px 14px 0 0;
cursor: pointer;
border-radius: 3px;
}
.field-colorpicker > ul li span {
display: block;
width: 25px;
height: 25px;
border: 1px solid #cecece;
}
.field-colorpicker > ul li:hover,
.field-colorpicker > ul li.active {
background-color: #cecece;
}
.field-colorpicker > ul li:hover span,
.field-colorpicker > ul li.active span {
border: 1px solid #ffffff;
}
.field-colorpicker > ul li.custom-color {
position: relative;
}
.field-colorpicker > ul li.custom-color span {
border-style: dashed;
}
.field-colorpicker > ul li.custom-color:hover span,
.field-colorpicker > ul li.custom-color.active span {
border-style: solid;
}
.field-colorpicker > ul li.custom-color:before {
text-indent: 0;
font-family: FontAwesome;
font-weight: normal;
font-style: normal;
text-decoration: inherit;
-webkit-font-smoothing: antialiased;
*margin-right: .3em;
content: "\f0d8";
display: block;
text-align: center;
color: #000;
background: #e0e0e0;
font-size: 9px;
height: 9px;
line-height: 9px;
width: 9px;
position: absolute;
bottom: 3px;
right: 3px;
}
.field-colorpicker >ul {list-style-type:none;padding:0;margin:0;margin-top:-8px}
.field-colorpicker >ul li {float:left;text-indent:-9999px;padding:3px;margin:14px 14px 0 0;cursor:pointer;border-radius:3px}
.field-colorpicker >ul li span {display:block;width:25px;height:25px;border:1px solid #cecece}
.field-colorpicker >ul li:hover,
.field-colorpicker >ul li.active {background-color:#cecece}
.field-colorpicker >ul li:hover span,
.field-colorpicker >ul li.active span {border:1px solid #fff}
.field-colorpicker >ul li.custom-color {position:relative}
.field-colorpicker >ul li.custom-color span {border-style:dashed}
.field-colorpicker >ul li.custom-color:hover span,
.field-colorpicker >ul li.custom-color.active span {border-style:solid}
.field-colorpicker >ul li.custom-color:before {text-indent:0;font-family:FontAwesome;font-weight:normal;font-style:normal;text-decoration:inherit;-webkit-font-smoothing:antialiased;content:"\f0d8";display:block;text-align:center;color:#000;background:#e0e0e0;font-size:9px;height:9px;line-height:9px;width:9px;position:absolute;bottom:3px;right:3px}
.sp-hue,
.sp-slider {
cursor: row-resize;
}
.sp-slider {cursor:row-resize}
.sp-color,
.sp-dragger {
cursor: crosshair;
}
.sp-dragger {cursor:crosshair}
.sp-alpha-inner,
.sp-alpha-handle {
cursor: col-resize;
}
.sp-hue {
left: 90%;
}
.sp-color {
right: 15%;
}
.sp-container {
border: none;
border-radius: 3px;
z-index: 10100;
-webkit-box-shadow: 0 1px 6px rgba(0, 0, 0, 0.12), 0 1px 4px rgba(0, 0, 0, 0.24);
box-shadow: 0 1px 6px rgba(0, 0, 0, 0.12), 0 1px 4px rgba(0, 0, 0, 0.24);
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
}
.sp-picker-container {
border: none;
}
.sp-alpha-handle {
background-color: #ccc;
border: 1px solid #666;
width: 4px;
}
.sp-alpha-handle {cursor:col-resize}
.sp-hue {left:90%}
.sp-color {right:15%}
.sp-container {border:none;border-radius:3px;z-index:10100;-webkit-box-shadow:0 1px 6px rgba(0,0,0,0.12),0 1px 4px rgba(0,0,0,0.24);box-shadow:0 1px 6px rgba(0,0,0,0.12),0 1px 4px rgba(0,0,0,0.24);font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol"}
.sp-picker-container {border:none}
.sp-alpha-handle {background-color:#ccc;border:1px solid #666;width:4px}
.sp-color,
.sp-hue {
border: 1px solid #ccc;
}
.sp-slider {
background-color: #ccc;
border: 1px solid #666;
height: 3px;
left: -4px;
width: 22px;
}
.sp-dragger {
background: transparent;
box-shadow: 0 0 0 1px #111;
}
.sp-input {
outline: none !important;
-webkit-appearance: none;
border: 1px solid #d1d6d9;
-webkit-box-shadow: inset 0 1px 0 rgba(209, 214, 217, 0.25), 0 1px 0 rgba(255,255,255,.5);
box-shadow: inset 0 1px 0 rgba(209, 214, 217, 0.25), 0 1px 0 rgba(255,255,255,.5);
-webkit-border-radius: 3px;
-moz-border-radius: 3px;
border-radius: 3px;
}
.sp-input:focus {
border: 1px solid #d1d6d9;
}
.sp-button-container {
width: 100%;
position: relative;
text-align: right;
padding-top: 4px;
}
.sp-hue {border:1px solid #ccc}
.sp-slider {background-color:#ccc;border:1px solid #666;height:3px;left:-4px;width:22px}
.sp-dragger {background:transparent;box-shadow:0 0 0 1px #111}
.sp-input {outline:none !important;-webkit-appearance:none;border:1px solid #d1d6d9;-webkit-box-shadow:inset 0 1px 0 rgba(209,214,217,0.25),0 1px 0 rgba(255,255,255,.5);box-shadow:inset 0 1px 0 rgba(209,214,217,0.25),0 1px 0 rgba(255,255,255,.5);-webkit-border-radius:3px;-moz-border-radius:3px;border-radius:3px}
.sp-input:focus {border:1px solid #d1d6d9}
.sp-button-container {width:100%;position:relative;text-align:right;padding-top:4px}
.sp-container button,
.sp-container button:hover,
.sp-container button:active {
text-shadow: none;
font-size: 13px;
text-align: left;
outline: none !important;
font-weight: normal;
-webkit-box-shadow: inset 0 -2px 0 rgba(0,0,0,.15);
box-shadow: inset 0 -2px 0 rgba(0,0,0,.15);
border: 1px solid transparent;
color: #ffffff;
border: none;
background: #656d79;
padding: 1px 7.5px;
font-size: 12px;
line-height: 1.5;
-webkit-border-radius: 3px;
-moz-border-radius: 3px;
border-radius: 3px;
}
.sp-container button:active {text-shadow:none;font-size:13px;text-align:left;outline:none !important;font-weight:normal;-webkit-box-shadow:inset 0 -2px 0 rgba(0,0,0,.15);box-shadow:inset 0 -2px 0 rgba(0,0,0,.15);border:1px solid transparent;color:#fff;border:none;background:#656d79;padding:1px 7.5px;font-size:12px;line-height:1.5;-webkit-border-radius:3px;-moz-border-radius:3px;border-radius:3px}
.sp-container button:hover,
.sp-container button:hover:hover,
.sp-container button:active:hover,
@ -160,11 +45,7 @@
.sp-container button:active.active,
.open .dropdown-toggle.sp-container button,
.open .dropdown-toggle.sp-container button:hover,
.open .dropdown-toggle.sp-container button:active {
color: #ffffff;
background: #1681ba;
border-color: #1681ba;
}
.open .dropdown-toggle.sp-container button:active {color:#fff;background:#1681ba;border-color:#1681ba}
.sp-container button:active,
.sp-container button:hover:active,
.sp-container button:active:active,
@ -173,18 +54,10 @@
.sp-container button:active.active,
.open .dropdown-toggle.sp-container button,
.open .dropdown-toggle.sp-container button:hover,
.open .dropdown-toggle.sp-container button:active {
background: #126896;
border-color: #105b83;
background-image: none;
}
.open .dropdown-toggle.sp-container button:active {background:#126896;border-color:#105b83;background-image:none}
.sp-container button.on,
.sp-container button:hover.on,
.sp-container button:active.on {
background: #494f58;
border-color: #40454d;
background-image: none;
}
.sp-container button:active.on {background:#494f58;border-color:#40454d;background-image:none}
.sp-container button.disabled,
.sp-container button:hover.disabled,
.sp-container button:active.disabled,
@ -214,48 +87,16 @@
.sp-container button:active.disabled.active,
.sp-container button[disabled].active,
.sp-container button:hover[disabled].active,
.sp-container button:active[disabled].active {
background: #656d79;
border-color: #656d79;
}
.sp-container button:active[disabled].active {background:#656d79;border-color:#656d79}
.sp-container button .badge,
.sp-container button:hover .badge,
.sp-container button:active .badge {
color: #656d79;
background: #ffffff;
}
.sp-cancel {
bottom: -3px;
left: 0;
position: absolute;
text-decoration: none;
font-family: serif;
font-size: 21px;
font-weight: bold;
line-height: 1;
color: #000000 !important;
text-shadow: 0 1px 0 #ffffff;
opacity: 0.2;
filter: alpha(opacity=20);
}
.sp-container button:active .badge {color:#656d79;background:#fff}
.sp-cancel {bottom:-3px;left:0;position:absolute;text-decoration:none;font-family:serif;font-size:21px;font-weight:bold;line-height:1;color:#000 !important;text-shadow:0 1px 0 #fff;opacity:0.2;filter:alpha(opacity=20)}
.sp-cancel:hover,
.sp-cancel:focus {
text-decoration: none;
cursor: pointer;
opacity: 0.5;
filter: alpha(opacity=50);
}
.sp-palette-container {
border: none;
float: none;
margin: 0;
padding: 5px 10px 0;
}
.sp-cancel:focus {text-decoration:none;cursor:pointer;opacity:0.5;filter:alpha(opacity=50)}
.sp-palette-container {border:none;float:none;margin:0;padding:5px 10px 0}
.sp-palette .sp-thumb-el,
.sp-palette .sp-thumb-el:hover {
border: 1px solid rgba(0, 0, 0, 0.9);
}
.sp-palette .sp-thumb-el:hover {border:1px solid rgba(0,0,0,0.9)}
.sp-palette .sp-thumb-el:hover,
.sp-palette .sp-thumb-el.sp-thumb-active {
border-color: rgba(0, 0, 0, 0.9);
}
.sp-palette .sp-thumb-el.sp-thumb-active {border-color:rgba(0,0,0,0.9)}
.sp-clear-enabled .sp-clear {left:88%;height:24px;margin-right:-4px}

View File

@ -97,6 +97,10 @@
.siblings().removeClass('active')
this.setColor($item.data('hexColor'))
if($item.data('hexColor').length > 0) {
$item.addClass('sp-clear-display')
}
}
// COLORPICKER PLUGIN DEFINITION

View File

@ -186,3 +186,9 @@
.sp-palette .sp-thumb-el.sp-thumb-active {
border-color: rgba(0, 0, 0, 0.9);
}
.sp-clear-enabled .sp-clear {
left: 88%;
height: 24px;
margin-right: -4px;
}

View File

@ -304,7 +304,7 @@
updateSelectionPaletteFromStorage();
offsetElement.bind("click.spectrum touchstart.spectrum", function (e) {
offsetElement.on("click.spectrum touchstart.spectrum", function (e) {
if (!disabled) {
toggle();
}
@ -325,13 +325,13 @@
// Handle user typed input
textInput.change(setFromTextInput);
textInput.bind("paste", function () {
textInput.on("paste", function () {
setTimeout(setFromTextInput, 1);
});
textInput.keydown(function (e) { if (e.keyCode == 13) { setFromTextInput(); } });
cancelButton.text(opts.cancelText);
cancelButton.bind("click.spectrum", function (e) {
cancelButton.on("click.spectrum", function (e) {
e.stopPropagation();
e.preventDefault();
revert();
@ -339,7 +339,7 @@
});
clearButton.attr("title", opts.clearText);
clearButton.bind("click.spectrum", function (e) {
clearButton.on("click.spectrum", function (e) {
e.stopPropagation();
e.preventDefault();
isEmpty = true;
@ -352,7 +352,7 @@
});
chooseButton.text(opts.chooseText);
chooseButton.bind("click.spectrum", function (e) {
chooseButton.on("click.spectrum", function (e) {
e.stopPropagation();
e.preventDefault();
@ -367,7 +367,7 @@
});
toggleButton.text(opts.showPaletteOnly ? opts.togglePaletteMoreText : opts.togglePaletteLessText);
toggleButton.bind("click.spectrum", function (e) {
toggleButton.on("click.spectrum", function (e) {
e.stopPropagation();
e.preventDefault();
@ -462,9 +462,14 @@
else {
set($(e.target).closest(".sp-thumb-el").data("color"));
move();
updateOriginalInput(true);
// If the picker is going to close immediately, a palette selection
// is a change. Otherwise, it's a move only.
if (opts.hideAfterPaletteSelect) {
hide();
updateOriginalInput(true);
hide();
} else {
updateOriginalInput();
}
}
@ -472,8 +477,8 @@
}
var paletteEvent = IE ? "mousedown.spectrum" : "click.spectrum touchstart.spectrum";
paletteContainer.delegate(".sp-thumb-el", paletteEvent, paletteElementClick);
initialColorContainer.delegate(".sp-thumb-el:nth-child(1)", paletteEvent, { ignore: true }, paletteElementClick);
paletteContainer.on(paletteEvent, ".sp-thumb-el", paletteElementClick);
initialColorContainer.on(paletteEvent, ".sp-thumb-el:nth-child(1)", { ignore: true }, paletteElementClick);
}
function updateSelectionPaletteFromStorage() {
@ -580,13 +585,15 @@
if ((value === null || value === "") && allowEmpty) {
set(null);
updateOriginalInput(true);
move();
updateOriginalInput();
}
else {
var tiny = tinycolor(value);
if (tiny.isValid()) {
set(tiny);
updateOriginalInput(true);
move();
updateOriginalInput();
}
else {
textInput.addClass("sp-validation-error");
@ -620,9 +627,9 @@
hideAll();
visible = true;
$(doc).bind("keydown.spectrum", onkeydown);
$(doc).bind("click.spectrum", clickout);
$(window).bind("resize.spectrum", resize);
$(doc).on("keydown.spectrum", onkeydown);
$(doc).on("click.spectrum", clickout);
$(window).on("resize.spectrum", resize);
replacer.addClass("sp-active");
container.removeClass("sp-hidden");
@ -665,9 +672,9 @@
if (!visible || flat) { return; }
visible = false;
$(doc).unbind("keydown.spectrum", onkeydown);
$(doc).unbind("click.spectrum", clickout);
$(window).unbind("resize.spectrum", resize);
$(doc).off("keydown.spectrum", onkeydown);
$(doc).off("click.spectrum", clickout);
$(window).off("resize.spectrum", resize);
replacer.removeClass("sp-active");
container.addClass("sp-hidden");
@ -678,6 +685,7 @@
function revert() {
set(colorOnShow, true);
updateOriginalInput(true);
}
function set(color, ignoreFormatChange) {
@ -719,7 +727,7 @@
h: currentHue,
s: currentSaturation,
v: currentValue,
a: Math.round(currentAlpha * 100) / 100
a: Math.round(currentAlpha * 1000) / 1000
}, { format: opts.format || currentPreferredFormat });
}
@ -909,7 +917,7 @@
function destroy() {
boundElement.show();
offsetElement.unbind("click.spectrum touchstart.spectrum");
offsetElement.off("click.spectrum touchstart.spectrum");
container.remove();
replacer.remove();
spectrums[spect.id] = null;
@ -988,17 +996,27 @@
var viewWidth = docElem.clientWidth + $(doc).scrollLeft();
var viewHeight = docElem.clientHeight + $(doc).scrollTop();
var offset = input.offset();
offset.top += inputHeight;
var offsetLeft = offset.left;
var offsetTop = offset.top;
offset.left -=
Math.min(offset.left, (offset.left + dpWidth > viewWidth && viewWidth > dpWidth) ?
Math.abs(offset.left + dpWidth - viewWidth) : 0);
offsetTop += inputHeight;
offset.top -=
Math.min(offset.top, ((offset.top + dpHeight > viewHeight && viewHeight > dpHeight) ?
offsetLeft -=
Math.min(offsetLeft, (offsetLeft + dpWidth > viewWidth && viewWidth > dpWidth) ?
Math.abs(offsetLeft + dpWidth - viewWidth) : 0);
offsetTop -=
Math.min(offsetTop, ((offsetTop + dpHeight > viewHeight && viewHeight > dpHeight) ?
Math.abs(dpHeight + inputHeight - extraY) : extraY));
return offset;
return {
top: offsetTop,
bottom: offset.bottom,
left: offsetLeft,
right: offset.right,
width: offset.width,
height: offset.height
};
}
/**
@ -1091,7 +1109,7 @@
maxWidth = $(element).width();
offset = $(element).offset();
$(doc).bind(duringDragEvents);
$(doc).on(duringDragEvents);
$(doc.body).addClass("sp-dragging");
move(e);
@ -1103,7 +1121,7 @@
function stop() {
if (dragging) {
$(doc).unbind(duringDragEvents);
$(doc).off(duringDragEvents);
$(doc.body).removeClass("sp-dragging");
// Wait a tick before notifying observers to allow the click event
@ -1115,7 +1133,7 @@
dragging = false;
}
$(element).bind("touchstart mousedown", start);
$(element).on("touchstart mousedown", start);
}
function throttle(func, wait, debounce) {
@ -1178,7 +1196,7 @@
// Initializing a new instance of spectrum
return this.spectrum("destroy").each(function () {
var options = $.extend({}, opts, $(this).data());
var options = $.extend({}, $(this).data(), opts);
var spect = spectrum(this, options);
$(this).data(dataID, spect.id);
});
@ -1244,7 +1262,7 @@
this._g = rgb.g,
this._b = rgb.b,
this._a = rgb.a,
this._roundA = mathRound(100*this._a) / 100,
this._roundA = mathRound(1000 * this._a) / 1000,
this._format = opts.format || rgb.format;
this._gradientType = opts.gradientType;
@ -1285,7 +1303,7 @@
},
setAlpha: function(value) {
this._a = boundAlpha(value);
this._roundA = mathRound(100*this._a) / 100;
this._roundA = mathRound(1000 * this._a) / 1000;
return this;
},
toHsv: function() {

View File

@ -16,7 +16,7 @@
.field-fileupload .upload-object .icon-container:after {background-image:url('../../../../../system/assets/ui/images/loader-transparent.svg');position:absolute;content:' ';width:40px;height:40px;left:50%;top:50%;margin-top:-20px;margin-left:-20px;display:block;background-size:40px 40px;background-position:50% 50%;-webkit-animation:spin 1s linear infinite;animation:spin 1s linear infinite}
.field-fileupload .upload-object.is-success .icon-container {opacity:1}
.field-fileupload .upload-object.is-success .icon-container:after {opacity:0;-webkit-transition:opacity 0.3s ease;transition:opacity 0.3s ease}
.field-fileupload .upload-object.is-error .icon-container:after {content:"";background:none;font-family:FontAwesome;font-weight:normal;font-style:normal;text-decoration:inherit;-webkit-font-smoothing:antialiased;*margin-right:.3em;content:"\f071";-webkit-animation:none;animation:none;font-size:40px;color:#ab2a1c;margin-top:-20px;margin-left:-20px;text-shadow:2px 2px 0 #fff}
.field-fileupload .upload-object.is-error .icon-container:after {content:"";background:none;font-family:FontAwesome;font-weight:normal;font-style:normal;text-decoration:inherit;-webkit-font-smoothing:antialiased;content:"\f071";-webkit-animation:none;animation:none;font-size:40px;color:#ab2a1c;margin-top:-20px;margin-left:-20px;text-shadow:2px 2px 0 #fff}
.field-fileupload .upload-object.is-loading .icon-container {opacity:.6}
.field-fileupload .upload-object.is-loading .icon-container:after {opacity:1;-webkit-transition:opacity 0.3s ease;transition:opacity 0.3s ease}
.field-fileupload .upload-object.is-success {cursor:pointer}

View File

@ -103,6 +103,7 @@
clickable: this.$uploadButton.get(0),
previewsContainer: this.$filesContainer.get(0),
maxFiles: !this.options.isMulti ? 1 : null,
maxFilesize: this.options.maxFilesize,
headers: {}
}
@ -432,6 +433,7 @@
extraData: {},
paramName: 'file_data',
fileTypes: null,
maxFilesize: 256,
template: null,
errorTemplate: null,
isMulti: null,

View File

@ -7,6 +7,7 @@
data-error-template="#<?= $this->getId('errorTemplate') ?>"
data-sort-handler="<?= $this->getEventHandler('onSortAttachments') ?>"
data-unique-id="<?= $this->getId() ?>"
data-max-filesize="<?= $maxFilesize ?>"
<?php if ($useCaption): ?>data-config-handler="<?= $this->getEventHandler('onLoadAttachmentConfig') ?>"<?php endif ?>
<?php if ($acceptedFileTypes): ?>data-file-types="<?= $acceptedFileTypes ?>"<?php endif ?>
>

View File

@ -6,6 +6,7 @@
data-template="#<?= $this->getId('template') ?>"
data-error-template="#<?= $this->getId('errorTemplate') ?>"
data-unique-id="<?= $this->getId() ?>"
data-max-filesize="<?= $maxFilesize ?>"
<?php if ($useCaption): ?>data-config-handler="<?= $this->getEventHandler('onLoadAttachmentConfig') ?>"<?php endif ?>
<?php if ($acceptedFileTypes): ?>data-file-types="<?= $acceptedFileTypes ?>"<?php endif ?>
>

View File

@ -7,6 +7,7 @@
data-error-template="#<?= $this->getId('errorTemplate') ?>"
data-sort-handler="<?= $this->getEventHandler('onSortAttachments') ?>"
data-unique-id="<?= $this->getId() ?>"
data-max-filesize="<?= $maxFilesize ?>"
<?php if ($useCaption): ?>data-config-handler="<?= $this->getEventHandler('onLoadAttachmentConfig') ?>"<?php endif ?>
<?php if ($acceptedFileTypes): ?>data-file-types="<?= $acceptedFileTypes ?>"<?php endif ?>
>

View File

@ -8,6 +8,7 @@
data-unique-id="<?= $this->getId() ?>"
data-thumbnail-width="<?= $imageWidth ?: '0' ?>"
data-thumbnail-height="<?= $imageHeight ?: '0' ?>"
data-max-filesize="<?= $maxFilesize ?>"
<?php if ($useCaption): ?>data-config-handler="<?= $this->getEventHandler('onLoadAttachmentConfig') ?>"<?php endif ?>
<?php if ($acceptedFileTypes): ?>data-file-types="<?= $acceptedFileTypes ?>"<?php endif ?>
>

View File

@ -1,110 +1,40 @@
.permissioneditor {
position: relative;
margin: 0 -20px;
}
.permissioneditor.control-disabled .permissions-overlay {
position: absolute;
left: 0;
top: 0;
width: 100%;
height: 100%;
background: rgba(255, 255, 255, 0.01);
cursor: not-allowed;
}
.permissioneditor.control-disabled table {
opacity: 0.5;
filter: alpha(opacity=50);
}
.permissioneditor table {
width: 100%;
}
.permissioneditor table th {
padding: 30px 4px 8px 4px;
color: #2a3e51;
font-weight: normal;
border-bottom: 1px solid #dbe1e3;
}
.permissioneditor table th.tab {
font-size: 13px;
}
.permissioneditor table th.permission-type {
text-transform: uppercase;
font-size: 11px;
text-align: center;
}
.permissioneditor table td {
padding: 10px 4px;
vertical-align: top;
border-bottom: 1px solid #ecf0f1;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
}
.permissioneditor table td.permission-value {
text-align: center;
}
.permissioneditor table td.permission-name {
font-size: 13px;
cursor: pointer;
color: #777777;
}
.permissioneditor table td p.comment {
margin-top: 5px;
margin-bottom: 0;
}
.permissioneditor table td p.comment:empty {
display: none;
}
.permissioneditor table tr:hover td {
background: #4da7e8;
}
.permissioneditor table tr:hover td.permission-name {
color: #ffffff !important;
}
.permissioneditor {position:relative;margin:0 -20px}
.permissioneditor.control-disabled .permissions-overlay {position:absolute;left:0;top:0;width:100%;height:100%;background:rgba(255,255,255,0.01);cursor:not-allowed}
.permissioneditor.control-disabled table {opacity:0.5;filter:alpha(opacity=50)}
.permissioneditor table {width:100%}
.permissioneditor table th {padding:30px 4px 8px 4px;color:#2a3e51;font-weight:normal;border-bottom:1px solid #dbe1e3}
.permissioneditor table th.tab {font-size:13px}
.permissioneditor table th.permission-type {text-transform:uppercase;font-size:11px;text-align:center}
.permissioneditor table td {padding:10px 4px;vertical-align:top;border-bottom:1px solid #ecf0f1;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}
.permissioneditor table td.permission-value {text-align:center}
.permissioneditor table td.permission-name {font-size:13px;cursor:pointer;color:#777}
.permissioneditor table td p.comment {margin-top:5px;margin-bottom:0}
.permissioneditor table td p.comment:empty {display:none}
.permissioneditor table tr:hover td {background:#4ea5e0}
.permissioneditor table tr:hover td.permission-name {color:#fff !important}
.permissioneditor table th:first-child,
.permissioneditor table td:first-child {
padding-left: 20px;
}
.permissioneditor table td:first-child {padding-left:20px}
.permissioneditor table th:last-child,
.permissioneditor table td:last-child {
padding-right: 5px;
}
.permissioneditor table .custom-radio,
.permissioneditor table .custom-checkbox {
display: inline-block;
padding-left: 0;
}
.permissioneditor table td:last-child {padding-right:5px}
.permissioneditor table .custom-radio,
.permissioneditor table .custom-checkbox,
.permissioneditor table .custom-switch {display:inline-block;padding-left:0}
.permissioneditor table .custom-radio,
.permissioneditor table .custom-checkbox,
.permissioneditor table .custom-switch,
.permissioneditor table .custom-radio label,
.permissioneditor table .custom-checkbox label {
margin-bottom: 0;
}
.permissioneditor table .custom-checkbox label,
.permissioneditor table .custom-switch label {margin-bottom:0}
.permissioneditor table .custom-radio label,
.permissioneditor table .custom-checkbox label {
padding: 0 0 0 14px;
margin: 0;
top: 0;
}
.permissioneditor table .custom-checkbox label,
.permissioneditor table .custom-switch label {padding:0 0 0 14px;margin:0;top:0}
.permissioneditor table .custom-radio label span,
.permissioneditor table .custom-checkbox label span {
text-indent: -10000em;
display: block;
}
.permissioneditor table .custom-checkbox label span,
.permissioneditor table .custom-switch label span {text-indent:-10000em;display:block}
.permissioneditor table .custom-radio label:before,
.permissioneditor table .custom-checkbox label:before {
margin-right: 0;
}
.permissioneditor table tr:last-child td {
border-bottom: none;
}
.permissioneditor table tr:first-child th {
padding-top: 0;
}
.permissioneditor table tr.disabled td.permission-name {
color: #AAA;
}
.permissioneditor table tr.last-section-row td {
border-bottom: none;
}
.permissioneditor table .custom-checkbox label:before,
.permissioneditor table .custom-switch label:before {margin-right:0}
.permissioneditor table tr:last-child td {border-bottom:none}
.permissioneditor table tr:first-child th {padding-top:0}
.permissioneditor table tr.disabled td.permission-name {color:#AAA}
.permissioneditor table tr.last-section-row td {border-bottom:none}

View File

@ -31,7 +31,7 @@
padding: 30px 4px 8px 4px;
color: @color-label;
font-weight: normal;
border-bottom: 1px solid @color-permissioneditor-section-border;
border-bottom: 1px solid @color-permissioneditor-section-border;
&.tab {
font-size: @font-size-base - 1;
@ -47,7 +47,7 @@
td {
padding: 10px 4px;
vertical-align: top;
border-bottom: 1px solid @color-permissioneditor-permission-border;
border-bottom: 1px solid @color-permissioneditor-permission-border;
.user-select(none);
&.permission-value{
@ -91,7 +91,8 @@
}
.custom-radio,
.custom-checkbox {
.custom-checkbox,
.custom-switch {
display: inline-block;;
padding-left: 0;

View File

@ -3,16 +3,18 @@
<?php
$firstTab = true;
$globalIndex = 0;
$checkboxMode = !($this->mode === 'radio');
?>
<?php foreach ($permissions as $tab => $tabPermissions): ?>
<tr class="section">
<th class="tab"><?= e(trans($tab)) ?></th>
<th class="permission-type"><?= $firstTab ? e(trans('backend::lang.user.allow')) : '' ?></th>
<?php if (!$checkboxMode): ?>
<?php if ($this->mode === 'radio') : ?>
<th class="permission-type"><?= $firstTab ? e(trans('backend::lang.user.inherit')) : '' ?></th>
<th class="permission-type"><?= $firstTab ? e(trans('backend::lang.user.deny')) : '' ?></th>
<?php endif ?>
<?php endif; ?>
<th></th>
</tr>
@ -24,30 +26,41 @@
<?php
$globalIndex++;
if (!$checkboxMode) {
$permissionValue = array_key_exists($permission->code, $permissionsData)
? $permissionsData[$permission->code]
: 0;
}
else {
$isChecked = array_key_exists($permission->code, $permissionsData);
switch ($this->mode) {
case 'radio':
$permissionValue = array_key_exists($permission->code, $permissionsData)
? $permissionsData[$permission->code]
: 0;
break;
case 'switch':
$isChecked = !((int) @$permissionsData[$permission->code] === -1);
break;
case 'checkbox':
default:
$isChecked = array_key_exists($permission->code, $permissionsData);
break;
}
$allowId = $this->getId('permission-' . $globalIndex . '-allow');
$inheritId = $this->getId('permission-' . $globalIndex . '-inherit');
$denyId = $this->getId('permission-' . $globalIndex . '-deny');
?>
<tr class="<?= $lastIndex == $index ? 'last-section-row' : '' ?>
<?= $checkboxMode ? 'mode-checkbox' : 'mode-radio' ?>
<?= $checkboxMode && !$isChecked ? 'disabled' : '' ?>
<?= !$checkboxMode && $permissionValue == -1 ? 'disabled' : '' ?>
">
<td class="permission-name">
<?= e(trans($permission->label)) ?>
<p class="comment"><?= e(trans($permission->comment)) ?></p>
</td>
<td class="permission-value">
<?php if (!$checkboxMode): ?>
<?php if ($this->mode === 'radio'): ?>
<td class="permission-value">
<div class="radio custom-radio">
<input
id="<?= 'permission-'.$globalIndex.'-allow' ?>"
id="<?= $allowId ?>"
name="<?= e($baseFieldName) ?>[<?= e($permission->code) ?>]"
value="1"
type="radio"
@ -55,41 +68,26 @@
data-radio-color="green"
>
<label for="<?= 'permission-'.$globalIndex.'-allow' ?>"><span>Allow</span></label>
<label for="<?= $allowId ?>"><span>Allow</span></label>
</div>
<?php else: ?>
<div class="checkbox custom-checkbox">
<input
id="<?= 'permission-'.$globalIndex.'-allow' ?>"
name="<?= e($baseFieldName) ?>[<?= e($permission->code) ?>]"
value="1"
type="checkbox"
<?= $isChecked ? 'checked="checked"' : '' ?>
>
<label for="<?= 'permission-'.$globalIndex.'-allow' ?>"><span>Allow</span></label>
</div>
<?php endif?>
</td>
<?php if (!$checkboxMode): ?>
</td>
<td class="permission-value">
<div class="radio custom-radio">
<input
id="<?= 'permission-'.$globalIndex.'-inherit' ?>"
id="<?= $inheritId ?>"
name="<?= e($baseFieldName) ?>[<?= e($permission->code) ?>]"
value="0"
<?= $permissionValue == 0 ? 'checked="checked"' : '' ?>
type="radio"
>
<label for="<?= 'permission-'.$globalIndex.'-inherit' ?>"><span>Inherit</span></label>
<label for="<?= $inheritId ?>"><span>Inherit</span></label>
</div>
</td>
<td class="permission-value">
<div class="radio custom-radio">
<input
id="<?= 'permission-'.$globalIndex.'-deny' ?>"
id="<?= $denyId ?>"
name="<?= e($baseFieldName) ?>[<?= e($permission->code) ?>]"
value="-1"
<?= $permissionValue == -1 ? 'checked="checked"' : '' ?>
@ -97,10 +95,44 @@
data-radio-color="red"
>
<label for="<?= 'permission-'.$globalIndex.'-deny' ?>"><span>Deny</span></label>
<label for="<?= $denyId ?>"><span>Deny</span></label>
</div>
</td>
<?php endif ?>
<?php elseif ($this->mode === 'switch'): ?>
<td class="permission-value">
<input
type="hidden"
name="<?= e($baseFieldName) ?>[<?= e($permission->code) ?>]"
value="-1"
>
<label class="custom-switch">
<input
id="<?= $allowId ?>"
name="<?= e($baseFieldName) ?>[<?= e($permission->code) ?>]"
value="1"
type="checkbox"
<?= $isChecked ? 'checked="checked"' : '' ?>
>
<span><span><?= e(trans('backend::lang.list.column_switch_true')) ?></span><span><?= e(trans('backend::lang.list.column_switch_false')) ?></span></span>
<a class="slide-button"></a>
</label>
</td>
<?php else: ?>
<td class="permission-value">
<div class="checkbox custom-checkbox">
<input
id="<?= $allowId ?>"
name="<?= e($baseFieldName) ?>[<?= e($permission->code) ?>]"
value="1"
type="checkbox"
<?= $isChecked ? 'checked="checked"' : '' ?>
>
<label for="<?= $allowId ?>"><span>Allow</span></label>
</div>
</td>
<?php endif; ?>
<td></td>
</tr>

View File

@ -28,6 +28,7 @@
class="btn btn-default clear-record"
data-request="<?= $this->getEventHandler('onClearRecord') ?>"
data-request-confirm="<?= e(trans('backend::lang.form.action_confirm')) ?>"
data-request-success="$('#<?= $field->getId() ?>').trigger('change')"
aria-label="Remove">
<i class="icon-times"></i>
</button>

View File

@ -6,9 +6,9 @@
.field-repeater ul.field-repeater-items >li.dragged .repeater-item-remove {opacity:0}
.field-repeater ul.field-repeater-items >li.dragged .repeater-item-collapsed-title {top:5px}
.field-repeater ul.field-repeater-items >li.placeholder {display:block;position:relative;height:25px;margin-bottom:5px}
.field-repeater ul.field-repeater-items >li.placeholder:before {display:block;position:absolute;font-family:FontAwesome;font-weight:normal;font-style:normal;text-decoration:inherit;-webkit-font-smoothing:antialiased;*margin-right:.3em;content:"\f054";color:#d35714;left:-10px;top:8px;z-index:2000}
.field-repeater ul.field-repeater-items >li.placeholder:before {display:block;position:absolute;font-family:FontAwesome;font-weight:normal;font-style:normal;text-decoration:inherit;-webkit-font-smoothing:antialiased;content:"\f054";color:#d35714;left:-10px;top:8px;z-index:2000}
.field-repeater li.field-repeater-item {position:relative;margin:0 0 1em 1em !important;padding:1.5em 1.25em 0 1.25em !important;background:#f5f5f5;border:1px solid #d1d6d9;border-radius:3px;box-shadow:inset 0 1px 0 rgba(209,214,217,0.25),0 1px 0 rgba(255,255,255,.5);min-height:30px}
.field-repeater li.field-repeater-item:before {color:#bdc3c7;font-family:FontAwesome;font-weight:normal;font-style:normal;text-decoration:inherit;-webkit-font-smoothing:antialiased;*margin-right:.3em;content:"\f111";font-size:8px;position:absolute;left:-18px;top:-2px}
.field-repeater li.field-repeater-item:before {color:#bdc3c7;font-family:FontAwesome;font-weight:normal;font-style:normal;text-decoration:inherit;-webkit-font-smoothing:antialiased;content:"\f111";font-size:8px;position:absolute;left:-18px;top:-2px}
.field-repeater li.field-repeater-item:after {counter-increment:repeater-index-counter;content:counter(repeater-index-counter);display:block;position:absolute;font-size:12px;left:-27px;color:#bdc3c7;top:10px;width:24px;text-align:center}
.field-repeater li.field-repeater-item.collapsed .field-repeater-form {display:none}
.field-repeater li.field-repeater-item.collapsed .repeater-item-collapse .repeater-item-collapse-one {-webkit-transform:scale(1,-1);-ms-transform:scale(1,-1);transform:scale(1,-1)}
@ -41,7 +41,7 @@
.field-repeater li.field-repeater-item:hover .repeater-item-remove,
.field-repeater li.field-repeater-item:active .repeater-item-remove {opacity:1}
.field-repeater .field-repeater-add-item {position:relative;margin-top:10px;margin-left:20px;border:2px dotted #e0e0e0;border-radius:5px}
.field-repeater .field-repeater-add-item:before {color:#bdc3c7;font-family:FontAwesome;font-weight:normal;font-style:normal;text-decoration:inherit;-webkit-font-smoothing:antialiased;*margin-right:.3em;content:"\f067";font-size:16px;position:absolute;left:-23px;top:-11px}
.field-repeater .field-repeater-add-item:before {color:#bdc3c7;font-family:FontAwesome;font-weight:normal;font-style:normal;text-decoration:inherit;-webkit-font-smoothing:antialiased;content:"\f067";font-size:16px;position:absolute;left:-23px;top:-11px}
.field-repeater .field-repeater-add-item >a {color:#bdc3c7;text-align:center;display:block;text-decoration:none;padding:13px 15px;text-transform:uppercase;font-weight:600;font-size:12px}
.field-repeater .field-repeater-add-item:hover,
.field-repeater .field-repeater-add-item:focus {background-color:#4ea5e0;border-color:transparent}

View File

@ -211,9 +211,14 @@
$target = $item
}
var $textInput = $('input[type=text]:first', $target)
var $textInput = $('input[type=text]:first, select:first', $target).first();
if ($textInput.length) {
return $textInput.val()
switch($textInput.prop("tagName")) {
case 'SELECT':
return $textInput.find('option:selected').text();
default:
return $textInput.val();
}
} else {
var $disabledTextInput = $('.text-field:first > .form-control', $target)
if ($disabledTextInput.length) {

View File

@ -523,6 +523,7 @@ body .fr-popup .fr-input-line textarea + label {background:transparent !importan
body .fr-popup .fr-input-line input.fr-not-empty:focus + label,
body .fr-popup .fr-input-line textarea.fr-not-empty:focus + label {color:#2a3e51}
body .fr-popup .fr-checkbox span {border-color:#d1d6d9}
.fr-element {height:100%}
.field-flush .field-richeditor,
.field-flush .field-richeditor.editor-focus {border:none}
.field-richeditor {border:1px solid #d1d6d9;-webkit-box-shadow:inset 0 1px 0 rgba(209,214,217,0.25),0 1px 0 rgba(255,255,255,.5);-moz-box-shadow:inset 0 1px 0 rgba(209,214,217,0.25),0 1px 0 rgba(255,255,255,.5);box-shadow:inset 0 1px 0 rgba(209,214,217,0.25),0 1px 0 rgba(255,255,255,.5);border-radius:3px;-moz-border-radius:3px;-webkit-border-radius:3px;-moz-background-clip:padding;-webkit-background-clip:padding-box;background-clip:padding-box;transition:border-color ease-in-out 0.15s,box-shadow ease-in-out 0.15s;-webkit-transition:border-color ease-in-out 0.15s,box-shadow ease-in-out 0.15s;-moz-transition:border-color ease-in-out 0.15s,box-shadow ease-in-out 0.15s;-ms-transition:border-color ease-in-out 0.15s,box-shadow ease-in-out 0.15s;-o-transition:border-color ease-in-out 0.15s,box-shadow ease-in-out 0.15s}
@ -561,6 +562,6 @@ body .fr-popup .fr-checkbox span {border-color:#d1d6d9}
.control-richeditor figure[data-audio]:after {content:attr(data-label)}
.control-richeditor figure[data-video]:before,
.control-richeditor figure[data-audio]:before {position:static;margin-right:8px}
.control-richeditor figure[data-video]:before {font-family:FontAwesome;font-weight:normal;font-style:normal;text-decoration:inherit;-webkit-font-smoothing:antialiased;*margin-right:.3em;content:"\f03d"}
.control-richeditor figure[data-audio]:before {font-family:FontAwesome;font-weight:normal;font-style:normal;text-decoration:inherit;-webkit-font-smoothing:antialiased;*margin-right:.3em;content:"\f028"}
.control-richeditor figure[data-video]:before {font-family:FontAwesome;font-weight:normal;font-style:normal;text-decoration:inherit;-webkit-font-smoothing:antialiased;content:"\f03d"}
.control-richeditor figure[data-audio]:before {font-family:FontAwesome;font-weight:normal;font-style:normal;text-decoration:inherit;-webkit-font-smoothing:antialiased;content:"\f028"}
.fr-quick-insert a.fr-floating-btn {color:rgba(64,82,97,0.8);text-decoration:none}

View File

@ -93,15 +93,15 @@ $node.attr('data-label',text)
insertElement($node)}
function _initUiBlocks(){$('[data-video], [data-audio]',editor.$el).each(function(){$(this).addClass('fr-draggable').attr({'data-ui-block':'true','draggable':'true','tabindex':'0'}).html('&nbsp;')
this.contentEditable=false})}
function _handleUiBlocksKeydown(ev){if(ev.which==40||ev.which==38||ev.which==8||ev.which==46){var $block=$(editor.selection.element())
function _handleUiBlocksKeydown(ev){if(ev.key==='ArrowDown'||ev.key==='ArrowUp'||ev.key==='Backspace'||ev.key==='Delete'){var $block=$(editor.selection.element())
if($block.is('br')){$block=$block.parent()}
if(!!$block.length){switch(ev.which){case 38:_handleUiBlockCaretIn($block.prev())
if(!!$block.length){switch(ev.key){case'ArrowUp':_handleUiBlockCaretIn($block.prev())
break
case 40:_handleUiBlockCaretIn($block.next())
case'ArrowDown':_handleUiBlockCaretIn($block.next())
break
case 46:_handleUiBlockCaretClearEmpty($block.next(),$block)
case'Delete':_handleUiBlockCaretClearEmpty($block.next(),$block)
break
case 8:_handleUiBlockCaretClearEmpty($block.prev(),$block)
case'Backspace':_handleUiBlockCaretClearEmpty($block.prev(),$block)
break}}}}
function _handleUiBlockCaretClearEmpty($block,$p){if($block.attr('data-ui-block')!==undefined&&$.trim($p.text()).length==0){$p.remove()
_handleUiBlockCaretIn($block)
@ -110,17 +110,17 @@ function _handleUiBlockCaretIn($block){if($block.attr('data-ui-block')!==undefin
editor.selection.clear()
return true}
return false}
function _uiBlockKeyDown(ev,block){if(ev.which==40||ev.which==38||ev.which==13||ev.which==8||ev.which==46){switch(ev.which){case 40:_focusUiBlockOrText($(block).next(),true)
function _uiBlockKeyDown(ev,block){if(ev.key==='ArrowDown'||ev.key==='ArrowUp'||ev.key==='Enter'||ev.key==='Backspace'||ev.key==='Delete'){switch(ev.key){case'ArrowDown':_focusUiBlockOrText($(block).next(),true)
break
case 38:_focusUiBlockOrText($(block).prev(),false)
case'ArrowUp':_focusUiBlockOrText($(block).prev(),false)
break
case 13:var $paragraph=$('<p><br/></p>')
case'Enter':var $paragraph=$('<p><br/></p>')
$paragraph.insertAfter(block)
editor.selection.setAfter(block)
editor.selection.restore()
editor.undo.saveStep()
break
case 8:case 46:var $nextFocus=$(block).next(),gotoStart=true
case'Backspace':case'Delete':var $nextFocus=$(block).next(),gotoStart=true
if($nextFocus.length==0){$nextFocus=$(block).prev()
gotoStart=false}
_focusUiBlockOrText($nextFocus,gotoStart)

View File

@ -85,28 +85,24 @@
}
function _handleUiBlocksKeydown(ev) {
if (ev.which == 40 || ev.which == 38 || ev.which == 8 || ev.which == 46) {
if (ev.key === 'ArrowDown' || ev.key === 'ArrowUp' || ev.key === 'Backspace' || ev.key === 'Delete') {
var $block = $(editor.selection.element())
if ($block.is('br')) {
$block = $block.parent()
}
if (!!$block.length) {
switch (ev.which) {
case 38:
// Up arrow
switch (ev.key) {
case 'ArrowUp':
_handleUiBlockCaretIn($block.prev())
break
case 40:
// Down arrow
case 'ArrowDown':
_handleUiBlockCaretIn($block.next())
break
case 46:
// Delete key
case 'Delete':
_handleUiBlockCaretClearEmpty($block.next(), $block)
break
case 8:
// Backspace key
case 'Backspace':
_handleUiBlockCaretClearEmpty($block.prev(), $block)
break
}
@ -133,27 +129,23 @@
}
function _uiBlockKeyDown(ev, block) {
if (ev.which == 40 || ev.which == 38 || ev.which == 13 || ev.which == 8 || ev.which == 46) {
switch (ev.which) {
case 40:
// Down arrow
if (ev.key === 'ArrowDown' || ev.key === 'ArrowUp' || ev.key === 'Enter' || ev.key === 'Backspace' || ev.key === 'Delete') {
switch (ev.key) {
case 'ArrowDown':
_focusUiBlockOrText($(block).next(), true)
break
case 38:
// Up arrow
case 'ArrowUp':
_focusUiBlockOrText($(block).prev(), false)
break
case 13:
// Enter key
case 'Enter':
var $paragraph = $('<p><br/></p>')
$paragraph.insertAfter(block)
editor.selection.setAfter(block)
editor.selection.restore()
editor.undo.saveStep()
break
case 8:
case 46:
// Delete / Backspace key
case 'Backspace':
case 'Delete':
var $nextFocus = $(block).next(),
gotoStart = true

View File

@ -54,6 +54,14 @@
@btn-active-text: #000;
@input-label-color: @color-label;
//
// Make the focus ring and textarea fill the whole rich editor container
//
.fr-element {
height: 100%;
}
//
// Rich Editor
//

View File

@ -16,11 +16,11 @@
<?php if ($noWrapTags): ?>data-no-wrap-tags="<?= e($noWrapTags) ?>"<?php endif ?>
<?php if ($removeTags): ?>data-remove-tags="<?= e($removeTags) ?>"<?php endif ?>
<?php if ($lineBreakerTags): ?>data-line-breaker-tags="<?= e($lineBreakerTags) ?>"<?php endif ?>
<?php if ($imageStyles): ?>data-image-styles="<?= e(json_encode($imageStyles)) ?>"<?php endif ?>
<?php if ($linkStyles): ?>data-link-styles="<?= e(json_encode($linkStyles)) ?>"<?php endif ?>
<?php if ($paragraphStyles): ?>data-paragraph-styles="<?= e(json_encode($paragraphStyles)) ?>"<?php endif ?>
<?php if ($tableStyles): ?>data-table-styles="<?= e(json_encode($tableStyles)) ?>"<?php endif ?>
<?php if ($tableCellStyles): ?>data-table-cell-styles="<?= e(json_encode($tableCellStyles)) ?>"<?php endif ?>
<?php if (isset($imageStyles)): ?>data-image-styles="<?= e(json_encode($imageStyles)) ?>"<?php endif ?>
<?php if (isset($linkStyles)): ?>data-link-styles="<?= e(json_encode($linkStyles)) ?>"<?php endif ?>
<?php if (isset($paragraphStyles)): ?>data-paragraph-styles="<?= e(json_encode($paragraphStyles)) ?>"<?php endif ?>
<?php if (isset($tableStyles)): ?>data-table-styles="<?= e(json_encode($tableStyles)) ?>"<?php endif ?>
<?php if (isset($tableCellStyles)): ?>data-table-cell-styles="<?= e(json_encode($tableCellStyles)) ?>"<?php endif ?>
data-links-handler="<?= $this->getEventHandler('onLoadPageLinksForm') ?>"
data-ace-vendor-path="<?= Url::asset('/modules/backend/formwidgets/codeeditor/assets/vendor/ace') ?>"
data-control="richeditor">

View File

@ -3,20 +3,37 @@
$availableOptions = $useKey ? $fieldOptions : array_unique(array_merge($selectedValues, $fieldOptions));
?>
<!-- Tag List -->
<select
id="<?= $field->getId() ?>"
name="<?= $field->getName() ?>[]"
class="form-control custom-select <?= !count($fieldOptions) ? 'select-no-dropdown' : '' ?> select-hide-selected"
<?php if (!empty($customSeparators)): ?>data-token-separators="<?= $customSeparators ?>"<?php endif ?>
<?php if (!empty($placeholder)): ?>data-placeholder="<?= e(trans($placeholder)) ?>"<?php endif ?>
multiple
<?= $field->getAttributes() ?>>
<?php foreach ($availableOptions as $key => $option): ?>
<?php if (!strlen($option)) continue ?>
<?php if ($useKey): ?>
<option value="<?= e($key) ?>" <?= in_array($key, $selectedValues) ? 'selected="selected"' : '' ?>><?= e(trans($option)) ?></option>
<?php else: ?>
<option value="<?= e($option) ?>" <?= in_array($option, $selectedValues) ? 'selected="selected"' : '' ?>><?= e(trans($option)) ?></option>
<?php endif ?>
<?php endforeach ?>
</select>
<?php if ($this->previewMode || $field->readOnly || $field->disabled): ?>
<ul class="form-control taglist--preview" <?= $field->readOnly || $field->disabled ? 'disabled="disabled"' : ''; ?>>
<?php foreach ($availableOptions as $key => $option): ?>
<?php if (!strlen($option)) continue ?>
<?php if (($useKey && in_array($key, $selectedValues)) || (!$useKey && in_array($option, $selectedValues))): ?>
<li class="taglist__item"><?= e(trans($option)) ?></li>
<?php endif ?>
<?php endforeach ?>
</ul>
<?php if ($field->readOnly): ?>
<input
type="hidden"
name="<?= $field->getName() ?>"
value="<?= $field->value ?>">
<?php endif ?>
<?php else: ?>
<select
id="<?= $field->getId() ?>"
name="<?= $field->getName() ?>[]"
class="form-control custom-select <?= !count($fieldOptions) ? 'select-no-dropdown' : '' ?> select-hide-selected"
<?php if (!empty($customSeparators)): ?>data-token-separators="<?= $customSeparators ?>"<?php endif ?>
<?php if (!empty($placeholder)): ?>data-placeholder="<?= e(trans($placeholder)) ?>"<?php endif ?>
multiple
<?= $field->getAttributes() ?>>
<?php foreach ($availableOptions as $key => $option): ?>
<?php if (!strlen($option)) continue ?>
<?php if ($useKey): ?>
<option value="<?= e($key) ?>" <?= in_array($key, $selectedValues) ? 'selected="selected"' : '' ?>><?= e(trans($option)) ?></option>
<?php else: ?>
<option value="<?= e($option) ?>" <?= in_array($option, $selectedValues) ? 'selected="selected"' : '' ?>><?= e(trans($option)) ?></option>
<?php endif ?>
<?php endforeach ?>
</select>
<?php endif ?>

View File

@ -8,6 +8,7 @@ use Redirect;
use October\Rain\Router\Helper as RouterHelper;
use System\Helpers\DateTime as DateTimeHelper;
use Backend\Classes\Skin;
use Backend\Helpers\Exception\DecompileException;
/**
* Backend Helper
@ -118,8 +119,8 @@ class Backend
'timeSince' => false,
'ignoreTimezone' => false,
], $options));
if(!$dateTime) {
if (!$dateTime) {
return '';
}
@ -157,4 +158,58 @@ class Backend
return '<time'.Html::attributes($attributes).'>'.e($defaultValue).'</time>'.PHP_EOL;
}
/**
* Decompiles the compilation asset files
*
* This is used to load each individual asset file, as opposed to using the compilation assets. This is useful only
* for development, to allow developers to test changes without having to re-compile assets.
*
* @param string $file The compilation asset file to decompile
* @param boolean $skinAsset If true, will load decompiled assets from the "skins" directory.
* @throws DecompileException If the compilation file cannot be decompiled
* @return array
*/
public function decompileAsset(string $file, bool $skinAsset = false)
{
if ($skinAsset) {
$assetFile = base_path(substr(Skin::getActive()->getPath($file, true), 1));
} else {
$assetFile = base_path($file);
}
if (!file_exists($assetFile)) {
throw new DecompileException('File ' . $file . ' does not exist to be decompiled.');
}
if (!is_readable($assetFile)) {
throw new DecompileException('File ' . $file . ' cannot be decompiled. Please allow read access to the file.');
}
$contents = file_get_contents($assetFile);
if (!preg_match('/^=require/m', $contents)) {
throw new DecompileException('File ' . $file . ' does not appear to be a compiled asset.');
}
// Find all assets that are compiled in this file
preg_match_all('/^=require\s+([A-z0-9-_+\.\/]+)$/m', $contents, $matches, PREG_SET_ORDER);
if (!count($matches)) {
throw new DecompileException('Unable to extract any asset paths when decompiled file ' . $file . '.');
}
// Determine correct asset path
$directory = str_replace(basename($file), '', $file);
return array_map(function ($match) use ($directory, $skinAsset) {
// Resolve relative asset paths
if ($skinAsset) {
$assetPath = base_path(substr(Skin::getActive()->getPath($directory . $match[1], true), 1));
} else {
$assetPath = base_path($directory . $match[1]);
}
$realPath = str_replace(base_path(), '', realpath($assetPath));
return Url::asset($realPath);
}, $matches);
}
}

View File

@ -0,0 +1,7 @@
<?php namespace Backend\Helpers\Exception;
use ApplicationException;
class DecompileException extends ApplicationException
{
}

View File

@ -101,8 +101,8 @@ return [
'reload' => 'إعادة تحميل',
'complete' => 'تم',
'select' => 'تحديد',
'select_all' => 'تحديد الكل',
'select_none' => 'إلغاء التحديد',
'select_all' => 'اختر الكل',
'select_none' => 'لا تختر شيء',
'select_placeholder' => 'من فضلك اختار',
'insert_row' => 'إضافة سجل',
'return_to_list' => 'عودة للقائمة',

View File

@ -25,9 +25,6 @@ return [
'help' => "Неабходна база дадзеных мець доступ у панэль кіравання. Праверце, што база дадзеных правільна наладжаная, а міграцыі выкананыя, перад тым, як пасправаць зноў",
'cms_link' => "Вярнуцца на хатнюю старонку"
],
'invalid_token' => [
'label' => "Няправільны токен бяспекі"
]
],
'partial' => [
'not_found_name' => "Частковы шаблон \":name\" не знойдзены."
@ -240,8 +237,8 @@ return [
'preview_no_files_message' => "Няма загружаных файлаў",
'preview_no_record_message' => "Няма выбраных запісаў",
'select' => "Выбраць",
'select_all' => "усё",
'select_none' => "нічога",
'select_all' => "абраць усё",
'select_none' => "выбраць няма",
'select_placeholder' => "Калі ласка, выберыце",
'insert_row' => "Уставіць радок",
'insert_row_below' => "Уставіць радок ніжэй",

View File

@ -19,9 +19,6 @@ return [
'help' => "Вие нямате нужните права за да видите тази страница.",
'cms_link' => 'Върни се към администраторския-панел'
],
'invalid_token' => [
'label' => 'Невалиден код за сигурност (token)'
]
],
'partial' => [
'not_found_name' => "Частичната страница ':name' не е намерена."
@ -201,8 +198,8 @@ return [
'preview_no_files_message' => 'Все още няма качени файлове.',
'preview_no_record_message' => 'Не е избран запис.',
'select' => 'Избери',
'select_all' => 'всичко',
'select_none' => 'нищо',
'select_all' => 'Избери всички',
'select_none' => 'изберете никой',
'select_placeholder' => 'моля изберете',
'insert_row' => 'Вмъкни ред',
'insert_row_below' => 'Вмъкни ред По-долу',

View File

@ -268,8 +268,8 @@ return [
'preview_no_media_message' => 'No hi ha medis seleccionats.',
'preview_no_record_message' => 'No hi ha cap registre seleccionat.',
'select' => 'Seleccionar',
'select_all' => 'tots',
'select_none' => 'cap',
'select_all' => 'seleccionar tot',
'select_none' => 'no selecciona cap',
'select_placeholder' => 'si us plau selecciona',
'insert_row' => 'Inserir fila',
'insert_row_below' => 'Inserir fila a sota',

View File

@ -25,9 +25,6 @@ return [
'help' => "K přístupu do administrace je zapotřebí databáze. Zkontrolujte, zda je databáze nakonfigurována a migrována a zkuste to znovu.",
'cms_link' => 'Zpět na úvodní stránku'
],
'invalid_token' => [
'label' => 'Neplatný bezpečnostní token',
]
],
'partial' => [
'not_found_name' => "Dílčí šablona ':name' nebyla nalezena."
@ -262,8 +259,8 @@ return [
'preview_no_media_message' => 'Žádné médium nebylo vybráno.',
'preview_no_record_message' => 'Žádný záznam není vybraný.',
'select' => 'Vybrat',
'select_all' => 'Vše',
'select_none' => 'Nic',
'select_all' => 'vybrat vše',
'select_none' => 'vyberte žádný',
'select_placeholder' => 'Prosím vyberte',
'insert_row' => 'Vložit řádek',
'insert_row_below' => 'Vložit řádek pod',

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